}
-Mesh::Loader::Loader(Mesh &m):
- DataFile::ObjectLoader<Mesh>(m)
+Mesh::Loader::Loader(Mesh &m, bool g):
+ DataFile::ObjectLoader<Mesh>(m),
+ allow_gl_calls(g)
{
add("batch", &Loader::batch);
add("vertices", &Loader::vertices);
fmt = (fmt, *i);
obj.vertices.reset(fmt);
load_sub(obj.vertices);
- obj.check_buffers(VERTEX_BUFFER);
+ if(allow_gl_calls)
+ {
+ obj.check_buffers(VERTEX_BUFFER);
+ obj.vtx_setup.set_vertex_array(obj.vertices);
+ }
}
void Mesh::Loader::batch(PrimitiveType p)
{
// TODO use correct filename
DataFile::Parser parser(io, "async");
- Loader loader(mesh);
+ Loader loader(mesh, false);
loader.load(parser);
}
else if(phase==1)
{
mesh.resize_buffers();
+ mesh.vtx_setup.set_vertex_array(vertices);
vertex_updater = mesh.vertices.refresh_async();
if(!mesh.batches.empty())
index_updater = mesh.batches.front().refresh_async();
public:
class Loader: public DataFile::ObjectLoader<Mesh>
{
+ private:
+ bool allow_gl_calls;
+
public:
- Loader(Mesh &);
+ Loader(Mesh &, bool = true);
private:
void vertices(const std::vector<VertexComponent> &);
void batch(PrimitiveType);