1 | /*! |
---|
2 | * @file vertex_array_model.h |
---|
3 | * @brief Contains the VertexArrayModel Class that handles 3D-Models rendered out of VertexArrays |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _VERTEX_ARRAY_MODEL_H |
---|
7 | #define _VERTEX_ARRAY_MODEL_H |
---|
8 | |
---|
9 | #include "model.h" |
---|
10 | |
---|
11 | #include "glincl.h" |
---|
12 | |
---|
13 | #include <vector> |
---|
14 | |
---|
15 | /* Forward Declaration */ |
---|
16 | class Material; |
---|
17 | |
---|
18 | |
---|
19 | ///////////// |
---|
20 | /// MODEL /// |
---|
21 | ///////////// |
---|
22 | //! Class that handles 3D-Models. it can also read them in and display them. |
---|
23 | /** |
---|
24 | * this renders models with help of the OpenGL glVertexArray |
---|
25 | */ |
---|
26 | class VertexArrayModel : public Model |
---|
27 | { |
---|
28 | public: |
---|
29 | VertexArrayModel(); |
---|
30 | VertexArrayModel(const Model& model); |
---|
31 | virtual ~VertexArrayModel(); |
---|
32 | |
---|
33 | void draw() const; |
---|
34 | |
---|
35 | |
---|
36 | void newStripe(); |
---|
37 | |
---|
38 | void addVertex(float x, float y, float z); |
---|
39 | void addNormal(float x, float y, float z); |
---|
40 | void addTexCoor(float u, float v); |
---|
41 | void addColor(float r, float g, float b); |
---|
42 | |
---|
43 | void addIndice(GLuint indice); |
---|
44 | |
---|
45 | void finalize(); |
---|
46 | |
---|
47 | // |
---|
48 | void planeModel(float sizeX, float sizeY, unsigned int resolutionX, unsigned int resolutionY); |
---|
49 | void spiralSphere(const float radius, const unsigned int loops, const unsigned int segmentsPerLoop); |
---|
50 | |
---|
51 | void debug() const; |
---|
52 | |
---|
53 | private: |
---|
54 | void importToVertexArray(); |
---|
55 | |
---|
56 | private: |
---|
57 | bool bFinalized; //!< Sets the Object to be finalized. |
---|
58 | |
---|
59 | std::vector<GLfloat> vertices; //!< The Array that handles the Vertices. |
---|
60 | std::vector<GLfloat> normals; //!< The Array that handles the Normals. |
---|
61 | std::vector<GLfloat> texCoords; //!< The Array that handles the VertexTextureCoordinates. |
---|
62 | std::vector<GLfloat> colors; //!< The Array that handles Colors. |
---|
63 | |
---|
64 | std::vector<GLuint> indices; //!< The Array that tells us what Vertex is connected to which other one. |
---|
65 | |
---|
66 | std::vector<GLuint> stripes; //!< A lsit of Stripes of this Model. |
---|
67 | |
---|
68 | }; |
---|
69 | |
---|
70 | #endif |
---|