Ignore:
Timestamp:
03/31/06 17:29:32 (19 years ago)
Author:
igarcia
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/BBC/BBCEntity.h

    r700 r721  
    44#include <BBCPrerequisites.h> 
    55#include <BBCSubEntity.h> 
     6#include <BBCMesh.h> 
    67 
    78namespace BBC { 
    89 
     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 
    920class _BBCExport Entity  
    1021{ 
     22private: 
     23    long references; 
     24    friend void boost::intrusive_ptr_add_ref(Entity * p); 
     25    friend void boost::intrusive_ptr_release(Entity * p); 
     26 
    1127  protected: 
    1228 
    13         typedef std::vector<SubEntity*> SubEntityList; 
     29        typedef std::vector<SubEntityPtr> SubEntityList; 
    1430 
    1531        unsigned int mEntityHandle; 
     
    1935        SubEntityList mSubEntityList; 
    2036 
    21         Ogre::Mesh *mMesh; 
     37        MeshPtr mMesh; 
    2238         
    2339  public: 
     
    2541    Entity(); 
    2642 
    27     ~Entity(); 
     43    virtual ~Entity(); 
    2844 
    2945        void createSubEntity(); 
    3046 
    31         void addSubEntity(SubEntity *value); 
     47        void addSubEntity(SubEntityPtr value); 
    3248 
    33         SubEntity* getSubEntity(unsigned int index); 
     49        SubEntityPtr getSubEntity(unsigned int index); 
    3450 
    3551        void removeSubEntity(unsigned int index); 
    3652 
    37         virtual Ogre::Mesh* getMesh(); 
     53        virtual MeshPtr getMesh(); 
    3854 
    39         virtual void setMesh(Ogre::Mesh *value); 
     55        virtual void setMesh(MeshPtr value); 
    4056 
    4157        void loadMesh(bool mergeSubMeshes); 
     
    6581}; 
    6682 
     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 
    67105} 
    68106#endif 
Note: See TracChangeset for help on using the changeset viewer.