#pragma region CPL License /* Nuclex Native Framework Copyright (C) 2002-2013 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #pragma endregion // CPL License #ifndef NUCLEX_SCENE_MATRIX44_H #define NUCLEX_SCENE_MATRIX44_H #include "Nuclex/Scene/Config.h" namespace Nuclex { namespace Scene { // ------------------------------------------------------------------------------------------- // /// Matrix that holds an orientation and translation in 4D space /// /// This kind of matrix is typically used to store an object's position, scale /// and orientation in 3D space (leaving the 4th dimension, aka W coordinates /// unused and set to the identity matrix values). /// template struct Matrix44 { /// An empty matrix public: static const Matrix44 Empty; /// The identity matrix public: static const Matrix44 Identity; /// Constructs an uninitialized 4x4 matrix public: Matrix44() {} /// Initializes a new 4x4 matrix /// Existing matrix that will be copied public: Matrix44(TScalar m[4][4]) : M11(m[0][0]), M12(m[0][1]), M13(m[0][2]), M14(m[0][3]), M21(m[1][0]), M22(m[1][1]), M23(m[1][2]), M24(m[1][3]), M31(m[2][0]), M32(m[2][1]), M33(m[2][2]), M34(m[2][3]), M41(m[3][0]), M42(m[3][1]), M43(m[3][2]), M44(m[3][3]) {} /// Initializes a new 4x4 matrix /// Value for the element in row 1, column 1 /// Value for the element in row 1, column 2 /// Value for the element in row 1, column 3 /// Value for the element in row 1, column 4 /// Value for the element in row 2, column 1 /// Value for the element in row 2, column 2 /// Value for the element in row 2, column 3 /// Value for the element in row 2, column 4 /// Value for the element in row 3, column 1 /// Value for the element in row 3, column 2 /// Value for the element in row 3, column 3 /// Value for the element in row 3, column 4 /// Value for the element in row 4, column 1 /// Value for the element in row 4, column 2 /// Value for the element in row 4, column 3 /// Value for the element in row 4, column 4 public: Matrix44( TScalar m11, TScalar m12, TScalar m13, TScalar m14, TScalar m21, TScalar m22, TScalar m23, TScalar m24, TScalar m31, TScalar m32, TScalar m33, TScalar m34, TScalar m41, TScalar m42, TScalar m43, TScalar m44 ) : M11(m11), M12(m12), M13(m13), M14(m14), M21(m21), M22(m22), M23(m23), M24(m24), M31(m31), M32(m32), M33(m33), M34(m34), M41(m41), M42(m42), M43(m43), M44(m44) {} /// Matrix row 1 column 1, storing the right vector's X coordinate public: TScalar M11; /// Matrix row 1 column 2, storing the right vector's Y coordinate public: TScalar M12; /// Matrix row 1 column 3, storing the right vector's Z coordinate public: TScalar M13; /// Matrix row 1 column 4, storing the right vector's W coordinate public: TScalar M14; /// Matrix row 2 column 1, storing the up vector's X coordinate public: TScalar M21; /// Matrix row 2 column 2, storing the up vector's Y coordinate public: TScalar M22; /// Matrix row 2 column 3, storing the up vector's Z coordinate public: TScalar M23; /// Matrix row 2 column 4, storing the up vector's W coordinate public: TScalar M24; /// Matrix row 3 column 1, storing the forward vector's X coordinate public: TScalar M31; /// Matrix row 3 column 2, storing the forward vector's Y coordinate public: TScalar M32; /// Matrix row 3 column 3, storing the forward vector's Z coordinate public: TScalar M33; /// Matrix row 3 column 4, storing the forward vector's W coordinate public: TScalar M34; /// Matrix row 4 column 1, storing the translation's X coordinate public: TScalar M41; /// Matrix row 4 column 2, storing the translation's Y coordinate public: TScalar M42; /// Matrix row 4 column 3, storing the translation's Z coordinate public: TScalar M43; /// Matrix row 4 column 4, storing the translation's W coordinate public: TScalar M44; }; // ------------------------------------------------------------------------------------------- // template const Matrix44 Matrix44::Empty( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); // ------------------------------------------------------------------------------------------- // template const Matrix44 Matrix44::Identity( 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ); // ------------------------------------------------------------------------------------------- // }} // namespace Nuclex::Scene #endif // NUCLEX_SCENE_MATRIX44_H