diff --git a/src/physics/collider.cpp b/src/physics/collider.cpp index 9ec5801..07fda40 100644 --- a/src/physics/collider.cpp +++ b/src/physics/collider.cpp @@ -26,7 +26,7 @@ float EntityCollider::m_xDepth(ColliderBox a, ColliderBox b) { float EntityCollider::m_yDepth(ColliderBox a, ColliderBox b) { - + } diff --git a/src/renderer/frustrum.hpp b/src/renderer/frustrum.hpp index a7537d4..cefa7e6 100644 --- a/src/renderer/frustrum.hpp +++ b/src/renderer/frustrum.hpp @@ -22,7 +22,6 @@ class FrustrumPlane { public: - }; diff --git a/src/world/block.cpp b/src/world/block.cpp index 253c441..39b400d 100644 --- a/src/world/block.cpp +++ b/src/world/block.cpp @@ -21,6 +21,7 @@ std::shared_ptr CBlockDictionary::GetInstance() { void CBlockDictionary::Build() { + // Order matters ! RegisterTexture("stone.png"); RegisterTexture("dirt.png"); RegisterTexture("grass_side.png"); diff --git a/src/world/generator/chunkgenerator.hpp b/src/world/generator/chunkgenerator.hpp index 139597f..1425a26 100644 --- a/src/world/generator/chunkgenerator.hpp +++ b/src/world/generator/chunkgenerator.hpp @@ -1,2 +1,6 @@ +#ifndef MINECRAFT_WORLD_GENERATOR_CHUNKGENERATOR_H_ +#define MINECRAFT_WORLD_GENERATOR_CHUNKGENERATOR_H_ + +#endif diff --git a/src/world/generator/chunkmanager.hpp b/src/world/generator/chunkmanager.hpp new file mode 100644 index 0000000..8420177 --- /dev/null +++ b/src/world/generator/chunkmanager.hpp @@ -0,0 +1,28 @@ +#ifndef MINECRAFT_WORLD_GENERATOR_CUNKMANAGER_H_ +#define MINECRAFT_WORLD_GENERATOR_CUNKMANAGER_H_ + +#include "../../common.hpp" + + +class Frustrum; + +class ChunkManager { +public: + + // Instatntiated + ChunkManager(); + + void Update(); + + void Play(); + void Pause(); + + void LoadChunksAroundWorldPoint(glm::vec3 worldPoint); + + + + void CullFrustrumFromRenderQueue(); + +}; + +#endif diff --git a/src/world/world.cpp b/src/world/world.cpp index fbc45c7..f7e3fbb 100644 --- a/src/world/world.cpp +++ b/src/world/world.cpp @@ -32,12 +32,12 @@ void World::LoadWorld() { m_noiseGenerator->SetFractalOctaves(5); // Generate a 54x54 chunk world - // for (int x = -4; x < 50; x++) - // for (int y = -50; y < 4; y++) { + for (int x = -4; x < 50; x++) + for (int y = -50; y < 4; y++) { - // m_chunkLoaderQueue.push({ x, y }); + m_chunkLoaderQueue.push({ x, y }); - // } + } // Spawn generator threads for (int i = 0; i < 6; i++) { @@ -103,20 +103,20 @@ std::vector> World::GetRenderableChunks() { void World::Update(std::shared_ptr player) { - glm::vec2 inChunk = GetChunk(player->Position); + // glm::vec2 inChunk = GetChunk(player->Position); - if (m_chunks.find(inChunk) == m_chunks.end()) { + // if (m_chunks.find(inChunk) == m_chunks.end()) { - m_chunkLoderMutex.lock(); + // m_chunkLoderMutex.lock(); - m_chunkLoaderQueue.push(inChunk); + // m_chunkLoaderQueue.push(inChunk); - m_chunkLoderMutex.unlock(); + // m_chunkLoderMutex.unlock(); - } + // } - std::cout << "Position: " << player->Position.x << ":" << player->Position.y << ":" << player->Position.z << std::endl; - std::cout << "Chunk: " << inChunk.x << ":" << inChunk.y << std::endl << std::endl; + // std::cout << "Position: " << player->Position.x << ":" << player->Position.y << ":" << player->Position.z << std::endl; + // std::cout << "Chunk: " << inChunk.x << ":" << inChunk.y << std::endl << std::endl; } diff --git a/src/world/world.hpp b/src/world/world.hpp index 988420e..771dedc 100644 --- a/src/world/world.hpp +++ b/src/world/world.hpp @@ -5,6 +5,7 @@ #include "../renderer/camera.hpp" +#include "generator/chunkmanager.hpp" #include "chunk/chunk.hpp" #include @@ -23,7 +24,6 @@ public: // Default constructor World(); - // Preps the render threads and loads all of the shaders void LoadWorld();