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










