Changeset 337 for experimental/distortionNG
- Timestamp:
- Mar 16, 2012, 10:44:23 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
experimental/distortionNG/extViewer.cpp
r336 r337 274 274 275 275 osg::TexMat* texmat = new osg::TexMat; 276 276 texmat->setScaleByTextureRectangleSize(true); 277 277 stateset->setTextureAttributeAndModes(0, texmat, osg::StateAttribute::ON); 278 278 … … 280 280 if (!applyIntensityMapAsColours && intensityMap) 281 281 { 282 // Resize intensityMap if the dimensions are wrong 283 if(intensityMap->s()!=tex_width || intensityMap->t()!=tex_height) 284 intensityMap->scaleImage(tex_width, tex_height, intensityMap->r()); 285 282 286 osg::TextureRectangle* intensityMapTexture = new osg::TextureRectangle(intensityMap); 283 intensityMapTexture->setTextureSize(tex_width, tex_height); 284 //intensityMapTexture->setInternalFormat(GL_RGB); 285 // intensityMapTexture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR); 286 //intensityMapTexture->setFilter(osg::Texture::MAG_FILTER,osg::Texture::LINEAR); 287 intensityMapTexture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR); 288 intensityMapTexture->setFilter(osg::Texture::MAG_FILTER,osg::Texture::LINEAR); 287 289 intensityMapTexture->setWrap(osg::Texture::WRAP_S,osg::Texture::CLAMP_TO_EDGE); 288 290 intensityMapTexture->setWrap(osg::Texture::WRAP_T,osg::Texture::CLAMP_TO_EDGE); … … 290 292 stateset->setTextureAttributeAndModes(1, intensityMapTexture, osg::StateAttribute::ON); 291 293 292 //osg::TexMat* texmat1 = new osg::TexMat;293 //texmat1->setScaleByTextureRectangleSize(true);294 //stateset->setTextureAttributeAndModes(1, texmat1, osg::StateAttribute::ON);295 }296 297 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, intensityMap, applyIntensityMapAsColours, projectorMatrix);298 geode->addDrawable(distortionMesh);299 300 if (intensityMap && !applyIntensityMapAsColours)301 {302 294 // create shaders for distortion 303 295 osg::Program* distortProgram = new osg::Program; … … 316 308 stateset->setAttributeAndModes(distortProgram, osg::StateAttribute::ON); 317 309 } 310 } 311 312 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, intensityMap, applyIntensityMapAsColours, projectorMatrix); 313 geode->addDrawable(distortionMesh); 314 315 if (intensityMap && !applyIntensityMapAsColours) 316 { 317 //// create shaders for distortion 318 //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 //} 318 333 } 319 334
Note: See TracChangeset
for help on using the changeset viewer.