Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/old.bezierTrack/src/object.h @ 3327

Last change on this file since 3327 was 2935, checked in by bensch, 20 years ago

orxonox/trunk/src: merged importer into src again

File size: 2.0 KB
Line 
1/*!
2  \file object.h
3  \brief Contains the Object Class that handles 3D-Objects
4*/
5
6#ifndef _OBJECT_H
7#define _OBJECT_H
8
9#include <GL/gl.h>
10#include <GL/glu.h>
11
12#include "array.h"
13#include "material.h"
14#include <fstream>
15
16using namespace std;
17
18extern int verbose; //!< fill be removed and added again as a verbose-class
19
20
21struct FaceElement
22{
23  char value[20];
24  FaceElement* next;
25};
26
27//! Class that handles 3D-Objects. it can also read them in and display them.
28class Object
29{
30 public:
31  Object ();
32  Object (char* fileName);
33  Object(char* fileName, float scaling);
34  ~Object ();
35 
36  bool importFile (char* fileName);
37  bool initialize (void);
38  bool finalize(void);
39  void draw (void);
40  void draw (int groupNumber);
41  void draw (char* groupName);
42  int getGroupCount();
43
44 private:
45  //! Group to handle multiple Objects per obj-file
46  struct Group
47  {
48    char* name;
49
50    GLuint listNumber;
51    Array* vertices;
52    int verticesCount;
53    Array* colors;
54    Array* normals;
55    Array* vTexture;
56    int faceMode;
57    int faceCount;
58
59    int firstVertex;
60    int firstNormal;
61    int firstVertexTexture;
62
63    Group* nextGroup;
64  };
65 
66  Group* firstGroup; //!< the first of all groups.
67  Group* currentGroup; //!< the currentGroup. this is the one we will work with.
68  int groupCount;
69
70  bool readingVertices;
71
72  char* objFileName;
73  char* mtlFileName;
74
75  Material* material;
76  float scaleFactor;
77
78  ifstream* OBJ_FILE;
79  ifstream* MTL_FILE;
80
81  bool initGroup(Group* group);
82  bool finalizeGroup (Group* group);
83  bool cleanupGroup(Group* group);
84
85
86  ///// readin ///
87  bool readFromObjFile (char* fileName);
88 
89  bool readVertex (char* vertexString);
90  bool readFace (char* faceString);
91  bool readVT (char* vtString);
92  bool readVertexNormal (char* normalString);
93  bool readVertexTexture (char* vTextureString);
94  bool readGroup (char* groupString);
95  bool readMtlLib (char* matFile);
96  bool readUseMtl (char* mtlString);
97
98  bool addGLElement (char* elementString);
99
100  void BoxObject (void);
101};
102
103#endif
Note: See TracBrowser for help on using the repository browser.