Changeset 315 for experimental
- Timestamp:
- Sep 4, 2011, 9:13:25 PM (13 years ago)
- Location:
- experimental/distortionNG
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
experimental/distortionNG/extViewer.cpp
r314 r315 16 16 extViewer::extViewer(osg::ArgumentParser& arguments) : Viewer(arguments) 17 17 { 18 // setUpViewForManualDistortion(0); 18 19 19 } 20 20 … … 29 29 } 30 30 31 void extViewer::setUpViewForManualDistortion( osg::Image* intensityMap, unsigned int screenNum)31 void extViewer::setUpViewForManualDistortion(unsigned int screenNum, osg::Image* intensityMap, const osg::Matrixd& projectorMatrix) 32 32 { 33 33 OSG_INFO<<"View::setUpViewForManualDistortion(sn="<<screenNum<<", im="<<intensityMap<<")"<<std::endl; … … 99 99 { 100 100 osg::ref_ptr<osg::Camera> camera = new osg::Camera; 101 camera->setName("Scene cam era");101 camera->setName("Scene cam"); 102 102 camera->setGraphicsContext(gc.get()); 103 103 camera->setViewport(new osg::Viewport(0,0,camera_width, camera_height)); … … 117 117 { 118 118 osg::Geode* geode = new osg::Geode(); 119 //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), radius, collar, applyIntensityMapAsColours ? intensityMap :0, projectorMatrix));120 geode->addDrawable(createMesh(16 , 19));119 //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)); 120 geode->addDrawable(createMesh(160, 190)); 121 121 122 122 // new we need to add the texture to the mesh, we do so by creating a … … 225 225 226 226 227 osg::ComputeBoundsVisitor cbv;228 cbv.applyDrawable(geom);229 osg::BoundingBox box = cbv.getBoundingBox();230 if (!box.valid())231 std::cout << "Invalid bounding box!";232 geom->setInitialBound(box);233 234 osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D;227 //osg::ComputeBoundsVisitor cbv; 228 //cbv.applyDrawable(geom); 229 //osg::BoundingBox box = cbv.getBoundingBox(); 230 //if (!box.valid()) 231 // std::cout << "Invalid bounding box!"; 232 //geom->setInitialBound(box); 233 234 /*osg::ref_ptr<osg::Texture2D> texture = new osg::Texture2D; 235 235 texture->setImage( osgDB::readImageFile("Images/osg256.png") ); 236 236 texture->setFilter( osg::Texture2D::MIN_FILTER, osg::Texture2D::LINEAR_MIPMAP_LINEAR ); 237 237 texture->setFilter( osg::Texture2D::MAG_FILTER, osg::Texture2D::LINEAR_MIPMAP_LINEAR ); 238 geom->getOrCreateStateSet()->setTextureAttributeAndModes( 0, texture.get() ); 238 geom->getOrCreateStateSet()->setTextureAttributeAndModes( 0, texture.get() );*/ 239 239 240 240 // Create normals 241 osgUtil::SmoothingVisitor::smooth( *geom );241 //osgUtil::SmoothingVisitor::smooth( *geom ); 242 242 243 243 return geom.release(); -
experimental/distortionNG/extViewer.h
r313 r315 14 14 15 15 /** Convenience method for projection on curved screens using a slave camera rendering scene and a second camera doing distortion correction to present on a nonplaner display.*/ 16 void setUpViewForManualDistortion( osg::Image* intensityMap, unsigned int screenNum=0);16 void setUpViewForManualDistortion(unsigned int screenNum=0, osg::Image* intensityMap=0, const osg::Matrixd& projectorMatrix = osg::Matrixd()); 17 17 18 18 static osg::Geometry* createMesh(unsigned int column, unsigned int row); -
experimental/distortionNG/main.cpp
r313 r315 41 41 // construct the viewer. 42 42 extViewer viewer(arguments); 43 viewer.setUpViewForManualDistortion(); 44 43 45 44 46 // set up the camera manipulators. … … 104 106 return 1; 105 107 } 108 else 109 viewer.setSceneData( rootnode ); 106 110 } 107 111 108 osg::ref_ptr<osg::Geode> geode = new osg::Geode;109 geode->addDrawable( extViewer::createMesh(16, 9) );110 geode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );111 geode->getOrCreateStateSet()->setAttributeAndModes( new osg::PolygonOffset(1.0f, 1.0f) );112 //osg::ref_ptr<osg::Geode> geode = new osg::Geode; 113 //geode->addDrawable( extViewer::createMesh(16, 9) ); 114 //geode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF ); 115 //geode->getOrCreateStateSet()->setAttributeAndModes( new osg::PolygonOffset(1.0f, 1.0f) ); 112 116 113 osg::ref_ptr<distortionHandler> selector = new distortionHandler( viewer.getCamera() );117 //osg::ref_ptr<distortionHandler> selector = new distortionHandler( viewer.getCamera() ); 114 118 115 osg::ref_ptr<osg::Group> root = new osg::Group;116 root->addChild( geode.get() );117 root->addChild( selector->createVertexHighlighter() );119 //osg::ref_ptr<osg::Group> root = new osg::Group; 120 //root->addChild( geode.get() ); 121 //root->addChild( selector->createVertexHighlighter() ); 118 122 119 viewer.addEventHandler( selector.get() );120 viewer.setSceneData( root.get() );123 //viewer.addEventHandler( selector.get() ); 124 //viewer.setSceneData( root.get() ); 121 125 122 // Avoid that the highlighter is culled away123 osg::CullSettings::CullingMode mode = viewer.getCamera()->getCullingMode();124 viewer.getCamera()->setCullingMode( mode & (~osg::CullSettings::SMALL_FEATURE_CULLING) );126 //// Avoid that the highlighter is culled away 127 //osg::CullSettings::CullingMode mode = viewer.getCamera()->getCullingMode(); 128 //viewer.getCamera()->setCullingMode( mode & (~osg::CullSettings::SMALL_FEATURE_CULLING) ); 125 129 126 130 // run the viewers main loop
Note: See TracChangeset
for help on using the changeset viewer.