-
-
Notifications
You must be signed in to change notification settings - Fork 78
/
XFileCharModelParser.h
82 lines (75 loc) · 3.35 KB
/
XFileCharModelParser.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#pragma once
#include "modelheaders.h"
#include "XFileParser.h"
#include "animated.h"
namespace ParaEngine
{
class CParaXModel;
/** parsing character parax model: binary file only. */
class XFileCharModelParser : public XFileParser
{
public:
/** Constructor. Creates a data structure out of the XFile given in the memory block.
* @param pBuffer Null-terminated memory buffer containing the XFile
*/
XFileCharModelParser(const char* pBuffer, int32 nSize);
~XFileCharModelParser();
public:
/** parse parax model */
CParaXModel* ParseParaXModel();
/** Load through a ParaXParser object.
* enumerate all top-level nodes, and save ParaX header struct and nodes data pointers.
*/
bool LoadParaX_Header();
/** processing the body data according to file type.
* LoadParaX_Header() will be called automatically if not called before.
* @see LoadParaX_Header() */
CParaXModel* LoadParaX_Body();
/** Finalize parser object. when the Parser will also be finalized in its destructor. */
void LoadParaX_Finalize();
public:
/** get the raw data pointer at the specified offset.
* return NULL if raw data is not available
*/
inline const char* GetRawData(int nOffset) const { return (m_pRaw != 0) ? (m_pRaw + nOffset) : NULL; };
public:
//** read the header to xheader. */
bool ReadParaXHeader(ParaXHeaderDef& xheader, XFileDataObjectPtr pFileData);
/** read all sub data*/
bool ReadXGlobalSequences(CParaXModel& xmesh, XFileDataObjectPtr pFileData);
bool ReadXVertices(CParaXModel& xmesh, XFileDataObjectPtr pFileData);
bool ReadXTextures(CParaXModel& xmesh, XFileDataObjectPtr pFileData);
bool ReadXAttachments(CParaXModel& xmesh, XFileDataObjectPtr pFileData);
bool ReadXColors(CParaXModel& xmesh, XFileDataObjectPtr pFileData);
bool ReadXTransparency(CParaXModel& xmesh, XFileDataObjectPtr pFileData);
bool ReadXViews(CParaXModel& xmesh, XFileDataObjectPtr pFileData);
bool ReadXIndices0(CParaXModel& xmesh, XFileDataObjectPtr pFileData);
bool ReadXGeosets(CParaXModel& xmesh, XFileDataObjectPtr pFileData);
bool ReadXRenderPass(CParaXModel& xmesh, XFileDataObjectPtr pFileData);
bool ReadXBones(CParaXModel& xmesh, XFileDataObjectPtr pFileData);
bool ReadXTexAnims(CParaXModel& xmesh, XFileDataObjectPtr pFileData);
bool ReadXParticleEmitters(CParaXModel& xmesh, XFileDataObjectPtr pFileData);
bool ReadXRibbonEmitters(CParaXModel& xmesh, XFileDataObjectPtr pFileData);
bool ReadXCameras(CParaXModel& xmesh, XFileDataObjectPtr pFileData);
bool ReadXLights(CParaXModel& xmesh, XFileDataObjectPtr pFileData);
bool ReadXAnimations(CParaXModel& xmesh, XFileDataObjectPtr pFileData);
/** read animation block to Animated<> struct
@param b: animation block.
@param anims: [out] animations
*/
bool ReadAnimationBlock(const AnimationBlock* b, Animated<Vector3>& anims, int *gs);
bool ReadAnimationBlock(const AnimationBlock* b, AnimatedShort& anims, int *gs);
bool ReadAnimationBlock(const AnimationBlock* b, Animated<float>& anims, int *gs);
bool ReadAnimationBlock(const AnimationBlock* b, Animated<Quaternion>& anims, int *gs);
protected:
ParaXHeaderDef m_xheader;
const char* m_pRaw;
XFileDataObjectPtr m_pRoot;
XFileDataObjectPtr m_pParaXBody;
XFileDataObjectPtr m_pParaXRawData;
XFileDataObjectPtr m_pParaXRef;
XFileDataObjectPtr m_pD3DMesh;
XFileDataObjectPtr m_pD3DRootFrame;
bool m_bHeaderLoaded;
};
}