From Jay Zuckerman, fixes to AutoTransform so that it includes checking of

previous position value.
This commit is contained in:
Robert Osfield 2004-08-05 15:15:51 +00:00
parent 009cda4134
commit e9f4ed87bc
2 changed files with 215 additions and 207 deletions

View File

@ -91,6 +91,8 @@ class SG_EXPORT AutoTransform : public Transform
mutable int _previousWidth;
mutable int _previousHeight;
mutable osg::Matrix _previousProjection;
mutable osg::Vec3 _previousPosition;
void computeMatrix() const;

View File

@ -112,7 +112,8 @@ void AutoTransform::accept(NodeVisitor& nv)
height = viewport->height();
}
const osg::Vec3& eyePoint = cs->getEyeLocal();
osg::Vec3 eyePoint = cs->getEyeLocal();
osg::Vec3 position = getPosition();
const osg::Matrix& projection = cs->getProjectionMatrix();
@ -132,6 +133,10 @@ void AutoTransform::accept(NodeVisitor& nv)
{
doUpdate = true;
}
else if (position != _previousPosition)
{
doUpdate = true;
}
}
_firstTimeToInitEyePoint = false;
@ -155,6 +160,7 @@ void AutoTransform::accept(NodeVisitor& nv)
_previousWidth = width;
_previousHeight = height;
_previousProjection = projection;
_previousPosition = position;
_matrixDirty = true;
}