Transform.h

Go to the documentation of this file.
00001 /* $Id: Transform.h,v 1.6 2002/11/20 15:22:15 cvs Exp $ */
00002 
00003 #ifndef __TRANSFORM_H
00004 #define __TRANSFORM_H
00005 
00006 #include <esg/Definitions.h>
00007 #include <esg/ESGObject.h>
00008 
00009 namespace esg {
00010 
00021 class OGSCENE_EXPORT Transform : public ESGObject {
00022 protected:
00023         Matrix4 _mat;    
00024         Matrix3 _rotMat; 
00025         Vector3 _trVec;  
00026         Vector3 _scVec;  
00027         bool    _haveAbbrev;
00028     
00029         virtual void _duplicate_attributes (const Transform&);
00030 
00031 public:
00035         Transform () : _haveAbbrev(false) { _mat.setIdentity(); }
00036 
00040         Transform (const Matrix4& src) : _mat(src), _haveAbbrev(false) {}
00041 
00045         virtual ~Transform () {}
00046 
00052         virtual Transform* clone (void) const;
00053 
00059         void rotateX (float a);
00060 
00066         void rotateY (float a);
00067 
00073         void rotateZ (float a);
00074 
00081         void rotate (float a, const Vector3& axis);
00082 
00090         void translate (float x, float y, float z);
00091         
00097         void scale (float s);
00098 
00106         void scale (float sx, float sy, float sz);
00107 
00113         void scale (const Vector3& s);
00114 
00120         void transform (const Matrix4& mat);
00121 
00125         void setIdentity (void);
00126 
00130         Matrix4& get (void) { return _mat; }
00131 
00135         const Matrix4& get (void) const { return _mat; }
00136 
00140         const Matrix3* getRotation (void) {
00141             if (!_haveAbbrev) {
00142                 _mat.get(_rotMat, _trVec, _scVec);
00143                 _haveAbbrev = true;
00144             }
00145             return &_rotMat;
00146         }
00147 
00151         const Vector3* getTranslation (void) {
00152             if (!_haveAbbrev) {
00153                 _mat.get(_rotMat, _trVec, _scVec);
00154                 _haveAbbrev = true;
00155             }
00156             return &_trVec;
00157         }
00158 
00162         const Vector3* getScale (void) {
00163             if (!_haveAbbrev) {
00164                 _mat.get(_rotMat, _trVec, _scVec);
00165                 _haveAbbrev = true;
00166             }
00167             return &_scVec;
00168         }
00169 };
00170 
00171 }; // namespace
00172 
00173 #endif // __TRANSFORM_H

Generated on Wed Jun 28 12:24:29 2006 for esg by  doxygen 1.4.6