source: GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/BBC/BBCEntityCluster.h @ 721

Revision 721, 2.0 KB checked in by igarcia, 19 years ago (diff)
Line 
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
11namespace BBC {
12
13// Forward declarations
14class EntityCluster;
15
16
17namespace boost
18{
19    void intrusive_ptr_add_ref(EntityCluster * p);
20    void intrusive_ptr_release(EntityCluster * p);
21};
22
23class _BBCExport EntityCluster
24{
25private:
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:
77namespace 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
95typedef ::boost::intrusive_ptr<EntityCluster> EntityClusterPtr;
96
97
98}
99#endif
Note: See TracBrowser for help on using the repository browser.