a434abafd7
Updates to the osg::Transform, adding preMult and postMult methods and deprecating the old preRotate,preTranslate,preScale. Updated the rest of the OSG so that it nolonger uses the deprecated osg::Transform nodes. Renamed osgUtil::SceneView::setGlobalState() to osgUtil::SceneView::setGlobalStateSet() so that the name reflects its functionality better. Updated osgGLUT::Viewer etc to cope with new name change.
86 lines
2.5 KiB
Plaintext
86 lines
2.5 KiB
Plaintext
//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.
|
|
|
|
#ifndef OSG_TRANSFORM
|
|
#define OSG_TRANSFORM 1
|
|
|
|
#include <osg/Group>
|
|
#include <osg/Matrix>
|
|
|
|
namespace osg {
|
|
|
|
/** Transform - is group which all children
|
|
are transformed by the the Transform's osg::Matrix. Typical uses
|
|
of the Transform is for positioning objects within a scene or
|
|
producing trakerball functionality or for animation.
|
|
*/
|
|
class SG_EXPORT Transform : public Group
|
|
{
|
|
public :
|
|
Transform();
|
|
Transform(const Matrix& matix);
|
|
|
|
META_Node(Transform);
|
|
|
|
/** Range of type that the Transform can be.*/
|
|
enum Type
|
|
{
|
|
DYNAMIC,
|
|
STATIC
|
|
};
|
|
|
|
/** Set the Transform Type, which can be DYNAMIC - the Marix
|
|
* value is updated duing the main loop, or STATIC - the Matrix
|
|
* is constant throughut the life of the main loop. STATIC
|
|
* Transforms can be optimized away is some instances, which
|
|
* can improve performanc so unless you plan to modify the
|
|
* Matrix explicity set the Matrix to STATIC. The default
|
|
* value is DYNAMIC.*/
|
|
inline void setType(Type type) { _type = type; }
|
|
/** Get the Transform Type.*/
|
|
inline const Type getType() const { return _type; }
|
|
|
|
inline Matrix& getMatrix() { return *_matrix; }
|
|
inline const Matrix& getMatrix() const { return *_matrix; }
|
|
|
|
inline void setMatrix(const Matrix& mat )
|
|
{
|
|
(*_matrix) = mat;
|
|
dirtyBound();
|
|
}
|
|
|
|
/** preMult trasforms relative to the childrens coordinate system.*/
|
|
inline void preMult( const Matrix& mat )
|
|
{
|
|
(*_matrix) = mat * (*_matrix);
|
|
dirtyBound();
|
|
}
|
|
|
|
/** postMult trasforms relative to the parents coordinate system.*/
|
|
inline void postMult( const Matrix& mat )
|
|
{
|
|
(*_matrix) = (*_matrix) * mat;
|
|
dirtyBound();
|
|
}
|
|
|
|
#ifdef USE_DEPRECATED_MATRIX_METHODS
|
|
void preScale( const float sx, const float sy, const float sz );
|
|
void preTranslate( const float tx, const float ty, const float tz );
|
|
void preRotate( const float deg, const float x, const float y, const float z );
|
|
#endif
|
|
|
|
protected :
|
|
|
|
virtual ~Transform();
|
|
|
|
virtual const bool computeBound() const;
|
|
|
|
Type _type;
|
|
ref_ptr<Matrix> _matrix;
|
|
};
|
|
|
|
};
|
|
|
|
#endif
|