00001 #ifndef _TRANSFORM_H_ 00002 #define _TRANSFORM_H_ 00003 00004 #include "cglib/matrix4x4.h" 00005 00007 struct Transform 00008 { 00009 public: 00010 Matrix4x4 m; 00011 Matrix4x4 mi; 00012 Matrix4x4 mit; 00013 00015 Transform(); 00016 00018 Transform(const Matrix4x4 &_m, const Matrix4x4 &_mi); 00019 00021 Transform(const Matrix4x4 &_m, const Matrix4x4 &_mi, const Matrix4x4 &_mit); 00022 00024 Transform operator*(const Transform &other) const; 00025 00027 Transform &operator*=(const Transform &otherz); 00028 00030 bool is_near(const Transform &other, float threshold=0.0001f); 00031 00033 static Transform identity(); 00034 00036 static Transform translate(float x, float y, float z); 00037 00039 static Transform translate_x(float x); 00040 00042 static Transform translate_y(float y); 00043 00045 static Transform translate_z(float z); 00046 00048 static Transform scale(float x, float y, float z); 00049 00051 static Transform scale(float s); 00052 00054 static Transform scale_x(float x); 00055 00057 static Transform scale_y(float y); 00058 00060 static Transform scale_z(float z); 00061 00063 static Transform rotate(float degrees, Vector3 axis); 00064 00066 static Transform rotate_x(float degrees); 00067 00069 static Transform rotate_y(float degrees); 00070 00072 static Transform rotate_z(float degrees); 00073 }; 00074 00075 00076 #endif /* _TRANSFORM_H_ */