1 /* ResidualVM - A 3D game interpreter
2  *
3  * ResidualVM 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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef MATH_VECTOR4D_H
24 #define MATH_VECTOR4D_H
25 
26 #include "common/scummsys.h"
27 #include "common/endian.h"
28 
29 #include "math/vector.h"
30 #include "math/angle.h"
31 
32 namespace Math {
33 
34 typedef Matrix<4, 1> Vector4d;
35 
36 template<>
37 class Matrix<4, 1> : public MatrixType<4, 1> {
38 public:
x()39 	float& x() { return value(0); }
x()40 	float x() const { return value(0); }
y()41 	float& y() { return value(1); }
y()42 	float y() const { return value(1); }
z()43 	float& z() { return value(2); }
z()44 	float z() const { return value(2); }
w()45 	float& w() { return value(3); }
w()46 	float w() const { return value(3); }
47 
48 	Matrix();
49 	Matrix(float lx, float ly, float lz, float lw);
50 	Matrix(const MatrixBase<4, 1> &m);
51 	Matrix(const float *data);
52 
53 	void set(float lx, float ly, float lz, float lw);
54 
get_vector4d(const char * data)55 	inline static Vector4d get_vector4d(const char *data) {
56 		return Vector4d(READ_LE_FLOAT(data), READ_LE_FLOAT(data + 4), READ_LE_FLOAT(data + 8), READ_LE_FLOAT(data + 12));
57 	}
58 
59 };
60 
61 } // end of namespace Math
62 
63 #endif
64