X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fvertexarray.h;h=f0baf2d4a84fa8896b21c351149d9cd28612ee04;hb=a8c4b199788c87f0a22b8c8df1509905b6fb488b;hp=9610905d218994fcb2e539a6fe06d1a4e3934a41;hpb=85facfb688035b5bbc9a3a87d080582fbf34930b;p=libs%2Fgl.git diff --git a/source/vertexarray.h b/source/vertexarray.h index 9610905d..f0baf2d4 100644 --- a/source/vertexarray.h +++ b/source/vertexarray.h @@ -11,6 +11,7 @@ Distributed under the LGPL #include #include #include +#include "primitivetype.h" #include "types.h" #include "vertexarraybuilder.h" #include "vertexformat.h" @@ -22,6 +23,8 @@ class VertexBuffer; class VertexArray { + friend class VertexArrayBuilder; + public: class Loader: public DataFile::Loader, public VertexArrayBuilder { @@ -29,6 +32,16 @@ public: Loader(VertexArray &); }; +private: + VertexFormat format; + std::vector data; + uint stride; + VertexBuffer *vbuf; + bool own_vbuf; + + VertexArray(const VertexArray &); + VertexArray &operator=(const VertexArray &); +public: VertexArray(VertexFormat); ~VertexArray(); @@ -36,20 +49,14 @@ public: const std::vector &get_data() const { return data; } void use_vertex_buffer(); void use_vertex_buffer(VertexBuffer *); + void reserve(unsigned); + unsigned size() const { return data.size()/stride; } void clear(); void reset(VertexFormat); RefPtr modify(); void apply() const; void update_data(); private: - VertexFormat format; - std::vector data; - uint stride; - VertexBuffer *vbuf; - bool own_vbuf; - - VertexArray(const VertexArray &); - VertexArray &operator=(const VertexArray &); void set_array(unsigned, unsigned, unsigned) const; static unsigned enabled_arrays;