ScummVM API documentation
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
27namespace QDEngine {
28
29typedef float VALUE3D;
30typedef 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
72MATRIX3D ZeroMatrix();
73MATRIX3D IdentityMatrix();
74
75MATRIX3D ProjectionMatrix(const float near_plane, const float far_plane, const float fov);
76MATRIX3D ViewMatrixByDir(const Vect3f &from,
77 const Vect3f &view_dir,
78 const Vect3f &world_up,
79 const Vect3f &cam_up);
80MATRIX3D ViewMatrix(const Vect3f &from, const Vect3f &at,
81 const Vect3f &world_up,
82 const Vect3f &cam_up);
83
84MATRIX3D RotateXMatrix(const float rads);
85MATRIX3D RotateYMatrix(const float rads);
86MATRIX3D RotateZMatrix(const float rads);
87MATRIX3D TranslateMatrix(const float dx, const float dy, const float dz);
88MATRIX3D TranslateMatrix(const Vect3f &v);
89MATRIX3D ScaleMatrix(const float size);
90MATRIX3D ScaleMatrix(const float a, const float b, const float c);
91MATRIX3D ScaleMatrix(const Vect3f &v);
92
93MATRIX3D MatrixMult(const MATRIX3D &a, const MATRIX3D &b);
94MATRIX3D MatrixInverse(const MATRIX3D &m);
95MATRIX3D MatrixTranspose(const MATRIX3D &m);
96
97Vect3f TransformVector(const Vect3f &v, const MATRIX3D &m);
98Vect3f 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: xmath.h:533
Базовый класс для игровых ресурсов.
Definition: console.h:28
Definition: qd_d3dutils.h:30