source:
orxonox.OLD/orxonox/trunk/importer/object.h
@
2865
Last change on this file since 2865 was 2863, checked in by bensch, 21 years ago | |
---|---|
File size: 1.9 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; | |
[2863] | 51 | int faceCount; |
[2850] | 52 | |
53 | int firstVertex; | |
54 | int firstNormal; | |
55 | int firstVertexTexture; | |
56 | ||
57 | Group* nextGroup; | |
58 | }; | |
59 | ||
60 | Group* firstGroup; //!< the first of all groups. | |
61 | Group* currentGroup; //!< the currentGroup. this is the one we will work with. | |
62 | int groupCount; | |
63 | ||
64 | bool readingVertices; | |
65 | ||
[2804] | 66 | char* objFileName; |
67 | char* mtlFileName; | |
[2850] | 68 | |
[2776] | 69 | Material* material; |
[2833] | 70 | float scaleFactor; |
[2760] | 71 | |
[2765] | 72 | ifstream* OBJ_FILE; |
73 | ifstream* MTL_FILE; | |
[2850] | 74 | |
75 | bool initGroup(Group* group); | |
76 | bool finalizeGroup (Group* group); | |
[2863] | 77 | bool cleanupGroup(Group* group); |
[2850] | 78 | |
79 | ||
80 | ///// readin /// | |
81 | bool readFromObjFile (char* fileName); | |
[2748] | 82 | |
[2767] | 83 | bool readVertex (char* vertexString); |
84 | bool readFace (char* faceString); | |
85 | bool readVT (char* vtString); | |
[2794] | 86 | bool readVertexNormal (char* normalString); |
[2820] | 87 | bool readVertexTexture (char* vTextureString); |
[2850] | 88 | bool readGroup (char* groupString); |
[2776] | 89 | bool readMtlLib (char* matFile); |
90 | bool readUseMtl (char* mtlString); | |
[2754] | 91 | |
[2768] | 92 | bool addGLElement (char* elementString); |
[2821] | 93 | |
94 | void BoxObject (void); | |
[2748] | 95 | }; |
[2773] | 96 | |
97 | #endif |
Note: See TracBrowser
for help on using the repository browser.