Changeset 328 for experimental/distortionNG
- Timestamp:
- Mar 2, 2012, 10:41:12 PM (13 years ago)
- Location:
- experimental/distortionNG
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
experimental/distortionNG/extViewer.cpp
r327 r328 72 72 return; 73 73 } 74 75 // Set up projection Matrix as it is done in View::setUpViewOnSingleScreen( 76 double fovy, aspectRatio, zNear, zFar; 77 _camera->getProjectionMatrixAsPerspective(fovy, aspectRatio, zNear, zFar); 78 79 double newAspectRatio = double(traits->width) / double(traits->height); 80 double aspectRatioChange = newAspectRatio / aspectRatio; 81 if (aspectRatioChange != 1.0) 82 { 83 _camera->getProjectionMatrix() *= osg::Matrix::scale(1.0/aspectRatioChange,1.0,1.0); 84 } 85 74 86 75 87 int tex_width = width; … … 115 127 } 116 128 117 //getCamera()->setProjectionMatrixAsPerspective(90.0f, (float)tex_width/(float)tex_height, 1, 1000.0);118 119 129 // distortion correction set up. 120 130 { 121 131 osg::Geode* geode = new osg::Geode(); 122 132 //geode->addDrawable(createParoramicSphericalDisplayDistortionMesh(osg::Vec3(0.0f,0.0f,0.0f), osg::Vec3(width,0.0f,0.0f), osg::Vec3(0.0f,height,0.0f), 1, 0.45, 0, projectorMatrix)); 123 geode->addDrawable(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 ));133 geode->addDrawable(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)); 124 134 125 135 // new we need to add the texture to the mesh, we do so by creating a … … 163 173 } 164 174 165 osg::Geometry* extViewer::createMesh(const osg::Vec3& origin, const osg::Vec3& widthVector, const osg::Vec3& heightVector, unsigned int columns, unsigned int rows 175 osg::Geometry* extViewer::createMesh(const osg::Vec3& origin, const osg::Vec3& widthVector, const osg::Vec3& heightVector, unsigned int columns, unsigned int rows, const osg::Matrix& projectorMatrix) 166 176 { 167 177 // Create Quad to render on … … 194 204 for ( unsigned int col=0; col<columns; col++ ) 195 205 { 196 vertices->push_back( origin+dy*row+dx*col ); 206 vertices->push_back( origin+dy*row+dx*col ); // geometry 197 207 osg::Vec2 texcoord = osg::Vec2((float)col/(float)(columns-1), (float)row/(float)(rows-1)); 198 208 texcoords0->push_back( texcoord ); -
experimental/distortionNG/extViewer.h
r316 r328 16 16 void setUpViewForManualDistortion(unsigned int screenNum=0, osg::Image* intensityMap=0, const osg::Matrixd& projectorMatrix = osg::Matrixd()); 17 17 18 static osg::Geometry* createMesh(const osg::Vec3& origin, const osg::Vec3& widthVector, const osg::Vec3& heightVector, unsigned int columns, unsigned int rows );18 static osg::Geometry* createMesh(const osg::Vec3& origin, const osg::Vec3& widthVector, const osg::Vec3& heightVector, unsigned int columns, unsigned int rows, const osg::Matrix& projectorMatrix); 19 19 };
Note: See TracChangeset
for help on using the changeset viewer.