Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk/src: merged trunk/importer into trunk/src again.
All conflicts resolved in favor of trunk/src.

File size: 2.2 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
[3185]9#include "stdincl.h"
[2835]10
11#include "array.h"
12#include "material.h"
[3185]13#include "vector.h"
[2835]14#include <fstream>
15
16using namespace std;
17
[3185]18extern int verbose; //!< Will be removed and added again as a verbose-class.
[2853]19
20
[2935]21
[2835]22//! Class that handles 3D-Objects. it can also read them in and display them.
23class Object
24{
25 public:
26  Object ();
27  Object (char* fileName);
28  Object(char* fileName, float scaling);
29  ~Object ();
30 
[3185]31  void draw (void) const;
32  void draw (int groupNumber) const;
33  void draw (char* groupName) const;
34  int getGroupCount() const;
[2835]35
[2853]36 private:
[3185]37  struct FaceElement
38  {
39    int vertexNumber;
40    int normalNumber;
41    int texCoordNumber;
42    FaceElement* next;
43  };
44
45  //! Face
46  struct Face
47  {
48    int vertexCount;
49    FaceElement* firstElem;
50
51    char* materialString;
52
53    Face* next;
54  };
55
[2853]56  //! Group to handle multiple Objects per obj-file
57  struct Group
58  {
59    char* name;
[2835]60
[2853]61    GLuint listNumber;
[3185]62    Face* firstFace;
63    Face* currentFace;
[2853]64    int faceMode;
[2866]65    int faceCount;
[2835]66
[3185]67    Group* next;
68  };
[2853]69
[3185]70
71  Array* vertices;
72  int verticesCount;
73  Array* colors;
74  Array* normals;
75  Array* vTexture;
76
[2853]77 
78  Group* firstGroup; //!< the first of all groups.
79  Group* currentGroup; //!< the currentGroup. this is the one we will work with.
80  int groupCount;
81
[3185]82  Material* material;
83  float scaleFactor;
[2853]84
[3185]85  char* objPath;
[2835]86  char* objFileName;
87  char* mtlFileName;
[2853]88
[3185]89  bool initialize (void);
[2853]90  bool initGroup(Group* group);
[3185]91  bool initFace (Face* face);
92  bool cleanup(void);
[2866]93  bool cleanupGroup(Group* group);
[3185]94  bool cleanupFace(Face* face);
95  bool cleanupFaceElement(FaceElement* faceElem);
[2853]96
97  ///// readin ///
[3185]98  bool importFile (char* fileName);
99  bool readFromObjFile (void);
[2835]100 
[3185]101  bool readGroup (char* groupString);
[2835]102  bool readVertex (char* vertexString);
103  bool readFace (char* faceString);
104  bool readVertexNormal (char* normalString);
105  bool readVertexTexture (char* vTextureString);
106  bool readMtlLib (char* matFile);
107  bool readUseMtl (char* mtlString);
108
[3185]109  bool importToGL (void);
110  bool addGLElement (FaceElement* elem);
[2835]111
[3185]112  bool buildVertexNormals ();
113
[2835]114  void BoxObject (void);
115};
116
117#endif
Note: See TracBrowser for help on using the repository browser.