Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
IOModel_X.h
Go to the documentation of this file.
1 // IOModel_X.h
3 // load/save X file descriptions
4 //
6 
7 #ifndef IOMODEL_X
8 #define IOMODEL_X
9 
10 #define DEBUG
11 #include <fstream>
12 #include <GL\freeglut.h>
13 
14 #include "../ToolBox\XFileStructs.h"
15 #include "../Toolbox\MyTrace.h"
16 #include "../framework\frm_IO.h"
17 #include "../framework\Frm_Mesh.h"
18 
19 namespace ToolBox {
20 
21 class IO_Model_X: Frm::IO<Frm::Model3D*>{
22  public:
23  IO_Model_X(void){_Type = IO_3DX;};
24  bool Load(std::string pFilename, Frm::Model3D* &pT);
25  bool Save(std::string pFilename, Frm::Model3D* &pT);
26  bool Load(std::string pFilename, std::vector<Frm::Model3D*> &pVT){return false;};
27  bool Save(std::string pFilename, std::vector<Frm::Model3D*> &pVT){return false;};
28 
29  private:
30  ifstream fin;
31  Frm::Bone* _LoadSkeletton;
32  Frm::Mesh* _LoadMesh;
33  Frm::AnimationSet* _LoadAnimationSet;
34  Frm::Model3D* _Object;
35 
36  //Utilities
37  int16 ProcessBlock(void);
38  int16 BlockID(std::string &pText);
39  void AvoidTemplate(void);
40  void Find(uchar pChar);
41  //Unique X struct ID in case no name are found
42  //Uses the Windows function GetTickCount
43  char* SetUID(char pType);
44  //structure used by the previous function to quickly
45  //convert a 32 bit number to a non-significant text.
46  union {
48  char Text[5];
49  }_X_UID;
50 
51  //X File struct processing
52  uint32 _MaxKey; //Max animation key for a loaded animation set
53  void ProcessFrameTransformMatrix(Frm::Bone* &pB);
54  void ProcessBone(Frm::Bone* pBone);
55  void ProcessMesh(void);
56  void ProcessMeshTextureCoords(void);
57  void ProcessMeshMaterials(void);
58  void ProcessMeshNormals(void);
59  void ProcessMaterial(void);
60  void ProcessSkinWeights(void);
61  void ProcessAnimationSets(void);
62  void ProcessAnimations(Frm::AnimationSet* &pAS);
63  void ProcessAnimationKeys(Frm::Animation* &pA);
64  void MapMeshToBones(Frm::Bone* &pBone);
65 };
66 
67 };
68 #endif
Definition: Frm_Mesh.h:124
Definition: Frm_Mesh.h:111
Definition: Frm_Mesh.h:24
Definition: Frm_IO.h:17
uchar _Type
Definition: Frm_IO.h:38
Definition: Frm_Mesh.h:27
Definition: Frm_Mesh.h:68
bool Save(std::string pFilename, std::vector< Frm::Model3D * > &pVT)
Definition: IOModel_X.h:27
bool Save(std::string pFilename, Frm::Model3D *&pT)
IO_Model_X(void)
Definition: IOModel_X.h:23
char Text[5]
Definition: IOModel_X.h:46
uint32 Integer
Definition: IOModel_X.h:45
bool Load(std::string pFilename, Frm::Model3D *&pT)
bool Load(std::string pFilename, std::vector< Frm::Model3D * > &pVT)
Definition: IOModel_X.h:26
Definition: IOTexture_BMP.h:16
unsigned char uchar
Definition: Frm_types.h:16
unsigned long int uint32
Definition: Frm_types.h:15
short int int16
Definition: Frm_types.h:12
#define IO_3DX
Definition: Frm_types.h:30