1 | #ifndef _BBCBILLBOARDCLUSTERDATA_H |
---|
2 | #define _BBCBILLBOARDCLUSTERDATA_H |
---|
3 | |
---|
4 | #include <BBCEntityCluster.h> |
---|
5 | |
---|
6 | namespace BBC { |
---|
7 | |
---|
8 | // Fordward declaration... |
---|
9 | class BillboardClusterData; |
---|
10 | |
---|
11 | namespace boost
|
---|
12 | {
|
---|
13 | void intrusive_ptr_add_ref(BillboardClusterData * p);
|
---|
14 | void intrusive_ptr_release(BillboardClusterData * p);
|
---|
15 | }; |
---|
16 | |
---|
17 | class _BBCExport BillboardClusterData |
---|
18 | { |
---|
19 | private:
|
---|
20 | long references;
|
---|
21 | friend void boost::intrusive_ptr_add_ref(BillboardClusterData * p);
|
---|
22 | friend void boost::intrusive_ptr_release(BillboardClusterData * p); |
---|
23 | |
---|
24 | public: |
---|
25 | BillboardClusterData(); |
---|
26 | |
---|
27 | virtual ~BillboardClusterData(); |
---|
28 | |
---|
29 | void setNormal(Ogre::Vector3 value); |
---|
30 | |
---|
31 | Ogre::Vector3 getNormal(); |
---|
32 | |
---|
33 | void setD(float value); |
---|
34 | |
---|
35 | float getD(); |
---|
36 | |
---|
37 | EntityClusterPtr getEntityCluster(); |
---|
38 | |
---|
39 | void setEntityCluster(EntityClusterPtr value); |
---|
40 | |
---|
41 | virtual void readBillboardClusterData(TiXmlNode *parentNode); |
---|
42 | |
---|
43 | virtual void writeBillboardClusterData(TiXmlNode *parentNode); |
---|
44 | |
---|
45 | virtual void generateBillboardBoundingQuad(); |
---|
46 | |
---|
47 | Ogre::Vector3 getQuadTopLeftCorner(); |
---|
48 | |
---|
49 | Ogre::Vector3 getQuadTopRightCorner(); |
---|
50 | |
---|
51 | Ogre::Vector3 getQuadBottomLeftCorner(); |
---|
52 | |
---|
53 | Ogre::Vector3 getQuadBottomRightCorner(); |
---|
54 | |
---|
55 | Ogre::Vector3 getAxisX(); |
---|
56 | |
---|
57 | Ogre::Vector3 getAxisY(); |
---|
58 | |
---|
59 | Ogre::Vector3 getAxisZ(); |
---|
60 | |
---|
61 | |
---|
62 | |
---|
63 | protected: |
---|
64 | EntityClusterPtr mEntityCluster; |
---|
65 | |
---|
66 | Ogre::Vector3 mAxisX; |
---|
67 | |
---|
68 | Ogre::Vector3 mAxisY; |
---|
69 | |
---|
70 | Ogre::Vector3 mAxisZ; |
---|
71 | |
---|
72 | enum BoundingQuadVertex { |
---|
73 | QUAD_TOP_LEFT, |
---|
74 | QUAD_TOP_RIGHT, |
---|
75 | QUAD_BOTTOM_RIGHT, |
---|
76 | QUAD_BOTTOM_LEFT |
---|
77 | }; |
---|
78 |
|
---|
79 | Ogre::Vector3 mBillboardCorners[4]; |
---|
80 | |
---|
81 | Ogre::Vector3 mNormal; |
---|
82 | |
---|
83 | float mD; |
---|
84 | |
---|
85 | }; |
---|
86 | |
---|
87 | // class specific addref/release implementation
|
---|
88 | // the two function overloads must be in the boost namespace on most compilers:
|
---|
89 | namespace boost
|
---|
90 | {
|
---|
91 | inline void intrusive_ptr_add_ref(BillboardClusterData * p)
|
---|
92 | {
|
---|
93 | // increment reference count of object *p
|
---|
94 | ++(p->references);
|
---|
95 | }
|
---|
96 |
|
---|
97 |
|
---|
98 |
|
---|
99 | inline void intrusive_ptr_release(BillboardClusterData * p)
|
---|
100 | {
|
---|
101 | // decrement reference count, and delete object when reference count reaches 0
|
---|
102 | if (--(p->references) == 0)
|
---|
103 | delete p;
|
---|
104 | }
|
---|
105 | } // namespace boost |
---|
106 | |
---|
107 | typedef ::boost::intrusive_ptr<BillboardClusterData> BillboardClusterDataPtr; |
---|
108 | |
---|
109 | } |
---|
110 | #endif |
---|