My Project
ParaMeshXMLFile.h
1 #pragma once
2 #include <vector>
3 #include <string>
4 #include "ParameterBlock.h"
5 namespace ParaEngine
6 {
7  using namespace std;
8 
30  {
31  public:
32  CParaMeshXMLFile(void);
33  ~CParaMeshXMLFile(void);
34 
37  {
38  TYPE_MESH_LOD,
39  TYPE_CHARACTER_LOD,
40  TYPE_MESH_BSP,
41  TYPE_MESH_GROUP,
42  };
43 
46  class CSubMesh
47  {
48  public:
49  CSubMesh():m_fToCameraDist(0.f){};
50  CSubMesh(float toCameraDist, const string& filename):m_fToCameraDist(toCameraDist), m_sFileName(filename){};
51 
53  float m_fToCameraDist;
54 
56  string m_sFileName;
57  };
58 
59  public:
63  bool LoadFromFile(const string& filename);
64 
66  bool LoadFromFile(const string& filename, const string& parentDir);
67 
71  bool LoadFromBuffer(const char* pData, int nSize);
72 
73 
75  void SetParentDirectory(const string& parentDir){m_sParentDirectory = parentDir;}
76 
78  const string& GetParentDirectory() { return m_sParentDirectory;}
79 
84  bool SaveToFile(const string& filename);
85 
87  ParaMeshXMLType GetType(){return m_nType;};
88 
94  int GetPrimaryShaderIndex() { return m_nPrimaryShader; }
95 
97  int GetSubMeshCount(){return (int)m_SubMeshes.size();}
98 
100  CSubMesh* GetSubMesh(int nIndex){
101  return (nIndex<(int)m_SubMeshes.size()) ? (&(m_SubMeshes[nIndex])) : NULL;
102  }
103 
104  public:
105 
108 
115 
118 
120  vector <CSubMesh> m_SubMeshes;
121 
124 
131 
134  };
135 
136 }
ParaMeshXMLType
type of the mesh that this file represents.
Definition: ParaMeshXMLFile.h:36
CSubMesh * GetSubMesh(int nIndex)
get the sub mesh info at the given index.
Definition: ParaMeshXMLFile.h:100
void SetParentDirectory(const string &parentDir)
set such as "model/", relative path will be appended with this one.
Definition: ParaMeshXMLFile.h:75
CParameterBlock m_paramBlock
effect parameter block with this asset.
Definition: ParaMeshXMLFile.h:133
float m_fToCameraDist
distance to camera.when this LOD mesh should be drawn.
Definition: ParaMeshXMLFile.h:50
sub LOD meshes.
Definition: ParaMeshXMLFile.h:46
different physics engine has different winding order.
Definition: EventBinding.h:32
int GetSubMeshCount()
get the number of sub meshes
Definition: ParaMeshXMLFile.h:97
const string & GetParentDirectory()
get such as "model/", relative path will be appended with this one.
Definition: ParaMeshXMLFile.h:78
int m_nVersion
file version
Definition: ParaMeshXMLFile.h:117
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
vector< CSubMesh > m_SubMeshes
sub meshes info.
Definition: ParaMeshXMLFile.h:120
string m_sFileName
absolute file name of the mesh
Definition: ParaMeshXMLFile.h:56
ParaMeshXMLType GetType()
get the type of the mesh that this file represents.
Definition: ParaMeshXMLFile.h:87
int GetPrimaryShaderIndex()
see ParaEngine::TechniqueHandle.
Definition: ParaMeshXMLFile.h:94
int m_nPrimaryShader
see ParaEngine::TechniqueHandle.
Definition: ParaMeshXMLFile.h:114
Para mesh XML file is a reference file for properly loading static mesh or parax mesh file...
Definition: ParaMeshXMLFile.h:29
Vector3 m_vMaxPos
bounding box of the mesh: max point
Definition: ParaMeshXMLFile.h:130
ParaMeshXMLType m_nType
type of the mesh file.
Definition: ParaMeshXMLFile.h:107
string m_sParentDirectory
such as "model/", relative path will be appended with this one.
Definition: ParaMeshXMLFile.h:123
Vector3 m_vMinPos
bounding box of the mesh: min point
Definition: ParaMeshXMLFile.h:128
bool m_bHasBoundingBox
bounding box of the mesh: whether contains bounding box info
Definition: ParaMeshXMLFile.h:126
a list of CParameter{name, value} pairs of anything.
Definition: ParameterBlock.h:108