Changeset 408 for experimental/distortionNG
- Timestamp:
- Aug 6, 2012, 10:59:23 PM (12 years ago)
- Location:
- experimental/distortionNG
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
experimental/distortionNG/DistortionManipulator.cpp
r407 r408 310 310 311 311 _distortionSet->setDistortionMeshDimensions(2, 2, true); // Reset dimensions and coordinates/texcoords & rebuild mesh data 312 updateDistortionMesh(); // Rebuild OSG Mesh (drawable) 312 _distortionSet->dirtyMesh(); 313 313 314 // Restore ProjectionMatrix 314 315 // Set up projection Matrix as it is done in View::setUpViewOnSingleScreen( 316 double fovy, aspectRatio, zNear, zFar; 317 _camera->getProjectionMatrixAsPerspective(fovy, aspectRatio, zNear, zFar); 318 319 double newAspectRatio = double(_distortionSet->intensityMap()->width) / double(_distortionSet->intensityMap()->height); 315 // Set up basic projection Matrix 316 double fovy = 30., aspectRatio = 1., zNear = 1., zFar = 1000.; 317 _distortionSet->getProjectionOffset().makePerspective( fovy, aspectRatio, zNear, zFar ); 318 319 double newAspectRatio = double(_distortionSet->getIntensityMap()->s()) / double(_distortionSet->getIntensityMap()->t()); 320 320 double aspectRatioChange = newAspectRatio / aspectRatio; 321 321 if (aspectRatioChange != 1.0) 322 322 { 323 _ camera->getProjectionMatrix() *= osg::Matrix::scale(1.0/aspectRatioChange,1.0,1.0);324 } 325 326 323 _distortionSet->getProjectionOffset() *= osg::Matrix::scale(1.0/aspectRatioChange,1.0,1.0); 324 } 325 326 _distortionSet->dirtyMatrix(); 327 327 } 328 328 … … 547 547 { 548 548 549 #if 1549 #if 0 550 550 /*******************************************/ 551 551 /*** ViewMatrix-Testcase "Garching" ***/ 552 552 /*******************************************/ 553 553 554 osg::Matrixd view Offset, transViewOffset, rotViewOffset;554 osg::Matrixd viewMatrix, transView, rotView; 555 555 556 rotView Offset.makeRotate(556 rotView.makeRotate( 557 557 osg::DegreesToRadians(-130.0), osg::Vec3(0,1,0), // heading 558 558 osg::DegreesToRadians(0.0), osg::Vec3(-1,0,0), // pitch 559 559 osg::DegreesToRadians(-80.0), osg::Vec3(0,0,1)); // roll 560 560 561 transViewOffset.makeTranslate(-4169457.75*0.99975, -860009.06*0.99975, -4737192.00*0.99975); 562 viewOffset = transViewOffset * rotViewOffset; 561 transView.makeTranslate(-4169457.75*0.99975, -860009.06*0.99975, -4737192.00*0.99975); 562 viewMatrix = transView * rotView; 563 564 if(_viewer->getCameraManipulator()==NULL) 565 { 566 _viewer->getCamera()->setViewMatrix(viewMatrix); 567 } 568 else 569 { 570 _viewer->getCameraManipulator()->setByMatrix(osg::Matrixd::inverse(viewMatrix)); 571 } 563 572 564 573 /**************************************/ … … 566 575 /**************************************/ 567 576 #endif 568 569 if(_viewer->getCameraManipulator()==NULL)570 {571 _viewer->getCamera()->setViewMatrix(viewOffset);572 }573 else574 {575 _viewer->getCameraManipulator()->setByMatrix(osg::Matrixd::inverse(viewOffset));576 }577 577 578 578 _viewer->getCamera()->setProjectionMatrix(osg::Matrix::identity()); … … 615 615 0.0 ); 616 616 vertices->push_back( tmpVec ); 617 OSG_ALWAYS<<"Transfering mesh vertex : X:"<<tmpVec.x()<<" Y:"<<tmpVec.y()<<" Z:"<<tmpVec.z()<<std::endl;617 //OSG_ALWAYS<<"Transfering mesh vertex : X:"<<tmpVec.x()<<" Y:"<<tmpVec.y()<<" Z:"<<tmpVec.z()<<std::endl; 618 618 619 619 // Note texCoords … … 622 622 623 623 texCoords->push_back(tmpTexCoords); 624 OSG_ALWAYS<<"Transfering texcoord vertex : X:"<<tmpTexCoords.x()<<" Y:"<<tmpTexCoords.y()<<std::endl;624 //OSG_ALWAYS<<"Transfering texcoord vertex : X:"<<tmpTexCoords.x()<<" Y:"<<tmpTexCoords.y()<<std::endl; 625 625 626 626 colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f)); -
experimental/distortionNG/DistortionSet.h
r407 r408 77 77 void setShaderIntensityMapVis(osg::Shader* shader) { shaderIntensityMapVis = shader; } 78 78 79 osg::Matrixd& getProjectionOffset() { return _projectionOffset; } 80 79 81 80 82
Note: See TracChangeset
for help on using the changeset viewer.