Changeset 391


Ignore:
Timestamp:
Jun 30, 2012, 1:09:04 PM (7 years ago)
Author:
Torben Dannhauer
Message:
 
Location:
experimental/distortionNG
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • experimental/distortionNG/DistortionManipulator.cpp

    r387 r391  
    289289        OSG_ALWAYS<<"Reseting IntensityMap Blending."<<std::endl;
    290290
    291         if (!image->isDataContiguous())
     291        //isDataContiguous is unknown to MSVS2010 and GCC
     292        /*if (!image->isDataContiguous())
    292293        {
    293294                OSG_WARN<<"Warning: DistortionManipulator does not support working with non contiguous imagery as blendmaps!"<<std::endl;
    294295                return;
    295         }
     296        }*/
    296297
    297298        // Fill intensity map with 255
     
    531532        if(_viewer.valid())
    532533        {
     534                // 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
    533540                _viewer->getCamera()->setViewMatrix(_distortionSet->getViewOffset());
    534541                _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());
    535550        }
    536551        else
     
    554569                                                                                0.0     );
    555570                vertices->push_back( tmpVec );
    556                 OSG_ALWAYS<<"Transfering mesh vertex : X:"<<tmpVec.x()<<" Y:"<<tmpVec.y()<<" Z:"<<tmpVec.z()<<std::endl;
     571                //OSG_ALWAYS<<"Transfering mesh vertex : X:"<<tmpVec.x()<<" Y:"<<tmpVec.y()<<" Z:"<<tmpVec.z()<<std::endl;
    557572
    558573                // Note texCoords
  • experimental/distortionNG/DistortionSetupStrategyProjectSyntropy.cpp

    r388 r391  
    294294                readFrustumFromCSVFile(_frustumFilename, numFrustumValues, frustumValues);
    295295               
    296                 osg::Matrixd viewOffset=osg::Matrixd();
     296                osg::Matrixd viewOffset=osg::Matrix::identity();
    297297                osg::Matrixd projectionOffset=osg::Matrixd();
    298298
     
    300300                // Translational Parameters are defines in millimeters (->Correction required?!)
    301301                // Coordinate System / Directions may be looked up in "Koordinatensystem.png", trans/rot order confirmed bei PS
    302                 viewOffset = osg::Matrixd::translate(frustumValues[0],frustumValues[1],frustumValues[2]);
    303                 viewOffset*= osg::Matrixd::rotate(osg::inDegrees(frustumValues[3]), 0.0,0.0,1.0); //Heading
    304                 viewOffset*= osg::Matrixd::rotate(osg::inDegrees(frustumValues[4]), 1.0,0.0,0.0); //Pitch
    305                 viewOffset*= osg::Matrixd::rotate(osg::inDegrees(frustumValues[5]), 0.0,1.0,0.0); //Bank
    306 
     302                osg::Matrixd rotViewOffset=osg::Matrixd();
     303                rotViewOffset.makeRotate(
     304                        osg::DegreesToRadians(frustumValues[3]), osg::Vec3(0,1,0),      // heading
     305                        osg::DegreesToRadians(-frustumValues[4]), osg::Vec3(1,0,0),     // pitch
     306                        osg::DegreesToRadians(frustumValues[5]), osg::Vec3(0,0,1));     // roll
     307
     308                osg::Matrixd transViewOffset=osg::Matrixd();
     309                transViewOffset.makeTranslate( frustumValues[0], frustumValues[1], frustumValues[2]);
     310
     311                viewOffset = viewOffset * rotViewOffset; // * transViewOffset;
     312               
    307313                //Frustum Parameters: Left, Right, Bottom, Top, zNear, zFar
    308                 //Alternative: viewer->camera->setprojectionmatrixasfrustum?
    309314                projectionOffset.makeFrustum(osg::inDegrees(frustumValues[6]), osg::inDegrees(frustumValues[7]), osg::inDegrees(frustumValues[8]), osg::inDegrees(frustumValues[9]), zNear, zFar);
    310315
  • experimental/distortionNG/main.cpp

    r389 r391  
    132132    if (!rootnode)
    133133    {
    134                 osgDB::Registry::instance()->getDataFilePathList().push_front("H:\\AllInOnDB");
    135                 rootnode = osgDB::readNodeFile("H:\\AllInOnDB\\terrain.osgb");
     134                //osgDB::Registry::instance()->getDataFilePathList().push_front("H:/AllInOnDB");
     135                rootnode = osgDB::readNodeFile("resources/TestSphere/sphere_500.obj");
    136136                if(!rootnode)
    137137                {
Note: See TracChangeset for help on using the changeset viewer.