Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: merged importer to src again

File size: 1.9 KB
RevLine 
[2835]1/*!
[2853]2  \file object.h
3  \brief Contains the Object Class that handles 3D-Objects
[2835]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
[2853]18extern int verbose; //!< fill be removed and added again as a verbose-class
19
20
[2835]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);
[2853]34  void draw (int groupNumber);
35  void draw (char* groupName);
36  int getGroupCount();
[2835]37
[2853]38 private:
39  //! Group to handle multiple Objects per obj-file
40  struct Group
41  {
42    char* name;
[2835]43
[2853]44    GLuint listNumber;
45    Array* vertices;
46    int verticesCount;
47    Array* colors;
48    Array* normals;
49    Array* vTexture;
50    int faceMode;
[2866]51    int faceCount;
[2835]52
[2853]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
[2835]66  char* objFileName;
67  char* mtlFileName;
[2853]68
[2835]69  Material* material;
70  float scaleFactor;
71
72  ifstream* OBJ_FILE;
73  ifstream* MTL_FILE;
[2853]74
75  bool initGroup(Group* group);
76  bool finalizeGroup (Group* group);
[2866]77  bool cleanupGroup(Group* group);
[2853]78
79
80  ///// readin ///
81  bool readFromObjFile (char* fileName);
[2835]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);
[2853]88  bool readGroup (char* groupString);
[2835]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.