X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=src%2Fui%2Fui.cpp;h=8ddd40c57fb8327a32c5097e890f5d4b6093e326;hb=282d731ea8f10342efa82012028de7043b3dd639;hp=c71b7c105a0f0c357a359e5cd8ac34779856d166;hpb=c04ea5a6f67d446ea29aa2e88dc4c666956d7732;p=blank.git diff --git a/src/ui/ui.cpp b/src/ui/ui.cpp index c71b7c1..8ddd40c 100644 --- a/src/ui/ui.cpp +++ b/src/ui/ui.cpp @@ -63,16 +63,20 @@ void HUD::Display(const Block &b) { void HUD::Render(DirectionalLighting &program) noexcept { + program.SetLightDirection({ 1.0f, 3.0f, 5.0f }); + // disable distance fog + program.SetFogDensity(0.0f); + GLContext::ClearDepthBuffer(); + + program.SetVP(view, projection); + if (block_visible) { - program.SetLightDirection({ 1.0f, 3.0f, 5.0f }); - // disable distance fog - program.SetFogDensity(0.0f); - GLContext::ClearDepthBuffer(); - program.SetMVP(block_transform, view, projection); + program.SetM(block_transform); block.Draw(); - program.SetM(crosshair_transform); - crosshair.Draw(); } + + program.SetM(crosshair_transform); + crosshair.Draw(); } @@ -128,6 +132,10 @@ void Interface::HandlePress(const SDL_KeyboardEvent &event) { TurnBlock(); break; + case SDLK_n: + ToggleCollision(); + break; + case SDLK_b: PrintBlockInfo(); break; @@ -178,6 +186,11 @@ void Interface::TurnBlock() { hud.Display(selection); } +void Interface::ToggleCollision() { + ctrl.Controlled().WorldCollidable(!ctrl.Controlled().WorldCollidable()); + std::cout << "collision " << (ctrl.Controlled().WorldCollidable() ? "on" : "off") << std::endl; +} + void Interface::PrintBlockInfo() { std::cout << std::endl; if (!aim_chunk) {