X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fchunk.cpp;h=bed947e3d5fdfff7182056313a30667ad9996edb;hb=f932e8c0273794bcd954c9f5b504bad6140f7cf4;hp=10031e77e359deb60145bdefe24d2195baecfa6e;hpb=2d5671c2ef977defae9ce0ce7248582ab3e8f011;p=blank.git diff --git a/src/chunk.cpp b/src/chunk.cpp index 10031e7..bed947e 100644 --- a/src/chunk.cpp +++ b/src/chunk.cpp @@ -6,6 +6,12 @@ #include +namespace { + +blank::Model::Buffer buf; + +} + namespace blank { Chunk::Chunk(const BlockTypeRegistry &types) @@ -117,7 +123,6 @@ void Chunk::CheckUpdate() { if (dirty) { Update(); } - model.CheckUpdate(); } void Chunk::Update() { @@ -127,17 +132,17 @@ void Chunk::Update() { vtx_count += shape->VertexCount(); idx_count += shape->VertexIndexCount(); } - model.Clear(); - model.Reserve(vtx_count, idx_count); + buf.Clear(); + buf.Reserve(vtx_count, idx_count); Model::Index vtx_counter = 0; for (size_t i = 0; i < Size(); ++i) { const BlockType &type = Type(blocks[i]); - type.FillModel(model, ToCoords(i), vtx_counter); + type.FillModel(buf, ToCoords(i), vtx_counter); vtx_counter += type.shape->VertexCount(); } - model.Invalidate(); + model.Update(buf); dirty = false; }