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

Revision 721, 2.1 KB checked in by igarcia, 19 years ago (diff)
Line 
1#ifndef _BBCENTITY_H
2#define _BBCENTITY_H
3
4#include <BBCPrerequisites.h>
5#include <BBCSubEntity.h>
6#include <BBCMesh.h>
7
8namespace BBC {
9
10// Forward declarations
11class Entity;
12
13
14namespace boost
15{
16    void intrusive_ptr_add_ref(Entity * p);
17    void intrusive_ptr_release(Entity * p);
18};
19
20class _BBCExport Entity
21{
22private:
23    long references;
24    friend void boost::intrusive_ptr_add_ref(Entity * p);
25    friend void boost::intrusive_ptr_release(Entity * p);
26
27  protected:
28
29        typedef std::vector<SubEntityPtr> SubEntityList;
30
31        unsigned int mEntityHandle;
32
33    unsigned int mBillboardHandle;
34
35        SubEntityList mSubEntityList;
36
37        MeshPtr mMesh;
38       
39  public:
40
41    Entity();
42
43    virtual ~Entity();
44
45        void createSubEntity();
46
47        void addSubEntity(SubEntityPtr value);
48
49        SubEntityPtr getSubEntity(unsigned int index);
50
51        void removeSubEntity(unsigned int index);
52
53        virtual MeshPtr getMesh();
54
55        virtual void setMesh(MeshPtr value);
56
57        void loadMesh(bool mergeSubMeshes);
58
59        void getMeshPositions(Ogre::Vector3 position, Ogre::Quaternion orient, Ogre::Vector3 scale, bool mergeSubMeshes);
60
61        void getMeshNormals(Ogre::Quaternion orient, Ogre::Vector3 scale, bool mergeSubMeshes);
62
63        void getMeshVertexColours(bool mergeSubMeshes);
64
65        void getMeshTexCoords(bool mergeSubMeshes);
66
67        void getMeshFacesVerticesID(bool mergeSubMeshes);
68
69        void setSubEntitiesDistinctVertexColours();
70
71    unsigned int getEntityHandle();
72
73    void setEntityHandle(unsigned int value);
74
75        void sincronizeNumSubEntities();
76
77        unsigned int getNumSubEntities();
78
79        void mergeSubEntities();
80
81};
82
83// class specific addref/release implementation
84// the two function overloads must be in the boost namespace on most compilers:
85namespace boost
86{
87 inline void intrusive_ptr_add_ref(Entity * p)
88  {
89    // increment reference count of object *p
90    ++(p->references);
91  }
92
93
94
95 inline void intrusive_ptr_release(Entity * p)
96  {
97   // decrement reference count, and delete object when reference count reaches 0
98   if (--(p->references) == 0)
99     delete p;
100  }
101} // namespace boost
102
103typedef ::boost::intrusive_ptr<Entity> EntityPtr;
104
105}
106#endif
Note: See TracBrowser for help on using the repository browser.