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

@@ -329,7 +329,7 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor
if (!_viewportStack.empty())
{
osg::Viewport* viewport = _viewportStack.back().get();
return osg::Matrix::scale(0.5f*viewport->width(),viewport->height(),0.5f)*osg::Matrix::translate(0.5f,0.5f,0.5f);
return viewport->computeWindowMatrix();
}
else
{

View File

@@ -248,6 +248,8 @@ class OSGUTIL_EXPORT SceneView : public osg::Referenced
virtual void cullStage(osg::Matrix* projection,osg::Matrix* modelview,osgUtil::CullVisitor* cullVisitor, osgUtil::RenderGraph* rendergraph, osgUtil::RenderStage* renderStage);
virtual void drawStage(osgUtil::RenderStage* renderStage);
const osg::Matrix computeMVPW() const;
osg::ref_ptr<osg::Node> _sceneData;
osg::ref_ptr<osg::StateSet> _globalState;
osg::ref_ptr<osg::Light> _light;