Last change
on this file since 3179 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
|
Rev | Line | |
---|
[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 | |
---|
| 9 | #include <GL/gl.h> |
---|
| 10 | #include <GL/glu.h> |
---|
| 11 | |
---|
| 12 | #include "array.h" |
---|
| 13 | #include "material.h" |
---|
| 14 | #include <fstream> |
---|
| 15 | |
---|
| 16 | using namespace std; |
---|
| 17 | |
---|
[2853] | 18 | extern int verbose; //!< fill be removed and added again as a verbose-class |
---|
| 19 | |
---|
| 20 | |
---|
[2935] | 21 | struct FaceElement |
---|
| 22 | { |
---|
| 23 | char value[20]; |
---|
| 24 | FaceElement* next; |
---|
| 25 | }; |
---|
| 26 | |
---|
[2835] | 27 | //! Class that handles 3D-Objects. it can also read them in and display them. |
---|
| 28 | class Object |
---|
| 29 | { |
---|
| 30 | public: |
---|
| 31 | Object (); |
---|
| 32 | Object (char* fileName); |
---|
| 33 | Object(char* fileName, float scaling); |
---|
| 34 | ~Object (); |
---|
| 35 | |
---|
| 36 | bool importFile (char* fileName); |
---|
| 37 | bool initialize (void); |
---|
| 38 | bool finalize(void); |
---|
| 39 | void draw (void); |
---|
[2853] | 40 | void draw (int groupNumber); |
---|
| 41 | void draw (char* groupName); |
---|
| 42 | int getGroupCount(); |
---|
[2835] | 43 | |
---|
[2853] | 44 | private: |
---|
| 45 | //! Group to handle multiple Objects per obj-file |
---|
| 46 | struct Group |
---|
| 47 | { |
---|
| 48 | char* name; |
---|
[2835] | 49 | |
---|
[2853] | 50 | GLuint listNumber; |
---|
| 51 | Array* vertices; |
---|
| 52 | int verticesCount; |
---|
| 53 | Array* colors; |
---|
| 54 | Array* normals; |
---|
| 55 | Array* vTexture; |
---|
| 56 | int faceMode; |
---|
[2866] | 57 | int faceCount; |
---|
[2835] | 58 | |
---|
[2853] | 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 | |
---|
[2835] | 72 | char* objFileName; |
---|
| 73 | char* mtlFileName; |
---|
[2853] | 74 | |
---|
[2835] | 75 | Material* material; |
---|
| 76 | float scaleFactor; |
---|
| 77 | |
---|
| 78 | ifstream* OBJ_FILE; |
---|
| 79 | ifstream* MTL_FILE; |
---|
[2853] | 80 | |
---|
| 81 | bool initGroup(Group* group); |
---|
| 82 | bool finalizeGroup (Group* group); |
---|
[2866] | 83 | bool cleanupGroup(Group* group); |
---|
[2853] | 84 | |
---|
| 85 | |
---|
| 86 | ///// readin /// |
---|
| 87 | bool readFromObjFile (char* fileName); |
---|
[2835] | 88 | |
---|
| 89 | bool readVertex (char* vertexString); |
---|
| 90 | bool readFace (char* faceString); |
---|
| 91 | bool readVT (char* vtString); |
---|
| 92 | bool readVertexNormal (char* normalString); |
---|
| 93 | bool readVertexTexture (char* vTextureString); |
---|
[2853] | 94 | bool readGroup (char* groupString); |
---|
[2835] | 95 | bool readMtlLib (char* matFile); |
---|
| 96 | bool readUseMtl (char* mtlString); |
---|
| 97 | |
---|
| 98 | bool addGLElement (char* elementString); |
---|
| 99 | |
---|
| 100 | void BoxObject (void); |
---|
| 101 | }; |
---|
| 102 | |
---|
| 103 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.