afTransform.h
资源名称:AirForce.rar [点击查看]
上传用户:kaiguan
上传日期:2007-10-28
资源大小:1074k
文件大小:1k
源码类别:
其他游戏
开发平台:
Visual C++
- #ifndef AF_TRANSFORM
- #define AF_TRANSFORM
- #include "afVec3.h"
- #include "afQuat.h"
- //#include <D3d8types.h>
- class afTransform
- {
- public:
- afTransform() { pos.x=pos.y=pos.z=0.0f; scale.x=scale.y=scale.z=1.0f; dirty=true; }
- /***** combine Transforms ... Caution!!! Quaternion-Combination not commutative ******/
- afTransform& operator*=(const afTransform& t); //result= Objekt * t
- afTransform& operator>=(const afTransform& t); //result= t * Objekt
- afTransform& operator= (const afTransform& t);
- void setPosition (const afVec3& nPos) {pos = nPos; dirty=true;}
- void setScale (const afVec3& nScale) {scale = nScale; dirty=true;}
- void setRotation (const afQuat& nRot) {rot = nRot; dirty=true;}
- void move (const afVec3& move) {pos+=move; dirty=true;}
- void scalef (const afVec3& scalefactor) {scale*=scalefactor; dirty=true;}
- void rotate (const afQuat& drot) {rot*=drot; dirty=true;}
- void rotate (const afVec3& drot) {afQuat quat(drot); rotate(quat); dirty=true;}
- const afVec3& getPosition() const { return pos; }
- const afVec3& getScale () const { return scale;}
- const afQuat& getRotation() const { return rot; }
- void updateMatrix();
- const afMatrix& getMatrix();
- //bool isDirty() { return dirty; }
- protected:
- afVec3 pos, scale;
- afQuat rot;
- afMatrix matrix;
- bool dirty;
- };
- #endif