| 13 | | |
| 14 | | double c_zNear = f(3,2) / (f(2,2)-1.0f); |
| 15 | | double c_zFar = f(3,2) / (1.0f+f(2,2)); |
| 16 | | |
| 17 | | double c_left = c_zNear * (f(2,0)-1.0f) / f(0,0); |
| 18 | | double c_right = c_zNear * (1.0f+f(2,0)) / f(0,0); |
| 19 | | |
| 20 | | double c_top = c_zNear * (1+f(2,1)) / f(1,1); |
| 21 | | double c_bottom = c_zNear * (f(2,1)-1.0f) / f(1,1); |
| 22 | | |
| 23 | | f.getFrustum(c_left,c_right,c_bottom,c_top,c_zNear,c_zFar); |
| 24 | | |
| 25 | | std::cout << "testFrustum"<<std::endl; |
| | 13 | double c_left=0; |
| | 14 | double c_right=0; |
| | 15 | double c_top=0; |
| | 16 | double c_bottom=0; |
| | 17 | double c_zNear=0; |
| | 18 | double c_zFar=0; |
| | 19 | |
| | 20 | |
| | 21 | std::cout << "testFrustum"<<f.getFrustum(c_left,c_right,c_bottom,c_top,c_zNear,c_zFar)<<std::endl; |
| 43 | | double c_zNear = (f(3,2)+1.0f) / f(2,2); |
| 44 | | double c_zFar = (f(3,2)-1.0f) / f(2,2); |
| 45 | | |
| 46 | | double c_left = -(1.0f+f(3,0)) / f(0,0); |
| 47 | | double c_right = (1.0f-f(3,0)) / f(0,0); |
| 48 | | |
| 49 | | double c_bottom = -(1.0f+f(3,1)) / f(1,1); |
| 50 | | double c_top = (1.0f-f(3,1)) / f(1,1); |
| 51 | | |
| 52 | | f.getOrtho(c_left,c_right,c_bottom,c_top,c_zNear,c_zFar); |
| 53 | | |
| 54 | | |
| 55 | | std::cout << "testOrtho"<<std::endl; |
| | 39 | double c_left=0; |
| | 40 | double c_right=0; |
| | 41 | double c_top=0; |
| | 42 | double c_bottom=0; |
| | 43 | double c_zNear=0; |
| | 44 | double c_zFar=0; |
| | 45 | |
| | 46 | std::cout << "testOrtho "<< f.getOrtho(c_left,c_right,c_bottom,c_top,c_zNear,c_zFar) << std::endl; |
| | 52 | |
| | 53 | std::cout << " zNear = "<<zNear<<" compute "<<c_zNear<<std::endl; |
| | 54 | std::cout << " zFar = "<<zFar<<" compute "<<c_zFar<<std::endl; |
| | 55 | |
| | 56 | std::cout << std::endl; |
| | 57 | } |
| | 58 | |
| | 59 | void testPerspective(double fovy,double aspect,double zNear,double zFar) |
| | 60 | { |
| | 61 | osg::Matrix f; |
| | 62 | f.makePerspective(fovy,aspect,zNear,zFar); |
| | 63 | |
| | 64 | double c_fovy=0; |
| | 65 | double c_aspect=0; |
| | 66 | double c_zNear=0; |
| | 67 | double c_zFar=0; |
| | 68 | |
| | 69 | std::cout << "testPerspective "<< f.getPerspective(c_fovy,c_aspect,c_zNear,c_zFar) << std::endl; |
| | 70 | std::cout << " fovy = "<<fovy<<" compute "<<c_fovy<<std::endl; |
| | 71 | std::cout << " aspect = "<<aspect<<" compute "<<c_aspect<<std::endl; |
| 161 | 175 | testLookAt(osg::Vec3(10.0,4.0,2.0),osg::Vec3(10.0,4.0,2.0)+osg::Vec3(0.0,1.0,0.0),osg::Vec3(0.0,0.0,1.0)); |
| 162 | 176 | testLookAt(osg::Vec3(10.0,4.0,2.0),osg::Vec3(10.0,4.0,2.0)+osg::Vec3(1.0,1.0,0.0),osg::Vec3(0.0,0.0,1.0)); |