diff --git a/engine/xe_model.cpp b/engine/xe_model.cpp index 49d4c9d..a891d5f 100644 --- a/engine/xe_model.cpp +++ b/engine/xe_model.cpp @@ -53,6 +53,7 @@ void Model::deleteModel(Model* model) { void Model::submitDeleteQueue(bool purge) { for(Model* model: DELETION_QUEUE) { + vkDeviceWaitIdle(model->xeDevice.device()); try { delete model; } catch(int err) {}; } DELETION_QUEUE.clear(); diff --git a/engine/xe_renderer.cpp b/engine/xe_renderer.cpp index fb19846..c2eee9d 100644 --- a/engine/xe_renderer.cpp +++ b/engine/xe_renderer.cpp @@ -59,7 +59,7 @@ void Renderer::freeCommandBuffers() { } VkCommandBuffer Renderer::beginFrame() { - assert(!isFrameStarted && "Can't acll beingFrame while already in progress"); + assert(!isFrameStarted && "Can't call beingFrame while already in progress"); auto result = xeSwapChain->acquireNextImage(¤tImageIndex); diff --git a/engine/xe_swap_chain.cpp b/engine/xe_swap_chain.cpp index f6b194d..ae103db 100755 --- a/engine/xe_swap_chain.cpp +++ b/engine/xe_swap_chain.cpp @@ -109,8 +109,6 @@ VkResult SwapChain::submitCommandBuffers( submitInfo.signalSemaphoreCount = 1; submitInfo.pSignalSemaphores = signalSemaphores; - - vkResetFences(device.device(), 1, &inFlightFences[currentFrame]); if (vkQueueSubmit(device.graphicsQueue(), 1, &submitInfo, inFlightFences[currentFrame]) != VK_SUCCESS) { diff --git a/src/chunk.cpp b/src/chunk.cpp index c52eeb3..395aee7 100644 --- a/src/chunk.cpp +++ b/src/chunk.cpp @@ -19,6 +19,8 @@ Chunk::~Chunk() { if(worker.joinable()) worker.join(); xe::Model::deleteModel(chunkMesh); + vertexData.data.clear(); + cubes.clear(); } // @@ -216,7 +218,7 @@ void Chunk::generate() { for(int x = 0; x < 16; x++) { for(int z = 0; z < 16; z++) { - int height = perlin.octave2D_01((( x + gridX * 16) * 0.01), ((z + gridZ * 16) * 0.01), 4) * 10; + int height = perlin.octave2D_01((( x + gridX * 16) * 0.01), ((z + gridZ * 16) * 0.01), 4) * 20; for(int y = 0; y < 256; y++) { if(y == height){ setBlock(x, y, z, GRASS); diff --git a/src/first_app.cpp b/src/first_app.cpp index 63a960d..43047f7 100755 --- a/src/first_app.cpp +++ b/src/first_app.cpp @@ -73,8 +73,8 @@ void FirstApp::reloadLoadedChunks(xe::GameObject& viewer) { int gridZ = static_cast(floor(gameObject.transform.translation.z / 16.f)); int newGridX = minX + x; int newGridZ = minZ + z; - // if(gridX < minX || gridZ < minZ || gridX > maxX || gridZ > maxZ) - // Chunk::deleteChunk(gridX, gridZ); + if(gridX < minX || gridZ < minZ || gridX > maxX || gridZ > maxZ) + Chunk::deleteChunk(gridX, gridZ); Chunk* chunk = Chunk::getChunk(newGridX, newGridZ); if(chunk == nullptr) { chunk = Chunk::newChunk(newGridX, newGridZ, 12345);