Changeset 397


Ignore:
Timestamp:
Jul 5, 2012, 3:44:40 PM (12 years ago)
Author:
Torben Dannhauer
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • experimental/distortionNG/DistortionManipulator.cpp

    r396 r397  
    532532        if(_viewer.valid())
    533533        {
     534                // Get slave struct to update the offset matrixes.
     535                int slaveIndex = _viewer->findSlaveIndexForCamera( _viewer->getCamera() );
     536
     537                _viewer->getSlave( slaveIndex )._projectionOffset = _distortionSet->getProjectionOffset();
     538                _viewer->getSlave( slaveIndex )._viewOffset = _distortionSet->getViewOffset();
     539
     540
    534541                // LF CameraMainupulators override ViewMatrix, so they have to go...
    535                 // alternatively, _viewer->getCameraManipulator()->setByMatrix(_distortionSet->getViewOffset()) could be set
    536                 // but this complicates exact camera positioning and rotating
    537 
    538                 _viewer->setCameraManipulator(0);
    539 
    540                 _viewer->getCamera()->setViewMatrix(_distortionSet->getViewOffset());
    541                 _viewer->getCamera()->setProjectionMatrix(_distortionSet->getProjectionOffset());
    542 
    543                 // Print viewMatrixAsLookAt for Debug Purposes
    544                 osg::Vec3 Eye,Focus,Vertical;
    545                 _viewer->getCamera()->getViewMatrixAsLookAt(Eye,Focus,Vertical);
    546                 OSG_ALWAYS<<"Camera Eyepoint: X:"<<Eye.x()<<" Y:"<<Eye.y()<<" Z:"<<Eye.z()<<std::endl;
    547                 printf("Camera Eyepoint: %.2lf, %.2lf, %.2lf\n",Eye.x(),Eye.y(),Eye.z());
    548                 printf("Camera Direction: %.2lf, %.2lf, %.2lf\n",Focus.x()-Eye.x(),Focus.y()-Eye.y(),Focus.z()-Eye.z());
    549                 printf("Vertical after: %.2lf, %.2lf, %.2lf\n",Vertical.x()-Eye.x(),Vertical.y()-Eye.y(),Vertical.z()-Eye.z());
    550 
    551                 double fovy, aspectRatio, zNear, zFar;
    552                 _viewer->getCamera()->getProjectionMatrixAsPerspective(fovy, aspectRatio, zNear, zFar);
    553                 OSG_ALWAYS<<"aspect ratio: "<<aspectRatio<<std::endl;
    554                 //double newAspectRatio = double(_screenPixWidth) / double(_screenPixHeight);
    555                 //double aspectRatioChange = newAspectRatio / aspectRatio;
    556                 //if (aspectRatioChange != 1.0)
    557                 //{
    558                 //      _viewer->getCamera()->getProjectionMatrix() *= osg::Matrix::scale(1.0/aspectRatioChange,1.0,1.0);
    559                 //}
    560 
    561 
     542                //// alternatively, _viewer->getCameraManipulator()->setByMatrix(_distortionSet->getViewOffset()) could be set
     543                //// but this complicates exact camera positioning and rotating
     544
     545                //_viewer->setCameraManipulator(0);
     546
     547                //_viewer->getCamera()->setViewMatrix(_distortionSet->getViewOffset());
     548                //_viewer->getCamera()->setProjectionMatrix(_distortionSet->getProjectionOffset());
     549
     550                //// Print viewMatrixAsLookAt for Debug Purposes
     551                //osg::Vec3 Eye,Focus,Vertical;
     552                //_viewer->getCamera()->getViewMatrixAsLookAt(Eye,Focus,Vertical);
     553                //OSG_ALWAYS<<"Camera Eyepoint: X:"<<Eye.x()<<" Y:"<<Eye.y()<<" Z:"<<Eye.z()<<std::endl;
     554                //printf("Camera Eyepoint: %.2lf, %.2lf, %.2lf\n",Eye.x(),Eye.y(),Eye.z());
     555                //printf("Camera Direction: %.2lf, %.2lf, %.2lf\n",Focus.x()-Eye.x(),Focus.y()-Eye.y(),Focus.z()-Eye.z());
     556                //printf("Vertical after: %.2lf, %.2lf, %.2lf\n",Vertical.x()-Eye.x(),Vertical.y()-Eye.y(),Vertical.z()-Eye.z());
    562557        }
    563558        else
Note: See TracChangeset for help on using the changeset viewer.