diff options
author | Stijn Buys <ingar@osirion.org> | 2008-04-05 10:52:39 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-04-05 10:52:39 +0000 |
commit | 25d2c764443723eb7a3dd5f8bf0b76586c1ff10b (patch) | |
tree | b9cc681a3ff20900b32ce287505d018e0a7ae35f /src/core/model.h | |
parent | 49e268d1b4244948e49a11612501a743e311fbaf (diff) |
Makefile.am updates, math::Axis, improved VertexArray, r_arraysize
Diffstat (limited to 'src/core/model.h')
-rw-r--r-- | src/core/model.h | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/src/core/model.h b/src/core/model.h index 958acc0..60746ae 100644 --- a/src/core/model.h +++ b/src/core/model.h @@ -23,27 +23,45 @@ class Model; namespace core { -/// size of the global vertex array - 32M -const size_t VERTEXARRAYSIZE=65536*512; +/// global vertex array + const int SPHERESEGMENTS=33; -/// global vertex array class VertexArray { public: - /// model vertices - static float vertex[VERTEXARRAYSIZE]; - static float vertex_color[VERTEXARRAYSIZE]; - static float vertex_normal[VERTEXARRAYSIZE]; + /// Create a new VertexArray with size in Mb + VertexArray(size_t size); + ~VertexArray(); - static size_t vertex_index; + void clear(); - static void clear(); + void add_vertex(math::Vector3f const &v, math::Vector3f const &n, math::Color const &color); + + + inline float *vertex() { return vertex_vertex; } + inline float *color() { return vertex_color; } + inline float *normal() { return vertex_normal; } + inline float *texture() { return vertex_texture; } + + inline size_t size() const { return vertex_size; } + inline size_t index() const { return vertex_index; } - static void add_vertex(math::Vector3f const &v, math::Vector3f const &n, math::Color const &color); + static inline VertexArray *instance() { return vertex_instance; } private: - static void add_sphere(); + /// model vertices + float *vertex_vertex; + float *vertex_color; + float *vertex_normal; + float *vertex_texture; + + size_t vertex_index; + size_t vertex_size; + + void add_sphere(); + + static VertexArray *vertex_instance; }; /// a model triangle |