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
|
Line | |
---|
1 | /*! |
---|
2 | \file object.h |
---|
3 | \brief Contains the Object Class that handles 3D-Objects |
---|
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 | |
---|
18 | extern int verbose; //!< fill be removed and added again as a verbose-class |
---|
19 | |
---|
20 | |
---|
21 | //! Class that handles 3D-Objects. it can also read them in and display them. |
---|
22 | class Object |
---|
23 | { |
---|
24 | public: |
---|
25 | Object (); |
---|
26 | Object (char* fileName); |
---|
27 | Object(char* fileName, float scaling); |
---|
28 | ~Object (); |
---|
29 | |
---|
30 | bool importFile (char* fileName); |
---|
31 | bool initialize (void); |
---|
32 | bool finalize(void); |
---|
33 | void draw (void); |
---|
34 | void draw (int groupNumber); |
---|
35 | void draw (char* groupName); |
---|
36 | int getGroupCount(); |
---|
37 | |
---|
38 | private: |
---|
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 | |
---|
65 | char* objFileName; |
---|
66 | char* mtlFileName; |
---|
67 | |
---|
68 | Material* material; |
---|
69 | float scaleFactor; |
---|
70 | |
---|
71 | ifstream* OBJ_FILE; |
---|
72 | ifstream* MTL_FILE; |
---|
73 | |
---|
74 | bool initGroup(Group* group); |
---|
75 | bool finalizeGroup (Group* group); |
---|
76 | |
---|
77 | |
---|
78 | ///// readin /// |
---|
79 | bool readFromObjFile (char* fileName); |
---|
80 | |
---|
81 | bool readVertex (char* vertexString); |
---|
82 | bool readFace (char* faceString); |
---|
83 | bool readVT (char* vtString); |
---|
84 | bool readVertexNormal (char* normalString); |
---|
85 | bool readVertexTexture (char* vTextureString); |
---|
86 | bool readGroup (char* groupString); |
---|
87 | bool readMtlLib (char* matFile); |
---|
88 | bool readUseMtl (char* mtlString); |
---|
89 | |
---|
90 | bool addGLElement (char* elementString); |
---|
91 | |
---|
92 | void BoxObject (void); |
---|
93 | }; |
---|
94 | |
---|
95 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.