Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/model/vertexarray.h')
-rw-r--r--src/model/vertexarray.h67
1 files changed, 46 insertions, 21 deletions
diff --git a/src/model/vertexarray.h b/src/model/vertexarray.h
index 6330d8c..37f2be9 100644
--- a/src/model/vertexarray.h
+++ b/src/model/vertexarray.h
@@ -10,7 +10,8 @@
#include "math/color.h"
#include "math/vector3f.h"
-namespace model {
+namespace model
+{
const int SPHERESEGMENTS=65;
@@ -23,40 +24,64 @@ public:
/// create a new VertexArray with size in Mb
VertexArray(size_t size);
~VertexArray();
-
+
void clear();
-
+
size_t add_vertex(math::Vector3f const &v, math::Vector3f const &n, math::Color const &color, float tex_x=0.0f, float tex_y=0.0f);
-
- 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 bool overflow() const { return vertex_overflow; }
-
+
+ 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 bool overflow() const
+ {
+ return vertex_overflow;
+ }
+
/// number of allocated floats
- inline size_t size() const { return vertex_size; }
-
+ inline size_t size() const
+ {
+ return vertex_size;
+ }
+
/// index to the top of the stack
- inline size_t index() const { return vertex_index; }
-
- static inline VertexArray *instance() { return vertex_instance; }
-
+ inline size_t index() const
+ {
+ return vertex_index;
+ }
+
+ static inline VertexArray *instance()
+ {
+ return vertex_instance;
+ }
+
private:
/// 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;
-
+
bool vertex_overflow;
};