]> git.tdb.fi Git - libs/gl.git/blobdiff - source/mesh.cpp
Pass the resource collection to async loaders
[libs/gl.git] / source / mesh.cpp
index 3e9e118ac52e6a9eb40b47345cce0f9692d9b140..8f7c517b2b5360a57d69bded3aed38d32b9ab58c 100644 (file)
@@ -31,6 +31,7 @@ void Mesh::init(ResourceManager *rm)
        vao_id = 0;
        defer_buffers = true;
        dirty = true;
+       disallow_rendering = false;
        winding = 0;
 
        if(rm)
@@ -152,7 +153,7 @@ void Mesh::draw() const
 
        if(!current())
                vertices.apply();
-       Bind bind_ibuf(ibuf, ELEMENT_ARRAY_BUFFER);
+       BindRestore bind_ibuf(ibuf, ELEMENT_ARRAY_BUFFER);
        Bind bind_winding(winding);
 
        for(list<Batch>::const_iterator i=batches.begin(); i!=batches.end(); ++i)
@@ -169,7 +170,6 @@ void Mesh::draw(Renderer &renderer) const
        }
 
        renderer.set_mesh(this);
-       renderer.set_element_buffer(ibuf);
        renderer.set_winding_test(winding);
 
        for(list<Batch>::const_iterator i=batches.begin(); i!=batches.end(); ++i)
@@ -183,7 +183,7 @@ void Mesh::bind() const
        if(!vao_id)
        {
                unbind();
-               vertices.apply();
+               vertices.apply(false);
        }
        else if(set_current(this))
        {
@@ -200,7 +200,7 @@ void Mesh::unbind()
                glBindVertexArray(0);
 }
 
-Resource::AsyncLoader *Mesh::load(IO::Seekable &io)
+Resource::AsyncLoader *Mesh::load(IO::Seekable &io, const Resources *)
 {
        return new AsyncLoader(*this, io);
 }