From 25d2c764443723eb7a3dd5f8bf0b76586c1ff10b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 5 Apr 2008 10:52:39 +0000 Subject: Makefile.am updates, math::Axis, improved VertexArray, r_arraysize --- src/core/model.h | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) (limited to 'src/core/model.h') 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 -- cgit v1.2.3