1 #ifndef MSP_GL_VERTEXSETUP_H_
2 #define MSP_GL_VERTEXSETUP_H_
5 #include "vertexformat.h"
6 #include "vertexsetup_backend.h"
15 Combines a VertexArray with an index buffer. This wraps OpenGL's vertex array
16 objects. Intended for internal use.
18 class VertexSetup: public VertexSetupBackend
20 friend VertexSetupBackend;
30 mutable unsigned dirty = 0;
31 const VertexArray *vertex_array = 0;
32 VertexFormat vertex_format;
33 const VertexArray *inst_array = 0;
34 VertexFormat inst_format;
35 const Buffer *index_buffer = 0;
36 DataType index_type = UNSIGNED_SHORT;
39 void set_format(const VertexFormat &);
40 void set_format_instanced(const VertexFormat &, const VertexFormat &);
42 void set_vertex_array(const VertexArray &);
43 void set_instance_array(const VertexArray &);
44 void set_index_buffer(const Buffer &, DataType);
45 const VertexArray *get_vertex_array() const { return vertex_array; }
46 const VertexArray *get_instance_array() const { return inst_array; }
47 const Buffer *get_index_buffer() const { return index_buffer; }
48 DataType get_index_type() const { return index_type; }
51 static bool verify_format(const VertexFormat &);
55 void refresh() const { if(dirty) update(); }
59 using VertexSetupBackend::set_debug_name;