Line | |
---|
1 | #ifndef _BILLBOARDGROUP_H |
---|
2 | #define _BILLBOARDGROUP_H |
---|
3 | |
---|
4 | #include <BBCPrerequisites.h> |
---|
5 | |
---|
6 | namespace BBC { |
---|
7 | |
---|
8 | typedef struct |
---|
9 | { |
---|
10 | unsigned int billboardHandle; |
---|
11 | unsigned int width; |
---|
12 | unsigned int height; |
---|
13 | Ogre::Vector2 min; |
---|
14 | Ogre::Vector2 max; |
---|
15 | } BillboardGroupedInfo; |
---|
16 | |
---|
17 | // Forward declarations
|
---|
18 | class BillboardGroup;
|
---|
19 |
|
---|
20 |
|
---|
21 | namespace boost
|
---|
22 | {
|
---|
23 | void intrusive_ptr_add_ref(BillboardGroup * p);
|
---|
24 | void intrusive_ptr_release(BillboardGroup * p);
|
---|
25 | }; |
---|
26 | |
---|
27 | class BillboardGroup |
---|
28 | { |
---|
29 | private:
|
---|
30 | long references;
|
---|
31 | friend void boost::intrusive_ptr_add_ref(BillboardGroup * p);
|
---|
32 | friend void boost::intrusive_ptr_release(BillboardGroup * p); |
---|
33 | |
---|
34 | protected: |
---|
35 | std::vector<unsigned int> mBillboardHandleList; |
---|
36 | |
---|
37 | public: |
---|
38 | |
---|
39 | BillboardGroup(); |
---|
40 | |
---|
41 | virtual ~BillboardGroup(); |
---|
42 | |
---|
43 | unsigned int getBillboardHandle(unsigned int iBillboard); |
---|
44 | |
---|
45 | void addBillboardHandle(unsigned int iBillboardHandle); |
---|
46 | |
---|
47 | unsigned int getNumBillboards(); |
---|
48 | |
---|
49 | }; |
---|
50 | |
---|
51 | // class specific addref/release implementation
|
---|
52 | // the two function overloads must be in the boost namespace on most compilers:
|
---|
53 | namespace boost
|
---|
54 | {
|
---|
55 | inline void intrusive_ptr_add_ref(BillboardGroup * p)
|
---|
56 | {
|
---|
57 | // increment reference count of object *p
|
---|
58 | ++(p->references);
|
---|
59 | }
|
---|
60 |
|
---|
61 |
|
---|
62 |
|
---|
63 | inline void intrusive_ptr_release(BillboardGroup * p)
|
---|
64 | {
|
---|
65 | // decrement reference count, and delete object when reference count reaches 0
|
---|
66 | if (--(p->references) == 0)
|
---|
67 | delete p;
|
---|
68 | }
|
---|
69 | } // namespace boost
|
---|
70 |
|
---|
71 | typedef ::boost::intrusive_ptr<BillboardGroup> BillboardGroupPtr;
|
---|
72 | |
---|
73 | } |
---|
74 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.