My Project
ParaXEntity.h
1 #pragma once
2 
3 #include "MeshEntity.h"
4 
5 namespace ParaEngine
6 {
7  class CParaXModel;
8 
9  struct ParaXEntity : public AssetEntity
10  {
11  public:
12  ParaXEntity(const AssetKey& key);
13  ParaXEntity();
14  virtual ~ParaXEntity();
15  ATTRIBUTE_DEFINE_CLASS(ParaXEntity);
16 
18  virtual int InstallFields(CAttributeClass* pClass, bool bOverride);
19 
21  virtual int GetChildAttributeObjectCount(int nColumnIndex = 0);
22  virtual IAttributeFields* GetChildAttributeObject(int nRowIndex, int nColumnIndex = 0);
23 
24  ATTRIBUTE_METHOD1(ParaXEntity, GetFileName_s, const char**) { *p1 = cls->GetFileName().c_str(); return S_OK; }
25 
26  ATTRIBUTE_METHOD1(ParaXEntity, DumpTextureUsage_s, const char**) { *p1 = cls->DumpTextureUsage(); return S_OK; }
27  ATTRIBUTE_METHOD1(ParaXEntity, GetPolyCount_s, int*) { *p1 = cls->GetPolyCount(); return S_OK; }
28  ATTRIBUTE_METHOD1(ParaXEntity, GetPhysicsCount_s, int*) { *p1 = cls->GetPhysicsCount(); return S_OK; }
29 
30 
31  public:
32  friend class CParaXProcessor;
33 
34  virtual void Cleanup();
35  virtual AssetEntity::AssetType GetType(){ return AssetEntity::parax; };
36 
37  CAnimInstanceBase* CreateAnimInstance();
38 
39  virtual HRESULT InitDeviceObjects();
40  virtual HRESULT DeleteDeviceObjects();
41 
46  virtual bool IsLoaded();
47 
50  const std::string& GetFileName();
51 
53 
59  void Refresh(const char* sFilename=NULL,bool bLazyLoad = false);
60 
62  int GetPolyCount();
64  int GetPhysicsCount();
66  const char* DumpTextureUsage();
67 
81  void CreateMeshLODLevel(float fromDepth, const std::string& sFilename);
82 
90  void UpdateManualLodLevel(int index, const std::string& sFilename);
91 
94  int GetLodIndex(float fCameraObjectDist, float fScaling = 1.f) const;
95 
102  int GetLodIndexSquaredDepth(float squaredDepth, float fScaling = 1.f) const;
103 
105  void RemoveLodLevels(void);
106 
110  CParaXModel* GetModel(int nLODIndex=0);
111 
113  void Init(const char* filename=NULL);
114 
120  HRESULT CreateModelFromFile_Serial(RenderDevicePtr pDev=NULL, const char* sFileName=NULL);
121 
128  HRESULT CreateModelFromFile_Async(void* pContext, RenderDevicePtr pDev = NULL, const char* sFileName = NULL);
129 
130  void SetPrimaryTechniqueHandle(int nHandle);
131  int GetPrimaryTechniqueHandle();
132 
134  virtual bool GetBoundingBox(Vector3* pMin, Vector3* pMax);
135  private:
138  std::vector<MeshLOD> m_MeshLODs;
139 
141  int m_nTechniqueHandle;
142  };
143 
145 }
virtual bool GetBoundingBox(Vector3 *pMin, Vector3 *pMax)
Get AABB bounding box of the asset object.
Definition: ParaXEntity.cpp:262
int GetPolyCount()
get polycount of this mesh object
Definition: ParaXEntity.cpp:284
HRESULT CreateModelFromFile_Async(void *pContext, RenderDevicePtr pDev=NULL, const char *sFileName=NULL)
this function is mostly used internally.
Definition: ParaXEntity.cpp:131
an attribute class is a collection of attribute fields.
Definition: AttributeClass.h:10
abstract class for all animation instance implementation.
Definition: AnimInstanceBase.h:66
void RemoveLodLevels(void)
Removes all LOD data from this Mesh.
Definition: ParaXEntity.cpp:243
virtual int InstallFields(CAttributeClass *pClass, bool bOverride)
this class should be implemented if one wants to add new attribute.
Definition: ParaXEntity.cpp:302
int GetPhysicsCount()
get physics polycount of this mesh object
Definition: ParaXEntity.cpp:290
AssetType
each asset type has a unique asset type number
Definition: AssetEntity.h:82
different physics engine has different winding order.
Definition: EventBinding.h:32
a very thin wrapper to DirectX device with a portable version of openGL implementation.
Definition: RenderDeviceDirectX.h:10
const char * DumpTextureUsage()
get texture usage such as the number of textures and their sizes.
Definition: ParaXEntity.cpp:296
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
AssetManager manages a set of asset entities of a certain type.
Definition: AssetManager.h:13
void Refresh(const char *sFilename=NULL, bool bLazyLoad=false)
refresh this texture surface with a local file.
Definition: ParaXEntity.cpp:85
void UpdateManualLodLevel(int index, const std::string &sFilename)
Changes the alternate mesh to use as a manual LOD at the given index.
Definition: ParaXEntity.cpp:193
int GetLodIndex(float fCameraObjectDist, float fScaling=1.f) const
Retrieves the level of detail index for the given depth value.
Definition: ParaXEntity.cpp:206
Definition: ParaXEntity.h:9
CParaXModel * GetModel(int nLODIndex=0)
get the highest level mesh if LOD is enabled.
Definition: ParaXEntity.cpp:167
HRESULT CreateModelFromFile_Serial(RenderDevicePtr pDev=NULL, const char *sFileName=NULL)
this function is mostly used internally.
Definition: ParaXEntity.cpp:101
virtual int GetChildAttributeObjectCount(int nColumnIndex=0)
get the number of child objects (row count) in the given column.
Definition: ParaXEntity.cpp:274
virtual bool IsLoaded()
most assets are loaded asynchronously.
Definition: ParaXEntity.cpp:177
A common interface for all classes implementing IAttributeFields By implementing this class&#39;s virtual...
Definition: IAttributeFields.h:59
const std::string & GetFileName()
name of the model file(*.x) name holding the parax object get the mesh file name of the lowest level ...
Definition: ParaXEntity.cpp:155
void CreateMeshLODLevel(float fromDepth, const std::string &sFilename)
Adds a new level-of-detail entry to this Mesh.
Definition: ParaXEntity.cpp:182
virtual void Cleanup()
Clean up additional resources.
Definition: ParaXEntity.cpp:251
virtual IAttributeFields * GetAttributeObject()
get the attribute object of this asset.
Definition: ParaXEntity.cpp:257
CParaXProcessor implementation of IDataProcessor.
Definition: ContentLoaderParaX.h:47
int GetLodIndexSquaredDepth(float squaredDepth, float fScaling=1.f) const
Retrieves the level of detail index for the given squared depth value.
Definition: ParaXEntity.cpp:211
std::string AssetKey
the unique key object for asset entity.
Definition: AssetEntity.h:13
void Init(const char *filename=NULL)
init the parax model.
Definition: ParaXEntity.cpp:149
ParaX model is the model file for character animation, etc in the game world.
Definition: ParaXModel.h:30
Base class for managed asset entity in ParaEngine.
Definition: AssetEntity.h:25