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