Removed the cached matrices from osg::Camera, so that

osg::Camrea::getModelViewMatrix() and osg::Camera::getProjectionMatrix() are
calculated on the fly.  Removed various redudent methods, including the
project and unproject methods which are better supported within osgUtil::SceneView.

Added a computeWindowMatrix() method to Viewport, to make it easier to construct
a MV*P*W matrix for converting local coords into screen coords and visa versa.
Converted SceneView and CullVisitor to use this new method.
This commit is contained in:
Robert Osfield
2002-04-16 11:41:32 +00:00
parent 43fa577566
commit f8340f9ef5
8 changed files with 174 additions and 399 deletions

View File

@@ -354,6 +354,20 @@ void Matrix::makePerspective(const double fovy,const double aspectRatio,
void Matrix::makeLookAt(const Vec3& eye,const Vec3& center,const Vec3& up)
{
Vec3 f(center-eye);
f.normalize();
Vec3 s(f^up);
s.normalize();
Vec3 u(s^f);
u.normalize();
set(
s[0], u[0], -f[0], 0.0f,
s[1], u[1], -f[1], 0.0f,
s[2], u[2], -f[2], 0.0f,
0.0f, 0.0f, 0.0f, 1.0f);
preMult(Matrix::translate(-eye));
}
#undef SET_ROW