]> git.tdb.fi Git - libs/gl.git/blobdiff - source/vertexarray.h
Move vertex buffer management from VertexArray to Mesh
[libs/gl.git] / source / vertexarray.h
index 26204b312134e4bc1c5ebf2ebe845c19ff205304..af1817b18461893591bc72c001db80c1dd72c0ce 100644 (file)
@@ -26,12 +26,19 @@ public:
        };
 
 private:
+       struct Array
+       {
+               unsigned char component;
+               unsigned char offset;
+
+               Array();
+       };
+
        VertexFormat format;
        std::vector<float> data;
        unsigned stride;
-       std::vector<unsigned char> arrays;
-       RefPtr<Buffer> vbuf;
-       bool defer_vbuf;
+       std::vector<Array> arrays;
+       Buffer *vbuf;
        mutable bool dirty;
 
        VertexArray(const VertexArray &);
@@ -46,7 +53,6 @@ private:
        static unsigned get_array_slot(unsigned char);
 
 public:
-       void use_vertex_buffer();
        void use_vertex_buffer(Buffer *);
 
        void clear();
@@ -62,6 +68,8 @@ public:
        const float *operator[](unsigned i) const { return &data[0]+i*stride; }
 
        void apply() const;
+private:
+       static void apply_arrays(const std::vector<Array> *, const std::vector<Array> *, const float *, unsigned);
 };
 
 } // namespace GL