Changeset 384 for experimental/distortionNG/DistortionManipulator.cpp
- Timestamp:
- Jun 15, 2012, 10:09:08 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
experimental/distortionNG/DistortionManipulator.cpp
r381 r384 518 518 updateDistortionViewProjectionMatrix(); 519 519 updateDistortionMesh(); 520 _distortionSet->clearDirtyStatus(); 520 521 } 521 522 … … 539 540 void DistortionManipulator::updateDistortionMesh() 540 541 { 541 542 } 542 // Create mesh vertex array 543 544 // Create textCoord array 545 546 // Apply arrays 547 548 osg::Vec3Array* vertices = new osg::Vec3Array; 549 osg::Vec2Array* texCoords = new osg::Vec2Array; 550 551 for(unsigned int i=0;i<_distortionSet->getDistortionMesh()->size();i++) 552 { 553 // Scale vector with the screen resolution 554 osg::Vec3 tmpVec = osg::Vec3( _distortionSet->getDistortionMesh()->at(i).x()*_screenPixWidth, 555 _distortionSet->getDistortionMesh()->at(i).y()*_screenPixHeight, 556 0.0 ); 557 vertices->push_back( tmpVec ); 558 OSG_ALWAYS<<"X:"<<tmpVec.x()<<" Y:"<<tmpVec.y()<<" Z:"<<tmpVec.z()<<std::endl; 559 560 // Note texCoords 561 osg::Vec2 tmpTexCoords = osg::Vec2( _distortionSet->getDistortionMesh()->at(i).z()*_screenPixWidth, 562 _distortionSet->getDistortionMesh()->at(i).w()*_screenPixHeight ); 563 texCoords->push_back(tmpTexCoords); 564 } 565 566 _distortionSet->getDistortionInternals()->getChild(osgViewer::DistortionSet::MESH)->asGeode()->getDrawable(0)->asGeometry()->setVertexArray(vertices); 567 _distortionSet->getDistortionInternals()->getChild(osgViewer::DistortionSet::MESH)->asGeode()->getDrawable(0)->asGeometry()->setTexCoordArray(0, texCoords); // todo: 0 ist hardcoded und müsste durch getTexUnitScene() ersetzt werden 568 _distortionSet->getDistortionInternals()->getChild(osgViewer::DistortionSet::MESH)->asGeode()->getDrawable(0)->asGeometry()->dirtyDisplayList(); 569 570 }
Note: See TracChangeset
for help on using the changeset viewer.