X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmesh.cpp;h=508054a521346ac45e394848fb0c7ec11f0fe799;hb=ab59f5a9e66b3fc7872ad96ec7949940189f0819;hp=9757df5cc9e20f364ff96880f115b1707a1f8f5e;hpb=6afbace895a7bbcf216ab8e48280ea0303ab5892;p=libs%2Fgl.git diff --git a/source/mesh.cpp b/source/mesh.cpp index 9757df5c..508054a5 100644 --- a/source/mesh.cpp +++ b/source/mesh.cpp @@ -85,7 +85,7 @@ void Mesh::add_batch(const Batch &b) Batch *prev = (batches.empty() ? 0 : &batches.back()); batches.push_back(b); if(ibuf) - batches.back().use_index_buffer(ibuf, prev); + batches.back().use_buffer(ibuf, prev); } } @@ -130,9 +130,15 @@ Mesh::Loader::Loader(Mesh &m): add("winding", &Loader::winding); } -void Mesh::Loader::vertices(VertexFormat f) +void Mesh::Loader::vertices(const vector &c) { - obj.vertices.reset(f); + if(c.empty()) + throw invalid_argument("No vertex components"); + + VertexFormat fmt; + for(vector::const_iterator i=c.begin(); i!=c.end(); ++i) + fmt = (fmt, *i); + obj.vertices.reset(fmt); load_sub(obj.vertices); }