CrystalSpace

Public API Reference

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

csgeom/trimesh.h

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_TRIMESH_H__
00020 #define __CS_TRIMESH_H__
00021 
00022 #include "csgeom/tri.h"
00023 #include "csgeom/math3d.h"
00024 #include "csutil/garray.h"
00025 #include "csutil/array.h"
00026 
00032 class csTriangleMesh
00033 {
00034 protected:
00036   csDirtyAccessArray<csTriangle> triangles;
00037 
00038 public:
00040   csTriangleMesh () { }
00042   csTriangleMesh (const csTriangleMesh& mesh);
00044   ~csTriangleMesh ();
00045 
00047   void AddTriangle (int a, int b, int c);
00049   csTriangle* GetTriangles () { return triangles.GetArray (); }
00051   const csTriangle* GetTriangles () const { return triangles.GetArray (); }
00053   csTriangle& GetTriangle (int i) { return triangles[i]; }
00055   int GetTriangleCount () const { return triangles.Length (); }
00056 
00058   void Clear ();
00060   void SetSize (int count);
00062   void SetTriangles (csTriangle const* trigs, int count);
00063 };
00064 
00070 class csTriangleVertex
00071 {
00072 public:
00074   csVector3 pos;
00076   int idx;
00077 
00079   csArray<int> con_triangles;
00080 
00082   csArray<int> con_vertices;
00083 
00085   csTriangleVertex () { }
00087   ~csTriangleVertex () { }
00089   void AddTriangle (int idx);
00091   void AddVertex (int idx);
00092 };
00093 
00098 class csTriangleVertices
00099 {
00100 protected:
00101   csTriangleVertex* vertices;
00102   int num_vertices;
00103 
00104 public:
00106   csTriangleVertices (csTriangleMesh* mesh, csVector3* verts, int num_verts);
00108   ~csTriangleVertices ();
00113   void UpdateVertices (csVector3* verts);
00114 
00116   int GetVertexCount () const { return num_vertices; }
00118   csTriangleVertex& GetVertex (int idx) { return vertices[idx]; }
00119 };
00120 
00121 #endif // __CS_TRIMESH_H__
00122 

Generated for Crystal Space by doxygen 1.2.18