1 #ifndef MSP_GL_VERTEXFORMAT_H_
2 #define MSP_GL_VERTEXFORMAT_H_
4 #include <msp/strings/lexicalcast.h>
33 VertexFormat(VertexComponent);
34 VertexFormat(const VertexFormat &);
35 VertexFormat &operator=(const VertexFormat &);
38 bool empty() const { return !data || !data[0]; }
39 const unsigned char *begin() const { return data ? data+1 : 0; }
40 const unsigned char *end() const { return data ? data+1+data[0] : 0; }
41 unsigned stride() const;
42 int offset(VertexComponent, unsigned = 0) const;
45 VertexFormat operator,(const VertexFormat &f, VertexComponent c);
46 inline VertexFormat operator,(VertexComponent c1, VertexComponent c2)
47 { return (VertexFormat(c1), c2); }
49 VertexFormat operator,(const VertexFormat &f, unsigned i);
50 inline VertexFormat operator,(VertexComponent c, unsigned i)
51 { return (VertexFormat(c), i); }
53 inline unsigned get_stride(const VertexFormat &f)
54 { return f.stride(); }
56 void operator>>(const LexicalConverter &, VertexComponent &);
57 void operator>>(const LexicalConverter &, VertexFormat &);