00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "CMatrix44.h"
00014 #include <math.h>
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 CMatrix44::CMatrix44(const float &f)
00032 {
00033 _11 = _12 = _13 = _14 =
00034 _21 = _22 = _23 = _24 =
00035 _31 = _31 = _33 = _34 =
00036 _41 = _42 = _43 = _44 = f;
00037 }
00038
00039 CMatrix44::CMatrix44(const float &f11, const float &f12, const float &f13, const float &f14,
00040 const float &f21, const float &f22, const float &f23, const float &f24,
00041 const float &f31, const float &f32, const float &f33, const float &f34,
00042 const float &f41, const float &f42, const float &f43, const float &f44)
00043 {
00044 _11 = f11; _12 = f12; _13 = f13; _14 = f14;
00045 _21 = f21; _22 = f22; _23 = f23; _24 = f24;
00046 _31 = f31; _32 = f32; _33 = f33; _34 = f34;
00047 _41 = f41; _42 = f42; _43 = f43; _44 = f44;
00048 }
00049
00050 CMatrix44::CMatrix44(const CMatrix44 &other)
00051 {
00052 _11 = other._11; _12 = other._12; _13 = other._13; _14 = other._14;
00053 _21 = other._21; _22 = other._22; _23 = other._23; _24 = other._24;
00054 _31 = other._31; _32 = other._32; _33 = other._33; _34 = other._34;
00055 _41 = other._41; _42 = other._42; _43 = other._43; _44 = other._44;
00056 }
00057
00058 const CMatrix44 &CMatrix44::operator=(const CMatrix44 &other)
00059 {
00060 _11 = other._11; _12 = other._12; _13 = other._13; _14 = other._14;
00061 _21 = other._21; _22 = other._22; _23 = other._23; _24 = other._24;
00062 _31 = other._31; _32 = other._32; _33 = other._33; _34 = other._34;
00063 _41 = other._41; _42 = other._42; _43 = other._43; _44 = other._44;
00064
00065 return *this;
00066 }
00067
00068
00069 const CMatrix44 CMatrix44::operator*(const CMatrix44 &other) const
00070 {
00071 return CMatrix44(_11 * other._11 + _12 * other._21 + _13 * other._31 + _14 * other._41,
00072 _11 * other._12 + _12 * other._22 + _13 * other._32 + _14 * other._42,
00073 _11 * other._13 + _12 * other._23 + _13 * other._33 + _14 * other._43,
00074 _11 * other._14 + _12 * other._24 + _13 * other._34 + _14 * other._44,
00075
00076 _21 * other._11 + _22 * other._21 + _23 * other._31 + _24 * other._41,
00077 _21 * other._12 + _22 * other._22 + _23 * other._32 + _24 * other._42,
00078 _21 * other._13 + _22 * other._23 + _23 * other._33 + _24 * other._43,
00079 _21 * other._14 + _22 * other._24 + _23 * other._34 + _24 * other._44,
00080
00081 _31 * other._11 + _32 * other._21 + _33 * other._31 + _34 * other._41,
00082 _31 * other._12 + _32 * other._22 + _33 * other._32 + _34 * other._42,
00083 _31 * other._13 + _32 * other._23 + _33 * other._33 + _34 * other._43,
00084 _31 * other._14 + _32 * other._24 + _33 * other._34 + _34 * other._44,
00085
00086 _41 * other._11 + _42 * other._21 + _43 * other._31 + _44 * other._41,
00087 _41 * other._12 + _42 * other._22 + _43 * other._32 + _44 * other._42,
00088 _41 * other._13 + _42 * other._23 + _43 * other._33 + _44 * other._43,
00089 _41 * other._14 + _42 * other._24 + _43 * other._34 + _44 * other._44);
00090 }
00091
00092 const CMatrix44 &CMatrix44::operator*=(const CMatrix44 &other)
00093 {
00094 Set(_11 * other._11 + _12 * other._21 + _13 * other._31 + _14 * other._41,
00095 _11 * other._12 + _12 * other._22 + _13 * other._32 + _14 * other._42,
00096 _11 * other._13 + _12 * other._23 + _13 * other._33 + _14 * other._43,
00097 _11 * other._14 + _12 * other._24 + _13 * other._34 + _14 * other._44,
00098
00099 _21 * other._11 + _22 * other._21 + _23 * other._31 + _24 * other._41,
00100 _21 * other._12 + _22 * other._22 + _23 * other._32 + _24 * other._42,
00101 _21 * other._13 + _22 * other._23 + _23 * other._33 + _24 * other._43,
00102 _21 * other._14 + _22 * other._24 + _23 * other._34 + _24 * other._44,
00103
00104 _31 * other._11 + _32 * other._21 + _33 * other._31 + _34 * other._41,
00105 _31 * other._12 + _32 * other._22 + _33 * other._32 + _34 * other._42,
00106 _31 * other._13 + _32 * other._23 + _33 * other._33 + _34 * other._43,
00107 _31 * other._14 + _32 * other._24 + _33 * other._34 + _34 * other._44,
00108
00109 _41 * other._11 + _42 * other._21 + _43 * other._31 + _44 * other._41,
00110 _41 * other._12 + _42 * other._22 + _43 * other._32 + _44 * other._42,
00111 _41 * other._13 + _42 * other._23 + _43 * other._33 + _44 * other._43,
00112 _41 * other._14 + _42 * other._24 + _43 * other._34 + _44 * other._44);
00113
00114 return *this;
00115 }
00116
00117 const CVector3f CMatrix44::operator*(const CVector3f &v) const
00118 {
00119
00120 return CVector3f(_11 * v.m_X + _12 * v.m_Y + _13 * v.m_Z + _14,
00121 _21 * v.m_X + _22 * v.m_Y + _23 * v.m_Z + _24,
00122 _31 * v.m_X + _32 * v.m_Y + _33 * v.m_Z + _34);
00123 }
00124
00125 bool CMatrix44::operator==(const CMatrix44 &other) const
00126 {
00127 return _11 == other._11 && _12 == other._12 && _13 == other._13 && _14 == other._14
00128 && _21 == other._21 && _22 == other._22 && _23 == other._23 && _24 == other._24
00129 && _31 == other._31 && _32 == other._32 && _33 == other._33 && _34 == other._34
00130 && _41 == other._41 && _42 == other._42 && _43 == other._43 && _44 == other._44;
00131 }
00132
00133 bool CMatrix44::operator!=(const CMatrix44 &other) const
00134 {
00135 return _11 != other._11 || _12 != other._12 || _13 != other._13 || _14 != other._14
00136 || _21 != other._21 || _22 != other._22 || _23 != other._23 || _24 != other._24
00137 || _31 != other._31 || _32 != other._32 || _33 != other._33 || _34 != other._34
00138 || _41 != other._41 || _42 != other._42 || _43 != other._43 || _44 != other._44;
00139 }
00140
00141 void CMatrix44::Set(const float &f)
00142 {
00143 _11 = _12 = _13 = _14 =
00144 _21 = _22 = _23 = _24 =
00145 _31 = _31 = _33 = _34 =
00146 _41 = _42 = _43 = _44 = f;
00147 }
00148
00149 void CMatrix44::Set(const float &f11, const float &f12, const float &f13, const float &f14,
00150 const float &f21, const float &f22, const float &f23, const float &f24,
00151 const float &f31, const float &f32, const float &f33, const float &f34,
00152 const float &f41, const float &f42, const float &f43, const float &f44)
00153 {
00154 _11 = f11; _12 = f12; _13 = f13; _14 = f14;
00155 _21 = f21; _22 = f22; _23 = f23; _24 = f24;
00156 _31 = f31; _32 = f32; _33 = f33; _34 = f34;
00157 _41 = f41; _42 = f42; _43 = f43; _44 = f44;
00158 }
00159
00160 float CMatrix44::Determinant()
00161 {
00162 return _14 * _23 * _32 * _41-_13 * _24 * _32 * _41-_14 * _22 * _33 * _41+_12 * _24 * _33 * _41 +
00163 _13 * _22 * _34 * _41-_12 * _23 * _34 * _41-_14 * _23 * _31 * _42+_13 * _24 * _31 * _42 +
00164 _14 * _21 * _33 * _42-_11 * _24 * _33 * _42-_13 * _21 * _34 * _42+_11 * _23 * _34 * _42 +
00165 _14 * _22 * _31 * _43-_12 * _24 * _31 * _43-_14 * _21 * _32 * _43+_11 * _24 * _32 * _43 +
00166 _12 * _21 * _34 * _43-_11 * _22 * _34 * _43-_13 * _22 * _31 * _44+_12 * _23 * _31 * _44 +
00167 _13 * _21 * _32 * _44-_11 * _23 * _32 * _44-_12 * _21 * _33 * _44+_11 * _22 * _33 * _44;
00168 }
00169
00170 void CMatrix44::Identity()
00171 {
00172 _11 = 1.0f; _12 = 0.0f; _13 = 0.0f; _14 = 0.0f;
00173 _21 = 0.0f; _22 = 1.0f; _23 = 0.0f; _24 = 0.0f;
00174 _31 = 0.0f; _32 = 0.0f; _33 = 1.0f; _34 = 0.0f;
00175 _41 = 0.0f; _42 = 0.0f; _43 = 0.0f; _44 = 1.0f;
00176 }
00177
00178 void CMatrix44::Invert()
00179 {
00180 Set(_23*_34*_42 - _24*_33*_42 + _24*_32*_43 - _22*_34*_43 - _23*_32*_44 + _22*_33*_44,
00181 _14*_33*_42 - _13*_34*_42 - _14*_32*_43 + _12*_34*_43 + _13*_32*_44 - _12*_33*_44,
00182 _13*_24*_42 - _14*_23*_42 + _14*_22*_43 - _12*_24*_43 - _13*_22*_44 + _12*_23*_44,
00183 _14*_23*_32 - _13*_24*_32 - _14*_22*_33 + _12*_24*_33 + _13*_22*_34 - _12*_23*_34,
00184 _24*_33*_41 - _23*_34*_41 - _24*_31*_43 + _21*_34*_43 + _23*_31*_44 - _21*_33*_44,
00185 _13*_34*_41 - _14*_33*_41 + _14*_31*_43 - _11*_34*_43 - _13*_31*_44 + _11*_33*_44,
00186 _14*_23*_41 - _13*_24*_41 - _14*_21*_43 + _11*_24*_43 + _13*_21*_44 - _11*_23*_44,
00187 _13*_24*_31 - _14*_23*_31 + _14*_21*_33 - _11*_24*_33 - _13*_21*_34 + _11*_23*_34,
00188 _22*_34*_41 - _24*_32*_41 + _24*_31*_42 - _21*_34*_42 - _22*_31*_44 + _21*_32*_44,
00189 _14*_32*_41 - _12*_34*_41 - _14*_31*_42 + _11*_34*_42 + _12*_31*_44 - _11*_32*_44,
00190 _12*_24*_41 - _14*_22*_41 + _14*_21*_42 - _11*_24*_42 - _12*_21*_44 + _11*_22*_44,
00191 _14*_22*_31 - _12*_24*_31 - _14*_21*_32 + _11*_24*_32 + _12*_21*_34 - _11*_22*_34,
00192 _23*_32*_41 - _22*_33*_41 - _23*_31*_42 + _21*_33*_42 + _22*_31*_43 - _21*_32*_43,
00193 _12*_33*_41 - _13*_32*_41 + _13*_31*_42 - _11*_33*_42 - _12*_31*_43 + _11*_32*_43,
00194 _13*_22*_41 - _12*_23*_41 - _13*_21*_42 + _11*_23*_42 + _12*_21*_43 - _11*_22*_43,
00195 _12*_23*_31 - _13*_22*_31 + _13*_21*_32 - _11*_23*_32 - _12*_21*_33 + _11*_22*_33);
00196 float d = 1.0f/Determinant();
00197 _11 *= d; _12 *= d; _13 *= d; _14 *= d;
00198 _21 *= d; _22 *= d; _23 *= d; _24 *= d;
00199 _31 *= d; _32 *= d; _33 *= d; _34 *= d;
00200 _41 *= d; _42 *= d; _43 *= d; _44 *= d;
00201 }
00202
00203 void CMatrix44::Transpose()
00204 {
00205 float f;
00206
00207 f = _12;
00208 _12 = _21;
00209 _21 = f;
00210
00211 f = _13;
00212 _13 = _31;
00213 _31 = f;
00214
00215 f = _14;
00216 _14 = _41;
00217 _41 = f;
00218
00219 f = _23;
00220 _23 = _32;
00221 _32 = f;
00222
00223 f = _24;
00224 _24 = _42;
00225 _42 = f;
00226
00227 f = _34;
00228 _34 = _43;
00229 _43 = f;
00230 }
00231
00232 void CMatrix44::TransposeFrom(const CMatrix44 &m)
00233 {
00234 _11 = m._11; _12 = m._21; _13 = m._31; _14 = m._41;
00235 _21 = m._12; _22 = m._22; _23 = m._32; _24 = m._42;
00236 _31 = m._13; _32 = m._23; _33 = m._33; _34 = m._43;
00237 _41 = m._14; _42 = m._24; _43 = m._34; _44 = m._44;
00238 }
00239
00240
00241 void CMatrix44::Multiply(const CMatrix44 &first, const CMatrix44 &second)
00242 {
00243 _11 = first._11 * second._11 + first._12 * second._21 + first._13 * second._31 + first._14 * second._41;
00244 _12 = first._11 * second._12 + first._12 * second._22 + first._13 * second._32 + first._14 * second._42;
00245 _13 = first._11 * second._13 + first._12 * second._23 + first._13 * second._33 + first._14 * second._43;
00246 _14 = first._11 * second._14 + first._12 * second._24 + first._13 * second._34 + first._14 * second._44;
00247
00248 _21 = first._21 * second._11 + first._22 * second._21 + first._23 * second._31 + first._24 * second._41;
00249 _22 = first._21 * second._12 + first._22 * second._22 + first._23 * second._32 + first._24 * second._42;
00250 _23 = first._21 * second._13 + first._22 * second._23 + first._23 * second._33 + first._24 * second._43;
00251 _24 = first._21 * second._14 + first._22 * second._24 + first._23 * second._34 + first._24 * second._44;
00252
00253 _31 = first._31 * second._11 + first._32 * second._21 + first._33 * second._31 + first._34 * second._41;
00254 _32 = first._31 * second._12 + first._32 * second._22 + first._33 * second._32 + first._34 * second._42;
00255 _33 = first._31 * second._13 + first._32 * second._23 + first._33 * second._33 + first._34 * second._43;
00256 _34 = first._31 * second._14 + first._32 * second._24 + first._33 * second._34 + first._34 * second._44;
00257
00258 _41 = first._41 * second._11 + first._42 * second._21 + first._43 * second._31 + first._44 * second._41;
00259 _42 = first._41 * second._12 + first._42 * second._22 + first._43 * second._32 + first._44 * second._42;
00260 _43 = first._41 * second._13 + first._42 * second._23 + first._43 * second._33 + first._44 * second._43;
00261 _44 = first._41 * second._14 + first._42 * second._24 + first._43 * second._34 + first._44 * second._44;
00262 }
00263
00264 void CMatrix44::Scaling(const float &fX, const float &fY, const float &fZ)
00265 {
00266 _11 = fX; _12 = 0.0f; _13 = 0.0f; _14 = 0.0f;
00267 _21 = 0.0f; _22 = fY; _23 = 0.0f; _24 = 0.0f;
00268 _31 = 0.0f; _32 = 0.0f; _33 = fZ; _34 = 0.0f;
00269 _41 = 0.0f; _42 = 0.0f; _43 = 0.0f; _44 = 1.0f;
00270 }
00271
00272 void CMatrix44::Scaling(const CVector3f &vScale)
00273 {
00274 _11 = vScale.m_X; _12 = 0.0f; _13 = 0.0f; _14 = 0.0f;
00275 _21 = 0.0f; _22 = vScale.m_Y; _23 = 0.0f; _24 = 0.0f;
00276 _31 = 0.0f; _32 = 0.0f; _33 = vScale.m_Z; _34 = 0.0f;
00277 _41 = 0.0f; _42 = 0.0f; _43 = 0.0f; _44 = 1.0f;
00278 }
00279
00280 void CMatrix44::Translation(const float &fX, const float &fY, const float &fZ)
00281 {
00282 _11 = 1.0f; _12 = 0.0f; _13 = 0.0f; _14 = fX;
00283 _21 = 0.0f; _22 = 1.0f; _23 = 0.0f; _24 = fY;
00284 _31 = 0.0f; _32 = 0.0f; _33 = 1.0f; _34 = fZ;
00285 _41 = 0.0f; _42 = 0.0f; _43 = 0.0f; _44 = 1.0f;
00286 }
00287
00288 void CMatrix44::Translation(const CVector3f &vTranslation)
00289 {
00290 _11 = 1.0f; _12 = 0.0f; _13 = 0.0f; _14 = vTranslation.m_X;
00291 _21 = 0.0f; _22 = 1.0f; _23 = 0.0f; _24 = vTranslation.m_Y;
00292 _31 = 0.0f; _32 = 0.0f; _33 = 1.0f; _34 = vTranslation.m_Z;
00293 _41 = 0.0f; _42 = 0.0f; _43 = 0.0f; _44 = 1.0f;
00294 }
00295
00296 void CMatrix44::RotationX(const float &fRad)
00297 {
00298 _11 = 1.0f; _12 = 0.0f; _13 = 0.0f; _14 = 0.0f;
00299 _21 = 0.0f; _22 = cos(fRad); _23 = sin(fRad); _24 = 0.0f;
00300 _31 = 0.0f; _32 = -_23; _33 = _22; _34 = 0.0f;
00301 _41 = 0.0f; _42 = 0.0f; _43 = 0.0f; _44 = 1.0f;
00302 }
00303
00304 void CMatrix44::RotationY(const float &fRad)
00305 {
00306 _11 = cos(fRad); _12 = 0.0f; _13 = -sin(fRad); _14 = 0.0f;
00307 _21 = 0.0f; _22 = 1.0f; _23 = 0.0f; _24 = 0.0f;
00308 _31 = -_13; _32 = 0.0f; _33 = _11; _34 = 0.0f;
00309 _41 = 0.0f; _42 = 0.0f; _43 = 0.0f; _44 = 1.0f;
00310 }
00311
00312 void CMatrix44::RotationZ(const float &fRad)
00313 {
00314 _11 = cos(fRad); _12 = sin(fRad); _13 = 0.0f; _14 = 0.0f;
00315 _21 = -_12; _22 = _11; _23 = 0.0f; _24 = 0.0f;
00316 _31 = 0.0f; _32 = 0.0f; _33 = 1.0f; _34 = 0.0f;
00317 _41 = 0.0f; _42 = 0.0f; _43 = 0.0f; _44 = 1.0f;
00318 }
00319
00320 void CMatrix44::RotationZYX(const float &fX, const float &fY, const float &fZ)
00321 {
00322 float sinx = sin(fX);
00323 float siny = sin(fY);
00324 float sinz = sin(fZ);
00325 float cosx = cos(fX);
00326 float cosy = cos(fY);
00327 float cosz = cos(fZ);
00328
00329 _11 = cosy*cosz; _12 = cosy*sinz; _13 = -siny; _14 = 0.0f;
00330 _21 = sinx*siny*cosz - sinz*cosx; _22 = sinx*siny*sinz+cosx*cosz; _23 = sinx*cosy; _24 = 0.0f;
00331 _31 = cosx*siny*cosz + sinx*sinz; _32 = cosx*siny*sinz - sinx*cosz; _33 = cosx*cosy; _34 = 0.0f;
00332 _41 = 0.0f; _42 = 0.0f; _43 = 0.0f; _44 = 1.0f;
00333 }
00334
00335 void CMatrix44::RotationZYX(const CVector3f &vRotation)
00336 {
00337 float sinx = sin(vRotation.m_X);
00338 float siny = sin(vRotation.m_Y);
00339 float sinz = sin(vRotation.m_Z);
00340 float cosx = cos(vRotation.m_X);
00341 float cosy = cos(vRotation.m_Y);
00342 float cosz = cos(vRotation.m_Z);
00343
00344 _11 = cosy*cosz; _12 = cosy*sinz; _13 = -siny; _14 = 0.0f;
00345 _21 = sinx*siny*cosz - sinz*cosx; _22 = sinx*siny*sinz+cosx*cosz; _23 = sinx*cosy; _24 = 0.0f;
00346 _31 = cosx*siny*cosz + sinx*sinz; _32 = cosx*siny*sinz - sinx*cosz; _33 = cosx*cosy; _34 = 0.0f;
00347 _41 = 0.0f; _42 = 0.0f; _43 = 0.0f; _44 = 1.0f;
00348 }
00349
00350 void CMatrix44::RotationZXY(const float &fX, const float &fY, const float &fZ)
00351 {
00352 float sinx = sin(fX);
00353 float siny = sin(fY);
00354 float sinz = sin(fZ);
00355 float cosx = cos(fX);
00356 float cosy = cos(fY);
00357 float cosz = cos(fZ);
00358
00359 _11 = cosy*cosz - sinx*siny*sinz; _12 = cosy*sinz + sinx*siny*cosz; _13 = -cosx*siny; _14 = 0.0f;
00360 _21 =-cosx*sinz; _22 = cosx*cosz; _23 = sinx; _24 = 0.0f;
00361 _31 = siny*cosz + sinx*cosy*sinz; _32 = siny*sinz - sinx*cosy*cosz; _33 = cosx*cosy ; _34 = 0.0f;
00362 _41 = 0.0f; _42 = 0.0f; _43 = 0.0f; _44 = 1.0f;
00363 }
00364
00365 void CMatrix44::RotationZXY(const CVector3f &vRotation)
00366 {
00367 float sinx = sin(vRotation.m_X);
00368 float siny = sin(vRotation.m_Y);
00369 float sinz = sin(vRotation.m_Z);
00370 float cosx = cos(vRotation.m_X);
00371 float cosy = cos(vRotation.m_Y);
00372 float cosz = cos(vRotation.m_Z);
00373
00374 _11 = cosy*cosz - sinx*siny*sinz; _12 = cosy*sinz + sinx*siny*cosz; _13 = -cosx*siny; _14 = 0.0f;
00375 _21 =-cosx*sinz; _22 = cosx*cosz; _23 = sinx; _24 = 0.0f;
00376 _31 = siny*cosz + sinx*cosy*sinz; _32 = siny*sinz - sinx*cosy*cosz; _33 = cosx*cosy ; _34 = 0.0f;
00377 _41 = 0.0f; _42 = 0.0f; _43 = 0.0f; _44 = 1.0f;
00378 }
00379
00380 const CVector3f CMatrix44::GetZXYRotationVector()
00381 {
00382 CVector3f rot;
00383 rot.m_Z = atan2(-_21, _22);
00384
00385
00386
00387
00388
00389 rot.m_X = asin(_23);
00390 rot.m_Y = atan2(-_13, _33);
00391
00392 return rot;
00393 }
00394
00395 void CMatrix44::Orthogonal(const float &fWidth, const float &fHeight, const float &fNearZ, const float &fFarZ)
00396 {
00397
00398 _11 = 2.0f / fWidth; _12 = 0.0f; _13 = 0.0f; _14 = -1.0f;
00399 _21 = 0.0f; _22 = -2.0f / fHeight; _23 = 0.0f; _24 = 1.0f;
00400 _31 = 0.0f; _32 = 0.0f; _33 = 2.0f / (fNearZ - fFarZ); _34 = (fNearZ + fFarZ) / (fFarZ - fNearZ);
00401 _41 = 0.0f; _42 = 0.0f; _43 = 0.0f; _44 = 1.0f;
00402
00403
00404
00405
00406
00407
00408
00409
00410 }
00411
00412 void CMatrix44::Perspective(const float &fFov, const float &fAspectRatio, const float &fNearZ, const float &fFarZ)
00413 {
00414 float tmp(fFov/2);
00415 _22 = 1.0f/tan(tmp);
00416 _11 = _22 / fAspectRatio; _12 = 0.0f; _13 = 0.0f; _14 = 0.0f;
00417 _21 = 0.0f; _23 = 0.0f; _24 = 0.0f;
00418 _31 = 0.0f; _32 = 0.0f; _33 = (fFarZ + fNearZ) / (fNearZ - fFarZ); _34 = fNearZ * _33 - fNearZ;
00419 _41 = 0.0f; _42 = 0.0f; _43 = -1.0f; _44 = 0.0f;
00420 }
00421
00422
00423 void CMatrix44::Log(word wTargetLog) const
00424 {
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434 }
00435
00436 CVector4f operator*(const CVector4f &v, const CMatrix44 &m)
00437 {
00438 return CVector4f(m._11 * v.m_X + m._12 * v.m_Y + m._13 * v.m_Z + m._14 * v.m_W,
00439 m._21 * v.m_X + m._22 * v.m_Y + m._23 * v.m_Z + m._24 * v.m_W,
00440 m._31 * v.m_X + m._32 * v.m_Y + m._33 * v.m_Z + m._34 * v.m_W,
00441 m._41 * v.m_X + m._42 * v.m_Y + m._43 * v.m_Z + m._44 * v.m_W);
00442 }
00443
00444 CVector4f &operator*=(CVector4f &v, const CMatrix44 &m)
00445 {
00446 v.Set(m._11 * v.m_X + m._12 * v.m_Y + m._13 * v.m_Z + m._14 * v.m_W,
00447 m._21 * v.m_X + m._22 * v.m_Y + m._23 * v.m_Z + m._24 * v.m_W,
00448 m._31 * v.m_X + m._32 * v.m_Y + m._33 * v.m_Z + m._34 * v.m_W,
00449 m._41 * v.m_X + m._42 * v.m_Y + m._43 * v.m_Z + m._44 * v.m_W);
00450 return v;
00451 }