ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
qd_d3dutils.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef QDENGINE_QDCORE_QD_ENGINE_D3DUTILS_H
23 #define QDENGINE_QDCORE_QD_ENGINE_D3DUTILS_H
24 
25 #include "qdengine/xmath.h"
26 
27 namespace QDEngine {
28 
29 typedef float VALUE3D;
30 typedef struct _MATRIX3D {
31  VALUE3D m[4][4];
32 
33  _MATRIX3D() { }
34  _MATRIX3D(VALUE3D _m00, VALUE3D _m01, VALUE3D _m02, VALUE3D _m03,
35  VALUE3D _m10, VALUE3D _m11, VALUE3D _m12, VALUE3D _m13,
36  VALUE3D _m20, VALUE3D _m21, VALUE3D _m22, VALUE3D _m23,
37  VALUE3D _m30, VALUE3D _m31, VALUE3D _m32, VALUE3D _m33
38  ) {
39  m[0][0] = _m00;
40  m[0][1] = _m01;
41  m[0][2] = _m02;
42  m[0][3] = _m03;
43  m[1][0] = _m10;
44  m[1][1] = _m11;
45  m[1][2] = _m12;
46  m[1][3] = _m13;
47  m[2][0] = _m20;
48  m[2][1] = _m21;
49  m[2][2] = _m22;
50  m[2][3] = _m23;
51  m[3][0] = _m30;
52  m[3][1] = _m31;
53  m[3][2] = _m32;
54  m[3][3] = _m33;
55  }
56 
57  VALUE3D &operator()(int iRow, int iColumn) {
58  return m[iRow][iColumn];
59  }
60  const VALUE3D &operator()(int iRow, int iColumn) const {
61  return m[iRow][iColumn];
62  }
64 
65 /*
66 **-----------------------------------------------------------------------------
67 ** Function Prototypes
68 **-----------------------------------------------------------------------------
69 */
70 
71 // generic simple matrix routines
72 MATRIX3D ZeroMatrix();
73 MATRIX3D IdentityMatrix();
74 
75 MATRIX3D ProjectionMatrix(const float near_plane, const float far_plane, const float fov);
76 MATRIX3D ViewMatrixByDir(const Vect3f &from,
77  const Vect3f &view_dir,
78  const Vect3f &world_up,
79  const Vect3f &cam_up);
80 MATRIX3D ViewMatrix(const Vect3f &from, const Vect3f &at,
81  const Vect3f &world_up,
82  const Vect3f &cam_up);
83 
84 MATRIX3D RotateXMatrix(const float rads);
85 MATRIX3D RotateYMatrix(const float rads);
86 MATRIX3D RotateZMatrix(const float rads);
87 MATRIX3D TranslateMatrix(const float dx, const float dy, const float dz);
88 MATRIX3D TranslateMatrix(const Vect3f &v);
89 MATRIX3D ScaleMatrix(const float size);
90 MATRIX3D ScaleMatrix(const float a, const float b, const float c);
91 MATRIX3D ScaleMatrix(const Vect3f &v);
92 
93 MATRIX3D MatrixMult(const MATRIX3D &a, const MATRIX3D &b);
94 MATRIX3D MatrixInverse(const MATRIX3D &m);
95 MATRIX3D MatrixTranspose(const MATRIX3D &m);
96 
97 Vect3f TransformVector(const Vect3f &v, const MATRIX3D &m);
98 Vect3f TransformNormal(const Vect3f &v, const MATRIX3D &m);
99 
100 /*
101 **-----------------------------------------------------------------------------
102 ** End of File
103 **-----------------------------------------------------------------------------
104 */
105 
106 } // namespace QDEngine
107 
108 #endif // QDENGINE_QDCORE_QD_ENGINE_D3DUTILS_H
Базовый класс для игровых ресурсов.
Definition: console.h:28
Definition: qd_d3dutils.h:30
Definition: xmath.h:533