My Project
ContentLoaderMesh.h
1 #pragma once
2 
3 #include "MeshEntity.h"
4 #include "ShapeAABB.h"
5 #include "IDataLoader.h"
6 
7 namespace ParaEngine
8 {
9  struct AssetFileEntry;
10 
16  class CMeshLoader : public IDataLoader
17  {
18  private:
19  friend struct MeshEntity;
20 
22  asset_ptr<MeshEntity> m_asset;
23  // if this is "", m_asset->GetLocalFileName() is used.
24  std::string m_sFileName;
25 
26  public:
30  CMeshLoader(asset_ptr<MeshEntity>& pAsset, const char* sFileName = NULL);
31  ~CMeshLoader();
32 
34  HRESULT CleanUp();
35 
36  // overrides
37  public:
39  const char* GetFileName();
41  HRESULT Decompress(void** ppData, int* pcBytes);
43  HRESULT Destroy();
45  HRESULT Load();
46  };
47 
52  {
53  private:
54  friend struct MeshEntity;
55 
57  asset_ptr<MeshEntity> m_asset;
59  RenderDevicePtr m_pDevice;
60 
61  char* m_pData;
62  int m_cBytes;
63 
66  std::vector<MeshLOD> m_MeshLODs;
67 
69  CParameterBlock* m_pParamBlock;
70 
72  int m_nTechniqueHandle;
73 
74  // aabb of the object
75  CShapeAABB m_aabb;
76 
78  AssetFileEntry* m_pAssetFileEntry;
79  private:
80  bool PopulateMesh();
81 
82  CParameterBlock* GetParamBlock(bool bCreateIfNotExist = false);
83  bool CreateMeshLODLevel(float fromDepth, const string& sFilename);
84 
85  public:
86  CMeshProcessor(asset_ptr<MeshEntity>& pAsset);
87  ~CMeshProcessor();
88 
90  RenderDevicePtr GetRenderDevice();
91 
93  HRESULT CleanUp();
94  // overrides
95  public:
96  HRESULT LockDeviceObject();
97  HRESULT UnLockDeviceObject();
98  HRESULT Destroy();
99  HRESULT Process(void* pData, int cBytes);
100  HRESULT CopyToResource();
101  void SetResourceError();
102  };
103 }
HRESULT Load()
Load is called from the IO thread to load data.
Definition: ContentLoaderMesh.cpp:60
CMeshProcessor implementation of IDataProcessor.
Definition: ContentLoaderMesh.h:51
HRESULT CleanUp()
clean up everything
Definition: ContentLoaderMesh.cpp:49
light-weighted file record header in memory.
Definition: AssetManifest.h:10
different physics engine has different winding order.
Definition: EventBinding.h:32
CMeshLoader implementation of IDataLoader it will first search locally.
Definition: ContentLoaderMesh.h:16
a very thin wrapper to DirectX device with a portable version of openGL implementation.
Definition: RenderDeviceDirectX.h:10
CMeshLoader(asset_ptr< MeshEntity > &pAsset, const char *sFileName=NULL)
Definition: ContentLoaderMesh.cpp:19
AABB-related code.
Definition: ShapeAABB.h:11
IDataProcessor is an interface that the AsyncLoader class uses to process and copy data into locked r...
Definition: IDataLoader.h:76
HRESULT Destroy()
Destroy is called by the graphics thread when it has consumed the data.
Definition: ContentLoaderMesh.cpp:54
const char * GetFileName()
get file name
Definition: ContentLoaderMesh.cpp:31
IDataLoader is an interface that the AsyncLoader class uses to load data from disk.
Definition: IDataLoader.h:14
MeshEntity distinguish one template from other.
Definition: MeshEntity.h:38
HRESULT Decompress(void **ppData, int *pcBytes)
Decompress is called by one of the processing threads to decompress the data.
Definition: ContentLoaderMesh.cpp:44
a list of CParameter{name, value} pairs of anything.
Definition: ParameterBlock.h:108