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 "Toolbox\MyTrace.h"
12 
13 #include "framework\frm_IO.h"
14 #include <fstream>
15 #include <GL\freeglut.h>
16 #include "framework\Frm_Mesh.h"
17 #include "ToolBox\XFileStructs.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::Model3D* _Object;
34 
35  //Utilities
36  int16 ProcessBlock(void);
37  int16 BlockID(std::string &pText);
38  void AvoidTemplate(void);
39  void Find(uchar pChar);
40  //Unique X struct ID in case no name are found
41  //Uses the Windows function GetTickCount
42  char* SetUID(char pType);
43  //structure used by the previous function to quickly
44  //convert a 32 bit number to a non-significant text.
45  union {
47  char Text[5];
48  }_X_UID;
49 
50  //X File struct processing
51  uint32 _MaxKey; //Max animation key for a loaded animation set
52  void ProcessFrameTransformMatrix(Frm::Bone* pB);
53  void ProcessBone(Frm::Bone* pBone);
54  void ProcessMesh(void);
55  void ProcessMeshTextureCoords(void);
56  void ProcessMeshMaterials(void);
57  void ProcessMeshNormals(void);
58  void ProcessMaterial(void);
59  void ProcessSkinWeights(void);
60  void MapMeshToBones(Frm::Bone* pBone);
61 };
62 
63 };
64 #endif
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