00001 /*************************************************************************** 00002 * patch.h 00003 * 00004 * Wed Feb 25 07:56:14 2004 00005 * Copyright 2004 thierry schartz 00006 * Email thierry.schartz@bluebottle.com 00007 ****************************************************************************/ 00008 /* 00009 * This program is free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU Library General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU General Public License 00020 * along with this program; if not, write to the Free Software 00021 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00022 */ 00023 00024 /**** 00025 This code was inspired from document "Rendering Quake 3 Maps" by Morgan McGuire 00026 http://www.cs.brown.edu/research/graphics/games/quake/quake3.html 00027 ****/ 00028 00029 #ifndef PATCH_H 00030 #define PATCH_H 00031 00032 #ifdef WIN32 00033 #include <windows.h> 00034 #endif 00035 00036 00037 #include "q3types.h" 00038 00039 namespace ngn { 00040 namespace core { 00041 namespace bsp { 00042 00043 00044 00045 class Q3Patch 00046 { 00047 public: 00048 Q3Patch(); 00049 virtual ~Q3Patch(); 00050 void tessellate( int level ); 00051 void render(); 00052 00053 static int Tesselation; 00054 tBSPVertex m_controls[9]; // control points for the curve 00055 00056 protected: 00057 int m_level; // subdivision level 00058 tBSPVertex *m_verts; // vertices of the curve 00059 unsigned int *m_indexes; 00060 int *m_trianglesPerRow; 00061 unsigned int **m_rowIndexes; // pointers to index array 00062 }; 00063 00064 struct tBSPPatchFace 00065 { 00066 int numPatches; 00067 Q3Patch *pPatches; 00068 }; 00069 00070 00071 }//bsp 00072 }//core 00073 }//ngn 00074 #endif /* PATCH_H */