3 This file is part of libmspgl
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #ifndef MSP_GL_VERTEXARRAY_H_
9 #define MSP_GL_VERTEXARRAY_H_
12 #include <msp/core/refptr.h>
13 #include <msp/datafile/loader.h>
14 #include "primitivetype.h"
16 #include "vertexarraybuilder.h"
17 #include "vertexformat.h"
26 friend class VertexArrayBuilder;
29 class Loader: public DataFile::Loader, public VertexArrayBuilder
32 Loader(VertexArray &);
37 std::vector<float> data;
42 VertexArray(const VertexArray &);
43 VertexArray &operator=(const VertexArray &);
45 VertexArray(VertexFormat);
48 VertexFormat get_format() const { return format; }
49 const std::vector<float> &get_data() const { return data; }
50 void use_vertex_buffer();
51 void use_vertex_buffer(VertexBuffer *);
52 void reserve(unsigned);
53 unsigned size() const { return data.size()/stride; }
55 void reset(VertexFormat);
56 RefPtr<VertexArrayBuilder> modify();
60 void set_array(unsigned, unsigned, unsigned) const;
62 static unsigned enabled_arrays;