X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp.cpp;h=9580d33560024171ab9db84e957777b697f2c970;hb=82426ae2997d2b21703d2d5afb631a84736e975f;hp=202f98c5b4fe46af2ae85a8824d69908fc354a31;hpb=cb959294a8271969ddfe411471d7f04e82c4788a;p=blank.git diff --git a/src/app.cpp b/src/app.cpp index 202f98c..9580d33 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -118,8 +118,8 @@ void Application::Update(int dt) { glm::vec3 pos = Chunk::ToCoords(blkid); outline_visible = true; outline.Clear(); - chunk->BlockAt(blkid).type->FillOutlineModel(outline); - outline_transform = glm::translate(chunk->Transform(), pos); + chunk->Type(chunk->BlockAt(blkid)).FillOutlineModel(outline); + outline_transform = glm::translate(chunk->Transform(world.Player().ChunkCoords()), pos); outline_transform = glm::scale(outline_transform, glm::vec3(1.0001f)); } else { outline_visible = false; @@ -127,14 +127,14 @@ void Application::Update(int dt) { if (pick) { if (chunk) { - place_id = chunk->BlockAt(blkid).type->id; + place_id = chunk->BlockAt(blkid).type; hud.Display(*world.BlockTypes()[place_id]); } pick = false; } if (remove) { if (chunk) { - chunk->BlockAt(blkid).type = world.BlockTypes()[remove_id]; + chunk->BlockAt(blkid).type = remove_id; chunk->Invalidate(); } remove = false; @@ -145,9 +145,9 @@ void Application::Update(int dt) { glm::vec3 next_pos = Chunk::ToCoords(blkid) + normal; if (!Chunk::InBounds(next_pos)) { mod_chunk = &world.Next(*chunk, normal); - next_pos -= normal * Chunk::Extent(); + next_pos -= normal * glm::vec3(Chunk::Extent()); } - mod_chunk->BlockAt(next_pos).type = world.BlockTypes()[place_id]; + mod_chunk->BlockAt(next_pos).type = place_id; mod_chunk->Invalidate(); } place = false;