From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- .../nel/driver_opengl_matrix_cpp-source.html | 176 +++++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100644 docs/doxygen/nel/driver_opengl_matrix_cpp-source.html (limited to 'docs/doxygen/nel/driver_opengl_matrix_cpp-source.html') diff --git a/docs/doxygen/nel/driver_opengl_matrix_cpp-source.html b/docs/doxygen/nel/driver_opengl_matrix_cpp-source.html new file mode 100644 index 00000000..889a5755 --- /dev/null +++ b/docs/doxygen/nel/driver_opengl_matrix_cpp-source.html @@ -0,0 +1,176 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
+
+ + +
+ + +
+Docs + +
+  + + + + + +
Documentation 
+ +
+Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  
+

driver_opengl_matrix.cpp

Go to the documentation of this file.
00001 
+00007 /* Copyright, 2000 Nevrax Ltd.
+00008  *
+00009  * This file is part of NEVRAX NEL.
+00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
+00011  * it under the terms of the GNU General Public License as published by
+00012  * the Free Software Foundation; either version 2, or (at your option)
+00013  * any later version.
+00014 
+00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
+00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
+00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+00018  * General Public License for more details.
+00019 
+00020  * You should have received a copy of the GNU General Public License
+00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
+00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+00023  * MA 02111-1307, USA.
+00024  */
+00025 
+00026 #include "driver_opengl.h"
+00027 
+00028 namespace NL3D {
+00029 
+00030 void CDriverGL::setFrustum(float left, float right, float bottom, float top, float znear, float zfar, bool perspective)
+00031 {
+00032         glMatrixMode(GL_PROJECTION);
+00033         glLoadIdentity();
+00034         if (perspective)
+00035         {
+00036                 glFrustum(left,right,bottom,top,znear,zfar);
+00037         }
+00038         else
+00039         {
+00040                 glOrtho(left,right,bottom,top,znear,zfar);
+00041         }
+00042         glMatrixMode(GL_MODELVIEW);
+00043 }
+00044 
+00045 // --------------------------------------------------
+00046 
+00047 void CDriverGL::setupViewMatrix(const CMatrix& mtx)
+00048 {
+00049         // Setup the matrix to transform the CScene basis in openGL basis.
+00050         CMatrix         changeBasis;
+00051         CVector         I(1,0,0);
+00052         CVector         J(0,0,-1);
+00053         CVector         K(0,1,0);
+00054 
+00055         changeBasis.identity();
+00056         changeBasis.setRot(I,J,K, true);
+00057         // Optimize it...
+00058         changeBasis*= mtx;
+00059         _ViewMtx=changeBasis;
+00060 
+00061         _MatrixSetupDirty= true;
+00062         _ViewMatrixSetupDirty= true;
+00063 }
+00064 
+00065 CMatrix CDriverGL::getViewMatrix(void) const
+00066 {
+00067         // Setup the matrix to transform the CScene basis in openGL basis.
+00068         CMatrix         changeBasis;
+00069         CVector         I(1,0,0);
+00070         CVector         J(0,0,1);
+00071         CVector         K(0,-1,0);
+00072 
+00073         changeBasis.identity();
+00074         changeBasis.setRot(I,J,K, true);
+00075         return(changeBasis*_ViewMtx);
+00076 }
+00077 
+00078 void CDriverGL::setupModelMatrix(const CMatrix& mtx, uint8 n)
+00079 {
+00080         // Check args
+00081         nlassert (n<IDriver::MaxModelMatrix);
+00082 
+00083 
+00084         // Dirt flags.
+00085         _MatrixSetupDirty= true;
+00086         // because we don't know for which (skin/normal/paletteSkin) mode this will be used, we must set the 2 flags.
+00087         _ModelViewMatrixDirty.set(n);
+00088         _ModelViewMatrixDirtyPaletteSkin.set(n);
+00089 
+00090 
+00091         // Put the matrix in the opengl world, and store it.
+00092         _ModelViewMatrix[n]= _ViewMtx*mtx;
+00093 }
+00094 
+00095 
+00096 
+00097 // ***************************************************************************
+00098 void    CDriverGL::CMatrix3x4::set(const CMatrix &mat)
+00099 {
+00100         const float     *m =mat.get();
+00101         a11= m[0]; a12= m[4]; a13= m[8] ; a14= m[12]; 
+00102         a21= m[1]; a22= m[5]; a23= m[9] ; a24= m[13]; 
+00103         a31= m[2]; a32= m[6]; a33= m[10]; a34= m[14]; 
+00104 }
+00105 
+00106 
+00107 } // NL3D
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1