X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmesh.h;h=54ff28031d369affe732031d5a5f6c4d6a3afa01;hb=67f22642d636861f90a016077c9387b7b8397414;hp=e9feb675a0635ee67127b5b4cd0f426617be7855;hpb=574abfb7aeb77436714ea06bf82713cb3d85204e;p=libs%2Fgl.git diff --git a/source/mesh.h b/source/mesh.h index e9feb675..54ff2803 100644 --- a/source/mesh.h +++ b/source/mesh.h @@ -5,6 +5,7 @@ #include "batch.h" #include "resource.h" #include "vertexarray.h" +#include "vertexsetup.h" #include "windingtest.h" namespace Msp { @@ -52,10 +53,10 @@ private: }; VertexArray vertices; - std::list batches; + std::vector batches; Buffer *vbuf; Buffer *ibuf; - unsigned vao_id; + VertexSetup vtx_setup; bool defer_buffers; mutable bool dirty; bool disallow_rendering; @@ -70,24 +71,24 @@ public: ~Mesh(); void clear(); - void use_buffers(bool); private: void create_buffers(); - void setup_vao() const; public: const VertexArray &get_vertices() const { return vertices; } + const VertexSetup &get_vertex_setup() const { return vtx_setup; } const Buffer *get_index_buffer() const { return ibuf; } unsigned get_n_vertices() const; float *modify_vertex(unsigned); void add_batch(const Batch &b); - const std::list &get_batches() { return batches; } + const std::vector &get_batches() const { return batches; } void set_winding(const WindingTest *); void draw() const; void draw(Renderer &) const; + void draw_instanced(Renderer &, const VertexSetup &, unsigned) const; /** Binds the mesh for rendering. The vertex array is applied using generic attributes only. Uses vertex array object if possible. */