1 | #ifndef _IMGVOXEL_H |
---|
2 | #define _IMGVOXEL_H |
---|
3 | |
---|
4 | |
---|
5 | #include "IMGBBox.h" |
---|
6 | |
---|
7 | namespace IMG { |
---|
8 | |
---|
9 | #define VOXEL_FACE_LEFT 0
|
---|
10 | #define VOXEL_FACE_RIGHT 1
|
---|
11 | #define VOXEL_FACE_BEHIND 2
|
---|
12 | #define VOXEL_FACE_FRONT 3
|
---|
13 | #define VOXEL_FACE_UNDER 4
|
---|
14 | #define VOXEL_FACE_OVER 5
|
---|
15 | #define VOXEL_NO_FACE -1
|
---|
16 | |
---|
17 | //* |
---|
18 | // Voxel |
---|
19 | //* |
---|
20 | class Voxel : public BBox { |
---|
21 | public: |
---|
22 | //Voxel(Ogre::AxisAlignedBox &box); |
---|
23 | Voxel(BBox & box); |
---|
24 | |
---|
25 | Voxel(); |
---|
26 | |
---|
27 | Voxel(const Voxel & v); |
---|
28 | |
---|
29 | inline ~Voxel() {}; |
---|
30 | |
---|
31 | //the real voxel's id from scene, for indexing purpose |
---|
32 | inline unsigned int GetIdVoxel() const { return idvoxel; }; |
---|
33 | |
---|
34 | //return the number of polygons in the voxel |
---|
35 | // Gametools -- Isma 17/08/2005 |
---|
36 | //int GetSizePolygonList() const { return polygonlistid.GetSize(); } |
---|
37 | //int GetSizePatchList() const { return patchlistid.GetSize(); } |
---|
38 | //return pointer to list_id_obspoly; |
---|
39 | //std::vector<unsigned int> * GetIdObsPolyList() { return &list_id_obspoly; } |
---|
40 | //bool InsertPolygon(); |
---|
41 | //set the boundbox of the voxel |
---|
42 | //inline void SetBoundBox(Ogre::AxisAlignedBox *b) |
---|
43 | inline void SetBoundBox(BBox * b) { |
---|
44 | BBox::StartBoundingBox(); |
---|
45 | mMinimum = b->getMinimum(); |
---|
46 | mMaximum = b->getMaximum(); |
---|
47 | }; |
---|
48 | |
---|
49 | inline void SetBoundBox(float x1, float y1, float z1, float x2, float y2, float z2) { |
---|
50 | BBox::StartBoundingBox(); |
---|
51 | BBox::AddBoundingVector3(x1, y1, z1); |
---|
52 | BBox::AddBoundingVector3(x2, y2, z2); |
---|
53 | }; |
---|
54 | |
---|
55 | void Print(); |
---|
56 | |
---|
57 | //print voxel info |
---|
58 | inline Ogre::Vector3 * GetVector3(int i) { |
---|
59 | return BBox::GetCorner(i); |
---|
60 | }; |
---|
61 | |
---|
62 | // Gametools -- Isma 17/08/2005 |
---|
63 | //unsigned int GetNextPatch() //return the id to next patch in the voxel |
---|
64 | //{ |
---|
65 | // if (index < GetSizePatchList()) return patchlistid.Get(index++); |
---|
66 | // //return -1; |
---|
67 | // return 0; |
---|
68 | //} |
---|
69 | // Gametools -- Isma 17/08/2005 |
---|
70 | //unsigned int GetPatch(unsigned int i) { if (i < GetSizePatchList()) return patchlistid.Get(i); else return 0;} |
---|
71 | // Gametools -- Isma 17/08/2005 |
---|
72 | //unsigned int GetPolygon(unsigned int i) { if (i < GetSizePolygonList())return polygonlistid.Get(i); else return 0; } |
---|
73 | // Gametools -- Isma 17/08/2005 |
---|
74 | //unsigned int GetNextObsPoly() //return the id to next obspoly in the voxel |
---|
75 | //{ |
---|
76 | // if (index_obspoly < GetSizePolygonList()) return polygonlistid.Get(index_obspoly++); |
---|
77 | // //return -1; |
---|
78 | // return 0; |
---|
79 | //} |
---|
80 | bool AddPatch(unsigned int id); |
---|
81 | |
---|
82 | //add one patch (only the id) to list_id_patch |
---|
83 | bool AddPoly(unsigned int id); |
---|
84 | |
---|
85 | //add one patch (only the id) to list_id_obspoly |
---|
86 | //reset the index of the patch list |
---|
87 | inline void ResetIndex() { index = 0; }; |
---|
88 | |
---|
89 | //reset the index of the obspolylist |
---|
90 | inline void ResetIndexObsPoly() { index_obspoly = 0; }; |
---|
91 | |
---|
92 | |
---|
93 | private: |
---|
94 | static unsigned int ID_VOXELS; |
---|
95 | |
---|
96 | unsigned int idvoxel; |
---|
97 | |
---|
98 | //for GetNextPatch() |
---|
99 | unsigned int index; |
---|
100 | |
---|
101 | //for GetNextObsPoly |
---|
102 | unsigned int index_obspoly; |
---|
103 | |
---|
104 | std::vector<unsigned int> list_id_obspoly; |
---|
105 | |
---|
106 | std::vector<unsigned int > list_id_patch; |
---|
107 | |
---|
108 | }; |
---|
109 | |
---|
110 | } |
---|
111 | #endif |
---|