2001-10-04 23:12:57 +08:00
|
|
|
//C++ header - Open Scene Graph - Copyright (C) 1998-2001 Robert Osfield
|
|
|
|
//Distributed under the terms of the GNU Library General Public License (LGPL)
|
|
|
|
//as published by the Free Software Foundation.
|
|
|
|
|
2001-09-20 05:19:47 +08:00
|
|
|
#ifndef OSG_TRANSFORM
|
|
|
|
#define OSG_TRANSFORM 1
|
|
|
|
|
|
|
|
#include <osg/Group>
|
|
|
|
#include <osg/Matrix>
|
|
|
|
|
|
|
|
namespace osg {
|
|
|
|
|
2002-02-06 05:54:46 +08:00
|
|
|
/** Transform - is group which all children are transformed by the the Transform's osg::Matrix.
|
|
|
|
* Typical uses
|
2001-12-29 22:27:46 +08:00
|
|
|
* of the Transform is for positioning objects within a scene or
|
|
|
|
* producing trackball functionality or for animation.
|
2002-02-06 05:54:46 +08:00
|
|
|
* The Transform node can be customized via the ComputeTransfromCallback which can be
|
|
|
|
* attached to the node, this might be used to convert internal representations of the transformation
|
|
|
|
* into generic osg::Matrix'c which are used during scene grpah traversal, such as CullTraversal and IntersectionTraversal.
|
2001-12-29 22:27:46 +08:00
|
|
|
* Note, if the transformation matrix scales the subgraph then the
|
|
|
|
* normals of the underlying geometry will need to be renormalized to
|
|
|
|
* be unit vectors once more. One can done transparently through OpenGL's
|
|
|
|
* use of either GL_NORMALIZE and GL_SCALE_NORMALIZE modes. Further
|
|
|
|
* background reading see the glNormalize documentation in the OpenGL Reference
|
|
|
|
* Guide (the blue book). To enable it in the OSG, you simple need to
|
|
|
|
* attach a local osg::StateSet to the osg::Transform, and set the appropriate
|
|
|
|
* mode to on via stateset->setMode(GL_NORMALIZE,osg::StateAttribute::ON);.
|
2001-09-20 05:19:47 +08:00
|
|
|
*/
|
|
|
|
class SG_EXPORT Transform : public Group
|
|
|
|
{
|
|
|
|
public :
|
Added support for shallow and deep copy of nodes, drawables and state, via a
copy constructor which takes an optional Cloner object, and the old
osg::Object::clone() has changed so that it now requires a Cloner as paramter.
This is passed on to the copy constructor to help control the shallow vs
deep copying. The old functionality of clone() which was clone of type has
been renamed to cloneType().
Updated all of the OSG to work with these new conventions, implemention all
the required copy constructors etc. A couple of areas will do shallow
copies by design, a couple of other still need to be updated to do either
shallow or deep.
Neither of the shallow or deep copy operations have been tested yet, only
the old functionality of the OSG has been checked so far, such running the
viewer on various demo datasets.
Also fixed a problem in osg::Optimize::RemoveRendundentNodesVisitor which
was not checking that Group didn't have have any attached StateSet's, Callbacks
or UserData. These checks have now been added, which fixes a bug which was
revealled by the new osgscribe demo, this related to removal of group acting
as state decorator.
method
2002-01-29 05:17:01 +08:00
|
|
|
|
2002-02-06 05:54:46 +08:00
|
|
|
|
2001-09-20 05:19:47 +08:00
|
|
|
Transform();
|
Added support for shallow and deep copy of nodes, drawables and state, via a
copy constructor which takes an optional Cloner object, and the old
osg::Object::clone() has changed so that it now requires a Cloner as paramter.
This is passed on to the copy constructor to help control the shallow vs
deep copying. The old functionality of clone() which was clone of type has
been renamed to cloneType().
Updated all of the OSG to work with these new conventions, implemention all
the required copy constructors etc. A couple of areas will do shallow
copies by design, a couple of other still need to be updated to do either
shallow or deep.
Neither of the shallow or deep copy operations have been tested yet, only
the old functionality of the OSG has been checked so far, such running the
viewer on various demo datasets.
Also fixed a problem in osg::Optimize::RemoveRendundentNodesVisitor which
was not checking that Group didn't have have any attached StateSet's, Callbacks
or UserData. These checks have now been added, which fixes a bug which was
revealled by the new osgscribe demo, this related to removal of group acting
as state decorator.
method
2002-01-29 05:17:01 +08:00
|
|
|
|
2002-01-29 22:04:06 +08:00
|
|
|
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
|
|
|
Transform(const Transform&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
|
Added support for shallow and deep copy of nodes, drawables and state, via a
copy constructor which takes an optional Cloner object, and the old
osg::Object::clone() has changed so that it now requires a Cloner as paramter.
This is passed on to the copy constructor to help control the shallow vs
deep copying. The old functionality of clone() which was clone of type has
been renamed to cloneType().
Updated all of the OSG to work with these new conventions, implemention all
the required copy constructors etc. A couple of areas will do shallow
copies by design, a couple of other still need to be updated to do either
shallow or deep.
Neither of the shallow or deep copy operations have been tested yet, only
the old functionality of the OSG has been checked so far, such running the
viewer on various demo datasets.
Also fixed a problem in osg::Optimize::RemoveRendundentNodesVisitor which
was not checking that Group didn't have have any attached StateSet's, Callbacks
or UserData. These checks have now been added, which fixes a bug which was
revealled by the new osgscribe demo, this related to removal of group acting
as state decorator.
method
2002-01-29 05:17:01 +08:00
|
|
|
|
2001-09-20 05:19:47 +08:00
|
|
|
Transform(const Matrix& matix);
|
|
|
|
|
2001-09-22 10:42:08 +08:00
|
|
|
META_Node(Transform);
|
2001-09-20 05:19:47 +08:00
|
|
|
|
Added DataVariance enum and set/get fields to osg::Object to help identify
which objects have values that vary over the lifetime of the object (DYNAMIC)
and ones that do not vary (STATIC). Removed the equivalent code in
osg::Transform, StateSet and StateAttribute, as these are now encompassed
by the new DataVariance field.
Removed MatrixMode enum from Matrix, and associated fields/parameters from
osg::Transfrom and osg::NodeVisitor, since MatrixMode was not providing
any useful functionality, but made the interface more complex (MatrixMode
was an experimental API)
Added ReferenceFrame field to osg::Transform which allows users to specify
transforms that are relative to their parents (the default, and previous behavior)
or absolute reference frame, which can be used for HUD's, camera relative
light sources etc etc. Note, the view frustum culling for absolute Transform
are disabled, and all their parents up to the root are also automatically
have view frustum culling disabled. However, once passed an absolute Transform
node culling will return to its default state of on, so you can still cull
underneath an absolute transform, its only the culling above which is disabled.
2002-04-12 07:20:23 +08:00
|
|
|
enum ReferenceFrame
|
2001-10-11 04:20:14 +08:00
|
|
|
{
|
Added DataVariance enum and set/get fields to osg::Object to help identify
which objects have values that vary over the lifetime of the object (DYNAMIC)
and ones that do not vary (STATIC). Removed the equivalent code in
osg::Transform, StateSet and StateAttribute, as these are now encompassed
by the new DataVariance field.
Removed MatrixMode enum from Matrix, and associated fields/parameters from
osg::Transfrom and osg::NodeVisitor, since MatrixMode was not providing
any useful functionality, but made the interface more complex (MatrixMode
was an experimental API)
Added ReferenceFrame field to osg::Transform which allows users to specify
transforms that are relative to their parents (the default, and previous behavior)
or absolute reference frame, which can be used for HUD's, camera relative
light sources etc etc. Note, the view frustum culling for absolute Transform
are disabled, and all their parents up to the root are also automatically
have view frustum culling disabled. However, once passed an absolute Transform
node culling will return to its default state of on, so you can still cull
underneath an absolute transform, its only the culling above which is disabled.
2002-04-12 07:20:23 +08:00
|
|
|
RELATIVE_TO_PARENTS,
|
2002-04-12 17:53:39 +08:00
|
|
|
RELATIVE_TO_ABSOLUTE
|
2001-10-11 04:20:14 +08:00
|
|
|
};
|
|
|
|
|
Added DataVariance enum and set/get fields to osg::Object to help identify
which objects have values that vary over the lifetime of the object (DYNAMIC)
and ones that do not vary (STATIC). Removed the equivalent code in
osg::Transform, StateSet and StateAttribute, as these are now encompassed
by the new DataVariance field.
Removed MatrixMode enum from Matrix, and associated fields/parameters from
osg::Transfrom and osg::NodeVisitor, since MatrixMode was not providing
any useful functionality, but made the interface more complex (MatrixMode
was an experimental API)
Added ReferenceFrame field to osg::Transform which allows users to specify
transforms that are relative to their parents (the default, and previous behavior)
or absolute reference frame, which can be used for HUD's, camera relative
light sources etc etc. Note, the view frustum culling for absolute Transform
are disabled, and all their parents up to the root are also automatically
have view frustum culling disabled. However, once passed an absolute Transform
node culling will return to its default state of on, so you can still cull
underneath an absolute transform, its only the culling above which is disabled.
2002-04-12 07:20:23 +08:00
|
|
|
/** Set the transform's ReferenceFrame, either to be realtive to its parent reference frame,
|
|
|
|
* or relative to an absolute coordinate frame. RELATIVE_TO_PARENTS is the default.
|
2002-04-12 17:53:39 +08:00
|
|
|
* Note, setting the RefrenceFrame to be RELATIVE_TO_ABSOLUTE will also set the CullingActive flag on the
|
Added DataVariance enum and set/get fields to osg::Object to help identify
which objects have values that vary over the lifetime of the object (DYNAMIC)
and ones that do not vary (STATIC). Removed the equivalent code in
osg::Transform, StateSet and StateAttribute, as these are now encompassed
by the new DataVariance field.
Removed MatrixMode enum from Matrix, and associated fields/parameters from
osg::Transfrom and osg::NodeVisitor, since MatrixMode was not providing
any useful functionality, but made the interface more complex (MatrixMode
was an experimental API)
Added ReferenceFrame field to osg::Transform which allows users to specify
transforms that are relative to their parents (the default, and previous behavior)
or absolute reference frame, which can be used for HUD's, camera relative
light sources etc etc. Note, the view frustum culling for absolute Transform
are disabled, and all their parents up to the root are also automatically
have view frustum culling disabled. However, once passed an absolute Transform
node culling will return to its default state of on, so you can still cull
underneath an absolute transform, its only the culling above which is disabled.
2002-04-12 07:20:23 +08:00
|
|
|
* transform, and hence all its parents, to false, therby disabling culling of it and all its
|
|
|
|
* parents. This is neccessary to prevent inappropriate culling, but may impact of cull times
|
|
|
|
* if the absolute transform is deep in the scene graph, it is therefore recommend to only use
|
|
|
|
* abolsoute Transforms at the top of the scene, for such things as headlight LightSource's or
|
|
|
|
* Head up displays.*/
|
|
|
|
void setReferenceFrame(ReferenceFrame rf);
|
2002-01-23 23:42:36 +08:00
|
|
|
|
Added DataVariance enum and set/get fields to osg::Object to help identify
which objects have values that vary over the lifetime of the object (DYNAMIC)
and ones that do not vary (STATIC). Removed the equivalent code in
osg::Transform, StateSet and StateAttribute, as these are now encompassed
by the new DataVariance field.
Removed MatrixMode enum from Matrix, and associated fields/parameters from
osg::Transfrom and osg::NodeVisitor, since MatrixMode was not providing
any useful functionality, but made the interface more complex (MatrixMode
was an experimental API)
Added ReferenceFrame field to osg::Transform which allows users to specify
transforms that are relative to their parents (the default, and previous behavior)
or absolute reference frame, which can be used for HUD's, camera relative
light sources etc etc. Note, the view frustum culling for absolute Transform
are disabled, and all their parents up to the root are also automatically
have view frustum culling disabled. However, once passed an absolute Transform
node culling will return to its default state of on, so you can still cull
underneath an absolute transform, its only the culling above which is disabled.
2002-04-12 07:20:23 +08:00
|
|
|
const ReferenceFrame getReferenceFrame() const { return _referenceFrame; }
|
2002-01-23 23:42:36 +08:00
|
|
|
|
2002-02-06 05:54:46 +08:00
|
|
|
|
Added DataVariance enum and set/get fields to osg::Object to help identify
which objects have values that vary over the lifetime of the object (DYNAMIC)
and ones that do not vary (STATIC). Removed the equivalent code in
osg::Transform, StateSet and StateAttribute, as these are now encompassed
by the new DataVariance field.
Removed MatrixMode enum from Matrix, and associated fields/parameters from
osg::Transfrom and osg::NodeVisitor, since MatrixMode was not providing
any useful functionality, but made the interface more complex (MatrixMode
was an experimental API)
Added ReferenceFrame field to osg::Transform which allows users to specify
transforms that are relative to their parents (the default, and previous behavior)
or absolute reference frame, which can be used for HUD's, camera relative
light sources etc etc. Note, the view frustum culling for absolute Transform
are disabled, and all their parents up to the root are also automatically
have view frustum culling disabled. However, once passed an absolute Transform
node culling will return to its default state of on, so you can still cull
underneath an absolute transform, its only the culling above which is disabled.
2002-04-12 07:20:23 +08:00
|
|
|
/** Callback attached to an Transform to specifiy how to compute the modelview transformation
|
2002-02-06 05:54:46 +08:00
|
|
|
* for the transform below the Transform node.*/
|
2002-02-07 09:15:15 +08:00
|
|
|
struct ComputeTransformCallback : public osg::Referenced
|
2002-01-24 06:15:39 +08:00
|
|
|
{
|
2002-02-07 09:15:15 +08:00
|
|
|
/** Get the transformation matrix which moves from local coords to world coords.*/
|
|
|
|
virtual const bool computeLocalToWorldMatrix(Matrix& matrix,const Transform* transform, NodeVisitor* nv) const = 0;
|
2001-09-20 05:19:47 +08:00
|
|
|
|
2002-02-07 09:15:15 +08:00
|
|
|
/** Get the transformation matrix which moves from world coords to local coords.*/
|
|
|
|
virtual const bool computeWorldToLocalMatrix(Matrix& matrix,const Transform* transform, NodeVisitor* nv) const = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
friend struct osg::Transform::ComputeTransformCallback;
|
2002-02-06 05:54:46 +08:00
|
|
|
|
|
|
|
/** Set the ComputerTransfromCallback which allows users to attach custom computation of the local transformation as
|
|
|
|
* seen by cull traversers and alike.*/
|
2002-02-07 09:15:15 +08:00
|
|
|
void setComputeTransformCallback(ComputeTransformCallback* ctc) { _computeTransformCallback=ctc; dirtyBound(); }
|
2002-01-24 06:15:39 +08:00
|
|
|
|
2002-02-06 05:54:46 +08:00
|
|
|
/** Get the non const ComputerTransfromCallback.*/
|
|
|
|
ComputeTransformCallback* getComputeTransformCallback() { return _computeTransformCallback.get(); }
|
2002-01-24 06:15:39 +08:00
|
|
|
|
2002-02-06 05:54:46 +08:00
|
|
|
/** Get the const ComputerTransfromCallback.*/
|
|
|
|
const ComputeTransformCallback* getComputeTransformCallback() const { return _computeTransformCallback.get(); }
|
2002-01-23 23:42:36 +08:00
|
|
|
|
|
|
|
|
2001-11-14 22:09:07 +08:00
|
|
|
|
2002-02-06 05:54:46 +08:00
|
|
|
/** Get the transformation matrix which moves from local coords to world coords.
|
|
|
|
* Return true if Matrix passed in has been modified and */
|
|
|
|
inline const bool getLocalToWorldMatrix(Matrix& matrix,NodeVisitor* nv) const
|
|
|
|
{
|
|
|
|
if (_computeTransformCallback.valid())
|
|
|
|
return _computeTransformCallback->computeLocalToWorldMatrix(matrix,this,nv);
|
|
|
|
else
|
|
|
|
return computeLocalToWorldMatrix(matrix,nv);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** Get the transformation matrix which moves from world coords to local coords.
|
|
|
|
* Return true if Matrix passed in has been modified and */
|
|
|
|
inline const bool getWorldToLocalMatrix(Matrix& matrix,NodeVisitor* nv) const
|
|
|
|
{
|
|
|
|
if (_computeTransformCallback.valid())
|
|
|
|
return _computeTransformCallback->computeWorldToLocalMatrix(matrix,this,nv);
|
|
|
|
else
|
|
|
|
return computeWorldToLocalMatrix(matrix,nv);
|
|
|
|
}
|
2002-01-24 06:15:39 +08:00
|
|
|
|
2002-01-23 23:42:36 +08:00
|
|
|
|
2002-01-24 06:15:39 +08:00
|
|
|
/** Set the transform's matrix.*/
|
2002-02-28 08:11:31 +08:00
|
|
|
void setMatrix(const Matrix& mat) { (*_matrix) = mat; _inverseDirty=true; computeInverse(); dirtyBound(); }
|
2002-01-24 06:15:39 +08:00
|
|
|
|
|
|
|
/** Get the transform's matrix. */
|
2002-02-06 05:54:46 +08:00
|
|
|
inline const Matrix& getMatrix() const { return *_matrix; }
|
2002-01-23 23:42:36 +08:00
|
|
|
|
2002-01-24 06:15:39 +08:00
|
|
|
/** preMult transform.*/
|
2002-02-28 08:11:31 +08:00
|
|
|
void preMult(const Matrix& mat) { _matrix->preMult(mat); _inverseDirty=true; computeInverse(); dirtyBound(); }
|
2002-01-24 06:15:39 +08:00
|
|
|
|
|
|
|
/** postMult transform.*/
|
2002-02-28 08:11:31 +08:00
|
|
|
void postMult(const Matrix& mat) { _matrix->postMult(mat); _inverseDirty=true; computeInverse(); dirtyBound(); }
|
2001-09-20 05:19:47 +08:00
|
|
|
|
2002-01-24 06:15:39 +08:00
|
|
|
|
2001-09-20 05:19:47 +08:00
|
|
|
protected :
|
|
|
|
|
|
|
|
virtual ~Transform();
|
|
|
|
|
2002-01-23 23:42:36 +08:00
|
|
|
/** Override's Group's computeBound.
|
|
|
|
* There is no need to override in subclasses from osg::Transform since this computeBound() uses
|
|
|
|
* the underlying matrix (calling computeMatrix if required.) */
|
2001-09-20 05:19:47 +08:00
|
|
|
virtual const bool computeBound() const;
|
2002-01-23 23:42:36 +08:00
|
|
|
|
2002-02-07 09:15:15 +08:00
|
|
|
virtual const bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const
|
2002-02-06 05:54:46 +08:00
|
|
|
{
|
Added DataVariance enum and set/get fields to osg::Object to help identify
which objects have values that vary over the lifetime of the object (DYNAMIC)
and ones that do not vary (STATIC). Removed the equivalent code in
osg::Transform, StateSet and StateAttribute, as these are now encompassed
by the new DataVariance field.
Removed MatrixMode enum from Matrix, and associated fields/parameters from
osg::Transfrom and osg::NodeVisitor, since MatrixMode was not providing
any useful functionality, but made the interface more complex (MatrixMode
was an experimental API)
Added ReferenceFrame field to osg::Transform which allows users to specify
transforms that are relative to their parents (the default, and previous behavior)
or absolute reference frame, which can be used for HUD's, camera relative
light sources etc etc. Note, the view frustum culling for absolute Transform
are disabled, and all their parents up to the root are also automatically
have view frustum culling disabled. However, once passed an absolute Transform
node culling will return to its default state of on, so you can still cull
underneath an absolute transform, its only the culling above which is disabled.
2002-04-12 07:20:23 +08:00
|
|
|
if (_referenceFrame==RELATIVE_TO_PARENTS)
|
2002-02-12 16:23:07 +08:00
|
|
|
{
|
Added DataVariance enum and set/get fields to osg::Object to help identify
which objects have values that vary over the lifetime of the object (DYNAMIC)
and ones that do not vary (STATIC). Removed the equivalent code in
osg::Transform, StateSet and StateAttribute, as these are now encompassed
by the new DataVariance field.
Removed MatrixMode enum from Matrix, and associated fields/parameters from
osg::Transfrom and osg::NodeVisitor, since MatrixMode was not providing
any useful functionality, but made the interface more complex (MatrixMode
was an experimental API)
Added ReferenceFrame field to osg::Transform which allows users to specify
transforms that are relative to their parents (the default, and previous behavior)
or absolute reference frame, which can be used for HUD's, camera relative
light sources etc etc. Note, the view frustum culling for absolute Transform
are disabled, and all their parents up to the root are also automatically
have view frustum culling disabled. However, once passed an absolute Transform
node culling will return to its default state of on, so you can still cull
underneath an absolute transform, its only the culling above which is disabled.
2002-04-12 07:20:23 +08:00
|
|
|
matrix.preMult(*_matrix);
|
2002-02-12 16:23:07 +08:00
|
|
|
}
|
Added DataVariance enum and set/get fields to osg::Object to help identify
which objects have values that vary over the lifetime of the object (DYNAMIC)
and ones that do not vary (STATIC). Removed the equivalent code in
osg::Transform, StateSet and StateAttribute, as these are now encompassed
by the new DataVariance field.
Removed MatrixMode enum from Matrix, and associated fields/parameters from
osg::Transfrom and osg::NodeVisitor, since MatrixMode was not providing
any useful functionality, but made the interface more complex (MatrixMode
was an experimental API)
Added ReferenceFrame field to osg::Transform which allows users to specify
transforms that are relative to their parents (the default, and previous behavior)
or absolute reference frame, which can be used for HUD's, camera relative
light sources etc etc. Note, the view frustum culling for absolute Transform
are disabled, and all their parents up to the root are also automatically
have view frustum culling disabled. However, once passed an absolute Transform
node culling will return to its default state of on, so you can still cull
underneath an absolute transform, its only the culling above which is disabled.
2002-04-12 07:20:23 +08:00
|
|
|
else // absolute
|
2002-02-12 16:23:07 +08:00
|
|
|
{
|
|
|
|
matrix = *_matrix;
|
|
|
|
}
|
Added DataVariance enum and set/get fields to osg::Object to help identify
which objects have values that vary over the lifetime of the object (DYNAMIC)
and ones that do not vary (STATIC). Removed the equivalent code in
osg::Transform, StateSet and StateAttribute, as these are now encompassed
by the new DataVariance field.
Removed MatrixMode enum from Matrix, and associated fields/parameters from
osg::Transfrom and osg::NodeVisitor, since MatrixMode was not providing
any useful functionality, but made the interface more complex (MatrixMode
was an experimental API)
Added ReferenceFrame field to osg::Transform which allows users to specify
transforms that are relative to their parents (the default, and previous behavior)
or absolute reference frame, which can be used for HUD's, camera relative
light sources etc etc. Note, the view frustum culling for absolute Transform
are disabled, and all their parents up to the root are also automatically
have view frustum culling disabled. However, once passed an absolute Transform
node culling will return to its default state of on, so you can still cull
underneath an absolute transform, its only the culling above which is disabled.
2002-04-12 07:20:23 +08:00
|
|
|
return true;
|
2002-02-06 05:54:46 +08:00
|
|
|
}
|
2002-01-23 23:42:36 +08:00
|
|
|
|
2002-02-07 09:15:15 +08:00
|
|
|
virtual const bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const
|
2002-02-06 05:54:46 +08:00
|
|
|
{
|
Added DataVariance enum and set/get fields to osg::Object to help identify
which objects have values that vary over the lifetime of the object (DYNAMIC)
and ones that do not vary (STATIC). Removed the equivalent code in
osg::Transform, StateSet and StateAttribute, as these are now encompassed
by the new DataVariance field.
Removed MatrixMode enum from Matrix, and associated fields/parameters from
osg::Transfrom and osg::NodeVisitor, since MatrixMode was not providing
any useful functionality, but made the interface more complex (MatrixMode
was an experimental API)
Added ReferenceFrame field to osg::Transform which allows users to specify
transforms that are relative to their parents (the default, and previous behavior)
or absolute reference frame, which can be used for HUD's, camera relative
light sources etc etc. Note, the view frustum culling for absolute Transform
are disabled, and all their parents up to the root are also automatically
have view frustum culling disabled. However, once passed an absolute Transform
node culling will return to its default state of on, so you can still cull
underneath an absolute transform, its only the culling above which is disabled.
2002-04-12 07:20:23 +08:00
|
|
|
if (_referenceFrame==RELATIVE_TO_PARENTS)
|
2002-02-12 16:23:07 +08:00
|
|
|
{
|
Added DataVariance enum and set/get fields to osg::Object to help identify
which objects have values that vary over the lifetime of the object (DYNAMIC)
and ones that do not vary (STATIC). Removed the equivalent code in
osg::Transform, StateSet and StateAttribute, as these are now encompassed
by the new DataVariance field.
Removed MatrixMode enum from Matrix, and associated fields/parameters from
osg::Transfrom and osg::NodeVisitor, since MatrixMode was not providing
any useful functionality, but made the interface more complex (MatrixMode
was an experimental API)
Added ReferenceFrame field to osg::Transform which allows users to specify
transforms that are relative to their parents (the default, and previous behavior)
or absolute reference frame, which can be used for HUD's, camera relative
light sources etc etc. Note, the view frustum culling for absolute Transform
are disabled, and all their parents up to the root are also automatically
have view frustum culling disabled. However, once passed an absolute Transform
node culling will return to its default state of on, so you can still cull
underneath an absolute transform, its only the culling above which is disabled.
2002-04-12 07:20:23 +08:00
|
|
|
matrix.postMult(*_inverse);
|
2002-02-12 16:23:07 +08:00
|
|
|
}
|
Added DataVariance enum and set/get fields to osg::Object to help identify
which objects have values that vary over the lifetime of the object (DYNAMIC)
and ones that do not vary (STATIC). Removed the equivalent code in
osg::Transform, StateSet and StateAttribute, as these are now encompassed
by the new DataVariance field.
Removed MatrixMode enum from Matrix, and associated fields/parameters from
osg::Transfrom and osg::NodeVisitor, since MatrixMode was not providing
any useful functionality, but made the interface more complex (MatrixMode
was an experimental API)
Added ReferenceFrame field to osg::Transform which allows users to specify
transforms that are relative to their parents (the default, and previous behavior)
or absolute reference frame, which can be used for HUD's, camera relative
light sources etc etc. Note, the view frustum culling for absolute Transform
are disabled, and all their parents up to the root are also automatically
have view frustum culling disabled. However, once passed an absolute Transform
node culling will return to its default state of on, so you can still cull
underneath an absolute transform, its only the culling above which is disabled.
2002-04-12 07:20:23 +08:00
|
|
|
else // absolute
|
2002-02-12 16:23:07 +08:00
|
|
|
{
|
|
|
|
matrix = *_inverse;
|
|
|
|
}
|
Added DataVariance enum and set/get fields to osg::Object to help identify
which objects have values that vary over the lifetime of the object (DYNAMIC)
and ones that do not vary (STATIC). Removed the equivalent code in
osg::Transform, StateSet and StateAttribute, as these are now encompassed
by the new DataVariance field.
Removed MatrixMode enum from Matrix, and associated fields/parameters from
osg::Transfrom and osg::NodeVisitor, since MatrixMode was not providing
any useful functionality, but made the interface more complex (MatrixMode
was an experimental API)
Added ReferenceFrame field to osg::Transform which allows users to specify
transforms that are relative to their parents (the default, and previous behavior)
or absolute reference frame, which can be used for HUD's, camera relative
light sources etc etc. Note, the view frustum culling for absolute Transform
are disabled, and all their parents up to the root are also automatically
have view frustum culling disabled. However, once passed an absolute Transform
node culling will return to its default state of on, so you can still cull
underneath an absolute transform, its only the culling above which is disabled.
2002-04-12 07:20:23 +08:00
|
|
|
return true;
|
2002-02-12 16:23:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void computeInverse() const
|
|
|
|
{
|
|
|
|
if (_inverseDirty)
|
|
|
|
{
|
|
|
|
_inverse->invert(*_matrix);
|
|
|
|
_inverseDirty = false;
|
|
|
|
}
|
2002-02-06 05:54:46 +08:00
|
|
|
}
|
2001-09-20 05:19:47 +08:00
|
|
|
|
2002-02-06 05:54:46 +08:00
|
|
|
|
Added DataVariance enum and set/get fields to osg::Object to help identify
which objects have values that vary over the lifetime of the object (DYNAMIC)
and ones that do not vary (STATIC). Removed the equivalent code in
osg::Transform, StateSet and StateAttribute, as these are now encompassed
by the new DataVariance field.
Removed MatrixMode enum from Matrix, and associated fields/parameters from
osg::Transfrom and osg::NodeVisitor, since MatrixMode was not providing
any useful functionality, but made the interface more complex (MatrixMode
was an experimental API)
Added ReferenceFrame field to osg::Transform which allows users to specify
transforms that are relative to their parents (the default, and previous behavior)
or absolute reference frame, which can be used for HUD's, camera relative
light sources etc etc. Note, the view frustum culling for absolute Transform
are disabled, and all their parents up to the root are also automatically
have view frustum culling disabled. However, once passed an absolute Transform
node culling will return to its default state of on, so you can still cull
underneath an absolute transform, its only the culling above which is disabled.
2002-04-12 07:20:23 +08:00
|
|
|
|
2002-02-06 05:54:46 +08:00
|
|
|
ref_ptr<ComputeTransformCallback> _computeTransformCallback;
|
|
|
|
|
Added DataVariance enum and set/get fields to osg::Object to help identify
which objects have values that vary over the lifetime of the object (DYNAMIC)
and ones that do not vary (STATIC). Removed the equivalent code in
osg::Transform, StateSet and StateAttribute, as these are now encompassed
by the new DataVariance field.
Removed MatrixMode enum from Matrix, and associated fields/parameters from
osg::Transfrom and osg::NodeVisitor, since MatrixMode was not providing
any useful functionality, but made the interface more complex (MatrixMode
was an experimental API)
Added ReferenceFrame field to osg::Transform which allows users to specify
transforms that are relative to their parents (the default, and previous behavior)
or absolute reference frame, which can be used for HUD's, camera relative
light sources etc etc. Note, the view frustum culling for absolute Transform
are disabled, and all their parents up to the root are also automatically
have view frustum culling disabled. However, once passed an absolute Transform
node culling will return to its default state of on, so you can still cull
underneath an absolute transform, its only the culling above which is disabled.
2002-04-12 07:20:23 +08:00
|
|
|
ReferenceFrame _referenceFrame;
|
2002-02-06 05:54:46 +08:00
|
|
|
ref_ptr<Matrix> _matrix;
|
2002-02-12 16:23:07 +08:00
|
|
|
mutable ref_ptr<Matrix> _inverse;
|
|
|
|
mutable bool _inverseDirty;
|
2002-02-06 05:54:46 +08:00
|
|
|
|
2001-09-20 05:19:47 +08:00
|
|
|
};
|
|
|
|
|
2002-02-03 20:33:41 +08:00
|
|
|
}
|
2001-09-20 05:19:47 +08:00
|
|
|
|
|
|
|
#endif
|