Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members
E:/Programming/MyProject/K_Game_hg/GameEngine/include/core/Matrix4.h
Go to the documentation of this file.
00001 // Copyright 2006-2011 by Kat'Oun
00002 
00003 #ifndef _MATRIX4_H_
00004 #define _MATRIX4_H_
00005 
00006 #include <EngineConfig.h>
00007 #include <core/Types.h>
00008 
00009 namespace core
00010 {
00011 
00012 class vector3d;
00013 class vector4d;
00014 class plane3d;
00015 class aabox3d;
00016 
00021 
00026 class ENGINE_PUBLIC_EXPORT matrix4
00027 {
00028 public:
00029 
00030         matrix4();
00031 
00032         matrix4(f32 m00, f32 m01, f32 m02, f32 m03, f32 m10, f32 m11, f32 m12, f32 m13,
00033                         f32 m20, f32 m21, f32 m22, f32 m23, f32 m30, f32 m31, f32 m32, f32 m33);
00034 
00036         matrix4& operator=(const matrix4 &other);
00037         
00039         f32& operator()(s32 row, s32 col);
00040 
00042         const f32& operator()(s32 row, s32 col) const;
00043 
00045         f32& operator[](u32 index);
00046 
00048         const f32& operator[](u32 index) const;
00049 
00051         bool operator==(const matrix4 &other) const;
00052 
00054         bool operator!=(const matrix4 &other) const;
00055 
00057         matrix4& operator*=(const matrix4& other);
00058 
00060         matrix4 operator*(const matrix4& other) const;
00061 
00063         matrix4& operator+=(const matrix4& other);
00064 
00066         matrix4 operator+(const matrix4& other) const;
00067 
00069         matrix4& operator-=(const matrix4& other);
00070 
00072         matrix4 operator-(const matrix4& other) const;
00073 
00074         matrix4 operator- () const;
00075 
00076         void set(f32 m00, f32 m01, f32 m02, f32 m03, f32 m10, f32 m11, f32 m12, f32 m13,
00077                 f32 m20, f32 m21, f32 m22, f32 m23, f32 m30, f32 m31, f32 m32, f32 m33);
00078         void set(const matrix4& other);
00079 
00080         f32* get();
00081         const f32* get() const;
00082 
00084         void makeIdentity();
00085 
00087         bool isIdentity();
00088 
00090         bool hasInverse();
00091 
00093         matrix4 getInverse() const;
00094 
00096         matrix4 getTransposed() const;
00097 
00099         void setTranslation(const vector3d& translation);
00100 
00102         vector3d getTranslation() const;
00103 
00105         void setInverseTranslation(const vector3d& translation);
00106 
00108         void setRotationRadians(const vector3d& rotation);
00109 
00111         void setRotationDegrees(const vector3d& rotation);
00112 
00114         vector3d getRotationDegrees() const;
00115 
00117         void setInverseRotationRadians(const vector3d& rotation);
00118 
00120         void setInverseRotationDegrees(const vector3d& rotation);
00121 
00123         void setScale(const vector3d& scale);
00124 
00126         vector3d getScale() const;
00127 
00129         void translateVector(vector3d& vect) const;
00130 
00132         void inverseTranslateVector(vector3d& vect) const;
00133 
00135         void rotateVector(vector3d& vect) const;
00136 
00138         void inverseRotateVect(vector3d& vect) const;
00139 
00141         void transformVector(vector3d& vect) const;
00142 
00144         void transformVector(const vector3d& in, vector3d& out) const;
00145 
00147         void transformVector(vector4d& vect) const;
00148 
00150         void transformVector(const vector4d& in, vector4d& out) const;
00151 
00153         void transformPlane(plane3d &plane) const;
00154 
00156         void transformPlane(const plane3d &in, plane3d &out) const;
00157 
00159         void transformBox(aabox3d& box) const;
00160 
00162         void buildProjectionMatrixInfinitePerspectiveFov(f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear);
00163         
00165         void buildProjectionMatrixPerspectiveFov(f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 zFar);
00166         
00168         void buildProjectionMatrixPerspective(f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar);
00169 
00171         void buildProjectionMatrixOrtho(f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar);
00172 
00174         void buildProjectionMatrixOrtho(f32 left, f32 right, f32 bottom, f32 top, f32 zNear, f32 zFar);
00175 
00177         void buildViewMatrix(const vector3d& position, const vector3d& target, const vector3d& upVector);
00178 
00184         void buildShadowMatrix(vector3d light, plane3d plane, f32 point = 1.0f);
00185 
00186         static const matrix4 ZERO;
00187 
00188         static const matrix4 IDENTITY;
00189 
00190 private:
00191 
00192         static float empty;
00193 
00195         f32 M[16];
00196 };
00197 
00198 } // end namespace core
00199 
00200 #endif

The KG Game Engine
The KG Game Engine Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:04 by Doxygen (1.7.4)