diff options
author | Stijn Buys <ingar@osirion.org> | 2008-05-03 21:04:02 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-05-03 21:04:02 +0000 |
commit | 82293065b52f5a4e5c4ccde5eade4ebae18014ca (patch) | |
tree | 254f1fa3259f03f033b3d1fd225742a12de167b1 /src/model/vertexarray.h | |
parent | 5388c37bdc040ba50d21ec16a01f399d20592a90 (diff) |
liibmodel
Diffstat (limited to 'src/model/vertexarray.h')
-rw-r--r-- | src/model/vertexarray.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/model/vertexarray.h b/src/model/vertexarray.h new file mode 100644 index 0000000..6145659 --- /dev/null +++ b/src/model/vertexarray.h @@ -0,0 +1,57 @@ +/* + model/vertexarray.h + This file is part of the Osirion project and is distributed under + the terms of the GNU General Public License version 2 +*/ + +#ifndef __INCLUDED_MODEL_VERTEXARRAY_H__ +#define __INCLUDED_MODEL_VERTEXARRAY_H__ + +#include "math/color.h" +#include "math/vector3f.h" + +namespace model { + +const int SPHERESEGMENTS=33; + +/// global vertex array +class VertexArray +{ +public: + /// create a new VertexArray with size in Mb + VertexArray(size_t size); + ~VertexArray(); + + 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 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; +}; + +} + +#endif // __INCLUDED_MODEL_VERTEXARRAY_H__ |