1 | #ifndef _BBCENTITYCLUSTER_H |
---|
2 | #define _BBCENTITYCLUSTER_H |
---|
3 | |
---|
4 | #include <BBCPrerequisites.h> |
---|
5 | #include <BBCEntity.h> |
---|
6 | #include <BBCEntityClusterData.h> |
---|
7 | #include <BBCEntityDistribution.h> |
---|
8 | |
---|
9 | #include <vector> |
---|
10 | |
---|
11 | namespace BBC { |
---|
12 | |
---|
13 | // Forward declarations
|
---|
14 | class EntityCluster;
|
---|
15 |
|
---|
16 |
|
---|
17 | namespace boost
|
---|
18 | {
|
---|
19 | void intrusive_ptr_add_ref(EntityCluster * p);
|
---|
20 | void intrusive_ptr_release(EntityCluster * p);
|
---|
21 | }; |
---|
22 | |
---|
23 | class _BBCExport EntityCluster |
---|
24 | { |
---|
25 | private:
|
---|
26 | long references;
|
---|
27 | friend void boost::intrusive_ptr_add_ref(EntityCluster * p);
|
---|
28 | friend void boost::intrusive_ptr_release(EntityCluster * p); |
---|
29 | |
---|
30 | public: |
---|
31 | EntityCluster(); |
---|
32 | |
---|
33 | virtual ~EntityCluster(); |
---|
34 | |
---|
35 | void removeEntityClusterData(unsigned int value); |
---|
36 | |
---|
37 | EntityClusterDataPtr getEntityClusterData(unsigned int value); |
---|
38 | |
---|
39 | void addEntityClusterData(EntityClusterDataPtr value); |
---|
40 | |
---|
41 | void removeEntitClusterData(unsigned int value); |
---|
42 | |
---|
43 | EntityDistributionPtr getEntityDistribution(); |
---|
44 | |
---|
45 | void setEntityDistribution(EntityDistributionPtr value); |
---|
46 | |
---|
47 | protected: |
---|
48 | |
---|
49 | EntityDistributionPtr mEntityDistribution; |
---|
50 | |
---|
51 | std::vector<EntityClusterDataPtr> mEntityClusterDataList; |
---|
52 | |
---|
53 | std::vector<unsigned int> mBillboarHandle; |
---|
54 | |
---|
55 | EntityPtr mEntity; |
---|
56 | |
---|
57 | unsigned int mBillboardHandle; |
---|
58 | |
---|
59 | public: |
---|
60 | |
---|
61 | EntityPtr getEntity(); |
---|
62 | |
---|
63 | void setEntity(EntityPtr value); |
---|
64 | |
---|
65 | unsigned int getNumEntitiesClusterData(); |
---|
66 | |
---|
67 | unsigned int getBillboardHandle(); |
---|
68 | |
---|
69 | void setBillboardHandle(unsigned int value); |
---|
70 | |
---|
71 | void generateEntityCluster(); |
---|
72 | |
---|
73 | }; |
---|
74 | |
---|
75 | // class specific addref/release implementation
|
---|
76 | // the two function overloads must be in the boost namespace on most compilers:
|
---|
77 | namespace boost
|
---|
78 | {
|
---|
79 | inline void intrusive_ptr_add_ref(EntityCluster * p)
|
---|
80 | {
|
---|
81 | // increment reference count of object *p
|
---|
82 | ++(p->references);
|
---|
83 | }
|
---|
84 |
|
---|
85 |
|
---|
86 |
|
---|
87 | inline void intrusive_ptr_release(EntityCluster * p)
|
---|
88 | {
|
---|
89 | // decrement reference count, and delete object when reference count reaches 0
|
---|
90 | if (--(p->references) == 0)
|
---|
91 | delete p;
|
---|
92 | }
|
---|
93 | } // namespace boost
|
---|
94 |
|
---|
95 | typedef ::boost::intrusive_ptr<EntityCluster> EntityClusterPtr;
|
---|
96 | |
---|
97 | |
---|
98 | } |
---|
99 | #endif |
---|