ランタイム: Mix/Matrix4x4.h Source File

ランタイム

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

Matrix4x4.h
Go to the documentation of this file.
1 #pragma once
2
5
6 #include "Mix/Vector3.h"
7
8 namespace Mix{
9
12 class _MIX_DLL_API Matrix4x4
13 {
14 public:
15 union
16 {
17 struct
18 {
19 Float32 m00;
20 Float32 m01;
21 Float32 m02;
22 Float32 m03;
23 Float32 m10;
24 Float32 m11;
25 Float32 m12;
26 Float32 m13;
27 Float32 m20;
28 Float32 m21;
29 Float32 m22;
30 Float32 m23;
31 Float32 m30;
32 Float32 m31;
33 Float32 m32;
34 Float32 m33;
35 };
36
37 Float32 m[4][4];
38 };
39
40 public:
42 Matrix4x4( void );
43
46 Matrix4x4( const Mix::Quaternion& r );
50 Matrix4x4( const Mix::Quaternion& r, const Mix::Vector3& t );
55 Matrix4x4( const Mix::Vector3& s, const Mix::Quaternion& r, const Mix::Vector3& t );
56
74 Matrix4x4( Float32 _m00, Float32 _m01, Float32 _m02, Float32 _m03,
75 Float32 _m10, Float32 _m11, Float32 _m12, Float32 _m13,
76 Float32 _m20, Float32 _m21, Float32 _m22, Float32 _m23,
77 Float32 _m30, Float32 _m31, Float32 _m32, Float32 _m33 );
80 Matrix4x4( const Matrix4x4& mm );
81
82 public:
85 Mix::Vector3 GetScaling( void ) const;
88 void SetScaling( Float32 s );
93 void SetScaling( Float32 sx, Float32 sy, Float32 sz );
96 void SetScaling( const Vector3& s );
97
100 Mix::Quaternion GetRotation( void ) const;
103 void SetRotation( const Mix::Quaternion& rot );
106 void SetRotationX( Float32 r );
109 void SetRotationY( Float32 r );
112 void SetRotationZ( Float32 r );
113
116 Mix::Vector3 GetTranslation( void ) const;
121 void SetTranslation( Float32 tx, Float32 ty, Float32 tz );
124 void SetTranslation( const Vector3& t );
125
129 Mix::Vector4 GetColumn( UInt32 index ) const;
133 void SetColumn( UInt32 index, const Mix::Vector4& v );
134
138 Mix::Vector4 GetRow( UInt32 index ) const;
142 void SetRow( UInt32 index, const Mix::Vector4& v );
143
145 void Inverse( void );
148 Mix::Matrix4x4 ToInverse( void ) const;
149
151 void Transpose( void );
154 Mix::Matrix4x4 ToTranspose( void ) const;
155
158 Mix::Vector3 ToEulerXYZ( void ) const;
161 Mix::Vector3 ToEulerXZY( void ) const;
164 Mix::Vector3 ToEulerYXZ( void ) const;
167 Mix::Vector3 ToEulerYZX( void ) const;
170 Mix::Vector3 ToEulerZXY( void ) const;
173 Mix::Vector3 ToEulerZYX( void ) const;
174
178 void Transform( Mix::Vector3* vectors, UInt32 numVector ) const;
183 void Transform( const Mix::Vector3* srcVectors, Mix::Vector3* dstVectors, UInt32 numVector ) const;
184
188 void Transform( Mix::Vector4* vectors, UInt32 numVector ) const;
193 void Transform( const Mix::Vector4* srcVectors, Mix::Vector4* dstVectors, UInt32 numVector ) const;
194
198 Mix::Vector3 TransformSR( const Mix::Vector3& v ) const;
202 void TransformSR( Mix::Vector3* vectors, UInt32 numVector ) const;
207 void TransformSR( const Mix::Vector3* srcVectors, Mix::Vector3* dstVectors, UInt32 numVector ) const;
208
212 Mix::Vector4 TransformSR( const Mix::Vector4& v ) const;
216 void TransformSR( Mix::Vector4* vectors, UInt32 numVector ) const;
221 void TransformSR( const Mix::Vector4* srcVectors, Mix::Vector4* dstVectors, UInt32 numVector ) const;
222
227 void Compose( const Mix::Vector3& s, const Mix::Quaternion& r, const Mix::Vector3& t );
228
238 Boolean Decompose( Mix::Vector3& s, Mix::Quaternion& r, Mix::Vector3& t ) const;
239
245 Mix::Matrix4x4 Remake( Boolean bScaling, Boolean bRotation, Boolean bTranslation ) const;
246
250 Boolean operator == ( const Matrix4x4& mat ) const;
254 Boolean operator != ( const Matrix4x4& mat ) const;
255
259 Matrix4x4& operator = ( const Matrix4x4& m );
263 Matrix4x4& operator *= ( const Matrix4x4& m );
267 Matrix4x4 operator * ( const Matrix4x4& m ) const;
271 Vector3 operator * ( const Vector3& v ) const;
275 Vector4 operator * ( const Vector4& v ) const;
280 friend const Vector3 operator * ( const Vector3& v, const Matrix4x4& m )
281 {
282 return m * v;
283 }
284
285 public:
291 static void LookAtLH( const Mix::Vector3& eye, const Mix::Vector3& at, const Mix::Vector3& up, Mix::Matrix4x4& mat );
297 static void LookAtLH( const Mix::Quaternion& rot, const Mix::Vector3& at, Float32 dist, Mix::Matrix4x4& mat );
304 static void PerspectiveFovLH( Float32 fovY, Float32 aspect, Float32 nearZ, Float32 farZ, Mix::Matrix4x4& mat );
311 static void OrthoLH( Float32 width, Float32 height, Float32 nearZ, Float32 farZ, Mix::Matrix4x4& mat );
316 static void OrthoOffCenterLH( const Mix::Vector3& min, const Mix::Vector3& max, Mix::Matrix4x4& mat );
317
318 public:
321 static const Matrix4x4& Zero( void )
322 {
323 static const Matrix4x4 mat( 0.0f, 0.0f, 0.0f, 0.0f,
324 0.0f, 0.0f, 0.0f, 0.0f,
325 0.0f, 0.0f, 0.0f, 0.0f,
326 0.0f, 0.0f, 0.0f, 0.0f );
327
328 return mat;
329 }
330
333 static const Matrix4x4& Identity( void )
334 {
335 static const Mix::Matrix4x4 mat( 1.0f, 0.0f, 0.0f, 0.0f,
336 0.0f, 1.0f, 0.0f, 0.0f,
337 0.0f, 0.0f, 1.0f, 0.0f,
338 0.0f, 0.0f, 0.0f, 1.0f );
339
340 return mat;
341 }
342 };
343
344 }
Mix::Vector3
3次元浮動小数点ベクトルクラス
Definition: Vector3.h:12
Mix::Matrix4x4::m30
Float32 m30
要素 ( 3, 0 ) の値
Definition: Matrix4x4.h:31
Mix::Matrix4x4::m23
Float32 m23
要素 ( 2, 3 ) の値
Definition: Matrix4x4.h:30
Mix::Matrix4x4::m20
Float32 m20
要素 ( 2, 0 ) の値
Definition: Matrix4x4.h:27
Mix::Matrix4x4::m33
Float32 m33
要素 ( 3, 3 ) の値
Definition: Matrix4x4.h:34
Mix::Matrix4x4::m03
Float32 m03
要素 ( 0, 3 ) の値
Definition: Matrix4x4.h:22
Mix::Matrix4x4::m13
Float32 m13
要素 ( 1, 3 ) の値
Definition: Matrix4x4.h:26
Mix::Quaternion
クォータニオンクラス
Definition: Quaternion.h:10
Mix::Matrix4x4::m02
Float32 m02
要素 ( 0, 2 ) の値
Definition: Matrix4x4.h:21
Mix::Matrix4x4::m12
Float32 m12
要素 ( 1, 2 ) の値
Definition: Matrix4x4.h:25
Mix::Matrix4x4::m10
Float32 m10
要素 ( 1, 0 ) の値
Definition: Matrix4x4.h:23
Mix::Matrix4x4::Identity
static const Matrix4x4 & Identity(void)
単位行列を取得します
Definition: Matrix4x4.h:333
Mix::Matrix4x4::m22
Float32 m22
要素 ( 2, 2 ) の値
Definition: Matrix4x4.h:29
Mix::Matrix4x4
4x4行列クラス
Definition: Matrix4x4.h:12
UInt32
unsigned int UInt32
符号無し32ビット整数
Definition: Common.h:68
Mix::Matrix4x4::m11
Float32 m11
要素 ( 1, 1 ) の値
Definition: Matrix4x4.h:24
Mix
ミックス
Definition: AtomicValue.h:6
Mix::Matrix4x4::m00
Float32 m00
要素 ( 0, 0 ) の値
Definition: Matrix4x4.h:19
Float32
float Float32
32ビット浮動小数点
Definition: Common.h:83
Mix::Matrix4x4::m01
Float32 m01
要素 ( 0, 1 ) の値
Definition: Matrix4x4.h:20
Vector3.h
3次元浮動小数点ベクトルクラスインクルードファイル
Mix::Matrix4x4::m21
Float32 m21
要素 ( 2, 1 ) の値
Definition: Matrix4x4.h:28
Mix::Matrix4x4::m31
Float32 m31
要素 ( 3, 1 ) の値
Definition: Matrix4x4.h:32
Mix::Vector4
4次元浮動小数点ベクトルクラス
Definition: Vector4.h:12
Mix::Matrix4x4::Zero
static const Matrix4x4 & Zero(void)
全ての要素が 0.0f の行列を取得します
Definition: Matrix4x4.h:321
Boolean
BOOL Boolean
32ビットブーリアン
Definition: Common.h:102
Mix::Matrix4x4::m32
Float32 m32
要素 ( 3, 2 ) の値
Definition: Matrix4x4.h:33
_MIX_DLL_API
#define _MIX_DLL_API
DLLインポート定義
Definition: Common.h:38