diff --git a/examples/osgunittests/osgunittests.cpp b/examples/osgunittests/osgunittests.cpp index 834613eac..d7ad5886d 100644 --- a/examples/osgunittests/osgunittests.cpp +++ b/examples/osgunittests/osgunittests.cpp @@ -10,19 +10,15 @@ void testFrustum(double left,double right,double bottom,double top,double zNear, osg::Matrix f; f.makeFrustum(left,right,bottom,top,zNear,zFar); + double c_left=0; + double c_right=0; + double c_top=0; + double c_bottom=0; + double c_zNear=0; + double c_zFar=0; - double c_zNear = f(3,2) / (f(2,2)-1.0f); - double c_zFar = f(3,2) / (1.0f+f(2,2)); - double c_left = c_zNear * (f(2,0)-1.0f) / f(0,0); - double c_right = c_zNear * (1.0f+f(2,0)) / f(0,0); - - double c_top = c_zNear * (1+f(2,1)) / f(1,1); - double c_bottom = c_zNear * (f(2,1)-1.0f) / f(1,1); - - f.getFrustum(c_left,c_right,c_bottom,c_top,c_zNear,c_zFar); - - std::cout << "testFrustum"<getOrtho(left, right, - bottom, top, - zNear, zFar); + return _projectionMatrix->getOrtho(left, right, + bottom, top, + zNear, zFar); } + return false; } -void SceneView::getProjectionMatrixAsFrustum(double& left, double& right, +bool SceneView::getProjectionMatrixAsFrustum(double& left, double& right, double& bottom, double& top, double& zNear, double& zFar) { if (_projectionMatrix.valid()) { - _projectionMatrix->getFrustum(left, right, - bottom, top, - zNear, zFar); + return _projectionMatrix->getFrustum(left, right, + bottom, top, + zNear, zFar); } + return false; } +bool SceneView::getProjectionMatrixAsPerspective(double& fovy,double& aspectRatio, + double& zNear, double& zFar) +{ + if (_projectionMatrix.valid()) + { + return _projectionMatrix->getPerspective(fovy, aspectRatio, zNear, zFar); + } + return false; +} void SceneView::setViewMatrix(const osg::Matrix& matrix) {