X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fvertexarray.h;h=26204b312134e4bc1c5ebf2ebe845c19ff205304;hb=b35ae038dd9d7456a207ecb30eb8960a00bbe71d;hp=d8484d83ca882ebb1c5e0d215aee57a930270dbf;hpb=8e9d872c2ba8dc633d29a673ba93adf38d262a5c;p=libs%2Fgl.git diff --git a/source/vertexarray.h b/source/vertexarray.h index d8484d83..26204b31 100644 --- a/source/vertexarray.h +++ b/source/vertexarray.h @@ -5,6 +5,7 @@ #include #include #include +#include "bindable.h" #include "datatype.h" #include "primitivetype.h" #include "vertexarraybuilder.h" @@ -15,7 +16,7 @@ namespace GL { class Buffer; -class VertexArray +class VertexArray: public Bindable { public: class Loader: public DataFile::Loader, public VertexArrayBuilder @@ -25,31 +26,14 @@ public: }; private: - struct ArrayMask - { - enum - { - B = (sizeof(unsigned)*CHAR_BIT), - N = (63+B)/B - }; - - unsigned mask[N]; - - ArrayMask(); - - void set(unsigned); - bool is_set(unsigned) const; - }; - VertexFormat format; std::vector data; unsigned stride; + std::vector arrays; RefPtr vbuf; bool defer_vbuf; mutable bool dirty; - static ArrayMask enabled_arrays; - VertexArray(const VertexArray &); VertexArray &operator=(const VertexArray &); public: @@ -58,7 +42,10 @@ public: void reset(const VertexFormat &); const VertexFormat &get_format() const { return format; } +private: + static unsigned get_array_slot(unsigned char); +public: void use_vertex_buffer(); void use_vertex_buffer(Buffer *);