X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp.cpp;h=d8f1e2147ba2589df979be0c7bbdd3402fc4eb57;hb=28fda9f7f55a9e806ade3f49f4e94f0242ec2c3c;hp=0d7e7dbb8fb511c40dbff366394699c99b1753e7;hpb=b35ce3a6423c554b34b37362c5550bd705e63a1d;p=blank.git diff --git a/src/app.cpp b/src/app.cpp index 0d7e7db..d8f1e21 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -31,10 +31,6 @@ Application::Application() , place_id(1) { GLContext::EnableVSync(); - GLuint VertexArrayID; - glGenVertexArrays(1, &VertexArrayID); - glBindVertexArray(VertexArrayID); - world.Generate({ -4, -4, -4 }, { 5, 5, 5}); hud.Viewport(960, 600); @@ -118,7 +114,7 @@ void Application::Update(int dt) { glm::vec3 pos = Chunk::ToCoords(blkid); outline_visible = true; outline.Clear(); - chunk->BlockAt(blkid).type->FillOutlineModel(outline); + 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 { @@ -127,14 +123,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 +141,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;