My Project
ParaXStaticModel.h
1 #pragma once
2 #ifdef USE_DIRECTX_RENDERER
3 #include "StaticMesh.h"
4 #endif
5 #include "ParaXStaticBase.h"
6 #include "ParaXStaticModelRenderPass.h"
7 
8 namespace ParaEngine
9 {
10  class CEffectFile;
11  class CFaceGroup;
12  class XFileParser;
13  using namespace std;
14  namespace XFile
15  {
16  struct Node;
17  struct Mesh;
18  struct Scene;
19  struct Material;
20  }
21 
22  //-----------------------------------------------------------------------------
23  // Name: class CParaXStaticModel
25  //-----------------------------------------------------------------------------
27  {
28  public:
30  virtual int GetAttributeClassID() { return ATTRIBUTE_CLASSID_CParaXStaticModel; }
32  virtual const char* GetAttributeClassName() { static const char name[] = "CParaXStaticModel"; return name; }
34  virtual const char* GetAttributeClassDescription() { static const char desc[] = ""; return desc; }
35 
37  virtual int GetPolyCount();
39  virtual int GetPhysicsCount();
41  virtual const char* DumpTextureUsage();
42 
44  virtual int GetNextPhysicsGroupID(int nPhysicsGroup = -1);
45 
52  virtual TextureEntity* GetDefaultReplaceableTexture(int ReplaceableTextureID);
53 
54  // Creation/destruction
59  virtual HRESULT Create(RenderDevicePtr pd3dDevice, void* buffer, DWORD nFileSize, bool bCheckSecondUV = false);
60 #ifdef USE_DIRECTX_RENDERER
61  virtual HRESULT Create(RenderDevicePtr pd3dDevice, LPD3DXFILEDATA pFileData) { return S_FALSE; };
62 #endif
63  virtual HRESULT Create(RenderDevicePtr pd3dDevice, XFile::Scene* pFileData);
64 
65  virtual HRESULT Destroy();
66 
67  // Initializing
68  virtual HRESULT InitDeviceObjects();
69  virtual HRESULT DeleteDeviceObjects();
70 
71  // -- Get Bounding sphere
72  virtual FLOAT ComputeBoundingSphere(Vector3* vObjectCenter, FLOAT* fObjectRadius);
73  virtual HRESULT ComputeBoundingBox(Vector3 *pMin, Vector3 *pMax);
74 
85  virtual HRESULT ClonePhysicsMesh(DWORD* pNumVertices, Vector3 ** ppVerts, DWORD* pNumTriangles, WORD** ppIndices, int* pnMeshPhysicsGroup = nullptr, int* pnTotalMeshGroupCount = nullptr);
86 
89 #ifdef USE_DIRECTX_RENDERER
90  virtual MeshHeader& GetMeshHeader(LPD3DXFILE pFileParser = nullptr) { return GetMeshHeader((XFileParser*)nullptr); };
91 #endif
92  virtual MeshHeader& GetMeshHeader(XFileParser* pFileParser = nullptr);
93 
94 #ifdef USE_DIRECTX_RENDERER
95 
96  virtual bool GetMeshHeaderFromFile(CParaFile& myFile, LPD3DXFILE pFileParser) { return false; };
97 #endif
98  virtual bool GetMeshHeaderFromFile(CParaFile& myFile, XFileParser* pFileParser);
99 
100  // Rendering
101  virtual HRESULT Render(SceneState * pSceneState, RenderDevicePtr pd3dDevice,
102  bool bDrawOpaqueSubsets = true,
103  bool bDrawAlphaSubsets = true, float fAlphaFactor = 1.0f)
104  {
105  return S_OK;
106  };
107 
108  virtual HRESULT Render(SceneState * pSceneState, CEffectFile *pEffect,
109  bool bDrawOpaqueSubsets = true,
110  bool bDrawAlphaSubsets = true, float fAlphaFactor = 1.0f, CParameterBlock* materialParams = nullptr);
111 
116  CParaXStaticModel(const char* strName = nullptr, XFileParser* pXFileParser = nullptr);
117  virtual ~CParaXStaticModel();
118 
119  protected:
120  HRESULT LoadToSystemBuffer(XFile::Scene* pFileData);
121  void BuildRenderBuffer();
122  void DrawRenderPass(int i);
123  protected:
124  std::vector<ParaXStaticModelRenderPass> m_passes;
125 
126  // system buffers
127  std::vector<mesh_vertex_normal> m_vertices;
128 
129  std::vector<int16> m_indices;
130  // device buffers
131  ParaVertexBuffer m_vertexBuffer;
132 
133  ParaIndexBuffer m_indexBuffer;
134  };
135 
136 #ifndef USE_DIRECTX_RENDERER
139 #endif
140 }
Which DXT Compression to Use? Obviously, there are some trade-offs between the different formats whic...
Definition: TextureEntity.h:29
It&#39;s used as parameter to Draw method of each scene object.
Definition: SceneState.h:284
Helper structure analogue to aiScene.
Definition: XFileHelper.h:123
different physics engine has different winding order.
Definition: EventBinding.h:32
Definition: minilua.c:352
mesh header
Definition: MeshHeader.h:6
a very thin wrapper to DirectX device with a portable version of openGL implementation.
Definition: RenderDeviceDirectX.h:10
cross platform vertex/index buffer.
Definition: ParaVertexBuffer.h:18
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
The XFileParser reads a XFile either in text or binary form and builds a temporary data structure out...
Definition: XFileParser.h:19
virtual int GetAttributeClassID()
attribute class ID should be identical, unless one knows how overriding rules work.
Definition: ParaXStaticModel.h:30
virtual const char * GetAttributeClassName()
a static string, describing the attribute class object&#39;s name
Definition: ParaXStaticModel.h:32
virtual const char * GetAttributeClassDescription()
a static string, describing the attribute class object
Definition: ParaXStaticModel.h:34
The ref_ptr class template stores a pointer to a dynamically allocated (AssetEntity|CRefCounted|BaseA...
Definition: PERefPtr.h:13
in OpenGL, there is no different between vertex and index buffer.
Definition: ParaVertexBuffer.h:78
Definition: effect_file.h:323
it presents a real or virtual file in ParaEngine.
Definition: ParaFile.h:31
Desc: Class for loading and rendering file-based meshes.
Definition: ParaXStaticModel.h:26
Definition: ParaXStaticBase.h:32
a list of CParameter{name, value} pairs of anything.
Definition: ParameterBlock.h:108