Last change
on this file since 3151 was
2860,
checked in by dave, 20 years ago
|
orxonox/branches/dave: das level hat jetzt form angenommen, stand:nach der Convention vom Samstag….
|
File size:
1.8 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 | |
---|
[2842] | 18 | extern int verbose; //!< fill be removed and added again as a verbose-class |
---|
| 19 | |
---|
| 20 | |
---|
[2823] | 21 | //! Class that handles 3D-Objects. it can also read them in and display them. |
---|
[2748] | 22 | class Object |
---|
| 23 | { |
---|
| 24 | public: |
---|
| 25 | Object (); |
---|
[2767] | 26 | Object (char* fileName); |
---|
[2833] | 27 | Object(char* fileName, float scaling); |
---|
[2748] | 28 | ~Object (); |
---|
| 29 | |
---|
[2767] | 30 | bool importFile (char* fileName); |
---|
| 31 | bool initialize (void); |
---|
| 32 | bool finalize(void); |
---|
| 33 | void draw (void); |
---|
[2851] | 34 | void draw (int groupNumber); |
---|
| 35 | void draw (char* groupName); |
---|
[2852] | 36 | int getGroupCount(); |
---|
[2767] | 37 | |
---|
[2748] | 38 | private: |
---|
[2850] | 39 | //! Group to handle multiple Objects per obj-file |
---|
| 40 | struct Group |
---|
| 41 | { |
---|
| 42 | char* name; |
---|
| 43 | |
---|
| 44 | GLuint listNumber; |
---|
| 45 | Array* vertices; |
---|
| 46 | int verticesCount; |
---|
| 47 | Array* colors; |
---|
| 48 | Array* normals; |
---|
| 49 | Array* vTexture; |
---|
| 50 | int faceMode; |
---|
| 51 | |
---|
| 52 | int firstVertex; |
---|
| 53 | int firstNormal; |
---|
| 54 | int firstVertexTexture; |
---|
| 55 | |
---|
| 56 | Group* nextGroup; |
---|
| 57 | }; |
---|
| 58 | |
---|
| 59 | Group* firstGroup; //!< the first of all groups. |
---|
| 60 | Group* currentGroup; //!< the currentGroup. this is the one we will work with. |
---|
| 61 | int groupCount; |
---|
| 62 | |
---|
| 63 | bool readingVertices; |
---|
| 64 | |
---|
[2804] | 65 | char* objFileName; |
---|
| 66 | char* mtlFileName; |
---|
[2850] | 67 | |
---|
[2776] | 68 | Material* material; |
---|
[2833] | 69 | float scaleFactor; |
---|
[2760] | 70 | |
---|
[2765] | 71 | ifstream* OBJ_FILE; |
---|
| 72 | ifstream* MTL_FILE; |
---|
[2850] | 73 | |
---|
| 74 | bool initGroup(Group* group); |
---|
| 75 | bool finalizeGroup (Group* group); |
---|
| 76 | |
---|
| 77 | |
---|
| 78 | ///// readin /// |
---|
| 79 | bool readFromObjFile (char* fileName); |
---|
[2748] | 80 | |
---|
[2767] | 81 | bool readVertex (char* vertexString); |
---|
| 82 | bool readFace (char* faceString); |
---|
| 83 | bool readVT (char* vtString); |
---|
[2794] | 84 | bool readVertexNormal (char* normalString); |
---|
[2820] | 85 | bool readVertexTexture (char* vTextureString); |
---|
[2850] | 86 | bool readGroup (char* groupString); |
---|
[2776] | 87 | bool readMtlLib (char* matFile); |
---|
| 88 | bool readUseMtl (char* mtlString); |
---|
[2754] | 89 | |
---|
[2768] | 90 | bool addGLElement (char* elementString); |
---|
[2821] | 91 | |
---|
| 92 | void BoxObject (void); |
---|
[2748] | 93 | }; |
---|
[2773] | 94 | |
---|
| 95 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.