Ignore:
Timestamp:
Aug 5, 2012, 11:09:39 PM (12 years ago)
Author:
Torben Dannhauer
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • experimental/distortionNG/DistortionManipulator.cpp

    r406 r407  
    308308                return;
    309309
    310         OSG_ALWAYS<<"ToDo: resetDistortion()"<<std::endl;
     310       
     311        _distortionSet->setDistortionMeshDimensions(2, 2, true);        // Reset dimensions and coordinates/texcoords & rebuild mesh data
     312        updateDistortionMesh(); // Rebuild OSG Mesh (drawable)
     313        // 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);
     320        double aspectRatioChange = newAspectRatio / aspectRatio;
     321        if (aspectRatioChange != 1.0)
     322        {
     323                _camera->getProjectionMatrix() *= osg::Matrix::scale(1.0/aspectRatioChange,1.0,1.0);
     324        }
     325
     326
    311327}
    312328
     
    599615                                                                                0.0     );
    600616                vertices->push_back( tmpVec );
    601                 //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;
    602618
    603619                // Note texCoords
     
    606622
    607623                texCoords->push_back(tmpTexCoords);
    608                 //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;
    609625
    610626                colors->push_back(osg::Vec4(1.0f,1.0f,1.0f,1.0f));
Note: See TracChangeset for help on using the changeset viewer.