Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/model.h')
-rw-r--r--src/core/model.h40
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