Changeset 384 for experimental
- Timestamp:
- Jun 15, 2012, 10:09:08 PM (12 years ago)
- Location:
- experimental/distortionNG
- Files:
-
- 2 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 } -
experimental/distortionNG/DistortionSetupStrategyProjectSyntropy.cpp
r383 r384 409 409 distortionSet->setDistortionMeshColumns(distortionMeshColumns); 410 410 distortionSet->setDistortionMeshRows(distortionMeshRows); 411 412 // apply new settings413 //if((_distortionType==TEXCOORDDISTORTION) || (_distortionType==COMBINEDDISTORTION))414 //{415 // distortionSet->getDistortionInternals()->getChild(osgViewer::DistortionSet::MESH)->asGeode()->getDrawable(0)->asGeometry()->setTexCoordArray(0,tmpMeshVec2);416 //}417 418 //if((_distortionType==VERTEXDISTORTION) || (_distortionType==COMBINEDDISTORTION))419 //{420 // OSG_ALWAYS<<"New mesh ---------------------------"<<std::endl;421 // for(unsigned int i=0;i<tmpMeshVec2->size();i++)422 // {423 // // Scale vector with the screen resolution424 // osg::Vec3 tmpVec = osg::Vec3( tmpMeshVec2->at(i).x()*width,425 // tmpMeshVec2->at(i).y()*height,426 // 0.0 );427 // vertexMeshVec3->push_back( tmpVec );428 // OSG_ALWAYS<<"X:"<<tmpVec.x()<<" Y:"<<tmpVec.y()<<" Z:"<<tmpVec.z()<<std::endl;429 // }430 // OSG_ALWAYS<<"tmpMeshVec2 size:"<<tmpMeshVec2->size()<<std::endl;431 // distortionSet->getDistortionInternals()->getChild(osgViewer::DistortionSet::MESH)->asGeode()->getDrawable(0)->asGeometry()->setVertexArray(vertexMeshVec3);432 // distortionSet->getDistortionInternals()->getChild(osgViewer::DistortionSet::MESH)->asGeode()->getDrawable(0)->asGeometry()->setTexCoordArray433 // distortionSet->getDistortionInternals()->getChild(osgViewer::DistortionSet::MESH)->asGeode()->getDrawable(0)->asGeometry()->dirtyDisplayList();434 //}435 411 } 436 412 }
Note: See TracChangeset
for help on using the changeset viewer.