00001 /*****************************************************************************
00002 * SGL: A Scene Graph Library
00003 *
00004 * Copyright (C) 1997-2001 Scott McMillan All Rights Reserved.
00005 *
00006 * This library is free software; you can redistribute it and/or
00007 * modify it under the terms of the GNU Library General Public
00008 * License as published by the Free Software Foundation; either
00009 * version 2 of the License, or (at your option) any later version.
00010 *
00011 * This library is distributed in the hope that it will be useful,
00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00014 * Library General Public License for more details.
00015 *
00016 * You should have received a copy of the GNU Library General Public
00017 * License along with this library; if not, write to the Free
00018 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019 *****************************************************************************
00020 * File: sglMatrix.hpp
00021 * Created: 2 January 1999
00022 * Summary: sglMat[234]f matrix classes and all helpful operations
00023 *****************************************************************************/
00024
00025 #ifndef __SGL_MATRIX_HPP
00026 #define __SGL_MATRIX_HPP
00027
00028 #include <sgl.h>
00029 #include <sglVector.hpp>
00030
00031 #include <sglMat2.hpp>
00032 #include <sglMat3.hpp>
00033 #include <sglMat4.hpp>
00034
00035 // ---------------------------------------------------------------------------
00036 // Forward references and convenience types
00037 // ---------------------------------------------------------------------------
00038
00039 typedef sglMat2<float> sglMat2f;
00040 typedef sglMat2<double> sglMat2d;
00041 typedef sglMat3<float> sglMat3f;
00042 typedef sglMat3<double> sglMat3d;
00043 typedef sglMat4<float> sglMat4f;
00044 typedef sglMat4<double> sglMat4d;
00045
00046 // ===========================================================================
00047 // identity Matrices for convenience
00048
00049 const sglMat2f sglIdentMat2f(1.0f, 0.0f,
00050 0.0f, 1.0f);
00051 const sglMat3f sglIdentMat3f(1.0f, 0.0f, 0.0f,
00052 0.0f, 1.0f, 0.0f,
00053 0.0f, 0.0f, 1.0f);
00054 const sglMat4f sglIdentMat4f(1.0f, 0.0f, 0.0f, 0.0f,
00055 0.0f, 1.0f, 0.0f, 0.0f,
00056 0.0f, 0.0f, 1.0f, 0.0f,
00057 0.0f, 0.0f, 0.0f, 1.0f);
00058
00059 const sglMat2d sglIdentMat2d(1.0, 0.0,
00060 0.0, 1.0);
00061 const sglMat3d sglIdentMat3d(1.0, 0.0, 0.0,
00062 0.0, 1.0, 0.0,
00063 0.0, 0.0, 1.0);
00064 const sglMat4d sglIdentMat4d(1.0, 0.0, 0.0, 0.0,
00065 0.0, 1.0, 0.0, 0.0,
00066 0.0, 0.0, 1.0, 0.0,
00067 0.0, 0.0, 0.0, 1.0);
00068
00069 // ===========================================================================
00070 // OpenGL convenience functions
00071
00072 inline void sglLoadMatrix(const sglMat4f& mat) { glLoadMatrixf(mat.getPtr()); }
00073 inline void sglLoadMatrix(const sglMat4d& mat) { glLoadMatrixd(mat.getPtr()); }
00074
00075 inline void sglMultMatrix(const sglMat4f& mat) { glMultMatrixf(mat.getPtr()); }
00076 inline void sglMultMatrix(const sglMat4d& mat) { glMultMatrixd(mat.getPtr()); }
00077
00078 #endif
1.2.6 written by Dimitri van Heesch,
© 1997-2001