#ifndef _3DSTRUCTS_H #define _3DSTRUCTS_H /* STL (Standard Template Library) Vector */ #include using namespace std; /*########################### Showroom.cpp ########################### # This file includes all of the model structures that are needed to load # in a .3DS file. # $Author: Ben Humphrey (DigiBen), Johannes Bader # $Revision: 1.0 # $Date: 5.5.04 ###################################################################### */ /* This is our 3D point class. This will be used to store the vertices of our model. */ class CVector3 { public: float x, y, z; }; /* This is our 2D point class. This will be used to store the UV coordinates. */ class CVector2 { public: float x, y; }; /* ############## Currently not supported by Showroom */ /* This holds the information for a material. It may be a texture map of a color. Some of these are not used, but I left them because you will want to eventually read in the UV tile ratio and the UV tile offset for some models.*/ struct tMaterialInfo { char strName[255]; /* The texture name */ char strFile[255]; /* The texture file name */ char color[3]; /* The color of the object (R, G, B) */ int texureId; /* the texture ID */ float uTile; /* u tiling of texture (Currently not used) */ float vTile; /* v tiling of texture (Currently not used) */ float uOffset; /* u offset of texture (Currently not used) */ float vOffset; /* v offset of texture (Currently not used) */ } ; /* This is the face structure. This is is used for indexing into the vertex and texture coordinate arrays. From this information we know which vertices from our vertex array go to which face, along with the correct texture coordinates. */ struct tFace { int vertIndex[3]; /* indicies for the verts that make up this triangle */ int coordIndex[3]; /* indicies for the tex coords to texture this face */ }; /* This holds the object information. An object is part of a model */ struct t3dObject { int iNumOfVerts; /* The number of verts in the model */ int iNumOfFaces; /* The number of faces in the model */ char strName[255]; /* The name of the object */ CVector3 *pVerts; /* The object's vertices */ CVector3 *pNormals; /* The object's normals */ CVector2 *pTexVerts; /* The texture's UV coordinates */ tFace *pFaces; /* The faces information of the object */ /* Not used */ int iNumTexVertex; // The number of texture coordinates int materialID; // The texture ID to use, which is the index into our texture array bool bHasTexture; // This is TRUE if there is a texture map for this object }; /* This holds the model information. A model may consist of several objects */ class C3dModel { public: int numOfObjects; /* The number of objects */ vector pObject; /* The object list for our model */ /* Not yet used */ int numOfMaterials; /* The number of materials */ vector pMaterials; /* The list of material information (Textures and colors) */ /* Draws the Model, mode = GL_LINE_STRIP etc. */ void Draw( int mode ); void PrintProperties( void ); }; #endif