CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

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 
00035 struct csPolygonMeshEdge
00036 {
00037   // Indices of the two vertices forming the edge.
00038   // vt1 < vt2.
00039   int vt1, vt2;
00040   // Indices of the two polygons sharing this edge.
00041   // If poly2 == -1 then this is an edge with only one polygon attached.
00042   int poly1, poly2;
00043 
00044   // Active or not. If this flag is true the edge is active in the sense
00045   // that it actually connects two non-coplanar polygons (or is only
00046   // connected to one polygon). Edges that are not active are not relevant
00047   // for outline calculation.
00048   bool active;
00049 };
00050 
00054 class csPolygonMeshTools
00055 {
00056 public:
00062   static void CalculateNormals (iPolygonMesh* mesh, csVector3* normals);
00063 
00069   static void CalculatePlanes (iPolygonMesh* mesh, csPlane3* planes);
00070 
00078   static csPolygonMeshEdge* CalculateEdges (iPolygonMesh*, int& num_edges);
00079 
00085   static int CheckActiveEdges (csPolygonMeshEdge* edges, int num_edges,
00086         csPlane3* planes);
00087 
00109   static void CalculateOutline (csPolygonMeshEdge* edges, int num_edges,
00110         csPlane3* planes, int num_vertices,
00111         const csVector3& pos,
00112         int* outline_edges, int& num_outline_edges,
00113         bool* outline_verts,
00114         float& valid_radius);
00115 };
00116 
00119 #endif // __CS_PMTOOLS_H__
00120 

Generated for Crystal Space by doxygen 1.2.14