From Brad Christiansen, fix to enable AutoTransform to keep track of window

size/perspective changes
This commit is contained in:
Robert Osfield
2004-02-11 10:19:52 +00:00
parent c13ece9672
commit 61cb27806f
2 changed files with 13 additions and 3 deletions

View File

@@ -89,13 +89,16 @@ class SG_EXPORT AutoTransform : public Transform
mutable bool _firstTimeToInitEyePoint;
mutable osg::Vec3 _previousEyePoint;
mutable int _previousWidth;
mutable int _previousHeight;
mutable int _previousHeight;
mutable osg::Matrix _previousProjection;
void computeMatrix() const;
mutable bool _matrixDirty;
mutable osg::Matrix _cachedMatrix;
};
}

View File

@@ -107,7 +107,9 @@ void AutoTransform::accept(NodeVisitor& nv)
height = viewport->height();
}
osg::Vec3 eyePoint = cs->getEyeLocal();
const osg::Vec3& eyePoint = cs->getEyeLocal();
const osg::Matrix& projection = cs->getProjectionMatrix();
bool doUpdate = _firstTimeToInitEyePoint;
if (!_firstTimeToInitEyePoint)
@@ -120,7 +122,11 @@ void AutoTransform::accept(NodeVisitor& nv)
else if (width!=_previousWidth || height!=_previousHeight)
{
doUpdate = true;
}
}
else if (projection != _previousProjection)
{
doUpdate = true;
}
}
_firstTimeToInitEyePoint = false;
@@ -143,6 +149,7 @@ void AutoTransform::accept(NodeVisitor& nv)
_previousEyePoint = eyePoint;
_previousWidth = width;
_previousHeight = height;
_previousProjection = projection;
_matrixDirty = true;
}