Rewrote the handling of AutoTransform::setAutoScaleToScreen(bool) functionality so that is disabling CullingActive when switched on.

This commit is contained in:
Robert Osfield
2018-04-02 18:26:26 +01:00
parent 6c055e3400
commit f71513cab5
2 changed files with 8 additions and 26 deletions

View File

@@ -25,7 +25,6 @@ AutoTransform::AutoTransform():
_minimumScale(0.0),
_maximumScale(DBL_MAX),
_autoScaleTransitionWidthRatio(0.25),
_matrixInitalized(false),
_axis(0.0f,0.0f,1.0f),
_normal(0.0f,-1.0f,0.0f),
_cachedMode(NO_ROTATION),
@@ -46,7 +45,6 @@ AutoTransform::AutoTransform(const AutoTransform& pat,const CopyOp& copyop):
_minimumScale(pat._minimumScale),
_maximumScale(pat._maximumScale),
_autoScaleTransitionWidthRatio(pat._autoScaleTransitionWidthRatio),
_matrixInitalized(false),
_axis(pat._axis),
_normal(pat._normal),
_cachedMode(pat._cachedMode),
@@ -55,6 +53,13 @@ AutoTransform::AutoTransform(const AutoTransform& pat,const CopyOp& copyop):
// setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1);
}
void AutoTransform::setAutoScaleToScreen(bool autoScaleToScreen)
{
_autoScaleToScreen = autoScaleToScreen;
if (_autoScaleToScreen) setCullingActive(false);
}
void AutoTransform::setAutoRotateMode(AutoRotateMode mode)
{
_autoRotateMode = mode;
@@ -135,8 +140,6 @@ bool AutoTransform::computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor* nv) co
osg::Matrixd AutoTransform::computeMatrix(const osg::NodeVisitor* nv) const
{
_matrixInitalized = true;
Quat rotation = _rotation;
osg::Vec3d scale = _scale;
@@ -297,19 +300,5 @@ osg::Matrixd AutoTransform::computeMatrix(const osg::NodeVisitor* nv) const
matrix.preMultScale(scale);
matrix.preMultTranslate(-_pivotPoint);
_cachedMatrix = matrix;
return matrix;
}
BoundingSphere AutoTransform::computeBound() const
{
BoundingSphere bsphere;
if ( getAutoScaleToScreen() && !_matrixInitalized )
return bsphere;
bsphere = Transform::computeBound();
return bsphere;
}