|
Blender
V2.59
|
00001 /* 00002 * $Id: MT_CmMatrix4x4.h 35158 2011-02-25 11:49:19Z jesterking $ 00003 * ***** BEGIN GPL LICENSE BLOCK ***** 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software Foundation, 00017 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 * 00019 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00020 * All rights reserved. 00021 * 00022 * The Original Code is: all of this file. 00023 * 00024 * Contributor(s): none yet. 00025 * 00026 * ***** END GPL LICENSE BLOCK ***** 00027 */ 00028 00034 #ifndef INCLUDED_MT_CmMatrix4x4 00035 #define INCLUDED_MT_CmMatrix4x4 00036 00048 #include "MT_Scalar.h" 00049 00050 class MT_Point3; 00051 class MT_Vector3; 00052 00053 class MT_CmMatrix4x4 00054 { 00055 00056 public : 00057 00058 MT_CmMatrix4x4( 00059 const float value[4][4] 00060 ); 00061 00062 MT_CmMatrix4x4( 00063 ); 00064 00065 00066 MT_CmMatrix4x4( 00067 const double value[16] 00068 ); 00069 00070 MT_CmMatrix4x4( 00071 const MT_CmMatrix4x4 & other 00072 ); 00073 00074 MT_CmMatrix4x4( 00075 const MT_Point3& orig, 00076 const MT_Vector3& dir, 00077 const MT_Vector3 up 00078 ); 00079 00080 void 00081 Identity( 00082 ); 00083 00084 void 00085 SetMatrix( 00086 const MT_CmMatrix4x4 & other 00087 ); 00088 00089 double* 00090 getPointer( 00091 ); 00092 00093 const 00094 double* 00095 getPointer( 00096 ) const; 00097 00098 void 00099 setElem( 00100 int pos, 00101 double newvalue 00102 ); 00103 00104 MT_Vector3 00105 GetRight( 00106 ) const; 00107 00108 MT_Vector3 00109 GetUp( 00110 ) const; 00111 00112 MT_Vector3 00113 GetDir( 00114 ) const; 00115 00116 MT_Point3 00117 GetPos( 00118 ) const; 00119 00120 void 00121 SetPos( 00122 const MT_Vector3 & v 00123 ); 00124 00125 double& 00126 operator ( 00127 ) (int row,int col) { return m_V[col][row]; } 00128 00129 static 00130 MT_CmMatrix4x4 00131 Perspective( 00132 MT_Scalar inLeft, 00133 MT_Scalar inRight, 00134 MT_Scalar inBottom, 00135 MT_Scalar inTop, 00136 MT_Scalar inNear, 00137 MT_Scalar inFar 00138 ); 00139 00140 protected: 00141 union 00142 { 00143 double m_V[4][4]; 00144 double m_Vflat[16]; 00145 }; 00146 }; 00147 00148 #endif //MT_CmMatrix4x4 00149