Have added a #define USE_DEPRECATED_API to include/osg/Export, and

various
osg header and source files to optional compile in deprecated parts of
the
OSG API.

Have renamed osg::Transparency osg::BlendFunc to bring it in line with
the
rest of the OSG's StateAttribute classes which are named after their
OpenGL counterparts.  include/osg/Transparency still exists and is
simply
a typedef to BlendFunc and is enclosed in a #ifdef USE_DEPRECTATED_API
block.

The matrix methods in the osg::Transform class have been
moved/replicated in
a osg::MatrixTransform sublcass from osg::Transform.  The old matrix
functionality is still present in the osg::Transform class but is guard
by #ifdef USG_DEPRECATED_API blocks.  One should now think of
osg::Transform
as being a Transform Node base class.  MatrixTransform has all the
functionality of the original Transform class, so should be used
instead.
This commit is contained in:
Robert Osfield
2002-07-12 14:25:10 +00:00
parent 00470acb61
commit 8128265e09
23 changed files with 323 additions and 264 deletions

View File

@@ -36,8 +36,9 @@ class SG_EXPORT Transform : public Group
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
Transform(const Transform&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
#ifdef USE_DEPRECATED_API
Transform(const Matrix& matix);
#endif
META_Node(osg, Transform);
enum ReferenceFrame
@@ -104,27 +105,59 @@ class SG_EXPORT Transform : public Group
}
#ifndef USE_DEPRECATED_API
virtual const bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const
{
if (_referenceFrame==RELATIVE_TO_ABSOLUTE)
{
return false;
}
else // absolute
{
matrix.makeIdent();
return true;
}
}
virtual const bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const
{
if (_referenceFrame==RELATIVE_TO_ABSOLUTE)
{
return false;
}
else // absolute
{
matrix.makeIdent();
return true;
}
}
virtual const bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const { return false; }
#else
/** Set the transform's matrix.*/
void setMatrix(const Matrix& mat) { (*_matrix) = mat; _inverseDirty=true; computeInverse(); dirtyBound(); }
void setMatrix(const Matrix& mat) { (*_deprecated_matrix) = mat; _deprecated_inverseDirty=true; computeInverse(); dirtyBound(); }
/** Get the transform's matrix. */
inline const Matrix& getMatrix() const { return *_matrix; }
inline const Matrix& getMatrix() const { return *_deprecated_matrix; }
/** preMult transform.*/
void preMult(const Matrix& mat) { _matrix->preMult(mat); _inverseDirty=true; computeInverse(); dirtyBound(); }
void preMult(const Matrix& mat) { _deprecated_matrix->preMult(mat); _deprecated_inverseDirty=true; computeInverse(); dirtyBound(); }
/** postMult transform.*/
void postMult(const Matrix& mat) { _matrix->postMult(mat); _inverseDirty=true; computeInverse(); dirtyBound(); }
void postMult(const Matrix& mat) { _deprecated_matrix->postMult(mat); _deprecated_inverseDirty=true; computeInverse(); dirtyBound(); }
virtual const bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const
{
if (_referenceFrame==RELATIVE_TO_PARENTS)
{
matrix.preMult(*_matrix);
matrix.preMult(*_deprecated_matrix);
}
else // absolute
{
matrix = *_matrix;
matrix = *_deprecated_matrix;
}
return true;
}
@@ -133,14 +166,16 @@ class SG_EXPORT Transform : public Group
{
if (_referenceFrame==RELATIVE_TO_PARENTS)
{
matrix.postMult(*_inverse);
matrix.postMult(*_deprecated_inverse);
}
else // absolute
{
matrix = *_inverse;
matrix = *_deprecated_inverse;
}
return true;
}
#endif
protected :
@@ -152,23 +187,26 @@ class SG_EXPORT Transform : public Group
virtual const bool computeBound() const;
inline void computeInverse() const
{
if (_inverseDirty)
{
_inverse->invert(*_matrix);
_inverseDirty = false;
}
}
ref_ptr<ComputeTransformCallback> _computeTransformCallback;
ReferenceFrame _referenceFrame;
ref_ptr<Matrix> _matrix;
mutable ref_ptr<Matrix> _inverse;
mutable bool _inverseDirty;
#ifdef USE_DEPRECATED_API
inline void computeInverse() const
{
if (_deprecated_inverseDirty)
{
_deprecated_inverse->invert(*_deprecated_matrix);
_deprecated_inverseDirty = false;
}
}
ref_ptr<Matrix> _deprecated_matrix;
mutable ref_ptr<Matrix> _deprecated_inverse;
mutable bool _deprecated_inverseDirty;
#endif
};