Changeset 360 for experimental/distortionNG/extViewer.cpp
- Timestamp:
- Apr 22, 2012, 12:47:07 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
experimental/distortionNG/extViewer.cpp
r359 r360 255 255 stateset->setTextureAttributeAndModes(_distortionSet->getTexUnitScene(), texmat, osg::StateAttribute::ON); 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 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), _distortionSet->getDistortionMeshColumns(), _distortionSet->getDistortionMeshColumns(), projectorMatrix); 258 258 meshGeode->addDrawable(distortionMesh); 259 259 … … 333 333 334 334 // create shaders for blending 335 osg::Program* distortProgram = new osg::Program;336 distortProgram->setName( "intensityMapBlending" );335 osg::Program* IntensityMapProgram = new osg::Program; 336 IntensityMapProgram->setName( "intensityMapBlending" ); 337 337 osg::Shader* fShader = osg::Shader::readShaderFile( osg::Shader::FRAGMENT, "shader.frag" ); 338 338 fShader->setName("intensityMapFragShader"); … … 340 340 if ( fShader ) 341 341 { 342 distortProgram->addShader( fShader );342 IntensityMapProgram->addShader( fShader ); 343 343 stateset->addUniform( new osg::Uniform("sceneTexture", (int)_distortionSet->getTexUnitScene()) ); 344 344 stateset->addUniform( new osg::Uniform("intensityMapTexture", (int)_distortionSet->getTexUnitIntensityMap()) ); 345 stateset->setAttributeAndModes( distortProgram, osg::StateAttribute::ON);345 stateset->setAttributeAndModes(IntensityMapProgram, osg::StateAttribute::ON); 346 346 } 347 347 } … … 358 358 359 359 // Create DistortionSet 360 _distortionSet= new osgViewer::DistortionSet();361 _distortionSet->setIntensityMap( intMap );362 _distortionSet->setDistortionMeshRows( 1);363 _distortionSet->setDistortionMeshColumns( 1);364 _distortionSet->setTexUnitScene( 0 );365 _distortionSet->setTexUnitIntensityMap( 1 );366 367 // Todo: call setupDistortion/Blendung to perform the blending368 } 360 osgViewer::DistortionSet* ds = new osgViewer::DistortionSet(); 361 ds->setIntensityMap( intMap ); 362 ds->setDistortionMeshRows( 2 ); 363 ds->setDistortionMeshColumns( 2 ); 364 ds->setTexUnitScene( 0 ); 365 ds->setTexUnitIntensityMap( 1 ); 366 367 setUpViewForManualDistortion(ds); 368 }
Note: See TracChangeset
for help on using the changeset viewer.