Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/object.h @ 2866

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

orxonox/trunk: merged importer to src again

File size: 1.9 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
21//! Class that handles 3D-Objects. it can also read them in and display them.
22class Object
23{
24 public:
25  Object ();
26  Object (char* fileName);
27  Object(char* fileName, float scaling);
28  ~Object ();
29 
30  bool importFile (char* fileName);
31  bool initialize (void);
32  bool finalize(void);
33  void draw (void);
34  void draw (int groupNumber);
35  void draw (char* groupName);
36  int getGroupCount();
37
38 private:
39  //! Group to handle multiple Objects per obj-file
40  struct Group
41  {
42    char* name;
43
44    GLuint listNumber;
45    Array* vertices;
46    int verticesCount;
47    Array* colors;
48    Array* normals;
49    Array* vTexture;
50    int faceMode;
51    int faceCount;
52
53    int firstVertex;
54    int firstNormal;
55    int firstVertexTexture;
56
57    Group* nextGroup;
58  };
59 
60  Group* firstGroup; //!< the first of all groups.
61  Group* currentGroup; //!< the currentGroup. this is the one we will work with.
62  int groupCount;
63
64  bool readingVertices;
65
66  char* objFileName;
67  char* mtlFileName;
68
69  Material* material;
70  float scaleFactor;
71
72  ifstream* OBJ_FILE;
73  ifstream* MTL_FILE;
74
75  bool initGroup(Group* group);
76  bool finalizeGroup (Group* group);
77  bool cleanupGroup(Group* group);
78
79
80  ///// readin ///
81  bool readFromObjFile (char* fileName);
82 
83  bool readVertex (char* vertexString);
84  bool readFace (char* faceString);
85  bool readVT (char* vtString);
86  bool readVertexNormal (char* normalString);
87  bool readVertexTexture (char* vTextureString);
88  bool readGroup (char* groupString);
89  bool readMtlLib (char* matFile);
90  bool readUseMtl (char* mtlString);
91
92  bool addGLElement (char* elementString);
93
94  void BoxObject (void);
95};
96
97#endif
Note: See TracBrowser for help on using the repository browser.