Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
cModel3DS.h
Go to the documentation of this file.
1 //
5 //
6 
7 #ifndef _INC_cModel3DS_H
8 #define _INC_cModel3DS_H
9 #ifndef NO_PRAGMA_ONCE
10 #pragma once
11 #endif
12 #include "cModel.h"
15 #include "GrayCore/include/cFile.h"
17 
18 namespace Gray3D
19 {
20  // This file includes all of the model structures that are needed to load
21  // a .3DS file. If you intend to do animation you will need to add on
22  // to this. These structures only support the information that is needed
23  // to load the objects in the scene and their associative materials.
24 
26  {
28  // This is our triangle/face structure. This is is used for indexing into the vertex
29  // and texture coordinate arrays. From this information we know which vertices
30  // from our vertex array go to which face, along with the correct texture coordinates.
31  int m_vertIndex[3]; // indicies for the verts that make up this triangle. m_aVerts
32  int m_coordIndex[3]; // indicies for the tex coords to texture this face. m_aTexVerts
33  };
34 
36  {
38  // This holds the information for a material. It may be a texture map of a color.
39  // Some of these are not used, but I left them because you will want to eventually
40  // read in the UV tile ratio and the UV tile offset for some models.
41  public:
43  // m_texureId(-1)
44  {
45  m_color[0] = m_color[1] = m_color[2] = 0;
46  }
47 
48  public:
49  cString m_strName; // The texture name
50  cString m_strFile; // The texture file name (If this is set it's a texture map) full path may be some place else.
51  COLOR_ELEM_t m_color[3]; // The color of the object (R, G, B)
52  // int m_texureId; // the texture ID
53  // cVector2f m_Tile; // u,v tiling of texture (Currently not used)
54  // cVector2f m_Offset; // u,v offset of texture (Currently not used)
55  };
56 
58 
60  {
63  public:
65  : m_materialID(-1) // The texture ID to use, which is the index into our texture array
66  , m_bHasTexture(false) // This is true if there is a texture map for this object
67  {
68  }
69 
70  public:
78  };
79 
81 
83  : public cXResourceFile
84  {
89 
90  public:
93  public:
94  cModel3DS(const FILECHAR_t* pszFileName);
95  ~cModel3DS();
96  HRESULT LoadFile(const FILECHAR_t* pszFileName);
97 
99  };
100 };
101 #endif
#define GRAY3D_LINK
Definition: Gray3D.h:15
INT32 HRESULT
_WIN32 style error codes. INT32
Definition: SysTypes.h:465
Definition: cModel3DS.h:36
cString m_strFile
Definition: cModel3DS.h:50
cString m_strName
Definition: cModel3DS.h:49
cModel3DSMaterialInfo()
Definition: cModel3DS.h:42
Definition: cModel3DS.h:60
cArrayVal< cVector3f > m_aNormals
The object's normals. ComputeNormals()
Definition: cModel3DS.h:75
cString m_strName
The name of the object.
Definition: cModel3DS.h:73
cArrayVal< cVector2f > m_aTexVerts
The texture's UV coordinates.
Definition: cModel3DS.h:76
cModel3DSObject()
Definition: cModel3DS.h:64
int m_materialID
The texture ID to use, which is the index into our m_aMaterials array.
Definition: cModel3DS.h:71
bool m_bHasTexture
This is true if there is a texture map for this object. m_materialID has a file.
Definition: cModel3DS.h:72
cArrayVal< cModel3DSFace > m_aFaces
The faces information of the object.
Definition: cModel3DS.h:77
cArrayVal< cVector3f > m_aVerts
The object's vertices.
Definition: cModel3DS.h:74
Definition: cModel3DS.h:84
UNITTEST_FRIEND(cModel3DS)
cArrayRef< cModel3DSObject > m_aObjects
The object/mesh list for our model.
Definition: cModel3DS.h:92
cArrayRef< cModel3DSMaterialInfo > m_aMaterials
The list of material information (Textures and colors)
Definition: cModel3DS.h:91
Definition: cXResourceFile.h:20
Definition: cArrayRef.h:21
Definition: cArray.h:914
Definition: cRefPtr.h:22
Definition: cRefPtr.h:225
Definition: Gray3D.cpp:12
cRefPtr< cModel3DSMaterialInfo > cModel3DSMaterialInfoPtr
Definition: cModel3DS.h:57
cRefPtr< cModel3DSObject > cModel3DSObjectPtr
Definition: cModel3DS.h:80
BYTE COLOR_ELEM_t
A single 8 bit color element. alpha, red, green, or blue intensity as 0-255.
Definition: cColorRef.h:34
char FILECHAR_t
a UTF8 char in a file name. like TCHAR
Definition: FileName.h:22
Definition: cModel3DS.h:26