Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
Frm_Mesh.h
Go to the documentation of this file.
1 // Frm_Mesh.h
3 //
4 //
6 
7 #ifndef FRM_MESH_H
8 #define FRM_MESH_H
9 
10 #include "framework\frm_types.h"
11 //#include "framework\frm_3Dmath.h"
12 #include "framework\frm_Material.h"
13 
14 #define DEBUG
15 #include "Toolbox\Mytrace.h"
16 
17 #include <list>
18 #include <vector>
19 
20 namespace Frm {
21 
22 class Mesh;
23 
24 class Bone {
25  public:
27  ~Bone(void);
28  Bone* IsName(std::string &BoneName);
29  void UpdateIndices(uint16 pIndex);
30 
34  float* _Weights;
35  std::string _MeshName;
36  std::string _Name;
37  std::list<Bone*> _Bones;
38 };
39 
40 struct Subset {
41  uint16 Size;
42  Face* Faces;
43  };
44 
45 class Mesh {
46  public:
47  Mesh(void):_nVertices(0), _Vertices(0),
48  _nFaces(0), _Faces(0),
50  _FaceMaterials(0),
51  _nNormals(0), _Normals(0),
52  _nMaterials(0),
53  _FirstVertex(0), //The _Firstxxx series are used
54  _FirstFace(0), //for mesh concatenation
56  _FirstNormal(0),
58  {};
59  ~Mesh(void);
60  Mesh* IsName(std::string &MeshName){if (strcmp(_Name.c_str(), MeshName.c_str())==0) return this; return 0;};
61  void UpdateIndices(void);
62  void CreateSubsets(void);
63  //Vertices
66  //Texture Coords for each vertex
69  //Faces
71  Face* _Faces;
72  //Subset of a mesh: there is one subset for each material used
73  std::list<Subset*> _Subsets;
74  //Normals
78  //Material index for each face
81  //list of Materials for that Mesh
82  std::list<Material*> _Materials;
83  std::string _Name;
84 };
85 
86 class Model3D {
87  public:
88  Model3D(void): _Skeletton(0){};
89  ~Model3D(void);
90  Mesh* IsMeshName(std::string &pText);
91  void ConcatenateMeshes(void);
93  std::list<Mesh*> _Meshes;
94  private:
95  void UpdateBoneIndices(Bone* &pBone);
96 };
97 };
98 
99 #endif
Definition: Frm_Mesh.h:24
void UpdateIndices(uint16 pIndex)
Definition: Frm_Mesh.cpp:35
std::list< Bone * > _Bones
Definition: Frm_Mesh.h:37
std::string _Name
Definition: Frm_Mesh.h:36
uint32 _nVertices
Definition: Frm_Mesh.h:32
Bone * IsName(std::string &BoneName)
Definition: Frm_Mesh.cpp:21
Bone(void)
Definition: Frm_Mesh.h:26
glMatrix _SkinOffset
Definition: Frm_Mesh.h:31
~Bone(void)
Definition: Frm_Mesh.cpp:14
glMatrix _MatrixPos
Definition: Frm_Mesh.h:31
uint16 * _Vertices
Definition: Frm_Mesh.h:33
std::string _MeshName
Definition: Frm_Mesh.h:35
float * _Weights
Definition: Frm_Mesh.h:34
Definition: Frm_Mesh.h:27
uint16 _nNormals
Definition: Frm_Mesh.h:57
uint16 _FirstTextureCoord
Definition: Frm_Mesh.h:49
Face * _Faces
Definition: Frm_Mesh.h:53
uint16 * _FaceMaterials
Definition: Frm_Mesh.h:62
void UpdateIndices(void)
uint16 _FirstVertex
Definition: Frm_Mesh.h:46
std::list< Material * > _Materials
Definition: Frm_Mesh.h:64
Face * _FaceNormals
Definition: Frm_Mesh.h:59
uint16 _nMaterials
Definition: Frm_Mesh.h:61
~Mesh(void)
void CreateSubsets(void)
uint32 _nFaces
Definition: Frm_Mesh.h:52
uint16 _FirstMaterial
Definition: Frm_Mesh.h:61
std::list< Subset * > _Subsets
Definition: Frm_Mesh.h:55
uint16 _nVertices
Definition: Frm_Mesh.h:46
Mesh * IsName(std::string &MeshName)
Definition: Frm_Mesh.h:60
Mesh(void)
Definition: Frm_Mesh.h:47
uint16 _nTextureCoords
Definition: Frm_Mesh.h:49
uint32 _FirstFace
Definition: Frm_Mesh.h:52
Vertex * _Vertices
Definition: Frm_Mesh.h:47
uint16 _FirstNormal
Definition: Frm_Mesh.h:57
std::string _Name
Definition: Frm_Mesh.h:65
TCoord * _TextureCoords
Definition: Frm_Mesh.h:50
vector< float > * _Normals
Definition: Frm_Mesh.h:58
Definition: Frm_Mesh.h:68
void ConcatenateMeshes(void)
Mesh * IsMeshName(std::string &pText)
Model3D(void)
Definition: Frm_Mesh.h:88
std::list< Mesh * > _Meshes
Definition: Frm_Mesh.h:74
Bone * _Skeletton
Definition: Frm_Mesh.h:92
void Identity(void)
Definition: Frm_3DMath.h:86
Definition: Frm.h:12
unsigned short int uint16
Definition: Frm_types.h:14
unsigned long int uint32
Definition: Frm_types.h:15
Definition: Frm_3DMath.h:15
Definition: Frm_Mesh.h:22
uint16 Size
Definition: Frm_Mesh.h:23
Face * Faces
Definition: Frm_Mesh.h:24