X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fvertexarray.h;h=9fa55b7117c32fdc2901c74215223b6616f9fa53;hb=0ef8e620a008e92069b0dd9ae4e972bc69430fc7;hp=82a6b6ac5260cb3bd074404480187022f2b03b37;hpb=2e9f905d2a2b0abdb7902aa3d3416a97666c489a;p=libs%2Fgl.git diff --git a/source/vertexarray.h b/source/vertexarray.h index 82a6b6ac..9fa55b71 100644 --- a/source/vertexarray.h +++ b/source/vertexarray.h @@ -6,6 +6,7 @@ #include #include #include "bindable.h" +#include "bufferable.h" #include "datatype.h" #include "primitivetype.h" #include "vertexarraybuilder.h" @@ -16,7 +17,7 @@ namespace GL { class Buffer; -class VertexArray: public Bindable +class VertexArray: public Bindable, public Bufferable { public: class Loader: public DataFile::Loader, public VertexArrayBuilder @@ -38,9 +39,6 @@ private: std::vector data; unsigned stride; std::vector arrays; - RefPtr vbuf; - bool defer_vbuf; - mutable bool dirty; VertexArray(const VertexArray &); VertexArray &operator=(const VertexArray &); @@ -54,24 +52,28 @@ private: static unsigned get_array_slot(unsigned char); public: - void use_vertex_buffer(); - void use_vertex_buffer(Buffer *); + /// Deprecated alias for use_buffer + void use_vertex_buffer(Buffer *b) { use_buffer(b); } void clear(); void reserve(unsigned); float *append(); float *modify(unsigned); private: - void set_dirty(); + virtual unsigned get_data_size() const; + virtual const void *get_data_pointer() const { return &data[0]; } public: unsigned size() const { return data.size()/stride; } const std::vector &get_data() const { return data; } const float *operator[](unsigned i) const { return &data[0]+i*stride; } - void apply() const; + void bind() const; + void apply() const { bind(); } private: static void apply_arrays(const std::vector *, const std::vector *, const float *, unsigned); +public: + static void unbind(); }; } // namespace GL