X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fvertexarray.h;h=e38f0afff910b20500b750983fcf957db934d741;hb=b760fa04a65deaceb4c793ba24ca4f4e01bdbc82;hp=1887ad912d52547d89257e48f74af7d10e58db47;hpb=ab59f5a9e66b3fc7872ad96ec7949940189f0819;p=libs%2Fgl.git diff --git a/source/vertexarray.h b/source/vertexarray.h index 1887ad91..e38f0aff 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,15 +52,16 @@ 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 void upload_data() const; public: unsigned size() const { return data.size()/stride; } @@ -70,6 +69,8 @@ public: const float *operator[](unsigned i) const { return &data[0]+i*stride; } void apply() const; +private: + static void apply_arrays(const std::vector *, const std::vector *, const float *, unsigned); }; } // namespace GL