1 #ifndef MSP_GL_VERTEXARRAY_H_
2 #define MSP_GL_VERTEXARRAY_H_
6 #include <msp/core/refptr.h>
7 #include <msp/datafile/loader.h>
9 #include "primitivetype.h"
10 #include "vertexarraybuilder.h"
11 #include "vertexformat.h"
21 class Loader: public DataFile::Loader, public VertexArrayBuilder
24 Loader(VertexArray &);
32 B = (sizeof(unsigned)*CHAR_BIT),
41 bool is_set(unsigned) const;
45 std::vector<float> data;
51 static ArrayMask enabled_arrays;
53 VertexArray(const VertexArray &);
54 VertexArray &operator=(const VertexArray &);
56 VertexArray(const VertexFormat &);
59 void reset(const VertexFormat &);
60 const VertexFormat &get_format() const { return format; }
62 void use_vertex_buffer();
63 void use_vertex_buffer(Buffer *);
66 void reserve(unsigned);
68 float *modify(unsigned);
73 unsigned size() const { return data.size()/stride; }
74 const std::vector<float> &get_data() const { return data; }
75 const float *operator[](unsigned i) const { return &data[0]+i*stride; }