]> git.tdb.fi Git - libs/gl.git/blobdiff - source/vertexformat.h
Turn VertexFormat into a class and hide the data member
[libs/gl.git] / source / vertexformat.h
index 35b5de3d15d9910da9ffda9bb15d521c112d1f91..fb47484b35940b7e873b6d2586d333df0edda802 100644 (file)
@@ -25,16 +25,21 @@ enum VertexComponent
        ATTRIB4
 };
 
-struct VertexFormat
+class VertexFormat
 {
+private:
        unsigned char *data;
 
+public:
        VertexFormat();
        VertexFormat(VertexComponent);
        VertexFormat(const VertexFormat &);
        VertexFormat &operator=(const VertexFormat &);
        ~VertexFormat();
 
+       VertexFormat operator,(VertexComponent c) const;
+       VertexFormat operator,(unsigned i) const;
+
        bool empty() const { return !data || !data[0]; }
        const unsigned char *begin() const { return data ? data+1 : 0; }
        const unsigned char *end() const { return data ? data+1+data[0] : 0; }
@@ -42,11 +47,9 @@ struct VertexFormat
        int offset(VertexComponent, unsigned = 0) const;
 };
 
-VertexFormat operator,(const VertexFormat &f, VertexComponent c);
 inline VertexFormat operator,(VertexComponent c1, VertexComponent c2)
 { return (VertexFormat(c1), c2); }
 
-VertexFormat operator,(const VertexFormat &f, unsigned i);
 inline VertexFormat operator,(VertexComponent c, unsigned i)
 { return (VertexFormat(c), i); }