1 | /*! |
---|
2 | \file vertex_list_model.h |
---|
3 | \brief Contains the VertexListModel Class that handles 3D-Models rendered out of VertexArrays |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _MODEL_H |
---|
7 | #define _MODEL_H |
---|
8 | |
---|
9 | #include "abstract_model.h" |
---|
10 | |
---|
11 | #include "glincl.h" |
---|
12 | |
---|
13 | #include "array.h" |
---|
14 | #include <list> |
---|
15 | |
---|
16 | // FORWARD DECLARATION // |
---|
17 | template<class T> class tArray; |
---|
18 | |
---|
19 | ///////////// |
---|
20 | /// MODEL /// |
---|
21 | ///////////// |
---|
22 | //! Class that handles 3D-Models. it can also read them in and display them. |
---|
23 | class Model : public AbstractModel |
---|
24 | { |
---|
25 | public: |
---|
26 | Model(); |
---|
27 | virtual ~Model(); |
---|
28 | |
---|
29 | void draw() const; |
---|
30 | |
---|
31 | Material* addMaterial(Material* material); |
---|
32 | Material* addMaterial(const char* materialName); |
---|
33 | |
---|
34 | bool addVertex(float x, float y, float z); |
---|
35 | |
---|
36 | bool addVertexNormal(float x, float y, float z); |
---|
37 | |
---|
38 | bool addVertexTexture(float u, float v); |
---|
39 | |
---|
40 | bool addFace(int faceElemCount, VERTEX_FORMAT type, ...); |
---|
41 | |
---|
42 | bool addGroup(const char* groupString); |
---|
43 | |
---|
44 | bool setMaterial(Material* mtl); |
---|
45 | |
---|
46 | void finalize(); |
---|
47 | |
---|
48 | |
---|
49 | private: |
---|
50 | bool buildTriangleList(); |
---|
51 | |
---|
52 | bool addGLElement(ModelFaceElement* elem); |
---|
53 | |
---|
54 | bool importToVertexArray(); |
---|
55 | |
---|
56 | bool deleteArrays(); |
---|
57 | bool cleanup(); |
---|
58 | |
---|
59 | private: |
---|
60 | bool finalized; //!< Sets the Object to be finalized. |
---|
61 | |
---|
62 | tArray<GLfloat> vertices; //!< The Array that handles the Vertices. |
---|
63 | tArray<GLfloat> normals; //!< The Array that handles the Normals. |
---|
64 | tArray<GLfloat> textures; //!< The Array that handles the VertexTextureCoordinates. |
---|
65 | |
---|
66 | tArray<GLfloat> indices; //!< The Array that tells us what Vertex is connected to which other one. |
---|
67 | |
---|
68 | std::list<ModelMaterial*> materialList; //!< A list for all the Materials in this Model |
---|
69 | }; |
---|
70 | |
---|
71 | #endif |
---|