1 #ifndef MSP_GL_VERTEXARRAY_H_
2 #define MSP_GL_VERTEXARRAY_H_
6 #include <msp/core/refptr.h>
7 #include <msp/datafile/loader.h>
10 #include "primitivetype.h"
11 #include "vertexarraybuilder.h"
12 #include "vertexformat.h"
19 class VertexArray: public Bindable<VertexArray>
22 class Loader: public DataFile::Loader, public VertexArrayBuilder
25 Loader(VertexArray &);
30 std::vector<float> data;
32 std::vector<unsigned char> arrays;
37 VertexArray(const VertexArray &);
38 VertexArray &operator=(const VertexArray &);
40 VertexArray(const VertexFormat &);
43 void reset(const VertexFormat &);
44 const VertexFormat &get_format() const { return format; }
46 static unsigned get_array_slot(unsigned char);
49 void use_vertex_buffer();
50 void use_vertex_buffer(Buffer *);
53 void reserve(unsigned);
55 float *modify(unsigned);
60 unsigned size() const { return data.size()/stride; }
61 const std::vector<float> &get_data() const { return data; }
62 const float *operator[](unsigned i) const { return &data[0]+i*stride; }