Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: merged branches/images back into the trunk.
merged with command: svn merge bensches/images/ trunk/ -r 3084:HEAD

Conflicts in configure/.ac

resolved in favor of branches/images (newer)

Mayor differences:

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