Line | |
---|
1 | #ifndef _IMGNODEBSP_H |
---|
2 | #define _IMGNODEBSP_H |
---|
3 | |
---|
4 | #include "IMGPrerequisites.h" |
---|
5 | #include "IMGBox2d.h" |
---|
6 | |
---|
7 | namespace IMG { |
---|
8 | |
---|
9 | class NodeBsp { |
---|
10 | public: |
---|
11 | NodeBsp(); |
---|
12 | |
---|
13 | Box2d * GetBound(); |
---|
14 | |
---|
15 | inline void SetBound(Box2d * box) { bound = box; }; |
---|
16 | |
---|
17 | inline NodeBsp * GetChild(int i) { return child[i]; }; |
---|
18 | |
---|
19 | inline void SetId(int id_) { id = id_; }; |
---|
20 | |
---|
21 | inline unsigned int GetId() const { return id; }; |
---|
22 | |
---|
23 | inline void SetChild(NodeBsp * node, int i) { child[i] = node; }; |
---|
24 | |
---|
25 | void Print(); |
---|
26 | |
---|
27 | //void SetPlane (Plane3 *pla) { plane = pla; } |
---|
28 | //Plane3 * GetPlane () { return plane; } |
---|
29 | NodeBsp * Insert(int w, int h); |
---|
30 | |
---|
31 | inline NodeBsp * Get(NodeBsp * node, int i) { |
---|
32 | if (!node) return NULL; |
---|
33 | if (node->GetId() == i ) return node; |
---|
34 | |
---|
35 | NodeBsp *nod; |
---|
36 | if (nod = node->GetChild(0)->Get (node->GetChild(0), i)) return nod; |
---|
37 | |
---|
38 | return node->GetChild(0)->Get (node->GetChild(1), i); |
---|
39 | |
---|
40 | }; |
---|
41 | |
---|
42 | |
---|
43 | private: |
---|
44 | bool fit; |
---|
45 | |
---|
46 | Box2d * bound; |
---|
47 | |
---|
48 | NodeBsp * child[2]; |
---|
49 | |
---|
50 | static unsigned int ID; |
---|
51 | |
---|
52 | int id; |
---|
53 | |
---|
54 | |
---|
55 | public: |
---|
56 | ~NodeBsp(); |
---|
57 | |
---|
58 | }; |
---|
59 | |
---|
60 | } |
---|
61 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.