Changeset 338
- Timestamp:
- Mar 16, 2012, 11:15:58 PM (13 years ago)
- Location:
- experimental/distortionNG
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
experimental/distortionNG/extViewer.cpp
r337 r338 313 313 geode->addDrawable(distortionMesh); 314 314 315 if (intensityMap && !applyIntensityMapAsColours)316 {317 //// create shaders for distortion318 //osg::Program* distortProgram = new osg::Program;319 //distortProgram->setName( "distortion" );320 //osg::Shader* vShader = osg::Shader::readShaderFile( osg::Shader::VERTEX, "shader.vert" );321 //vShader->setName("intensityMapVertShader");322 //osg::Shader* fShader = osg::Shader::readShaderFile( osg::Shader::FRAGMENT, "shader.frag" );323 //fShader->setName("intensityMapFragShader");324 325 //if ( vShader && fShader )326 //{327 // //distortProgram->addShader( vShader );328 // distortProgram->addShader( fShader );329 // stateset->addUniform( new osg::Uniform("sceneTexture", 0) );330 // stateset->addUniform( new osg::Uniform("intensityMapTexture", 1) );331 // stateset->setAttributeAndModes(distortProgram, osg::StateAttribute::ON);332 //}333 }334 335 336 315 osg::ref_ptr<osg::Camera> camera = new osg::Camera; 337 316 camera->setGraphicsContext(gc.get()); … … 350 329 camera->setViewMatrix(osg::Matrix::identity()); 351 330 352 // //selector353 //geode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF );354 //geode->getOrCreateStateSet()->setAttributeAndModes( new osg::PolygonOffset(1.0f, 1.0f) );355 //osg::ref_ptr<distortionHandler> selector = new distortionHandler( camera, distortionMesh );331 // selector 332 geode->getOrCreateStateSet()->setMode( GL_LIGHTING, osg::StateAttribute::OFF ); 333 geode->getOrCreateStateSet()->setAttributeAndModes( new osg::PolygonOffset(1.0f, 1.0f) ); 334 osg::ref_ptr<distortionHandler> selector = new distortionHandler( camera, distortionMesh ); 356 335 osg::ref_ptr<osg::Group> root = new osg::Group; 357 336 root->addChild(geode); 358 //root->addChild(selector->createVertexHighlighter());359 //addEventHandler( selector.get() );337 root->addChild(selector->createVertexHighlighter()); 338 addEventHandler( selector.get() ); 360 339 camera->addChild(root); 361 // //Avoid that the highlighter is culled away362 //osg::CullSettings::CullingMode mode = camera->getCullingMode();363 //camera->setCullingMode( mode & (~osg::CullSettings::SMALL_FEATURE_CULLING) );340 // Avoid that the highlighter is culled away 341 osg::CullSettings::CullingMode mode = camera->getCullingMode(); 342 camera->setCullingMode( mode & (~osg::CullSettings::SMALL_FEATURE_CULLING) ); 364 343 365 344 -
experimental/distortionNG/shader.frag
r336 r338 1 1 uniform sampler2DRect sceneTexture; 2 2 uniform sampler2DRect intensityMapTexture; 3 invarying vec2 texcoord_scene;4 invarying vec2 texcoord_intensityMap;3 varying vec2 texcoord_scene; 4 varying vec2 texcoord_intensityMap; 5 5 6 6 void main(void) -
experimental/distortionNG/shader.vert
r335 r338 1 outvarying vec2 texcoord_scene;2 outvarying vec2 texcoord_intensityMap;1 varying vec2 texcoord_scene; 2 varying vec2 texcoord_intensityMap; 3 3 4 4 void main() 5 5 { 6 6 gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; 7 texcoord_scene = vec2(gl_MultiTexCoord0 );8 texcoord_intensityMap = vec2(gl_MultiTexCoord1 );7 texcoord_scene = vec2(gl_MultiTexCoord0.xy); 8 texcoord_intensityMap = vec2(gl_MultiTexCoord1.xy); 9 9 }
Note: See TracChangeset
for help on using the changeset viewer.