Changeset 392


Ignore:
Timestamp:
Jun 30, 2012, 5:25:38 PM (7 years ago)
Author:
Torben Dannhauer
Message:
 
Location:
experimental/distortionNG
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • experimental/distortionNG/DistortionManipulator.cpp

    r391 r392  
    5353        //_distortionMesh(distortionMesh)
    5454
    55         // Create Shader to vizualize intensitymap during blending setup.
     55        // Create Shader to visualize intensitymap during blending setup.
    5656        osg::Shader* sh = osg::Shader::readShaderFile( osg::Shader::FRAGMENT, "shaderIntensityMapVis.frag" );
    5757        sh->setName("shaderIntensityMapVis");
  • experimental/distortionNG/DistortionSet.cpp

    r383 r392  
    5656        _distortionMeshColumns = cols;
    5757
    58         if(_distortionMesh->size() != _distortionMeshRows * _distortionMeshRows)        // If dimensions differ: discard current mesh and createa new one
     58        if(_distortionMesh->size() != _distortionMeshRows * _distortionMeshColumns)     // If dimensions differ: discard current mesh and create a new one
    5959        {
    60                 _distortionMesh = new osg::Vec4Array(_distortionMeshRows * _distortionMeshRows);
     60                _distortionMesh = new osg::Vec4Array(_distortionMeshRows * _distortionMeshColumns);
    6161                for(int row=0;row<_distortionMeshRows;row++)
    6262                {
  • experimental/distortionNG/distortionNG.vcproj

    r372 r392  
    391391                </Filter>
    392392                <File
     393                        RelativePath=".\shader.vert"
     394                        >
     395                </File>
     396                <File
    393397                        RelativePath=".\shaderIntensityMap.frag"
    394398                        >
  • experimental/distortionNG/extViewer.cpp

    r381 r392  
    364364        osg::Program* IntensityMapProgram = new osg::Program;
    365365        IntensityMapProgram->setName( "intensityMapBlending" );
     366        osg::Shader* shaderVert = osg::Shader::readShaderFile( osg::Shader::VERTEX, "shader.vert" );
     367        shaderVert->setName("shaderVert");
    366368        osg::Shader* shaderIntensityMap = osg::Shader::readShaderFile( osg::Shader::FRAGMENT, "shaderIntensityMap.frag" );
    367369        shaderIntensityMap->setName("shaderIntensityMap");
     370
    368371        _distortionSet->setShaderIntensityMap( shaderIntensityMap );
    369372
    370         if ( shaderIntensityMap )
    371         {
     373        if ( shaderVert && shaderIntensityMap )
     374        {
     375                IntensityMapProgram->addShader( shaderVert );
    372376                IntensityMapProgram->addShader( shaderIntensityMap );
    373377                stateset->addUniform( new osg::Uniform("sceneTexture", (int)_distortionSet->getTexUnitScene()) );
  • experimental/distortionNG/main.cpp

    r391 r392  
    5353        osg::ref_ptr<osgViewer::DistortionSet> _distortionSet = new osgViewer::DistortionSet();
    5454        _distortionSet->setIntensityMap( intMap );
    55         _distortionSet->setDistortionMeshDimensions(20, 20);
     55        _distortionSet->setDistortionMeshDimensions(20, 30);
    5656       
    5757
  • experimental/distortionNG/shader.vert

    r338 r392  
    11varying vec2 texcoord_scene;
    22varying vec2 texcoord_intensityMap;
     3
     4varying vec2 texCoord;
    35
    46void main()
     
    79        texcoord_scene = vec2(gl_MultiTexCoord0.xy);
    810        texcoord_intensityMap = vec2(gl_MultiTexCoord1.xy);
     11        texCoord = gl_MultiTexCoord0.xy;
    912}
  • experimental/distortionNG/shaderIntensityMap.frag

    r363 r392  
    33varying vec2 texcoord_scene;
    44varying vec2 texcoord_intensityMap;
     5
     6varying vec2 texCoord;
    57
    68void main(void)
     
    911        vec4 blendColor;
    1012
    11         sceneColor = texture2DRect(sceneTexture, gl_FragCoord);
     13        //sceneColor = texture2DRect(sceneTexture, gl_FragCoord);
    1214        blendColor = texture2DRect(intensityMapTexture, gl_FragCoord);
    13         gl_FragColor = sceneColor * blendColor;
     15       
     16        //gl_FragColor = blendColor * texture2DRect( sceneTexture, texCoord*vec2(1920, 1200)) ;
     17        gl_FragColor = texture2DRect( sceneTexture, texCoord*vec2(1920, 1200)) ;
    1418}
Note: See TracChangeset for help on using the changeset viewer.