K3dDrawTriangle.h

Go to the documentation of this file.
00001 
00014 /***************************************************************************
00015  *   Copyright (C) 2007 by Jan Koci   *
00016  *   honza.koci@email.cz   *
00017  *   http://kengine.sourceforge.net/tutorial/
00018  *                                                                         *
00019  *   This program is free software; you can redistribute it and/or modify  *
00020  *   it under the terms of the GNU General Public License as published by  *
00021  *   the Free Software Foundation; either version 2 of the License, or     *
00022  *   (at your option) any later version.                                   *
00023  *                                                                         *
00024  *   This program is distributed in the hope that it will be useful,       *
00025  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00026  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00027  *   GNU General Public License for more details.                          *
00028  *                                                                         *
00029  *   You should have received a copy of the GNU General Public License     *
00030  *   along with this program; if not, write to the                         *
00031  *   Free Software Foundation, Inc.,                                       *
00032  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00033  ***************************************************************************/
00034 
00035 #pragma once
00036 
00037 #include "K3dOpenGL.h"
00038 
00039 
00040 struct TRenderVertex
00041 {
00042         GLfloat afVector[3];
00043         TRenderVertex()
00044         {
00045                 for ( int i=0; i<3; i++ )
00046                 {
00047                         afVector[i] = 0;
00048                 }
00049         }
00050 };
00051 
00052 struct TRenderTriangle
00053 {
00054         TRenderVertex atVertex[3];
00055         TRenderVertex atNormal[3];
00056 };
00057 
00058 class K3dDrawTriangle
00059 {
00060                 K3dGameData *m_pGameData;       
00061                 TRenderVertex *m_ptVertexArray; 
00062                 TRenderVertex *m_ptNormalArray; 
00063                 int m_iNumVertices;     
00064                 bool m_bIsWireframe;    
00065         public:
00066 
00067                 K3dDrawTriangle ( K3dGameData *_pGameData )
00068                 {
00069                         m_pGameData = _pGameData;
00070                         m_iNumVertices = 0;
00071                         m_ptVertexArray = NULL;
00072                         m_ptNormalArray = NULL;
00073                         m_bIsWireframe = false;
00074                 }
00075                 ~K3dDrawTriangle()
00076                 {
00077                         //glDisableClientState(GL_VERTEX_ARRAY);
00078                         //glDisableClientState(GL_NORMAL_ARRAY);
00079                         DeleteVertexArray();
00080                 }
00081 
00082                 void AddTriangle ( TRenderTriangle &_rtTriangle );
00083                 void DeleteVertexArray();
00084                 void DrawTriangleArray();
00085                 void ReallocVertexArray ( const int _iNewSize );
00086                 void InitTriangleArray();
00087 };
00088 

Generated on Thu Aug 16 23:53:26 2007 for K3dEngine by  doxygen 1.5.0