00001 // 00002 // sgMatrix4x4.h 00003 // Engine 00004 // 00005 // Created by Nils Daumann on 24.05.10. 00006 // Copyright (c) 2010 Nils Daumann 00007 00008 // Permission is hereby granted, free of charge, to any person obtaining a copy 00009 // of this software and associated documentation files (the "Software"), to deal 00010 // in the Software without restriction, including without limitation the rights 00011 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00012 // copies of the Software, and to permit persons to whom the Software is 00013 // furnished to do so, subject to the following conditions: 00014 00015 // The above copyright notice and this permission notice shall be included in 00016 // all copies or substantial portions of the Software. 00017 00018 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00019 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00020 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00021 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00022 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00023 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00024 // THE SOFTWARE. 00025 00026 #import "sgVector4.h" 00027 #import "sgVector3.h" 00028 00029 class sgQuaternion; 00030 00034 class sgMatrix4x4 00035 { 00036 public: 00041 sgMatrix4x4(); 00042 00048 sgMatrix4x4(const sgMatrix4x4 &other); 00049 00055 sgMatrix4x4(float *other); 00056 00061 bool operator== (const sgMatrix4x4 &other); 00062 00067 bool operator!= (const sgMatrix4x4 &other); 00068 00073 sgMatrix4x4 &operator= (const sgMatrix4x4 &other); 00074 00079 sgMatrix4x4 &operator= (float *other); 00080 00085 sgMatrix4x4 operator* (const sgMatrix4x4 &other); 00086 00091 sgMatrix4x4 &operator*= (const sgMatrix4x4 &other); 00092 00097 sgVector4 operator* (const sgVector4 &other); 00098 00103 sgVector3 operator* (const sgVector3 &other); 00104 00110 void set(float *other); 00111 00116 void makeIdentity(); 00117 00128 void makeProjectionOrtho(float left, float right, float bottom, float top, float clipnear, float clipfar); 00129 00138 void makeProjectionPersp(float arc, float aspect, float clipnear, float clipfar); 00139 00145 void makeTranslate(const sgVector4 &trans); 00146 00152 void makeTranslate(const sgVector3 &trans); 00153 00159 void makeScale(const sgVector4 &scal); 00160 00166 void makeScale(const sgVector3 &scal); 00167 00173 void makeRotate(const sgVector4 &rot); 00174 00180 void makeRotate(const sgVector3 &rot); 00181 00187 void makeRotate(const sgQuaternion &rot); 00188 00194 void translate(const sgVector4 &trans); 00195 00201 void translate(const sgVector3 &trans); 00202 00208 void scale(const sgVector4 &scal); 00209 00215 void scale(const sgVector3 &scal); 00216 00222 void rotate(const sgVector4 &rot); 00223 00229 void rotate(const sgVector3 &rot); 00230 00236 void rotate(const sgQuaternion &rot); 00237 00242 void transpose(); 00243 00249 sgVector4 transform(const sgVector4 &other); 00250 00256 sgVector3 transform(const sgVector3 &other); 00257 00262 float mat[16]; 00263 };