Changeset 383 for experimental/distortionNG/DistortionSet.cpp
- Timestamp:
- Jun 15, 2012, 9:14:07 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
experimental/distortionNG/DistortionSet.cpp
r379 r383 24 24 DistortionSet::DistortionSet() 25 25 { 26 _dirty = false; 26 _meshDirty = false; 27 _matrixDirty = false; 27 28 28 29 _distortionMeshRows = 2; 29 30 _distortionMeshColumns = 2; 30 //GLenum _meshType;31 _distortionMesh = new osg::Vec4Array(); 31 32 32 33 _intensityMap = NULL; … … 50 51 } 51 52 52 void DistortionSet::setDistortionMesh (osg::Geometry*)53 void DistortionSet::setDistortionMeshDimensions(int rows, int cols) 53 54 { 54 // todo: denormalisieren und mesh dann an seine passenden Platz vom Switch packen. 55 _distortionMeshRows = rows; 56 _distortionMeshColumns = cols; 57 58 if(_distortionMesh->size() != _distortionMeshRows * _distortionMeshRows) // If dimensions differ: discard current mesh and createa new one 59 { 60 _distortionMesh = new osg::Vec4Array(_distortionMeshRows * _distortionMeshRows); 61 for(int row=0;row<_distortionMeshRows;row++) 62 { 63 for(int col=0;col<_distortionMeshColumns;col++) 64 { 65 float x=col/_distortionMeshColumns; // Vertex X 66 float y=row/_distortionMeshRows; // Vertex Y 67 float z=col/_distortionMeshColumns; // TexCoord X 68 float w=row/_distortionMeshRows; // TexCoord Y 69 70 _distortionMesh->at(row*_distortionMeshColumns+col).set(x,y,z,w); 71 } 72 } 73 } 55 74 } 56 75 57 const osg::Geometry* DistortionSet::getDistortionMesh() const58 {59 // Todo: Normalisieren und dann zurückgeben60 return NULL;61 }62 76 63 77 REGISTER_OBJECT_WRAPPER( osgViewer_DistortionSet, // The unique wrapper name … … 69 83 ADD_INT_SERIALIZER( DistortionMeshRows, 1 ); //int _distortionMeshRows; 70 84 ADD_INT_SERIALIZER( DistortionMeshColumns, 1 ); //int _distortionMeshColumns; 71 ADD_OBJECT_SERIALIZER( DistortionMesh, osg:: Geometry, NULL ); // Normalisiertes Mesh85 ADD_OBJECT_SERIALIZER( DistortionMesh, osg::Vec4Array, NULL ); // x,y = vertex coordinates, z,t=textureCoordinates, Werte sind normalisiert auf 0-1 72 86 73 87 ADD_GLENUM_SERIALIZER( MeshType, GLenum, GL_QUAD_STRIP ); //osg::PrimitiveSet::Mode _MeshType
Note: See TracChangeset
for help on using the changeset viewer.