- Timestamp:
- 03/31/06 17:29:32 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/BBC/BBCEntity.h
r700 r721 4 4 #include <BBCPrerequisites.h> 5 5 #include <BBCSubEntity.h> 6 #include <BBCMesh.h> 6 7 7 8 namespace BBC { 8 9 10 // Forward declarations 11 class Entity; 12 13 14 namespace boost 15 { 16 void intrusive_ptr_add_ref(Entity * p); 17 void intrusive_ptr_release(Entity * p); 18 }; 19 9 20 class _BBCExport Entity 10 21 { 22 private: 23 long references; 24 friend void boost::intrusive_ptr_add_ref(Entity * p); 25 friend void boost::intrusive_ptr_release(Entity * p); 26 11 27 protected: 12 28 13 typedef std::vector<SubEntity *> SubEntityList;29 typedef std::vector<SubEntityPtr> SubEntityList; 14 30 15 31 unsigned int mEntityHandle; … … 19 35 SubEntityList mSubEntityList; 20 36 21 Ogre::Mesh *mMesh;37 MeshPtr mMesh; 22 38 23 39 public: … … 25 41 Entity(); 26 42 27 ~Entity();43 virtual ~Entity(); 28 44 29 45 void createSubEntity(); 30 46 31 void addSubEntity(SubEntity *value);47 void addSubEntity(SubEntityPtr value); 32 48 33 SubEntity *getSubEntity(unsigned int index);49 SubEntityPtr getSubEntity(unsigned int index); 34 50 35 51 void removeSubEntity(unsigned int index); 36 52 37 virtual Ogre::Mesh*getMesh();53 virtual MeshPtr getMesh(); 38 54 39 virtual void setMesh( Ogre::Mesh *value);55 virtual void setMesh(MeshPtr value); 40 56 41 57 void loadMesh(bool mergeSubMeshes); … … 65 81 }; 66 82 83 // class specific addref/release implementation 84 // the two function overloads must be in the boost namespace on most compilers: 85 namespace 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 103 typedef ::boost::intrusive_ptr<Entity> EntityPtr; 104 67 105 } 68 106 #endif
Note: See TracChangeset
for help on using the changeset viewer.