Ignore:
Timestamp:
Apr 22, 2012, 12:47:07 PM (12 years ago)
Author:
Torben Dannhauer
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • experimental/distortionNG/extViewer.cpp

    r359 r360  
    255255        stateset->setTextureAttributeAndModes(_distortionSet->getTexUnitScene(), texmat, osg::StateAttribute::ON);
    256256
    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);
    258258                meshGeode->addDrawable(distortionMesh);
    259259
     
    333333
    334334        // 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" );
    337337        osg::Shader* fShader = osg::Shader::readShaderFile( osg::Shader::FRAGMENT, "shader.frag" );
    338338        fShader->setName("intensityMapFragShader");
     
    340340        if ( fShader )
    341341        {
    342                 distortProgram->addShader( fShader );
     342                IntensityMapProgram->addShader( fShader );
    343343                stateset->addUniform( new osg::Uniform("sceneTexture", (int)_distortionSet->getTexUnitScene()) );
    344344                stateset->addUniform( new osg::Uniform("intensityMapTexture", (int)_distortionSet->getTexUnitIntensityMap()) );
    345                 stateset->setAttributeAndModes(distortProgram, osg::StateAttribute::ON);
     345                stateset->setAttributeAndModes(IntensityMapProgram, osg::StateAttribute::ON);
    346346        }
    347347}
     
    358358
    359359        // 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 blending
    368 }
     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.