Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IceTrilist.h
Go to the documentation of this file.
1 
8 
11 // Include Guard
12 #ifndef __ICETRILIST_H__
13 #define __ICETRILIST_H__
14 
16  {
17  public:
18  // Constructor / Destructor
19  TriList() {}
20  ~TriList() {}
21 
22  inline_ udword GetNbTriangles() const { return GetNbEntries()/9; }
23  inline_ Triangle* GetTriangles() const { return (Triangle*)GetEntries(); }
24 
25  void AddTri(const Triangle& tri)
26  {
27  Add(tri.mVerts[0].x).Add(tri.mVerts[0].y).Add(tri.mVerts[0].z);
28  Add(tri.mVerts[1].x).Add(tri.mVerts[1].y).Add(tri.mVerts[1].z);
29  Add(tri.mVerts[2].x).Add(tri.mVerts[2].y).Add(tri.mVerts[2].z);
30  }
31 
32  void AddTri(const Point& p0, const Point& p1, const Point& p2)
33  {
34  Add(p0.x).Add(p0.y).Add(p0.z);
35  Add(p1.x).Add(p1.y).Add(p1.z);
36  Add(p2.x).Add(p2.y).Add(p2.z);
37  }
38  };
39 
41  {
42  public:
43  // Constructor / Destructor
46 
47  inline_ udword GetNbTriangles() const { return GetNbEntries()/3; }
49 
50  void AddTriangle(const IndexedTriangle& tri)
51  {
52  Add(tri.mVRef[0]).Add(tri.mVRef[1]).Add(tri.mVRef[2]);
53  }
54 
55  void AddTriangle(udword vref0, udword vref1, udword vref2)
56  {
57  Add(vref0).Add(vref1).Add(vref2);
58  }
59  };
60 
61 #endif //__ICETRILIST_H__