Changeset 329 for experimental/distortionNG/extViewer.cpp
- Timestamp:
- Mar 3, 2012, 1:22:05 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
experimental/distortionNG/extViewer.cpp
r328 r329 1 1 #include "extViewer.h" 2 2 #include "distortionNG.h" 3 4 #include <osg/PolygonOffset> 3 5 #include<osg/Texture2D> 4 6 #include<osg/TextureRectangle> … … 131 133 osg::Geode* geode = new osg::Geode(); 132 134 //geode->addDrawable(createParoramicSphericalDisplayDistortionMesh(osg::Vec3(0.0f,0.0f,0.0f), osg::Vec3(width,0.0f,0.0f), osg::Vec3(0.0f,height,0.0f), 1, 0.45, 0, projectorMatrix)); 133 geode->addDrawable(createMesh(osg::Vec3(0.0f,0.0f,0.0f), osg::Vec3(width,0.0f,0.0f), osg::Vec3(0.0f,height,0.0f), 20, 20, projectorMatrix)); 135 osg::Geometry* distortionMesh = createMesh(osg::Vec3(0.0f,0.0f,0.0f), osg::Vec3(width,0.0f,0.0f), osg::Vec3(0.0f,height,0.0f), 20, 20, projectorMatrix); 136 geode->addDrawable(distortionMesh); 134 137 135 138 // new we need to add the texture to the mesh, we do so by creating a … … 165 168 166 169 // add subgraph to render 167 camera->addChild(geode); 170 //camera->addChild(geode); 171 172 // selector 173 geode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF ); 174 geode->getOrCreateStateSet()->setAttributeAndModes( new osg::PolygonOffset(1.0f, 1.0f) ); 175 osg::ref_ptr<distortionHandler> selector = new distortionHandler( camera, distortionMesh ); 176 osg::ref_ptr<osg::Group> root = new osg::Group; 177 root->addChild(geode); 178 root->addChild(selector->createVertexHighlighter()); 179 addEventHandler( selector.get() ); 180 camera->addChild(root); 181 // Avoid that the highlighter is culled away 182 osg::CullSettings::CullingMode mode = camera->getCullingMode(); 183 camera->setCullingMode( mode & (~osg::CullSettings::SMALL_FEATURE_CULLING) ); 184 168 185 169 186 camera->setName("Dist Cam");
Note: See TracChangeset
for help on using the changeset viewer.