From a5ddb0e37faec347b1027b83b09a9b75f2eb0129 Mon Sep 17 00:00:00 2001 From: EmaMaker Date: Fri, 11 Nov 2022 19:16:04 +0100 Subject: [PATCH] chunkmgr: avoid call of chunkmesh default ctor --- include/chunkmesh.hpp | 1 - src/chunkmanager.cpp | 14 ++++++-------- src/chunkmesh.cpp | 12 +++++------- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/include/chunkmesh.hpp b/include/chunkmesh.hpp index f0e3031..b461fe6 100644 --- a/include/chunkmesh.hpp +++ b/include/chunkmesh.hpp @@ -13,7 +13,6 @@ class ChunkMesh { public: - ChunkMesh(); ChunkMesh(Chunk::Chunk *c); void mesh(); void draw(); diff --git a/src/chunkmanager.cpp b/src/chunkmanager.cpp index 076ac8c..2c05579 100644 --- a/src/chunkmanager.cpp +++ b/src/chunkmanager.cpp @@ -12,7 +12,7 @@ #include #include -std::unordered_map chunks{}; +std::unordered_map chunks; namespace chunkmanager { @@ -86,16 +86,14 @@ namespace chunkmanager // std::cout << "Checking" << i << ", " << j << ", " << k <chunk << std::endl; + // if(this->chunk != nullptr) delete this->chunk; + // this->chunk = nullptr; + // delete[] (this->theShader); } ChunkMesh::ChunkMesh(Chunk::Chunk *c) @@ -30,8 +32,6 @@ ChunkMesh::ChunkMesh(Chunk::Chunk *c) void ChunkMesh::mesh() { - if (!(this->chunk)) - return; /* * Taking inspiration from 0fps and the jme3 porting at * https://github.com/roboleary/GreedyMesh/blob/master/src/mygame/Main.java @@ -227,8 +227,6 @@ void ChunkMesh::mesh() void ChunkMesh::draw() { - if (!(this->chunk)) - return; // glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); // wireframe mode