From 30ac1a58ee34c3c151349edcb4758ea3e0088427 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Sun, 23 Jun 2024 02:05:13 +0300 Subject: [PATCH] remove test code --- src/graphics/render/WorldRenderer.cpp | 21 ++------------------- src/maths/FrustumCulling.hpp | 5 ++--- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/src/graphics/render/WorldRenderer.cpp b/src/graphics/render/WorldRenderer.cpp index ca90013d..f94939de 100644 --- a/src/graphics/render/WorldRenderer.cpp +++ b/src/graphics/render/WorldRenderer.cpp @@ -107,7 +107,7 @@ bool WorldRenderer::drawChunk( chunk->z * CHUNK_D + CHUNK_D ); - if (!frustumCulling->IsBoxVisible(min, max)) + if (!frustumCulling->isBoxVisible(min, max)) return false; } glm::vec3 coord(chunk->x*CHUNK_W+0.5f, 0.5f, chunk->z*CHUNK_D+0.5f); @@ -195,24 +195,7 @@ void WorldRenderer::renderLevel( drawChunks(level->chunks.get(), camera, shader); shader->uniformMatrix("u_model", glm::mat4(1.0f)); - if (auto model = assets->get("cube")) { - srand(0); - float timer = Window::time(); - for (size_t i = 0; i < 10000; i++) { - float x = (rand() % 5000)*0.1f; - float y = (rand() % 1000)*0.1f + 60; - float z = (rand() % 5000)*0.1f; - glm::vec3 coord(x, y, z); - int rot = rand() % 1000; - if (frustumCulling->IsBoxVisible(coord, coord)) { - modelBatch->translate(coord); - modelBatch->rotate(glm::vec3(0, 1, 0), timer*3+rot); - modelBatch->draw(model); - modelBatch->popMatrix(); - modelBatch->popMatrix(); - } - } - } + // draw entities here modelBatch->render(); skybox->unbind(); diff --git a/src/maths/FrustumCulling.hpp b/src/maths/FrustumCulling.hpp index b2b46ed4..309fc1ba 100644 --- a/src/maths/FrustumCulling.hpp +++ b/src/maths/FrustumCulling.hpp @@ -9,7 +9,7 @@ public: Frustum() {}; void update(glm::mat4 projview); - bool IsBoxVisible(const glm::vec3& minp, const glm::vec3& maxp) const; + bool isBoxVisible(const glm::vec3& minp, const glm::vec3& maxp) const; private: enum Planes @@ -76,8 +76,7 @@ inline void Frustum::update(glm::mat4 m) } -inline bool Frustum::IsBoxVisible(const glm::vec3& minp, const glm::vec3& maxp) const -{ +inline bool Frustum::isBoxVisible(const glm::vec3& minp, const glm::vec3& maxp) const { // check box outside/inside of frustum for (int i = 0; i < Count; i++) {