csplugincommon/opengl/glhelper.h
Go to the documentation of this file.00001 /* 00002 Copyright (C) 2002 by Marten Svanfeldt 00003 Anders Stenberg 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __CS_CSPLUGINCOMMON_OPENGL_GLHELPER_H__ 00021 #define __CS_CSPLUGINCOMMON_OPENGL_GLHELPER_H__ 00022 00027 #include "csgeom/matrix3.h" 00028 #include "csgeom/transfrm.h" 00029 #include "csgeom/vector3.h" 00030 00034 00035 static inline void makeGLMatrix (const csReversibleTransform& t, 00036 float matrix[16]) 00037 { 00038 const csMatrix3 &orientation = t.GetO2T(); 00039 const csVector3 &translation = t.GetO2TTranslation(); 00040 00041 matrix[0] = orientation.m11; 00042 matrix[1] = orientation.m12; 00043 matrix[2] = orientation.m13; 00044 matrix[3] = 0.0f; 00045 00046 matrix[4] = orientation.m21; 00047 matrix[5] = orientation.m22; 00048 matrix[6] = orientation.m23; 00049 matrix[7] = 0.0f; 00050 00051 matrix[8] = orientation.m31; 00052 matrix[9] = orientation.m32; 00053 matrix[10] = orientation.m33; 00054 matrix[11] = 0.0f; 00055 00056 matrix[12] = translation.x; 00057 matrix[13] = translation.y; 00058 matrix[14] = translation.z; 00059 matrix[15] = 1.0f; 00060 } 00061 00063 static inline void makeGLMatrix (const csMatrix3& m, float matrix[16]) 00064 { 00065 matrix[0] = m.m11; 00066 matrix[1] = m.m12; 00067 matrix[2] = m.m13; 00068 matrix[3] = 0.0f; 00069 00070 matrix[4] = m.m21; 00071 matrix[5] = m.m22; 00072 matrix[6] = m.m23; 00073 matrix[7] = 0.0f; 00074 00075 matrix[8] = m.m31; 00076 matrix[9] = m.m32; 00077 matrix[10] = m.m33; 00078 matrix[11] = 0.0f; 00079 00080 matrix[12] = 0.0f; 00081 matrix[13] = 0.0f; 00082 matrix[14] = 0.0f; 00083 matrix[15] = 1.0f; 00084 } 00085 00088 #endif
Generated for Crystal Space by doxygen 1.4.6