Changeset 380
- Timestamp:
- Jun 14, 2012, 10:21:52 PM (12 years ago)
- Location:
- experimental/distortionNG
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
experimental/distortionNG/DistortionManipulator.cpp
r379 r380 18 18 19 19 #include "DistortionManipulator.h" 20 #include "extViewer.h" 20 21 21 22 #include <osgViewer/Viewer> … … 33 34 34 35 35 DistortionManipulator::DistortionManipulator( DistortionSet* ds)36 : _highlightColor( osg::Vec4(1.0f, 1.0f, 0.0f, 1.0f) ), _distortionSet( ds ) 36 DistortionManipulator::DistortionManipulator(extViewer* viewer, DistortionSet* ds) 37 : _highlightColor( osg::Vec4(1.0f, 1.0f, 0.0f, 1.0f) ), _distortionSet( ds ), _viewer(viewer) 37 38 { 38 39 activeSetupMode = DISABLED; … … 258 259 //OSG_ALWAYS<<"Calling delegated class.."<<std::endl; 259 260 _delegatedDistortionSetupStrategy->delegateDistortionSetup(_distortionSet); 260 if( _distortionSet->isDirty() )261 if( _distortionSet->isDirty() && _viewer.valid()) 261 262 { 262 // todo: transfer matrixes into viewer camera.263 _viewer->updateDistortion(); 263 264 } 264 265 //OSG_ALWAYS<<"..done"<<std::endl; -
experimental/distortionNG/DistortionManipulator.h
r372 r380 31 31 #include "DistortionSet.h" 32 32 33 class extViewer; 33 34 34 35 namespace osgViewer { … … 58 59 59 60 60 DistortionManipulator( DistortionSet* ds);61 DistortionManipulator(extViewer* viewer, DistortionSet* ds); 61 62 virtual ~DistortionManipulator(); 62 63 … … 89 90 osg::ref_ptr<osg::Geometry> _highlighter; 90 91 osg::observer_ptr<osg::Camera> _camera; 92 osg::observer_ptr<extViewer> _viewer; 91 93 osg::Geometry* _distortionMesh; 92 94 const osg::Vec4 _highlightColor; -
experimental/distortionNG/extViewer.cpp
r370 r380 397 397 setUpViewForManualDistortion(ds); 398 398 } 399 400 void extViewer::updateDistortion() 401 { 402 if(!_distortionSet.valid()) 403 { 404 osg::notify(osg::WARN) << "You cannot update the distortion without distortion set up." << std::endl; 405 return; 406 } 407 408 this->getCamera()->setViewMatrix(_distortionSet->getViewOffset()); 409 this->getCamera()->setProjectionMatrix(_distortionSet->getProjectionOffset()); 410 } -
experimental/distortionNG/extViewer.h
r374 r380 51 51 void setUpIntensityMapBlending(std::string intensityMap); 52 52 53 /** 54 * \brief This functions updates the distortion setup by applying the distortionSet values to the viewers distortion setup. 55 * 56 */ 57 void updateDistortion(); 58 53 59 osgViewer::DistortionSet* getDistortionSet() {return _distortionSet;} 54 60 void setDistortionSet(osgViewer::DistortionSet* ds) {_distortionSet = ds;} -
experimental/distortionNG/main.cpp
r376 r380 93 93 94 94 // Add the distortion manipulator 95 osgViewer::DistortionManipulator* distortionManip = new osgViewer::DistortionManipulator( _distortionSet);95 osgViewer::DistortionManipulator* distortionManip = new osgViewer::DistortionManipulator(&viewer, _distortionSet); 96 96 97 97 DistortionSetupStrategyProjectSyntropy* psStrategy = new DistortionSetupStrategyProjectSyntropy();
Note: See TracChangeset
for help on using the changeset viewer.