Changeset 392 for experimental/distortionNG
- Timestamp:
- Jun 30, 2012, 5:25:38 PM (12 years ago)
- Location:
- experimental/distortionNG
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
experimental/distortionNG/DistortionManipulator.cpp
r391 r392 53 53 //_distortionMesh(distortionMesh) 54 54 55 // Create Shader to vi zualize intensitymap during blending setup.55 // Create Shader to visualize intensitymap during blending setup. 56 56 osg::Shader* sh = osg::Shader::readShaderFile( osg::Shader::FRAGMENT, "shaderIntensityMapVis.frag" ); 57 57 sh->setName("shaderIntensityMapVis"); -
experimental/distortionNG/DistortionSet.cpp
r383 r392 56 56 _distortionMeshColumns = cols; 57 57 58 if(_distortionMesh->size() != _distortionMeshRows * _distortionMesh Rows) // If dimensions differ: discard current mesh and createa new one58 if(_distortionMesh->size() != _distortionMeshRows * _distortionMeshColumns) // If dimensions differ: discard current mesh and create a new one 59 59 { 60 _distortionMesh = new osg::Vec4Array(_distortionMeshRows * _distortionMesh Rows);60 _distortionMesh = new osg::Vec4Array(_distortionMeshRows * _distortionMeshColumns); 61 61 for(int row=0;row<_distortionMeshRows;row++) 62 62 { -
experimental/distortionNG/distortionNG.vcproj
r372 r392 391 391 </Filter> 392 392 <File 393 RelativePath=".\shader.vert" 394 > 395 </File> 396 <File 393 397 RelativePath=".\shaderIntensityMap.frag" 394 398 > -
experimental/distortionNG/extViewer.cpp
r381 r392 364 364 osg::Program* IntensityMapProgram = new osg::Program; 365 365 IntensityMapProgram->setName( "intensityMapBlending" ); 366 osg::Shader* shaderVert = osg::Shader::readShaderFile( osg::Shader::VERTEX, "shader.vert" ); 367 shaderVert->setName("shaderVert"); 366 368 osg::Shader* shaderIntensityMap = osg::Shader::readShaderFile( osg::Shader::FRAGMENT, "shaderIntensityMap.frag" ); 367 369 shaderIntensityMap->setName("shaderIntensityMap"); 370 368 371 _distortionSet->setShaderIntensityMap( shaderIntensityMap ); 369 372 370 if ( shaderIntensityMap ) 371 { 373 if ( shaderVert && shaderIntensityMap ) 374 { 375 IntensityMapProgram->addShader( shaderVert ); 372 376 IntensityMapProgram->addShader( shaderIntensityMap ); 373 377 stateset->addUniform( new osg::Uniform("sceneTexture", (int)_distortionSet->getTexUnitScene()) ); -
experimental/distortionNG/main.cpp
r391 r392 53 53 osg::ref_ptr<osgViewer::DistortionSet> _distortionSet = new osgViewer::DistortionSet(); 54 54 _distortionSet->setIntensityMap( intMap ); 55 _distortionSet->setDistortionMeshDimensions(20, 20);55 _distortionSet->setDistortionMeshDimensions(20, 30); 56 56 57 57 -
experimental/distortionNG/shader.vert
r338 r392 1 1 varying vec2 texcoord_scene; 2 2 varying vec2 texcoord_intensityMap; 3 4 varying vec2 texCoord; 3 5 4 6 void main() … … 7 9 texcoord_scene = vec2(gl_MultiTexCoord0.xy); 8 10 texcoord_intensityMap = vec2(gl_MultiTexCoord1.xy); 11 texCoord = gl_MultiTexCoord0.xy; 9 12 } -
experimental/distortionNG/shaderIntensityMap.frag
r363 r392 3 3 varying vec2 texcoord_scene; 4 4 varying vec2 texcoord_intensityMap; 5 6 varying vec2 texCoord; 5 7 6 8 void main(void) … … 9 11 vec4 blendColor; 10 12 11 sceneColor = texture2DRect(sceneTexture, gl_FragCoord);13 //sceneColor = texture2DRect(sceneTexture, gl_FragCoord); 12 14 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)) ; 14 18 }
Note: See TracChangeset
for help on using the changeset viewer.