X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmesh.h;h=730b724c9e81a9eee6072cac1d4762b503dbd6fc;hb=126ac7ca4053b765eab1473d2865bce728ef2428;hp=6181d5fb9bc1b9126248d2e786f826a77c7c92bd;hpb=99b3477d16295c9b90daa0a397bfc375dd3aac4d;p=libs%2Fgl.git diff --git a/source/mesh.h b/source/mesh.h index 6181d5fb..730b724c 100644 --- a/source/mesh.h +++ b/source/mesh.h @@ -17,7 +17,7 @@ Raw mesh data, consisting of a VertexArray and one or more Batches. Though a Mesh can draw itself, it's usually used as part of Renderables rather than on its own. */ -class Mesh +class Mesh: public Bindable { friend class MeshBuilder; @@ -37,7 +37,9 @@ private: std::list batches; Buffer *vbuf; Buffer *ibuf; + unsigned vao_id; bool defer_buffers; + mutable bool dirty; const WindingTest *winding; public: @@ -49,9 +51,11 @@ public: void use_buffers(bool); private: void create_buffers(); + void setup_vao() const; public: const VertexArray &get_vertices() const { return vertices; } + const Buffer *get_index_buffer() const { return ibuf; } unsigned get_n_vertices() const; float *modify_vertex(unsigned); @@ -62,6 +66,10 @@ public: void draw() const; void draw(Renderer &) const; + + void bind() const; + + static void unbind(); }; } // namespace GL