]> git.localhorst.tv Git - blank.git/blobdiff - src/client/client.cpp
slight simplification of cull test
[blank.git] / src / client / client.cpp
index 232ba250eaa9236ff4fd9a4603a85ab9449536f9..b79c435473e946de841c7353cb2fb37870923c87 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "../app/Environment.hpp"
 #include "../app/init.hpp"
+#include "../geometry/distance.hpp"
 #include "../model/Model.hpp"
 #include "../io/WorldSave.hpp"
 #include "../world/ChunkIndex.hpp"
@@ -79,9 +80,6 @@ InteractiveState::InteractiveState(MasterState &master, uint32_t player_id)
        chunk_renderer.FogDensity(master.GetWorldConf().fog_density);
        loop_timer.Start();
        stat_timer.Start();
-       if (save.Exists(player)) {
-               save.Read(player);
-       }
 }
 
 void InteractiveState::OnResume() {
@@ -160,7 +158,7 @@ void InteractiveState::Update(int dt) {
        if (input.BlockFocus()) {
                hud.FocusBlock(input.BlockFocus().GetChunk(), input.BlockFocus().block);
        } else if (input.EntityFocus()) {
-               hud.FocusEntity(*input.EntityFocus().entity);
+               hud.FocusEntity(input.EntityFocus().GetEntity());
        } else {
                hud.FocusNone();
        }
@@ -350,6 +348,14 @@ void InteractiveState::SetDebug(bool b) {
        }
 }
 
+void InteractiveState::NextCamera() {
+       if (iszero(master.GetEnv().viewport.CameraOffset())) {
+               master.GetEnv().viewport.OffsetCamera(glm::vec3(0.0f, 0.0f, -5.0f));
+       } else {
+               master.GetEnv().viewport.OffsetCamera(glm::vec3(0.0f, 0.0f, 0.0f));
+       }
+}
+
 void InteractiveState::Exit() {
        save.Write(player);
        master.Quit();