]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/mesh.cpp
Make VertexFormat capable of storing type information
[libs/gl.git] / source / core / mesh.cpp
index 38642d4e26ee7459896429a03775eba3736f1700..de05102a358a5665a51b12cd0c345c21441052d5 100644 (file)
@@ -89,7 +89,6 @@ void Mesh::check_buffers(unsigned mask)
                        ibuf = new Buffer;
                        if(!batches.empty())
                                batches.front().change_buffer(ibuf);
-                       vtx_setup.set_index_buffer(*ibuf);
                        dirty |= INDEX_BUFFER;
 
 #ifdef DEBUG
@@ -97,6 +96,9 @@ void Mesh::check_buffers(unsigned mask)
                                vbuf->set_debug_name(debug_name+" [IBO]");
 #endif
                }
+
+               if(!batches.empty())
+                       vtx_setup.set_index_buffer(*ibuf, batches.front().get_index_type());
        }
 }
 
@@ -105,7 +107,7 @@ unsigned Mesh::get_n_vertices() const
        return vertices.size();
 }
 
-float *Mesh::modify_vertex(unsigned i)
+char *Mesh::modify_vertex(unsigned i)
 {
        if(vertices.get_format().empty())
                throw invalid_operation("Mesh::modify_vertex");