From bd798a6c4efe654fd6e63932defcff702fadbb70 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 25 Aug 2003 13:06:15 +0000 Subject: [PATCH] Added getInitialInverseViewMatrix() to osg::State. --- include/osg/State | 12 ++++-------- src/osg/State.cpp | 8 ++++++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/include/osg/State b/include/osg/State index d5a7c25c2..c1cc6b2a7 100644 --- a/include/osg/State +++ b/include/osg/State @@ -87,13 +87,10 @@ class SG_EXPORT State : public Referenced } - inline void setInitialViewMatrix(const osg::RefMatrix* matrix) - { - if (matrix) _initialViewMatrix = matrix; - else _initialViewMatrix = _identity; - } + inline void setInitialViewMatrix(const osg::RefMatrix* matrix); inline const osg::Matrix& getInitialViewMatrix() const { return *_initialViewMatrix; } + inline const osg::Matrix& getInitialInverseViewMatrix() const { return _initialInverseViewMatrix; } inline void applyProjectionMatrix(const osg::RefMatrix* matrix) { @@ -620,7 +617,6 @@ class SG_EXPORT State : public Referenced * if true steps should be taken to complete rendering early.*/ bool getAbortRendering() const { return _abortRenderingPtr!=0?(*_abortRenderingPtr):false; } - void setReportGLErrors(bool flag) { _reportGLErrors = flag; } bool getReportGLErrors() const { return _reportGLErrors; } @@ -628,8 +624,6 @@ class SG_EXPORT State : public Referenced bool checkGLErrors(StateAttribute::GLMode mode) const; bool checkGLErrors(const StateAttribute* attribute) const; - - protected: virtual ~State(); @@ -642,6 +636,8 @@ class SG_EXPORT State : public Referenced ref_ptr _projection; ref_ptr _modelView; + Matrix _initialInverseViewMatrix; + ref_ptr _displaySettings; bool* _abortRenderingPtr; diff --git a/src/osg/State.cpp b/src/osg/State.cpp index 233988307..5c73cd701 100644 --- a/src/osg/State.cpp +++ b/src/osg/State.cpp @@ -112,6 +112,14 @@ void State::reset() setActiveTextureUnit(0); } +void State::setInitialViewMatrix(const osg::RefMatrix* matrix) +{ + if (matrix) _initialViewMatrix = matrix; + else _initialViewMatrix = _identity; + + _initialInverseViewMatrix.invert(*_initialViewMatrix); +} + void State::pushStateSet(const StateSet* dstate) { _drawStateStack.push_back(dstate);