1 #ifndef MSP_GL_VERTEXFORMAT_H_
2 #define MSP_GL_VERTEXFORMAT_H_
4 #include <msp/strings/lexicalcast.h>
35 VertexFormat(VertexComponent);
36 VertexFormat(const VertexFormat &);
37 VertexFormat &operator=(const VertexFormat &);
40 VertexFormat operator,(VertexComponent c) const;
41 VertexFormat operator,(unsigned i) const;
43 bool empty() const { return !data || !data[0]; }
44 const unsigned char *begin() const { return data ? data+1 : 0; }
45 const unsigned char *end() const { return data ? data+1+data[0] : 0; }
46 unsigned stride() const;
47 int offset(VertexComponent) const;
50 inline VertexFormat operator,(VertexComponent c1, VertexComponent c2)
51 { return (VertexFormat(c1), c2); }
53 inline VertexFormat operator,(VertexComponent c, unsigned i)
54 { return (VertexFormat(c), i); }
56 VertexComponent make_indexed_component(VertexComponent, unsigned);
58 inline unsigned get_component_type(unsigned char c)
61 inline unsigned get_component_size(unsigned char c)
64 inline unsigned get_stride(const VertexFormat &f)
65 { return f.stride(); }
67 void operator>>(const LexicalConverter &, VertexComponent &);
68 void operator>>(const LexicalConverter &, VertexFormat &);