Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/importer/object.h @ 2851

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

orxonox/trunk/importer: extended the draw function. Now you can draw one of the objects with the call to its name, or its number.

File size: 1.8 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
37 private:
38  //! Group to handle multiple Objects per obj-file
39  struct Group
40  {
41    char* name;
42
43    GLuint listNumber;
44    Array* vertices;
45    int verticesCount;
46    Array* colors;
47    Array* normals;
48    Array* vTexture;
49    int faceMode;
50
51    int firstVertex;
52    int firstNormal;
53    int firstVertexTexture;
54
55    Group* nextGroup;
56  };
57 
58  Group* firstGroup; //!< the first of all groups.
59  Group* currentGroup; //!< the currentGroup. this is the one we will work with.
60  int groupCount;
61
62  bool readingVertices;
63
64  char* objFileName;
65  char* mtlFileName;
66
67  Material* material;
68  float scaleFactor;
69
70  ifstream* OBJ_FILE;
71  ifstream* MTL_FILE;
72
73  bool initGroup(Group* group);
74  bool finalizeGroup (Group* group);
75
76
77  ///// readin ///
78  bool readFromObjFile (char* fileName);
79 
80  bool readVertex (char* vertexString);
81  bool readFace (char* faceString);
82  bool readVT (char* vtString);
83  bool readVertexNormal (char* normalString);
84  bool readVertexTexture (char* vTextureString);
85  bool readGroup (char* groupString);
86  bool readMtlLib (char* matFile);
87  bool readUseMtl (char* mtlString);
88
89  bool addGLElement (char* elementString);
90
91  void BoxObject (void);
92};
93
94#endif
Note: See TracBrowser for help on using the repository browser.