Changeset 351 for experimental/distortionNG
- Timestamp:
- Apr 21, 2012, 4:59:57 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
experimental/distortionNG/extViewer.cpp
r350 r351 57 57 } 58 58 59 static osg::Geometry* createMesh(const osg::Vec3& origin, const osg::Vec3& widthVector, const osg::Vec3& heightVector, unsigned int columns, unsigned int rows, osg::Image* intensityMap, bool applyIntensityMapAsColours,const osg::Matrix& projectorMatrix)59 static osg::Geometry* createMesh(const osg::Vec3& origin, const osg::Vec3& widthVector, const osg::Vec3& heightVector, unsigned int columns, unsigned int rows, const osg::Matrix& projectorMatrix) 60 60 { 61 61 // Create Quad to render on … … 79 79 osg::Vec3Array* vertices = new osg::Vec3Array; 80 80 osg::Vec2Array* texcoords0 = new osg::Vec2Array; 81 osg::Vec2Array* texcoords1 = intensityMap==0 ? new osg::Vec2Array : 0;82 81 osg::Vec4Array* colors = new osg::Vec4Array; 83 82 … … 98 97 99 98 // Set Color of the mesh node 100 if (intensityMap && applyIntensityMapAsColours) 101 { 102 colors->push_back(intensityMap->getColor(texcoord)); 103 } 104 else 105 { 106 colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); 107 } 108 109 // Set coordinates for second texcoords array (if applyIntensityMapAsColours==true) 110 if (texcoords1) 111 texcoords1->push_back( texcoord ); 99 colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); 112 100 } 113 101 } … … 121 109 122 110 geom->setTexCoordArray(0,texcoords0); 123 if (texcoords1)124 geom->setTexCoordArray(1,texcoords1);125 111 126 112 // Quads grid … … 271 257 setUpIntensityMapBlending(_distortionSet, stateset, screenNum); 272 258 273 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, _distortionSet->getIntensityMap(), false,projectorMatrix);259 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); 274 260 geode->addDrawable(distortionMesh); 275 261 … … 367 353 { 368 354 distortProgram->addShader( fShader ); 369 //stateset->addUniform( new osg::Uniform("sceneTexture", _distortionSet->getTexUnitScene()) ); 370 //stateset->addUniform( new osg::Uniform("intensityMapTexture", _distortionSet->getTexUnitIntensityMap()) ); 371 stateset->addUniform( new osg::Uniform("sceneTexture", 0 ) ); 372 stateset->addUniform( new osg::Uniform("intensityMapTexture", 1 ) ); 355 stateset->addUniform( new osg::Uniform("sceneTexture", (int)_distortionSet->getTexUnitScene()) ); 356 stateset->addUniform( new osg::Uniform("intensityMapTexture", (int)_distortionSet->getTexUnitIntensityMap()) ); 373 357 stateset->setAttributeAndModes(distortProgram, osg::StateAttribute::ON); 374 358 }
Note: See TracChangeset
for help on using the changeset viewer.