]> git.localhorst.tv Git - blank.git/blobdiff - src/hud.cpp
minor optimizations in chunk
[blank.git] / src / hud.cpp
index 266b80ae9dcbdc4f7aa29984817152501813c621..0f496c6d7ce074f59a4dd224043ba9f38c2af3c3 100644 (file)
@@ -39,18 +39,18 @@ HUD::HUD(const BlockTypeRegistry &types)
 }
 
 
-void HUD::Viewport(float width, float height) {
+void HUD::Viewport(float width, float height) noexcept {
        Viewport(0, 0, width, height);
 }
 
-void HUD::Viewport(float x, float y, float width, float height) {
+void HUD::Viewport(float x, float y, float width, float height) noexcept {
        projection = glm::ortho(x, width, height, y, near, far);
        crosshair_transform = glm::translate(glm::mat4(1.0f), glm::vec3(width * 0.5f, height * 0.5f, 0.0f));
 }
 
 
 void HUD::Display(const Block &b) {
-       const BlockType &type = *types.Get(b.type);
+       const BlockType &type = types.Get(b.type);
 
        block_buf.Clear();
        type.FillModel(block_buf, b.Transform());
@@ -59,9 +59,11 @@ void HUD::Display(const Block &b) {
 }
 
 
-void HUD::Render(DirectionalLighting &program) {
+void HUD::Render(DirectionalLighting &program) noexcept {
        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);
                block.Draw();