Changeset 351


Ignore:
Timestamp:
Apr 21, 2012, 4:59:57 PM (13 years ago)
Author:
Torben Dannhauer
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • experimental/distortionNG/extViewer.cpp

    r350 r351  
    5757}
    5858
    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)
     59static 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)
    6060{
    6161        // Create Quad to render on
     
    7979        osg::Vec3Array* vertices = new osg::Vec3Array;
    8080    osg::Vec2Array* texcoords0 = new osg::Vec2Array;
    81     osg::Vec2Array* texcoords1 = intensityMap==0 ? new osg::Vec2Array : 0;
    8281    osg::Vec4Array* colors = new osg::Vec4Array;
    8382
     
    9897
    9998                        // 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));
    112100                }
    113101        }
     
    121109
    122110    geom->setTexCoordArray(0,texcoords0);
    123     if (texcoords1)
    124                 geom->setTexCoordArray(1,texcoords1);
    125111
    126112        // Quads grid
     
    271257                setUpIntensityMapBlending(_distortionSet, stateset, screenNum);
    272258
    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);
    274260                geode->addDrawable(distortionMesh);
    275261
     
    367353        {
    368354                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()) );
    373357                stateset->setAttributeAndModes(distortProgram, osg::StateAttribute::ON);
    374358        }
Note: See TracChangeset for help on using the changeset viewer.