"L. Spiro Engine"

F:/My Projects/LSEngine/Modules/LSEngine/Src/Models/LSEModelInstance.h

00001 
00016 #ifndef __LSE_MODELINSTANCE_H__
00017 #define __LSE_MODELINSTANCE_H__
00018 
00019 #include "../LSEEngine.h"
00020 #include "../Entity/LSEActor.h"
00021 #include "Frustum/LSMFrustum.h"
00022 #include "LSEMeshInstance.h"
00023 #include "ModelManager/LSDModelManager.h"
00024 #include "Models/LSDSharedModel.h"
00025 
00026 namespace lse {
00027 
00028         // == Enumerations.
00032         enum LSE_MODEL_TYPES {
00033                 LSE_MT_MODEL                                                    = (1UL << 0UL),                                         
00034                 LSE_MT_DRAWABLEMODEL                                    = (1UL << 1UL),                                         
00035         };
00036 
00043         class CModelInstance : public CActor {
00044         public :
00045                 // == Various constructors.
00046                 LSE_CALLCTOR                                                    CModelInstance();
00047                 virtual LSE_CALLCTOR                                    ~CModelInstance();
00048                 
00049                 
00050                 // == Types.
00054                 typedef CVectorPoD<CMeshInstance *, LSUINT32>
00055                                                                                                 CMeshList;
00056 
00057 
00058                 // == Functions.
00067                 LSBOOL LSE_CALL                                                 CreateModelFromFile( const LSCHAR * _pcPath, CStdAllocator * _psaAllocator = NULL );
00068 
00072                 LSVOID LSE_CALL                                                 Reset();
00073 
00079                 virtual LSUINT32 LSE_CALL                               EntityType() const;
00080 
00086                 virtual LSUINT32 LSE_CALL                               ModelType() const;
00087 
00093                 LSE_INLINE const CAabb & LSE_CALL               Aabb() const;
00094 
00101                 CMeshInstance * LSE_CALL                                MeshByName( const LSCHAR * _pcName );
00102 
00109                 const CMeshInstance * LSE_CALL                  MeshByName( const LSCHAR * _pcName ) const;
00110                 
00116                 LSE_INLINE CMeshList & LSE_CALL                 Meshes();
00117                 
00123                 LSE_INLINE const CMeshList & LSE_CALL   Meshes() const;
00124 
00125 
00126                 // == Members.
00130                 static CModelManager<CSharedModelPtr>   m_mmModelMan;
00131 
00132 
00133         protected :
00134                 // == Members.
00138                 CSharedModelPtr                                                 m_smpModel;
00139 
00143                 CMeshList                                                               m_mlMeshes;
00144 
00148                 mutable CAabb                                                   m_aAabb;
00149 
00153                 CStdAllocator *                                                 m_psaAllocator;
00154 
00158                 CAllocator                                                              m_aVecAllocator;
00159                 
00160 
00161                 // == Functions.
00169                 virtual CSharedModelPtr LSE_CALL                GetModel( const LSCHAR * _pcPath ) const;
00170 
00176                 virtual CMeshInstance * LSE_CALL                CreateMesh() const;
00177 
00183                 virtual LSBOOL LSE_CALL                                 LoadFinished();
00184 
00191                 CMeshInstance * LSE_CALL                                MeshById( LSUINT64 _ui64Id );
00192 
00196                 virtual LSVOID LSE_CALL                                 WorldDidChange() const;
00197 
00198         private :
00199                 typedef CActor                                                  Parent;
00200         };
00201 
00202 
00203         // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00204         // DEFINITIONS
00205         // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
00206         // == Types.
00210         typedef CSharedPtr<CModelInstance>                      CModelInstancePtr;
00211 
00212         // == Functions.
00218         LSE_INLINE const CAabb & LSE_CALL CModelInstance::Aabb() const {
00219                 UndirtyWorld();
00220                 return m_aAabb;
00221         }
00222         
00228         LSE_INLINE CModelInstance::CMeshList & LSE_CALL CModelInstance::Meshes() {
00229                 return m_mlMeshes;
00230         }
00231         
00237         LSE_INLINE const CModelInstance::CMeshList & LSE_CALL CModelInstance::Meshes() const {
00238                 return m_mlMeshes;
00239         }
00240 
00241 }       // namespace lse
00242 
00243 #endif  // __LSE_MODELINSTANCE_H__
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator