From 4f83af18578f2ff7036f7f7729619fea8acb8edc Mon Sep 17 00:00:00 2001 From: tylermurphy534 Date: Sat, 1 Oct 2022 16:28:38 -0400 Subject: move chunk loading into world class --- src/world.hpp | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/world.hpp (limited to 'src/world.hpp') diff --git a/src/world.hpp b/src/world.hpp new file mode 100644 index 0000000..12e0285 --- /dev/null +++ b/src/world.hpp @@ -0,0 +1,43 @@ +#pragma once + +#include "xe_game_object.hpp" +#include "chunk_renderer.hpp" +#include "chunk.hpp" + +#include + +namespace app { + +class World { + + public: + + World(xe::GameObject& viewer, int renderDistance, int worldSeed); + ~World(); + + void reloadChunks(); + void reloadChunks(int newRenderDistance); + + void render(xe::Camera& camera); + + private: + + void resetChunks(); + + void unloadOldChunks(); + void loadNewChunks(); + void updateChunkMeshs(); + + int viewX, viewZ; + + int worldSeed; + int renderDistance; + + const xe::GameObject& viewer; + std::vector loadedChunks; + + ChunkRenderer chunkRenderer; + +}; + +} \ No newline at end of file -- cgit v1.2.3-freya