/* =========================================================================== maya2q3 - export .md3 files from maya Copyright (C) 2007 HermitWorks Entertainment Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. =========================================================================== */ #ifndef INC__quat_h_ #define INC__quat_h_ /* Constructors are kept as seperate functions as putting them in their type will force constructors to propagate up through any class/struct that includes a vecN. Even if the default constructor is empty and gets optimized away this causes some stupid issues when trying to stick a vector in a union or at global scope. Three cheers for the C++ spec which doesn't treat an empty default constructor the same as the implied default constructor when there are no other constructors. */ #include "math-vector.h" struct quat { public: float i, j, k, w; quat operator * ( const quat &q ) const; quat& operator *= ( const quat &q ); inline vec3 ijk( void ) const { vec3 ret = { i, j, k }; return ret; } static const quat identity; }; inline quat quatc( float i, float j, float k, float w ) { quat ret = { i, j, k, w }; return ret; } inline quat quatc( const vec3 &ijk, float w ) { quat ret = { ijk.x, ijk.y, ijk.z, w }; return ret; } #endif