00001 /* Copyright (C) 2001 W.P. van Paassen - peter@paassen.tmfweb.nl 00002 00003 This program is free software; you can redistribute it and/or modify it under 00004 the terms of the GNU General Public License as published by the Free 00005 Software Foundation; either version 2 of the License, or (at your 00006 option) any later version. 00007 00008 This program is distributed in the hope that it will be useful, but WITHOUT 00009 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00010 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00011 for more details. 00012 00013 You should have received a copy of the GNU General Public License 00014 along with this program; see the file COPYING. If not, write to the Free 00015 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 00016 00017 #ifndef WP_TRIANGLE_H 00018 #define WP_TRIANGLE_H 00019 00020 #include "WP_Def.h" 00021 #include "WP_Vector3D.h" 00022 00023 namespace WPCG 00024 { 00025 //forward declarations 00026 class WP_Vertex; 00027 00046 class WP_Triangle 00047 { 00048 public: 00049 WP_Triangle(){}; 00050 ~WP_Triangle(){}; 00051 00055 void drawOpenGL() const; 00056 00060 WP_Vertex* vertices[3]; 00061 00065 WP_Vector3D normal; 00066 }; 00067 00086 class WP_TriangleGroup 00087 { 00088 public: 00089 WP_TriangleGroup(){}; 00090 WP_TriangleGroup(const WP_TriangleGroup &group); 00091 00092 virtual ~WP_TriangleGroup(){ 00093 delete[] indices; 00094 delete[] texCoords; 00095 }; 00096 00097 WP_TriangleGroup& operator=(const WP_TriangleGroup &group); 00098 00099 virtual void drawOpenGL(const WP_Vertex *verticesFrameA, const WP_Vertex *verticesFrameB, scalar interpolation) const = 0; 00100 virtual void drawOpenGL(const WP_Vertex *verticesFrameA, scalar interpolation) const = 0; 00101 00102 unsigned int *indices; 00103 unsigned int numberIndices; 00104 scalar *texCoords; 00105 }; 00106 00125 class WP_TriangleStrip: public WP_TriangleGroup 00126 { 00127 public: 00128 WP_TriangleStrip(){}; 00129 WP_TriangleStrip(const WP_TriangleStrip &strip):WP_TriangleGroup(strip){}; 00130 ~WP_TriangleStrip(){}; 00131 00132 WP_TriangleStrip& operator=(const WP_TriangleStrip &strip); 00133 00134 void drawOpenGL(const WP_Vertex *verticesFrameA, const WP_Vertex *verticesFrameB, scalar interpolation) const; 00135 void drawOpenGL(const WP_Vertex *verticesFrameA, scalar interpolation) const; 00136 }; 00137 00138 00157 class WP_TriangleFan: public WP_TriangleGroup 00158 { 00159 public: 00160 WP_TriangleFan(){}; 00161 WP_TriangleFan(const WP_TriangleFan &fan):WP_TriangleGroup(fan){}; 00162 ~WP_TriangleFan(){}; 00163 00164 WP_TriangleFan& operator=(const WP_TriangleFan &fan); 00165 00166 void drawOpenGL(const WP_Vertex *verticesFrameA, const WP_Vertex *verticesFrameB, scalar interpolation) const; 00167 void drawOpenGL(const WP_Vertex *verticesFrameA, scalar interpolation) const; 00168 }; 00169 } 00170 #endif 00171 00172 00173