Changeset 318 for experimental
- Timestamp:
- Sep 8, 2011, 6:56:02 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
experimental/distortionNG/extViewer.cpp
r317 r318 175 175 yAxis /= height; 176 176 177 osg::Vec3 dx = xAxis*(width/((float)(columns )));178 osg::Vec3 dy = yAxis*(height/((float)(rows )));177 osg::Vec3 dx = xAxis*(width/((float)(columns-1))); 178 osg::Vec3 dy = yAxis*(height/((float)(rows-1))); 179 179 180 180 … … 187 187 geom->getOrCreateStateSet()->setMode(GL_CULL_FACE, osg::StateAttribute::OFF | osg::StateAttribute::PROTECTED); 188 188 189 for ( unsigned int i=0; i<rows; ++i)189 for ( unsigned int row=0; row<rows; ++row ) 190 190 { 191 for ( unsigned int j=0; j<columns; ++j)191 for ( unsigned int col=0; col<columns; ++col ) 192 192 { 193 vertices->push_back( origin+dy* i+dx*j);194 texcoords0->push_back( osg::Vec2((float) j/(float)columns, (float)i/(float)rows) );193 vertices->push_back( origin+dy*row+dx*col ); 194 texcoords0->push_back( osg::Vec2((float)col/(float)columns, (float)row/(float)rows) ); 195 195 196 196 // if (intensityMap) … … 223 223 // geometry->addPrimitiveSet(elements); 224 224 225 for ( unsigned int i=0; i<rows-1; ++i)225 for ( unsigned int row=0; row<rows; ++row ) 226 226 { 227 227 osg::ref_ptr<osg::DrawElementsUInt> de = new osg::DrawElementsUInt(GL_QUAD_STRIP, columns*2); 228 for ( unsigned int j=0; j<columns; ++j)228 for ( unsigned int col=0; col<columns; ++col ) 229 229 { 230 (*de)[ j*2 + 0] = i*columns + j;231 (*de)[ j*2 + 1] = (i+1)*columns + j;230 (*de)[col*2 + 0] = row*columns + col; 231 (*de)[col*2 + 1] = (row+1)*columns + col; 232 232 } 233 233 geom->addPrimitiveSet( de.get() );
Note: See TracChangeset
for help on using the changeset viewer.