Rewrote the handling of AutoTransform::setAutoScaleToScreen(bool) functionality so that is disabling CullingActive when switched on.
This commit is contained in:
parent
11230c3f0b
commit
5c48904626
@ -89,8 +89,7 @@ class OSG_EXPORT AutoTransform : public Transform
|
||||
/** Get the front face direction normal. */
|
||||
inline const Vec3& getNormal() const { return _normal; }
|
||||
|
||||
void setAutoScaleToScreen(bool autoScaleToScreen) { _autoScaleToScreen = autoScaleToScreen; }
|
||||
|
||||
void setAutoScaleToScreen(bool autoScaleToScreen);
|
||||
bool getAutoScaleToScreen() const { return _autoScaleToScreen; }
|
||||
|
||||
void setAutoScaleTransitionWidthRatio(float ratio) { _autoScaleTransitionWidthRatio = ratio; }
|
||||
@ -101,9 +100,6 @@ class OSG_EXPORT AutoTransform : public Transform
|
||||
|
||||
virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor* nv) const;
|
||||
|
||||
virtual BoundingSphere computeBound() const;
|
||||
|
||||
|
||||
protected :
|
||||
|
||||
virtual ~AutoTransform() {}
|
||||
@ -125,9 +121,6 @@ class OSG_EXPORT AutoTransform : public Transform
|
||||
|
||||
osg::Matrixd computeMatrix(const osg::NodeVisitor* nv) const;
|
||||
|
||||
mutable bool _matrixInitalized;
|
||||
mutable osg::Matrixd _cachedMatrix;
|
||||
|
||||
enum AxisAligned
|
||||
{
|
||||
AXIAL_ROT_X_AXIS=ROTATE_TO_AXIS+1,
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user