diff options
author | Stijn Buys <ingar@osirion.org> | 2010-02-20 21:52:31 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2010-02-20 21:52:31 +0000 |
commit | 745b4e04e5f23a02e5d9b12ebabf38d6dd034136 (patch) | |
tree | 53bf2cbe44067c5900a07d577e8533bf0b2b0796 /src/model/vertexarray.h | |
parent | 60cbb49128dd9561858855886c765515c7e89593 (diff) |
Use interleaved vertex arrays
Diffstat (limited to 'src/model/vertexarray.h')
-rw-r--r-- | src/model/vertexarray.h | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/model/vertexarray.h b/src/model/vertexarray.h index 4377f67..2e43f2a 100644 --- a/src/model/vertexarray.h +++ b/src/model/vertexarray.h @@ -25,25 +25,23 @@ public: VertexArray(size_t size); ~VertexArray(); + /// clear array, set memory to 0 void clear(); + + /// print vertex array usage to console + void info(); size_t add_vertex(math::Vector3f const &v, math::Vector3f const &n, float tex_x = 0.0f, float tex_y = 0.0f); - inline float *vertex() { - return vertex_vertex; - } - - inline float *normal() { - return vertex_normal; - } - - inline float *texture() { - return vertex_texture; - } - + /// true when the array is full inline bool overflow() const { return vertex_overflow; } + + /// pointer to model vertices, sequential in GL_T2F_N3F_V3F format + inline const float *ptr() const { + return vertex_data; + } /// size of the vertex array in number of floats (for a single array) inline size_t size() const { @@ -60,10 +58,8 @@ public: } private: - /// model vertices - float *vertex_vertex; - float *vertex_normal; - float *vertex_texture; + /// model vertices, sequential in GL_T2F_N3F_V3F format + float *vertex_data; size_t vertex_index; size_t vertex_size; |