Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages
trimeshlod.h
00001 /* 00002 Copyright (C) 1998,2001 by Jorrit Tyberghein 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public 00015 License along with this library; if not, write to the Free 00016 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 #ifndef __CS_TRIMESHLOD_H__ 00020 #define __CS_TRIMESHLOD_H__ 00021 00022 #include "csextern.h" 00023 00024 #include "csgeom/math3d.h" 00025 #include "csgeom/trimesh.h" 00026 #include "csutil/list.h" 00027 00028 class csTriangleVerticesCost; 00029 00035 class CS_CSGEOM_EXPORT csTriangleVertexCost : public csTriangleVertex 00036 { 00037 public: 00039 bool deleted; 00040 00042 float cost; 00044 int to_vertex; 00045 00047 csTriangleVertexCost () : deleted (false) { } 00049 ~csTriangleVertexCost () { } 00051 bool DelVertex (int idx); 00053 void ReplaceVertex (int old, int replace); 00054 }; 00055 00059 class CS_CSGEOM_EXPORT csTriangleLODAlgo 00060 { 00061 public: 00062 virtual ~csTriangleLODAlgo () { } 00063 00068 virtual void CalculateCost (csTriangleVerticesCost* vertices, 00069 csTriangleVertexCost* vertex) = 0; 00070 }; 00071 00077 class CS_CSGEOM_EXPORT csTriangleLODAlgoEdge : public csTriangleLODAlgo 00078 { 00079 public: 00080 virtual ~csTriangleLODAlgoEdge () { } 00081 virtual void CalculateCost (csTriangleVerticesCost* vertices, 00082 csTriangleVertexCost* vertex); 00083 }; 00084 00089 class CS_CSGEOM_EXPORT csTriangleVerticesSorted 00090 { 00091 private: 00092 int num_vertices; 00093 csTriangleVerticesCost* vertices; 00094 csTriangleVertexCost* verts; 00095 00096 csList<int> sorted_list; 00097 csList<int>::Iterator* entry_per_vertex; 00098 00099 public: 00100 csTriangleVerticesSorted (csTriangleVerticesCost* vertices); 00101 ~csTriangleVerticesSorted (); 00102 00109 int GetLowestCostVertex (); 00110 00115 void ChangeCostVertex (int vtidx); 00116 }; 00117 00124 class CS_CSGEOM_EXPORT csTriangleVerticesCost 00125 { 00126 private: 00127 csTriangleVertexCost* vertices; 00128 int num_vertices; 00129 00130 public: 00139 csTriangleVerticesCost (csTriangleMesh* mesh, csVector3* verts, 00140 int num_verts); 00142 ~csTriangleVerticesCost (); 00147 void UpdateVertices (csVector3* verts); 00148 00150 int GetVertexCount () const { return num_vertices; } 00152 csTriangleVertexCost* GetVertices () const { return vertices; } 00154 csTriangleVertexCost& GetVertex (int idx) { return vertices[idx]; } 00155 00157 void CalculateCost (csTriangleLODAlgo* lodalgo); 00158 00160 int GetMinimalCostVertex (float& min_cost); 00161 00165 csTriangleVerticesSorted* SortVertices (); 00166 00168 void Dump (); 00169 }; 00170 00175 class CS_CSGEOM_EXPORT csTriangleMeshLOD 00176 { 00177 public: 00198 static void CalculateLOD (csTriangleMesh* mesh, 00199 csTriangleVerticesCost* verts, 00200 int* translate, int* emerge_from, csTriangleLODAlgo* lodalgo); 00201 00217 static csTriangle* CalculateLOD (csTriangleMesh* mesh, 00218 csTriangleVerticesCost* verts, float max_cost, int& num_triangles, 00219 csTriangleLODAlgo* lodalgo); 00220 00236 static csTriangle* CalculateLODFast (csTriangleMesh* mesh, 00237 csTriangleVerticesCost* verts, float max_cost, int& num_triangles, 00238 csTriangleLODAlgo* lodalgo); 00239 }; 00240 00241 #endif // __CS_TRIMESHLOD_H__
Generated for Crystal Space by doxygen 1.3.9.1