Changeset 360 for experimental/distortionNG
- Timestamp:
- Apr 22, 2012, 12:47:07 PM (13 years ago)
- Location:
- experimental/distortionNG
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
experimental/distortionNG/DistortionSet.cpp
r353 r360 24 24 DistortionSet::DistortionSet() 25 25 { 26 _distortionMeshRows = 1;27 _distortionMeshColumns = 1;26 _distortionMeshRows = 2; 27 _distortionMeshColumns = 2; 28 28 //GLenum _meshType; 29 29 -
experimental/distortionNG/DistortionSet.h
r357 r360 23 23 #include <osg/Camera> 24 24 #include <osg/Switch> 25 #include <osg/Shader> 25 26 26 27 namespace osgViewer { … … 59 60 60 61 osg::Switch* getDistortionInternals() { return _distortionInternals; } 62 63 61 64 62 65 -
experimental/distortionNG/extViewer.cpp
r359 r360 255 255 stateset->setTextureAttributeAndModes(_distortionSet->getTexUnitScene(), texmat, osg::StateAttribute::ON); 256 256 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); 258 258 meshGeode->addDrawable(distortionMesh); 259 259 … … 333 333 334 334 // 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" ); 337 337 osg::Shader* fShader = osg::Shader::readShaderFile( osg::Shader::FRAGMENT, "shader.frag" ); 338 338 fShader->setName("intensityMapFragShader"); … … 340 340 if ( fShader ) 341 341 { 342 distortProgram->addShader( fShader );342 IntensityMapProgram->addShader( fShader ); 343 343 stateset->addUniform( new osg::Uniform("sceneTexture", (int)_distortionSet->getTexUnitScene()) ); 344 344 stateset->addUniform( new osg::Uniform("intensityMapTexture", (int)_distortionSet->getTexUnitIntensityMap()) ); 345 stateset->setAttributeAndModes( distortProgram, osg::StateAttribute::ON);345 stateset->setAttributeAndModes(IntensityMapProgram, osg::StateAttribute::ON); 346 346 } 347 347 } … … 358 358 359 359 // 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 blending368 } 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 } -
experimental/distortionNG/extViewer.h
r359 r360 38 38 /** Convenience method for projection on curved screens using a slave camera rendering scene and a second camera doing distortion correction to present on a nonplaner display.*/ 39 39 void setUpViewForManualDistortion(osgViewer::DistortionSet* distSet, unsigned int screenNum=0, const osg::Matrixd& projectorMatrix = osg::Matrixd()); 40 //void setUpViewForManualDistortion(unsigned int rows, unsigned int colums, std::string intensityMap=""); 41 40 42 41 43 void setUpIntensityMapBlending(osgViewer::DistortionSet* distSet, unsigned int screenNum=0); -
experimental/distortionNG/main.cpp
r359 r360 56 56 viewer.setUpViewForManualDistortion(_distortionSet, 0); 57 57 58 58 //viewer.setUpIntensityMapBlending("intensitymap.png"); 59 59 60 60 // set up the camera manipulators. … … 195 195 * 196 196 * 197 * 197 * direct to do: 198 * 199 * speichern des containers in ein .dist file 200 * Laden des Containers. 201 * osgviewer setup fit machen: simple distortion ( nur rows, colums und optional blendmap ist angegeben 202 * shaderwechsel funktioniert, so dass die reine blendmap angezeigt werden kann. 203 * reset distortion funktioniert. 204 * statesetmanipulator muss auf die scene, nicht auf mesh losgehen. 205 * 206 * Anwenden der distortion auf die Meshknoten oder die texturekoordinaten 207 * 208 * alternativ: 209 * - umstellung der koordinaten auf [0-1] 210 * - speichern der hieght und width im container so daß das mesh an andere Bildschirmgrößen angepasst werden kann. 211 198 212 * 199 213 */
Note: See TracChangeset
for help on using the changeset viewer.