Changeset 353 for experimental/distortionNG/extViewer.cpp
- Timestamp:
- Apr 21, 2012, 9:49:26 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
experimental/distortionNG/extViewer.cpp
r352 r353 20 20 #include "distortionNG.h" 21 21 22 #include <osg/Switch> 22 23 #include <osg/PolygonOffset> 23 24 #include <osg/Texture2D> … … 273 274 camera->setViewMatrix(osg::Matrix::identity()); 274 275 275 osg::ref_ptr<osg:: Group> root = new osg::Group;276 root->addChild(geode ); // add mesh to rootso camera renders mesh (and thus render the scene)276 osg::ref_ptr<osg::Switch> root = _distortionSet->getDistortionInternals(); 277 root->addChild(geode, true); // adds mesh,shader,.. so camera renders mesh (and thus render the scene) 277 278 camera->addChild(root); 278 279 279 // selector 280 //geode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF ); 281 //geode->getOrCreateStateSet()->setAttributeAndModes( new osg::PolygonOffset(1.0f, 1.0f) ); 282 //osg::ref_ptr<distortionHandler> selectorHandler = new distortionHandler( camera, distortionMesh ); 283 //osg::Geode* selectorHighlighter = selectorHandler->createVertexHighlighter(); 284 //selectorHighlighter->setCullingActive(false); // disable the culling for the selector, otherwise the selector is culled away on the edge. 285 //root->addChild(selectorHighlighter); 286 //addEventHandler( selectorHandler.get() );// should be in main.cpp 280 _distortionSet->setDistortionCamera( camera ); 281 282 // Ensure selector is visible: 283 geode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF ); 284 geode->getOrCreateStateSet()->setAttributeAndModes( new osg::PolygonOffset(1.0f, 1.0f) ); 287 285 288 //// Avoid that the highlighter is culled away289 //osg::CullSettings::CullingMode mode = camera->getCullingMode();290 //camera->setCullingMode( mode & (~osg::CullSettings::SMALL_FEATURE_CULLING) );291 292 286 camera->setName("Dist Cam"); 293 287
Note: See TracChangeset
for help on using the changeset viewer.