From a59905f5b1d35db378aa71fade01c210127b533c Mon Sep 17 00:00:00 2001 From: DrSocalkwe3n Date: Sat, 16 Aug 2025 22:18:05 +0600 Subject: [PATCH] * --- Src/Client/Vulkan/VulkanRenderSession.cpp | 3 +++ Src/Client/Vulkan/VulkanRenderSession.hpp | 4 ++++ Src/Server/GameServer.cpp | 1 + Src/Server/RemoteClient.cpp | 8 ++++---- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Src/Client/Vulkan/VulkanRenderSession.cpp b/Src/Client/Vulkan/VulkanRenderSession.cpp index c97fa8e..89ff14c 100644 --- a/Src/Client/Vulkan/VulkanRenderSession.cpp +++ b/Src/Client/Vulkan/VulkanRenderSession.cpp @@ -1253,6 +1253,9 @@ void VulkanRenderSession::pushStage(EnumRenderStage stage) { return; VKCTX->ThreadVertexObj.pushStage(stage); + + if(stage == EnumRenderStage::Shutdown) + VKCTX->ThreadVertexObj.join(); } std::vector VulkanRenderSession::generateMeshForVoxelChunks(const std::vector cubes) { diff --git a/Src/Client/Vulkan/VulkanRenderSession.hpp b/Src/Client/Vulkan/VulkanRenderSession.hpp index a8336da..5d15170 100644 --- a/Src/Client/Vulkan/VulkanRenderSession.hpp +++ b/Src/Client/Vulkan/VulkanRenderSession.hpp @@ -234,6 +234,10 @@ class VulkanRenderSession : public IRenderSession, public IVulkanDependent { return std::pair{vertexVoxels, vertexNodes}; } + void join() { + Thread.join(); + } + private: // Буферы для хранения вершин VertexPool VertexPool_Voxels; diff --git a/Src/Server/GameServer.cpp b/Src/Server/GameServer.cpp index 9914ac8..b3e45d9 100644 --- a/Src/Server/GameServer.cpp +++ b/Src/Server/GameServer.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include diff --git a/Src/Server/RemoteClient.cpp b/Src/Server/RemoteClient.cpp index 3be9d40..27510e9 100644 --- a/Src/Server/RemoteClient.cpp +++ b/Src/Server/RemoteClient.cpp @@ -764,10 +764,10 @@ void RemoteClient::NetworkAndResource_t::decrementAssets(ResUses_t::RefAssets_t& } void RemoteClient::onUpdate() { - Pos::Object pos = CameraPos; + Pos::Object cameraPos = CameraPos; Pos::GlobalRegion r1 = LastPos >> 12 >> 4 >> 2; - Pos::GlobalRegion r2 = pos >> 12 >> 4 >> 2; + Pos::GlobalRegion r2 = cameraPos >> 12 >> 4 >> 2; if(r1 != r2) { CrossedRegion = true; } @@ -781,7 +781,7 @@ void RemoteClient::onUpdate() { glm::quat q = CameraQuat.toQuat(); glm::vec4 v = glm::mat4(q)*glm::vec4(0, 0, -6, 1); Pos::GlobalNode pos = (Pos::GlobalNode) (glm::vec3) v; - pos += pos >> Pos::Object_t::BS_Bit; + pos += cameraPos >> Pos::Object_t::BS_Bit; if(action == 0) { // Break @@ -794,7 +794,7 @@ void RemoteClient::onUpdate() { } } - LastPos = pos; + LastPos = cameraPos; } std::vector> RemoteClient::getViewPoints() {