X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fvertexarray.h;h=0223a1f4434df584cc16dd59a0a659f23d2f1409;hb=98cc25ffe956bc162c053c96df659ba40dfe2d6e;hp=26204b312134e4bc1c5ebf2ebe845c19ff205304;hpb=b35ae038dd9d7456a207ecb30eb8960a00bbe71d;p=libs%2Fgl.git diff --git a/source/vertexarray.h b/source/vertexarray.h index 26204b31..0223a1f4 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 @@ -26,13 +27,18 @@ public: }; private: + struct Array + { + unsigned char component; + unsigned char offset; + + Array(); + }; + VertexFormat format; std::vector data; unsigned stride; - std::vector arrays; - RefPtr vbuf; - bool defer_vbuf; - mutable bool dirty; + std::vector arrays; VertexArray(const VertexArray &); VertexArray &operator=(const VertexArray &); @@ -46,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 const void *get_data_pointer() const { return &data[0]; } public: unsigned size() const { return data.size()/stride; } @@ -62,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