Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/john/src/3dStructs.h @ 2064

Last change on this file since 2064 was 2035, checked in by john, 20 years ago

Diese Dateien werden für das Importieren von 3ds Modellen gebraucht.
3ds importiert die Daten.
3dUnit enthält die Daten.
3dsStructs definiert einige 3d Variablen

File size: 3.3 KB
RevLine 
[2035]1#ifndef _3DSTRUCTS_H
2#define _3DSTRUCTS_H
3
4/* STL (Standard Template Library) Vector */
5#include <vector>
6using namespace std;
7
8/*########################### Showroom.cpp ###########################
9# This file includes all of the model structures that are needed to load
10# in a .3DS file.
11# $Author: Ben Humphrey (DigiBen), Johannes Bader
12# $Revision: 1.0
13# $Date: 5.5.04
14###################################################################### */
15
16/* This is our 3D point class. 
17   This will be used to store the vertices of our model. */
18class CVector3
19{
20public:
21        float x, y, z;
22};
23
24/* This is our 2D point class. 
25   This will be used to store the UV coordinates. */
26class CVector2
27{
28public:
29        float x, y;
30};
31
32/* ############## Currently not supported by Showroom */
33
34/* This holds the information for a material.  It may be a texture map of a
35   color. Some of these are not used, but I left them because you will want to
36   eventually read in the UV tile ratio and the UV tile offset for some
37   models.*/
38struct tMaterialInfo
39{
40        char  strName[255];             /* The texture name */
41        char  strFile[255];             /* The texture file name */
42        char  color[3];                 /* The color of the object (R, G, B) */
43        int   texureId;                 /* the texture ID */
44        float uTile;                            /* u tiling of texture  (Currently not used) */
45        float vTile;                            /* v tiling of texture  (Currently not used) */
46        float uOffset;                     /* u offset of texture       (Currently not used) */
47        float vOffset;                          /* v offset of texture  (Currently not used) */
48} ;
49
50
51/* This is the face structure.  This is is used for indexing into the vertex
52   and texture coordinate arrays.  From this information we know which vertices
53   from our vertex array go to which face, along with the correct
54   texture coordinates. */
55struct tFace
56{
57        int vertIndex[3];        /* indicies for the verts that make up this triangle */
58        int coordIndex[3]; /* indicies for the tex coords to texture this face */
59};
60
61/* This holds the object information. An object is part of a model */
62struct t3dObject
63{
64        int  iNumOfVerts;                       /* The number of verts in the model */
65        int  iNumOfFaces;                       /* The number of faces in the model */
66        char strName[255];              /* The name of the object       */
67        CVector3  *pVerts;              /* The object's vertices */
68        CVector3  *pNormals;            /* The object's normals */
69        CVector2  *pTexVerts;   /* The texture's UV coordinates */
70        tFace *pFaces;                          /* The faces information of the object */
71 
72   /* Not used */
73   int  iNumTexVertex;          // The number of texture coordinates
74        int  materialID;                        // The texture ID to use, which is the index into our texture array
75        bool bHasTexture;                       // This is TRUE if there is a texture map for this object       
76};
77
78/* This holds the model information. A model may consist of several
79   objects */
80class C3dModel
81{
82        public:
83      int numOfObjects;                                    /* The number of objects */
84      vector<t3dObject> pObject;                        /* The object list for our model */
85     
86        /* Not yet used */
87           int numOfMaterials;                                  /* The number of materials */
88           vector<tMaterialInfo> pMaterials;    /* The list of material information
89                                              (Textures and colors) */
90      /* Draws the Model, mode = GL_LINE_STRIP etc. */
91      void Draw( int mode );
92      void PrintProperties( void );
93};
94
95#endif
Note: See TracBrowser for help on using the repository browser.