[700] | 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 | |
---|
[721] | 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 | |
---|
[700] | 30 | public: |
---|
| 31 | EntityCluster(); |
---|
| 32 | |
---|
[721] | 33 | virtual ~EntityCluster(); |
---|
[700] | 34 | |
---|
[721] | 35 | void removeEntityClusterData(unsigned int value); |
---|
[700] | 36 | |
---|
[721] | 37 | EntityClusterDataPtr getEntityClusterData(unsigned int value); |
---|
[700] | 38 | |
---|
[721] | 39 | void addEntityClusterData(EntityClusterDataPtr value); |
---|
| 40 | |
---|
[700] | 41 | void removeEntitClusterData(unsigned int value); |
---|
| 42 | |
---|
[721] | 43 | EntityDistributionPtr getEntityDistribution(); |
---|
[700] | 44 | |
---|
[721] | 45 | void setEntityDistribution(EntityDistributionPtr value); |
---|
[700] | 46 | |
---|
| 47 | protected: |
---|
| 48 | |
---|
[721] | 49 | EntityDistributionPtr mEntityDistribution; |
---|
[700] | 50 | |
---|
[721] | 51 | std::vector<EntityClusterDataPtr> mEntityClusterDataList; |
---|
[700] | 52 | |
---|
| 53 | std::vector<unsigned int> mBillboarHandle; |
---|
| 54 | |
---|
[721] | 55 | EntityPtr mEntity; |
---|
[700] | 56 | |
---|
| 57 | unsigned int mBillboardHandle; |
---|
| 58 | |
---|
| 59 | public: |
---|
| 60 | |
---|
[721] | 61 | EntityPtr getEntity(); |
---|
[700] | 62 | |
---|
[721] | 63 | void setEntity(EntityPtr value); |
---|
[700] | 64 | |
---|
| 65 | unsigned int getNumEntitiesClusterData(); |
---|
| 66 | |
---|
| 67 | unsigned int getBillboardHandle(); |
---|
| 68 | |
---|
| 69 | void setBillboardHandle(unsigned int value); |
---|
| 70 | |
---|
| 71 | void generateEntityCluster(); |
---|
| 72 | |
---|
| 73 | }; |
---|
| 74 | |
---|
[721] | 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 | |
---|
[700] | 98 | } |
---|
| 99 | #endif |
---|