Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/branches/sound/importer/object.h @ 3463

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

orxonox/branches/sound: merged Trunk back into sound. and included all headers for real into the configure.ac-script.

File size: 2.0 KB
RevLine 
[2823]1/*!
[2842]2  \file object.h
3  \brief Contains the Object Class that handles 3D-Objects
[2823]4*/
5
[2776]6#ifndef _OBJECT_H
7#define _OBJECT_H
[2773]8
9#include <GL/gl.h>
10#include <GL/glu.h>
11
[2754]12#include "array.h"
[2776]13#include "material.h"
[2823]14#include <fstream>
[2748]15
[2823]16using namespace std;
[2804]17
[2842]18extern int verbose; //!< fill be removed and added again as a verbose-class
19
20
[2934]21struct FaceElement
22{
23  char value[20];
24  FaceElement* next;
25};
26
[2823]27//! Class that handles 3D-Objects. it can also read them in and display them.
[2748]28class Object
29{
30 public:
31  Object ();
[2767]32  Object (char* fileName);
[2833]33  Object(char* fileName, float scaling);
[2748]34  ~Object ();
35 
[2767]36  bool importFile (char* fileName);
37  bool initialize (void);
38  bool finalize(void);
39  void draw (void);
[2851]40  void draw (int groupNumber);
41  void draw (char* groupName);
[2852]42  int getGroupCount();
[2767]43
[2748]44 private:
[2850]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;
[2863]57    int faceCount;
[2850]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
[2804]72  char* objFileName;
73  char* mtlFileName;
[2850]74
[2776]75  Material* material;
[2833]76  float scaleFactor;
[2760]77
[2765]78  ifstream* OBJ_FILE;
79  ifstream* MTL_FILE;
[2850]80
81  bool initGroup(Group* group);
82  bool finalizeGroup (Group* group);
[2863]83  bool cleanupGroup(Group* group);
[2850]84
85
86  ///// readin ///
87  bool readFromObjFile (char* fileName);
[2748]88 
[2767]89  bool readVertex (char* vertexString);
90  bool readFace (char* faceString);
91  bool readVT (char* vtString);
[2794]92  bool readVertexNormal (char* normalString);
[2820]93  bool readVertexTexture (char* vTextureString);
[2850]94  bool readGroup (char* groupString);
[2776]95  bool readMtlLib (char* matFile);
96  bool readUseMtl (char* mtlString);
[2754]97
[2768]98  bool addGLElement (char* elementString);
[2821]99
100  void BoxObject (void);
[2748]101};
[2773]102
103#endif
Note: See TracBrowser for help on using the repository browser.