Transform
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSG_TRANSFORM
#define OSG_TRANSFORM 1
#include <osg/Group>
#include <osg/Matrix>
#ifndef GL_RESCALE_NORMAL
#define GL_RESCALE_NORMAL 0x803A
#endif
#ifndef GL_NORMALIZE
#define GL_NORMALIZE 0x0BA1
#endif
namespace osg {
extern OSG_EXPORT Matrix computeLocalToWorld(const NodePath& nodePath, bool ignoreCameras = true);
extern OSG_EXPORT Matrix computeWorldToLocal(const NodePath& nodePath, bool ignoreCameras = true);
extern OSG_EXPORT Matrix computeLocalToEye(const Matrix& modelview, const NodePath& nodePath, bool ignoreCameras = true);
extern OSG_EXPORT Matrix computeEyeToLocal(const Matrix& modelview, const NodePath& nodePath, bool ignoreCameras = true);
class OSG_EXPORT Transform : public Group
{
public :
Transform();
Transform(const Transform&,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
META_Node(osg, Transform);
virtual Transform* asTransform() { return this; }
virtual const Transform* asTransform() const { return this; }
virtual MatrixTransform* asMatrixTransform() { return 0; }
virtual const MatrixTransform* asMatrixTransform() const { return 0; }
virtual PositionAttitudeTransform* asPositionAttitudeTransform() { return 0; }
virtual const PositionAttitudeTransform* asPositionAttitudeTransform() const { return 0; }
virtual AutoTransform* asAutoTransform() { return 0; }
virtual const AutoTransform* asAutoTransform() const { return 0; }
enum ReferenceFrame
{
RELATIVE_RF,
ABSOLUTE_RF,
ABSOLUTE_RF_INHERIT_VIEWPOINT
};
void setReferenceFrame(ReferenceFrame rf);
ReferenceFrame getReferenceFrame() const { return _referenceFrame; }
virtual bool computeLocalToWorldMatrix(Matrix& matrix,NodeVisitor*) const
{
if (_referenceFrame==RELATIVE_RF)
{
return false;
}
else // absolute
{
matrix.makeIdentity();
return true;
}
}
virtual bool computeWorldToLocalMatrix(Matrix& matrix,NodeVisitor*) const
{
if (_referenceFrame==RELATIVE_RF)
{
return false;
}
else // absolute
{
matrix.makeIdentity();
return true;
}
}
virtual BoundingSphere computeBound() const;
protected :
virtual ~Transform();
ReferenceFrame _referenceFrame;
};
}
#endif
Group
Matrix
osg::AutoTransform
Definition AutoTransform:28
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::Group::Group
Group()
osg::MatrixTransform
Definition MatrixTransform:26
osg::Matrixd::makeIdentity
void makeIdentity()
osg::NodeVisitor
Definition NodeVisitor:82
osg::PositionAttitudeTransform
Definition PositionAttitudeTransform:29
osg::Transform::_referenceFrame
ReferenceFrame _referenceFrame
Definition Transform:164
osg::Transform::META_Node
META_Node(osg, Transform)
osg::Transform::Transform
Transform(const Transform &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
osg::Transform::computeWorldToLocalMatrix
virtual bool computeWorldToLocalMatrix(Matrix &matrix, NodeVisitor *) const
Definition Transform:139
osg::Transform::asAutoTransform
virtual const AutoTransform * asAutoTransform() const
Definition Transform:95
osg::Transform::asAutoTransform
virtual AutoTransform * asAutoTransform()
Definition Transform:94
osg::Transform::~Transform
virtual ~Transform()
osg::Transform::Transform
Transform()
osg::Transform::asMatrixTransform
virtual const MatrixTransform * asMatrixTransform() const
Definition Transform:89
osg::Transform::asTransform
virtual const Transform * asTransform() const
Definition Transform:86
osg::Transform::asTransform
virtual Transform * asTransform()
Definition Transform:85
osg::Transform::asPositionAttitudeTransform
virtual PositionAttitudeTransform * asPositionAttitudeTransform()
Definition Transform:91
osg::Transform::computeBound
virtual BoundingSphere computeBound() const
osg::Transform::asMatrixTransform
virtual MatrixTransform * asMatrixTransform()
Definition Transform:88
osg::Transform::getReferenceFrame
ReferenceFrame getReferenceFrame() const
Definition Transform:124
osg::Transform::computeLocalToWorldMatrix
virtual bool computeLocalToWorldMatrix(Matrix &matrix, NodeVisitor *) const
Definition Transform:126
osg::Transform::asPositionAttitudeTransform
virtual const PositionAttitudeTransform * asPositionAttitudeTransform() const
Definition Transform:92
osg::Transform::ReferenceFrame
ReferenceFrame
Definition Transform:98
osg::Transform::RELATIVE_RF
@ RELATIVE_RF
Definition Transform:99
osg::Transform::ABSOLUTE_RF_INHERIT_VIEWPOINT
@ ABSOLUTE_RF_INHERIT_VIEWPOINT
Definition Transform:101
osg::Transform::ABSOLUTE_RF
@ ABSOLUTE_RF
Definition Transform:100
osg::Transform::setReferenceFrame
void setReferenceFrame(ReferenceFrame rf)
osg
Definition AlphaFunc:19
osg::computeEyeToLocal
OSG_EXPORT Matrix computeEyeToLocal(const Matrix &modelview, const NodePath &nodePath, bool ignoreCameras=true)
osg::BoundingSphere
BoundingSphered BoundingSphere
Definition BoundingSphere:314
osg::Matrix
Matrixd Matrix
Definition Matrix:27
osg::NodePath
std::vector< Node * > NodePath
Definition Node:47
osg::computeLocalToEye
OSG_EXPORT Matrix computeLocalToEye(const Matrix &modelview, const NodePath &nodePath, bool ignoreCameras=true)
osg::computeLocalToWorld
OSG_EXPORT Matrix computeLocalToWorld(const NodePath &nodePath, bool ignoreCameras=true)
osg::computeWorldToLocal
OSG_EXPORT Matrix computeWorldToLocal(const NodePath &nodePath, bool ignoreCameras=true)
OSG_EXPORT
#define OSG_EXPORT
Definition osg/Export:39