Changeset 359
- Timestamp:
- Apr 22, 2012, 9:33:36 AM (13 years ago)
- Location:
- experimental/distortionNG
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
experimental/distortionNG/extViewer.cpp
r357 r359 240 240 // distortion correction set up. 241 241 { 242 osg::Geode* geode = new osg::Geode(); 242 osg::ref_ptr<osg::Switch> root = _distortionSet->getDistortionInternals(); 243 osg::Geode* meshGeode = new osg::Geode(); 244 root->addChild(meshGeode, true); // Child #0 (adds mesh,shader,.. so camera renders mesh (and thus render the scene)) 245 243 246 244 247 // new we need to add the scene texture to the mesh, we do so by creating a 245 248 // StateSet to contain the Texture StateAttribute. 246 osg::StateSet* stateset = geode->getOrCreateStateSet();249 osg::StateSet* stateset = meshGeode->getOrCreateStateSet(); 247 250 stateset->setTextureAttributeAndModes(_distortionSet->getTexUnitScene(), sceneTexture,osg::StateAttribute::ON); 248 251 stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF); … … 250 253 osg::TexMat* texmat = new osg::TexMat; 251 254 texmat->setScaleByTextureRectangleSize(true); 252 stateset->setTextureAttributeAndModes(0, texmat, osg::StateAttribute::ON); 253 254 setUpIntensityMapBlending(_distortionSet, stateset, screenNum); 255 stateset->setTextureAttributeAndModes(_distortionSet->getTexUnitScene(), texmat, osg::StateAttribute::ON); 255 256 256 257 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); 257 geode->addDrawable(distortionMesh); 258 meshGeode->addDrawable(distortionMesh); 259 260 setUpIntensityMapBlending(_distortionSet, screenNum); 258 261 259 262 osg::ref_ptr<osg::Camera> camera = new osg::Camera; … … 273 276 camera->setViewMatrix(osg::Matrix::identity()); 274 277 275 osg::ref_ptr<osg::Switch> root = _distortionSet->getDistortionInternals();276 root->addChild(geode, true); // Child #0 (adds mesh,shader,.. so camera renders mesh (and thus render the scene))277 278 camera->addChild(root); 278 279 279 _distortionSet->setDistortionCamera( camera ); 280 280 281 281 // Ensure selector is visible: 282 geode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );283 geode->getOrCreateStateSet()->setAttributeAndModes( new osg::PolygonOffset(1.0f, 1.0f) );282 meshGeode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF ); 283 meshGeode->getOrCreateStateSet()->setAttributeAndModes( new osg::PolygonOffset(1.0f, 1.0f) ); 284 284 285 285 camera->setName("Dist Cam"); … … 289 289 } 290 290 291 void extViewer::setUpIntensityMapBlending(osgViewer::DistortionSet* distSet, osg::StateSet* stateset,unsigned int screenNum)291 void extViewer::setUpIntensityMapBlending(osgViewer::DistortionSet* distSet, unsigned int screenNum) 292 292 { 293 293 osg::Image* intensityMap = _distortionSet->getIntensityMap(); 294 osg::StateSet* stateset = _distortionSet->getDistortionInternals()->getChild(osgViewer::DistortionSet::MESH)->getOrCreateStateSet(); 295 294 296 if(intensityMap == NULL) return; 295 297 -
experimental/distortionNG/extViewer.h
r352 r359 39 39 void setUpViewForManualDistortion(osgViewer::DistortionSet* distSet, unsigned int screenNum=0, const osg::Matrixd& projectorMatrix = osg::Matrixd()); 40 40 41 void setUpIntensityMapBlending(osgViewer::DistortionSet* distSet, osg::StateSet* stateset,unsigned int screenNum=0);41 void setUpIntensityMapBlending(osgViewer::DistortionSet* distSet, unsigned int screenNum=0); 42 42 void setUpIntensityMapBlending(std::string intensityMap); 43 43 -
experimental/distortionNG/main.cpp
r357 r359 174 174 * distortionManipulator abgeleitet von osgGA::GUIEventHandler 175 175 * Grundfunktionen: 176 * [ .]- Key to Show Distortion Mesh / Intensity Map / none176 * [done|.|.] - Key to Show Distortion Mesh / Intensity Map / none 177 177 * - Key to Save distortion Container - via plugin 178 178 * [.] - Key to toggle MANUAL mode between blending und distortion setup
Note: See TracChangeset
for help on using the changeset viewer.