csgeom/pmtools.h
Go to the documentation of this file.00001 /* 00002 Copyright (C) 2002 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_PMTOOLS_H__ 00020 #define __CS_PMTOOLS_H__ 00021 00028 class csVector3; 00029 class csPlane3; 00030 struct iPolygonMesh; 00031 00032 #include "csextern.h" 00033 00034 #include "csutil/array.h" 00035 #include "csgeom/polymesh.h" 00036 00040 struct csPolygonMeshEdge 00041 { 00042 // Indices of the two vertices forming the edge. 00043 // vt1 < vt2. 00044 int vt1, vt2; 00045 // Indices of the two polygons sharing this edge. 00046 // If poly2 == -1 then this is an edge with only one polygon attached. 00047 int poly1, poly2; 00048 00049 // Active or not. If this flag is true the edge is active in the sense 00050 // that it actually connects two non-coplanar polygons (or is only 00051 // connected to one polygon). Edges that are not active are not relevant 00052 // for outline calculation. 00053 bool active; 00054 }; 00055 00059 class CS_CSGEOM_EXPORT csPolygonMeshTools 00060 { 00061 public: 00067 static void CalculateNormals (iPolygonMesh* mesh, csVector3* normals); 00068 00074 static void CalculatePlanes (iPolygonMesh* mesh, csPlane3* planes); 00075 00083 static csPolygonMeshEdge* CalculateEdges (iPolygonMesh*, int& num_edges); 00084 00090 static int CheckActiveEdges (csPolygonMeshEdge* edges, int num_edges, 00091 csPlane3* planes); 00092 00114 static void CalculateOutline (csPolygonMeshEdge* edges, int num_edges, 00115 csPlane3* planes, int num_vertices, 00116 const csVector3& pos, 00117 int* outline_edges, int& num_outline_edges, 00118 bool* outline_verts, 00119 float& valid_radius); 00120 00125 static bool IsMeshClosed (iPolygonMesh* polyMesh); 00126 00133 static void CloseMesh (iPolygonMesh* polyMesh, 00134 csArray<csMeshedPolygon>& newPolys, int*& vertidx, int& vertidx_len); 00135 00140 static void Triangulate (iPolygonMesh* polymesh, 00141 csTriangle*& tris, int& tri_count); 00142 00148 static void Polygonize (iPolygonMesh* polymesh, 00149 csMeshedPolygon*& polygons, int& poly_count); 00150 }; 00151 00154 #endif // __CS_PMTOOLS_H__ 00155
Generated for Crystal Space by doxygen 1.2.18