From 0104585e107e7b12aefeba7ac8fddc69c0c61e72 Mon Sep 17 00:00:00 2001 From: Astazium <113135541+Astazium@users.noreply.github.com> Date: Mon, 1 Jun 2026 12:19:33 +0300 Subject: [PATCH 01/18] gbuffer refactor --- src/graphics/core/GBuffer.cpp | 223 +++++++++++----------------------- src/graphics/core/GBuffer.hpp | 29 +++-- 2 files changed, 87 insertions(+), 165 deletions(-) diff --git a/src/graphics/core/GBuffer.cpp b/src/graphics/core/GBuffer.cpp index aba3103fc..30c3e66c7 100644 --- a/src/graphics/core/GBuffer.cpp +++ b/src/graphics/core/GBuffer.cpp @@ -8,143 +8,62 @@ using namespace advanced_pipeline; static debug::Logger logger("gl-gbuffer"); -// TODO: REFACTOR - -void GBuffer::createColorBuffer() { - if (colorBuffer == 0) - glGenTextures(1, &colorBuffer); - glBindTexture(GL_TEXTURE_2D, colorBuffer); - glTexImage2D( - GL_TEXTURE_2D, - 0, - GL_RGB, - width, - height, - 0, - GL_RGB, - GL_UNSIGNED_BYTE, - nullptr - ); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glFramebufferTexture2D( - GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, colorBuffer, 0 - ); +void GBuffer::createBuffer(Buffer& buffer) { + if (buffer.buffer == 0) { + if (&buffer == &depthBuffer) + glGenRenderbuffers(1, &depthBuffer.buffer); + else + glGenTextures(1, &buffer.buffer); + } + if (&buffer == &depthBuffer){ + glBindRenderbuffer(GL_RENDERBUFFER, depthBuffer.buffer); + glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, width, height); + glFramebufferRenderbuffer( + GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthBuffer.buffer + ); + } else { + glBindTexture(GL_TEXTURE_2D, buffer.buffer); + glTexImage2D( + GL_TEXTURE_2D, + 0, + buffer.internalformat, + width, + height, + 0, + buffer.format, + buffer.type, + nullptr + ); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + if (&buffer != &ssaoBuffer) + { + glFramebufferTexture2D( + GL_FRAMEBUFFER, buffer.attachment, GL_TEXTURE_2D, buffer.buffer, 0 + ); + } + } } -void GBuffer::createPositionsBuffer() { - if (positionsBuffer == 0) - glGenTextures(1, &positionsBuffer); - glBindTexture(GL_TEXTURE_2D, positionsBuffer); - glTexImage2D( - GL_TEXTURE_2D, - 0, - GL_RGBA16F, - width, - height, - 0, - GL_RGBA, - GL_FLOAT, - nullptr - ); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glFramebufferTexture2D( - GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, positionsBuffer, 0 - ); -} +GBuffer::GBuffer(uint width, uint height) + : width(width), height(height), -void GBuffer::createNormalsBuffer() { - if (normalsBuffer == 0) - glGenTextures(1, &normalsBuffer); - glBindTexture(GL_TEXTURE_2D, normalsBuffer); - glTexImage2D( - GL_TEXTURE_2D, - 0, - GL_RGBA16F, - width, - height, - 0, - GL_RGB, - GL_FLOAT, - nullptr - ); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glFramebufferTexture2D( - GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, GL_TEXTURE_2D, normalsBuffer, 0 - ); -} - -void GBuffer::createEmissionBuffer() { - if (emissionBuffer == 0) - glGenTextures(1, &emissionBuffer); - glBindTexture(GL_TEXTURE_2D, emissionBuffer); - glTexImage2D( - GL_TEXTURE_2D, - 0, - GL_R8, - width, - height, - 0, - GL_RED, - GL_FLOAT, - nullptr - ); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glFramebufferTexture2D( - GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT3, GL_TEXTURE_2D, emissionBuffer, 0 - ); -} - -void GBuffer::createDepthBuffer() { - if (depthBuffer == 0) - glGenRenderbuffers(1, &depthBuffer); - glBindRenderbuffer(GL_RENDERBUFFER, depthBuffer); - glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, width, height); - glFramebufferRenderbuffer( - GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthBuffer - ); -} - -void GBuffer::createSSAOBuffer() { - if (ssaoBuffer == 0) - glGenTextures(1, &ssaoBuffer); - glBindTexture(GL_TEXTURE_2D, ssaoBuffer); - glTexImage2D( - GL_TEXTURE_2D, - 0, - GL_R16F, - width, - height, - 0, - GL_RED, - GL_FLOAT, - nullptr - ); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); -} - -GBuffer::GBuffer(uint width, uint height) : width(width), height(height) { + colorBuffer {0, GL_RGB, GL_RGB, GL_UNSIGNED_BYTE, GL_COLOR_ATTACHMENT0}, + positionsBuffer {0, GL_RGBA16F, GL_RGBA, GL_FLOAT, GL_COLOR_ATTACHMENT1}, + normalsBuffer {0, GL_RGBA16F, GL_RGB, GL_FLOAT, GL_COLOR_ATTACHMENT2}, + emissionBuffer {0, GL_R8, GL_RED, GL_FLOAT, GL_COLOR_ATTACHMENT3}, + ssaoBuffer {0, GL_R16F, GL_RED, GL_FLOAT, 0}, + depthBuffer {0, 0, 0, 0, 0} +{ glGenFramebuffers(1, &fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo); - createColorBuffer(); - createPositionsBuffer(); - createNormalsBuffer(); - createEmissionBuffer(); + createBuffer(colorBuffer); + createBuffer(positionsBuffer); + createBuffer(normalsBuffer); + createBuffer(emissionBuffer); GLenum attachments[4] = { GL_COLOR_ATTACHMENT0, @@ -154,7 +73,7 @@ GBuffer::GBuffer(uint width, uint height) : width(width), height(height) { }; glDrawBuffers(4, attachments); - createDepthBuffer(); + createBuffer(depthBuffer); int status; if ((status = glCheckFramebufferStatus(GL_FRAMEBUFFER)) != GL_FRAMEBUFFER_COMPLETE) { @@ -164,9 +83,9 @@ GBuffer::GBuffer(uint width, uint height) : width(width), height(height) { glGenFramebuffers(1, &ssaoFbo); glBindFramebuffer(GL_FRAMEBUFFER, ssaoFbo); - createSSAOBuffer(); + createBuffer(ssaoBuffer); glFramebufferTexture2D( - GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, ssaoBuffer, 0 + GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, ssaoBuffer.buffer, 0 ); GLenum ssaoAttachments[1] = {GL_COLOR_ATTACHMENT0}; glDrawBuffers(1, ssaoAttachments); @@ -179,12 +98,12 @@ GBuffer::GBuffer(uint width, uint height) : width(width), height(height) { } GBuffer::~GBuffer() { - glDeleteTextures(1, &colorBuffer); - glDeleteTextures(1, &positionsBuffer); - glDeleteTextures(1, &normalsBuffer); - glDeleteTextures(1, &emissionBuffer); - glDeleteTextures(1, &ssaoBuffer); - glDeleteRenderbuffers(1, &depthBuffer); + glDeleteTextures(1, &colorBuffer.buffer); + glDeleteTextures(1, &positionsBuffer.buffer); + glDeleteTextures(1, &normalsBuffer.buffer); + glDeleteTextures(1, &emissionBuffer.buffer); + glDeleteTextures(1, &ssaoBuffer.buffer); + glDeleteRenderbuffers(1, &depthBuffer.buffer); glDeleteFramebuffers(1, &fbo); glDeleteFramebuffers(1, &ssaoFbo); } @@ -204,23 +123,23 @@ void GBuffer::unbind() { void GBuffer::bindBuffers() const { glActiveTexture(GL_TEXTURE0 + TARGET_EMISSION); - glBindTexture(GL_TEXTURE_2D, emissionBuffer); + glBindTexture(GL_TEXTURE_2D, emissionBuffer.buffer); glActiveTexture(GL_TEXTURE0 + TARGET_NORMALS); - glBindTexture(GL_TEXTURE_2D, normalsBuffer); + glBindTexture(GL_TEXTURE_2D, normalsBuffer.buffer); glActiveTexture(GL_TEXTURE0 + TARGET_POSITIONS); - glBindTexture(GL_TEXTURE_2D, positionsBuffer); + glBindTexture(GL_TEXTURE_2D, positionsBuffer.buffer); glActiveTexture(GL_TEXTURE0 + TARGET_COLOR); - glBindTexture(GL_TEXTURE_2D, colorBuffer); + glBindTexture(GL_TEXTURE_2D, colorBuffer.buffer); if (TARGET_COLOR != 0) glActiveTexture(GL_TEXTURE0); } void GBuffer::bindSSAOBuffer() const { - glBindTexture(GL_TEXTURE_2D, ssaoBuffer); + glBindTexture(GL_TEXTURE_2D, ssaoBuffer.buffer); } void GBuffer::bindDepthBuffer(int drawFbo) { @@ -239,24 +158,24 @@ void GBuffer::resize(uint width, uint height) { glBindFramebuffer(GL_FRAMEBUFFER, fbo); - createDepthBuffer(); - createColorBuffer(); - createPositionsBuffer(); - createNormalsBuffer(); - createEmissionBuffer(); + createBuffer(depthBuffer); + createBuffer(colorBuffer); + createBuffer(positionsBuffer); + createBuffer(normalsBuffer); + createBuffer(emissionBuffer); glBindTexture(GL_TEXTURE_2D, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, ssaoFbo); - createSSAOBuffer(); + createBuffer(ssaoBuffer); glBindTexture(GL_TEXTURE_2D, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0); } std::unique_ptr GBuffer::toImage() const { auto data = std::make_unique(width * height * 3); - glBindTexture(GL_TEXTURE_2D, colorBuffer); + glBindTexture(GL_TEXTURE_2D, colorBuffer.buffer); glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, data.get()); glBindTexture(GL_TEXTURE_2D, 0); return std::make_unique( diff --git a/src/graphics/core/GBuffer.hpp b/src/graphics/core/GBuffer.hpp index ae433c873..f48b430e2 100644 --- a/src/graphics/core/GBuffer.hpp +++ b/src/graphics/core/GBuffer.hpp @@ -25,22 +25,25 @@ public: std::unique_ptr toImage() const; private: + struct Buffer { + uint buffer; + const int internalformat; + const uint format; + const uint type; + const uint attachment; + }; + uint width; uint height; uint fbo; - uint colorBuffer = 0; - uint positionsBuffer = 0; - uint normalsBuffer = 0; - uint emissionBuffer = 0; - uint depthBuffer = 0; - uint ssaoFbo = 0; - uint ssaoBuffer = 0; + Buffer colorBuffer; + Buffer positionsBuffer; + Buffer normalsBuffer; + Buffer emissionBuffer; + Buffer depthBuffer; + uint ssaoFbo; + Buffer ssaoBuffer; - void createColorBuffer(); - void createPositionsBuffer(); - void createNormalsBuffer(); - void createEmissionBuffer(); - void createDepthBuffer(); - void createSSAOBuffer(); + void createBuffer(Buffer& buffer); }; From 77d9ca1d86b619f4a80b69ced3e5ef963a22d997 Mon Sep 17 00:00:00 2001 From: Astazium <113135541+Astazium@users.noreply.github.com> Date: Mon, 1 Jun 2026 21:18:33 +0300 Subject: [PATCH 02/18] fix --- src/graphics/core/GBuffer.cpp | 4 ++-- src/logic/scripting/lua/libs/libentity.cpp | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/graphics/core/GBuffer.cpp b/src/graphics/core/GBuffer.cpp index 30c3e66c7..85a223ca5 100644 --- a/src/graphics/core/GBuffer.cpp +++ b/src/graphics/core/GBuffer.cpp @@ -54,8 +54,8 @@ GBuffer::GBuffer(uint width, uint height) positionsBuffer {0, GL_RGBA16F, GL_RGBA, GL_FLOAT, GL_COLOR_ATTACHMENT1}, normalsBuffer {0, GL_RGBA16F, GL_RGB, GL_FLOAT, GL_COLOR_ATTACHMENT2}, emissionBuffer {0, GL_R8, GL_RED, GL_FLOAT, GL_COLOR_ATTACHMENT3}, - ssaoBuffer {0, GL_R16F, GL_RED, GL_FLOAT, 0}, - depthBuffer {0, 0, 0, 0, 0} + depthBuffer {0, 0, 0, 0, 0}, + ssaoBuffer {0, GL_R16F, GL_RED, GL_FLOAT, 0} { glGenFramebuffers(1, &fbo); glBindFramebuffer(GL_FRAMEBUFFER, fbo); diff --git a/src/logic/scripting/lua/libs/libentity.cpp b/src/logic/scripting/lua/libs/libentity.cpp index d2c0c4bc5..48b05228d 100644 --- a/src/logic/scripting/lua/libs/libentity.cpp +++ b/src/logic/scripting/lua/libs/libentity.cpp @@ -62,6 +62,9 @@ static int l_get_def(lua::State* L) { static int l_spawn(lua::State* L) { auto level = controller->getLevel(); auto defname = lua::tostring(L, 1); + if (defname == nullptr) { + throw std::runtime_error("empty string"); + } auto& def = content->entities.require(defname); auto pos = lua::tovec3(L, 2); dv::value args = nullptr; From 0a3f51666e1ed01e6edb5bba7e8e69331f2a0921 Mon Sep 17 00:00:00 2001 From: Astazium <113135541+Astazium@users.noreply.github.com> Date: Wed, 3 Jun 2026 18:02:36 +0300 Subject: [PATCH 03/18] Update libentity.cpp --- src/logic/scripting/lua/libs/libentity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/logic/scripting/lua/libs/libentity.cpp b/src/logic/scripting/lua/libs/libentity.cpp index 48b05228d..892dbe050 100644 --- a/src/logic/scripting/lua/libs/libentity.cpp +++ b/src/logic/scripting/lua/libs/libentity.cpp @@ -63,7 +63,7 @@ static int l_spawn(lua::State* L) { auto level = controller->getLevel(); auto defname = lua::tostring(L, 1); if (defname == nullptr) { - throw std::runtime_error("empty string"); + throw std::runtime_error("invalid string"); } auto& def = content->entities.require(defname); auto pos = lua::tovec3(L, 2); From 3c10611fdad35875062c84da5a4ca96c230a79eb Mon Sep 17 00:00:00 2001 From: Astazium <113135541+Astazium@users.noreply.github.com> Date: Thu, 4 Jun 2026 17:33:24 +0300 Subject: [PATCH 04/18] Update libentity.cpp --- src/logic/scripting/lua/libs/libentity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/logic/scripting/lua/libs/libentity.cpp b/src/logic/scripting/lua/libs/libentity.cpp index 892dbe050..f4e8ea432 100644 --- a/src/logic/scripting/lua/libs/libentity.cpp +++ b/src/logic/scripting/lua/libs/libentity.cpp @@ -63,7 +63,7 @@ static int l_spawn(lua::State* L) { auto level = controller->getLevel(); auto defname = lua::tostring(L, 1); if (defname == nullptr) { - throw std::runtime_error("invalid string"); + throw std::runtime_error("string is nil"); } auto& def = content->entities.require(defname); auto pos = lua::tovec3(L, 2); From 74c9070fdcde6fd4da83fbd1ff4ab7ee87f55097 Mon Sep 17 00:00:00 2001 From: Astazium <113135541+Astazium@users.noreply.github.com> Date: Thu, 4 Jun 2026 17:34:29 +0300 Subject: [PATCH 05/18] Update libentity.cpp --- src/logic/scripting/lua/libs/libentity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/logic/scripting/lua/libs/libentity.cpp b/src/logic/scripting/lua/libs/libentity.cpp index f4e8ea432..892dbe050 100644 --- a/src/logic/scripting/lua/libs/libentity.cpp +++ b/src/logic/scripting/lua/libs/libentity.cpp @@ -63,7 +63,7 @@ static int l_spawn(lua::State* L) { auto level = controller->getLevel(); auto defname = lua::tostring(L, 1); if (defname == nullptr) { - throw std::runtime_error("string is nil"); + throw std::runtime_error("invalid string"); } auto& def = content->entities.require(defname); auto pos = lua::tovec3(L, 2); From ecedc3c436b2eb514d529cd0d698c7d8638f8ff3 Mon Sep 17 00:00:00 2001 From: Astazium <113135541+Astazium@users.noreply.github.com> Date: Fri, 17 Jul 2026 12:55:27 +0300 Subject: [PATCH 06/18] hide self skeleton debug rendering in first person --- src/graphics/render/WorldRenderer.cpp | 3 ++- src/objects/Entities.cpp | 9 ++++++--- src/objects/Entities.hpp | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/graphics/render/WorldRenderer.cpp b/src/graphics/render/WorldRenderer.cpp index 2e150e1f7..357a2e1cc 100644 --- a/src/graphics/render/WorldRenderer.cpp +++ b/src/graphics/render/WorldRenderer.cpp @@ -275,7 +275,8 @@ void WorldRenderer::renderLines( auto ctx = pctx.sub(lineBatch.get()); bool culling = engine.getSettings().graphics.frustumCulling.get(); level.entities->renderDebug( - *lineBatch, culling ? frustumCulling.get() : nullptr, ctx + *lineBatch, culling ? frustumCulling.get() : nullptr, ctx, + player.currentCamera.get() == player.fpCamera.get() ? player.getEntity() : 0 ); } } diff --git a/src/objects/Entities.cpp b/src/objects/Entities.cpp index fafd99fe5..c4a4a763b 100644 --- a/src/objects/Entities.cpp +++ b/src/objects/Entities.cpp @@ -415,7 +415,7 @@ static void debug_render_skeleton( } void Entities::renderDebug( - LineBatch& batch, const Frustum* frustum, const DrawContext& pctx + LineBatch& batch, const Frustum* frustum, const DrawContext& pctx, entityid_t fpsEntity ) { { auto ctx = pctx.sub(&batch); @@ -443,12 +443,15 @@ void Entities::renderDebug( } } { - auto view = registry->view(); + auto view = registry->view(); auto ctx = pctx.sub(&batch); ctx.setDepthTest(false); ctx.setDepthMask(false); ctx.setLineWidth(2); - for (auto [entity, transform, skeleton] : view.each()) { + for (auto [entity, eid, transform, skeleton] : view.each()) { + if (eid.uid == fpsEntity) { + continue; + } auto config = skeleton.config; if (config == nullptr) { continue; diff --git a/src/objects/Entities.hpp b/src/objects/Entities.hpp index 0d003ffb1..b678512a9 100644 --- a/src/objects/Entities.hpp +++ b/src/objects/Entities.hpp @@ -58,7 +58,7 @@ public: void update(float delta); void renderDebug( - LineBatch& batch, const Frustum* frustum, const DrawContext& ctx + LineBatch& batch, const Frustum* frustum, const DrawContext& ctx, entityid_t fpsEntity ); void render( const Assets& assets, From c6d8035f3b36c265b37975d7a1c4d047b9a037dc Mon Sep 17 00:00:00 2001 From: Astazium <113135541+Astazium@users.noreply.github.com> Date: Tue, 4 Aug 2026 23:26:03 +0300 Subject: [PATCH 07/18] detailed error message --- src/logic/scripting/lua/libs/libentity.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/logic/scripting/lua/libs/libentity.cpp b/src/logic/scripting/lua/libs/libentity.cpp index 46efdff0f..80f7cc4cf 100644 --- a/src/logic/scripting/lua/libs/libentity.cpp +++ b/src/logic/scripting/lua/libs/libentity.cpp @@ -72,7 +72,7 @@ static int l_spawn(lua::State* L) { auto level = controller->getLevel(); auto defname = lua::tostring(L, 1); if (defname == nullptr) { - throw std::runtime_error("invalid string"); + throw std::runtime_error("string expected, got nil"); } auto& def = content->entities.require(defname); auto pos = lua::tovec3(L, 2); From 859935f3b5e92d5afb013d1565565061de22c1b4 Mon Sep 17 00:00:00 2001 From: Astazium <113135541+Astazium@users.noreply.github.com> Date: Wed, 5 Aug 2026 23:06:16 +0300 Subject: [PATCH 08/18] ObjParser and small libvecn refactor --- src/coders/obj.cpp | 122 +++++++++++++---------- src/logic/scripting/lua/libs/libvecn.cpp | 61 ++++-------- 2 files changed, 90 insertions(+), 93 deletions(-) diff --git a/src/coders/obj.cpp b/src/coders/obj.cpp index d7ff244aa..6da92a66c 100644 --- a/src/coders/obj.cpp +++ b/src/coders/obj.cpp @@ -10,53 +10,69 @@ class ObjParser : BasicParser { std::vector uvs {{0, 0}}; std::vector normals {{0, 1, 0}}; - // TODO: refactor - void parseFace(Mesh& mesh) { - std::vector vertices; - while (hasNext()) { - auto c = peekInLine(); - if (c == '\n') { - break; - } else if (hasNext()) { - uint indices[3] {}; - uint i = 0; - do { - char next = peekInLine(); - if (is_digit(next)) { - indices[i] = parseSimpleInt(10); - if (hasNext() && peekInLine() == '/') { - pos++; - } - } else if (next == '/') { - pos++; - } else { - break; - } - } while (hasNext() && peekInLine() != '\n' && ++i < 3); + Vertex parseFaceVertex() { + auto parseIndex = [&]() -> uint { + if (!hasNext() || !is_digit(peekInLine())) { + return 0; + } + return parseSimpleInt(10); + }; - vertices.push_back(Vertex { - coords[indices[0]], uvs[indices[1]], normals[indices[2]]}); + uint coord = parseIndex(); + uint uv = 0; + uint normal = 0; + + if (hasNext() && peekInLine() == '/') { + pos++; + + uv = parseIndex(); + + if (hasNext() && peekInLine() == '/') { + pos++; + normal = parseIndex(); } } - if (hasNext() && peekInLine() != '\n') { - skipLine(); - } + + return Vertex { + coords[coord], + uvs[uv], + normals[normal] + }; + } + + void triangulate(const std::vector& vertices, std::vector& output) { if (vertices.size() >= 3) { for (size_t j = 0; j < vertices.size() - 2; j++) { - mesh.vertices.push_back(vertices[0]); + output.push_back(vertices[0]); for (size_t i = 1; i < 3; i++) { - mesh.vertices.push_back(vertices[i + j]); + output.push_back(vertices[i + j]); } } } } -public: - ObjParser(const std::string_view file, const std::string_view src) - : BasicParser(file, src) { + + void parseFace(Mesh& mesh) { + std::vector vertices; + while (hasNext() && peekInLine() != '\n') { + vertices.push_back(parseFaceVertex()); + } + triangulate(vertices, mesh.vertices); } - std::unique_ptr parse() { - // first iteration - collecting vertex data + glm::vec3 parseVec3() { + float x = parseNumber().asNumber(); + float y = parseNumber().asNumber(); + float z = parseNumber().asNumber(); + return glm::vec3 {x, y, z}; + } + + glm::vec2 parseVec2() { + float x = parseNumber().asNumber(); + float y = parseNumber().asNumber(); + return glm::vec2 {x, y}; + } + + void collectVertexData() { while (hasNext()) { if (peek() == '#') { skipLine(); @@ -64,27 +80,18 @@ public: } auto cmd = parseName(); if (cmd == "v") { - float x = parseNumber().asNumber(); - float y = parseNumber().asNumber(); - float z = parseNumber().asNumber(); - coords.emplace_back(x, y, z); + coords.emplace_back(parseVec3()); } else if (cmd == "vt") { - float u = parseNumber().asNumber(); - float v = parseNumber().asNumber(); - uvs.emplace_back(u, v); + uvs.emplace_back(parseVec2()); } else if (cmd == "vn") { - float x = parseNumber().asNumber(); - float y = parseNumber().asNumber(); - float z = parseNumber().asNumber(); - normals.emplace_back(x, y, z); + normals.emplace_back(parseVec3()); } else { skipLine(); } } - // second iteration - building meshes - reset(); + } - auto model = std::make_unique(); + void buildMeshes(Model& model) { std::string texture; while (hasNext()) { if (peek() != '#' && parseName() == "usemtl") { @@ -95,7 +102,7 @@ public: skipLine(); } do { - Mesh* mesh = &model->addMesh(texture); + Mesh* mesh = &model.addMesh(texture); while (hasNext()) { if (peek() == '#') { skipLine(); @@ -105,7 +112,7 @@ public: if (cmd == "usemtl") { skipWhitespace(); texture = readUntilEOL(); - mesh = &model->addMesh(texture); + mesh = &model.addMesh(texture); break; } else if (cmd == "f") { parseFace(*mesh); @@ -113,6 +120,19 @@ public: skipLine(); } } while (hasNext()); + } +public: + ObjParser(const std::string_view file, const std::string_view src) + : BasicParser(file, src) { + } + + std::unique_ptr parse() { + // first iteration - collecting vertex data + collectVertexData(); + // second iteration - building meshes + reset(); + auto model = std::make_unique(); + buildMeshes(*model); model->clean(); return model; } diff --git a/src/logic/scripting/lua/libs/libvecn.cpp b/src/logic/scripting/lua/libs/libvecn.cpp index e0a5ac3dd..47ce1ca70 100644 --- a/src/logic/scripting/lua/libs/libvecn.cpp +++ b/src/logic/scripting/lua/libs/libvecn.cpp @@ -211,59 +211,36 @@ static int l_tostring(lua::State* L) { return lua::pushstring(L, ss.str()); } +#define VECLIB_BASE(dimension) \ +{"add", lua::wrap>}, \ +{"sub", lua::wrap>}, \ +{"mul", lua::wrap>}, \ +{"div", lua::wrap>}, \ +{"distance", lua::wrap>}, \ +{"normalize", lua::wrap>}, \ +{"length", lua::wrap>}, \ +{"tostring", lua::wrap>}, \ +{"abs", lua::wrap>}, \ +{"round", lua::wrap>}, \ +{"inverse", lua::wrap>}, \ +{"pow", lua::wrap>}, \ +{"dot", lua::wrap>}, \ +{"mix", lua::wrap>}, + const luaL_Reg vec2lib[] = { - {"add", lua::wrap>}, - {"sub", lua::wrap>}, - {"mul", lua::wrap>}, - {"div", lua::wrap>}, - {"distance", lua::wrap>}, - {"normalize", lua::wrap>}, - {"length", lua::wrap>}, - {"tostring", lua::wrap>}, - {"abs", lua::wrap>}, - {"round", lua::wrap>}, - {"inverse", lua::wrap>}, - {"pow", lua::wrap>}, - {"dot", lua::wrap>}, + VECLIB_BASE(2) {"angle", lua::wrap}, - {"mix", lua::wrap>}, {"rotate", lua::wrap}, {nullptr, nullptr} }; const luaL_Reg vec3lib[] = { - {"add", lua::wrap>}, - {"sub", lua::wrap>}, - {"mul", lua::wrap>}, - {"div", lua::wrap>}, - {"distance", lua::wrap>}, - {"normalize", lua::wrap>}, - {"length", lua::wrap>}, - {"tostring", lua::wrap>}, - {"abs", lua::wrap>}, - {"round", lua::wrap>}, - {"inverse", lua::wrap>}, - {"pow", lua::wrap>}, - {"dot", lua::wrap>}, + VECLIB_BASE(3) {"spherical_rand", lua::wrap}, - {"mix", lua::wrap>}, {nullptr, nullptr} }; const luaL_Reg vec4lib[] = { - {"add", lua::wrap>}, - {"sub", lua::wrap>}, - {"mul", lua::wrap>}, - {"div", lua::wrap>}, - {"distance", lua::wrap>}, - {"normalize", lua::wrap>}, - {"length", lua::wrap>}, - {"tostring", lua::wrap>}, - {"abs", lua::wrap>}, - {"round", lua::wrap>}, - {"inverse", lua::wrap>}, - {"pow", lua::wrap>}, - {"dot", lua::wrap>}, - {"mix", lua::wrap>}, + VECLIB_BASE(4) {nullptr, nullptr} }; From 7388a2c8358518eb645c330c8e2812d9b20b9126 Mon Sep 17 00:00:00 2001 From: Astazium <113135541+Astazium@users.noreply.github.com> Date: Sun, 23 Aug 2026 20:49:30 +0300 Subject: [PATCH 09/18] fix older cmake versions --- src/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 12ece0f7f..2f4969a29 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,6 +14,13 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows") find_package(OpenAL CONFIG REQUIRED) else() find_package(OpenAL REQUIRED) + if(NOT TARGET OpenAL::OpenAL) + add_library(OpenAL::OpenAL UNKNOWN IMPORTED) + set_target_properties(OpenAL::OpenAL PROPERTIES + IMPORTED_LOCATION "${OPENAL_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${OPENAL_INCLUDE_DIR}" + ) + endif() endif() find_package(ZLIB REQUIRED) find_package(PNG REQUIRED) From 16cd4baedf50f9492c29c4deb30237a6ea104d45 Mon Sep 17 00:00:00 2001 From: Astazium <113135541+Astazium@users.noreply.github.com> Date: Sun, 23 Aug 2026 21:09:35 +0300 Subject: [PATCH 10/18] another fix for older cmake versions --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 27a9d507b..62d9ba100 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,7 @@ target_link_options(VoxelEngine PRIVATE $<$:-no-pie>) add_custom_command( TARGET VoxelEngine POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/res $/res) if(VOXELENGINE_BUILD_TESTS) From c7db30528ebbbcadebc3bc07245d954085443d66 Mon Sep 17 00:00:00 2001 From: Astazium <113135541+Astazium@users.noreply.github.com> Date: Wed, 16 Sep 2026 21:46:30 +0300 Subject: [PATCH 11/18] fix includes --- src/graphics/ui/GUI.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/graphics/ui/GUI.cpp b/src/graphics/ui/GUI.cpp index 944c32fb5..5a0260f62 100644 --- a/src/graphics/ui/GUI.cpp +++ b/src/graphics/ui/GUI.cpp @@ -1,8 +1,5 @@ #include "GUI.hpp" -#include -#include - #include "assets/Assets.hpp" #include "debug/Logger.hpp" #include "elements/Label.hpp" @@ -17,7 +14,6 @@ #include "graphics/core/Shader.hpp" #include "graphics/core/Font.hpp" #include "graphics/core/DrawContext.hpp" -#include "graphics/core/Shader.hpp" #include "gui_util.hpp" #include "window/Camera.hpp" #include "window/Window.hpp" From 23cc72dde43b99fbc1089c095448bfdf6ff7fbdb Mon Sep 17 00:00:00 2001 From: Astazium <113135541+Astazium@users.noreply.github.com> Date: Wed, 16 Sep 2026 22:03:15 +0300 Subject: [PATCH 12/18] rename macros parameter --- src/logic/scripting/lua/libs/libvecn.cpp | 30 ++++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/logic/scripting/lua/libs/libvecn.cpp b/src/logic/scripting/lua/libs/libvecn.cpp index 47ce1ca70..4254332e9 100644 --- a/src/logic/scripting/lua/libs/libvecn.cpp +++ b/src/logic/scripting/lua/libs/libvecn.cpp @@ -211,21 +211,21 @@ static int l_tostring(lua::State* L) { return lua::pushstring(L, ss.str()); } -#define VECLIB_BASE(dimension) \ -{"add", lua::wrap>}, \ -{"sub", lua::wrap>}, \ -{"mul", lua::wrap>}, \ -{"div", lua::wrap>}, \ -{"distance", lua::wrap>}, \ -{"normalize", lua::wrap>}, \ -{"length", lua::wrap>}, \ -{"tostring", lua::wrap>}, \ -{"abs", lua::wrap>}, \ -{"round", lua::wrap>}, \ -{"inverse", lua::wrap>}, \ -{"pow", lua::wrap>}, \ -{"dot", lua::wrap>}, \ -{"mix", lua::wrap>}, +#define VECLIB_BASE(n) \ +{"add", lua::wrap>}, \ +{"sub", lua::wrap>}, \ +{"mul", lua::wrap>}, \ +{"div", lua::wrap>}, \ +{"distance", lua::wrap>}, \ +{"normalize", lua::wrap>}, \ +{"length", lua::wrap>}, \ +{"tostring", lua::wrap>}, \ +{"abs", lua::wrap>}, \ +{"round", lua::wrap>}, \ +{"inverse", lua::wrap>}, \ +{"pow", lua::wrap>}, \ +{"dot", lua::wrap>}, \ +{"mix", lua::wrap>}, const luaL_Reg vec2lib[] = { VECLIB_BASE(2) From 68a01e3648b285a77fb5ec3cc12b65f4168d39c6 Mon Sep 17 00:00:00 2001 From: Astazium <113135541+Astazium@users.noreply.github.com> Date: Wed, 16 Sep 2026 23:45:47 +0300 Subject: [PATCH 13/18] fix comments --- src/graphics/core/PostProcessing.hpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/graphics/core/PostProcessing.hpp b/src/graphics/core/PostProcessing.hpp index f9d50b75b..f05b64701 100644 --- a/src/graphics/core/PostProcessing.hpp +++ b/src/graphics/core/PostProcessing.hpp @@ -24,8 +24,6 @@ struct PostProcessingVertex { }; /// @brief Framebuffer with blitting with shaders. -/// @attention Current implementation does not support multiple render passes -/// for multiple effects. Will be implemented in v0.21 class PostProcessing { public: PostProcessing(size_t effectSlotsCount); @@ -73,7 +71,7 @@ private: void refreshFbos(uint width, uint height); - /// @brief Main framebuffer (lasy field) + /// @brief Main framebuffer (lazy field) std::unique_ptr fbo; std::unique_ptr fboSecond; /// @brief Fullscreen quad mesh as the post-processing canvas From 89bedf95950f0c7d97ecd6e7581566ff9643fad3 Mon Sep 17 00:00:00 2001 From: Astazium <113135541+Astazium@users.noreply.github.com> Date: Thu, 17 Sep 2026 01:27:21 +0300 Subject: [PATCH 14/18] fix noiseTexture deleting --- src/graphics/core/PostProcessing.cpp | 67 ++++++++++++++++------------ src/graphics/core/PostProcessing.hpp | 2 +- 2 files changed, 40 insertions(+), 29 deletions(-) diff --git a/src/graphics/core/PostProcessing.cpp b/src/graphics/core/PostProcessing.cpp index ec491c527..05682be04 100644 --- a/src/graphics/core/PostProcessing.cpp +++ b/src/graphics/core/PostProcessing.cpp @@ -1,4 +1,7 @@ #include "PostProcessing.hpp" + +#include + #include "Mesh.hpp" #include "Shader.hpp" #include "GBuffer.hpp" @@ -10,15 +13,37 @@ #include "window/Camera.hpp" #include -#include // TODO: REFACTOR WHOLE RENDER ENGINE using namespace advanced_pipeline; +static uint create_noise_texture() { + std::vector ssaoNoise; + for (unsigned int i = 0; i < 16; i++) { + glm::vec3 noise( + (rand() / static_cast(RAND_MAX)) * 2.0 - 1.0, + (rand() / static_cast(RAND_MAX)) * 2.0 - 1.0, + 0.0f + ); + ssaoNoise.push_back(noise); + } + + uint noiseTexture; + glGenTextures(1, &noiseTexture); + glBindTexture(GL_TEXTURE_2D, noiseTexture); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16F, 4, 4, 0, GL_RGB, GL_FLOAT, ssaoNoise.data()); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glBindTexture(GL_TEXTURE_2D, 0); + return noiseTexture; +} + PostProcessing::PostProcessing(size_t effectSlotsCount) : effectSlots(effectSlotsCount) { - // Fullscreen quad mesh bulding + // Fullscreen quad mesh building PostProcessingVertex meshData[] { {{-1.0f, -1.0f}}, {{-1.0f, 1.0f}}, @@ -29,27 +54,12 @@ PostProcessing::PostProcessing(size_t effectSlotsCount) }; quadMesh = std::make_unique>(meshData, 6); - - std::vector ssaoNoise; - for (unsigned int i = 0; i < 16; i++) - { - glm::vec3 noise( - (rand() / static_cast(RAND_MAX)) * 2.0 - 1.0, - (rand() / static_cast(RAND_MAX)) * 2.0 - 1.0, - 0.0f); - ssaoNoise.push_back(noise); - } - glGenTextures(1, &noiseTexture); - glBindTexture(GL_TEXTURE_2D, noiseTexture); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16F, 4, 4, 0, GL_RGB, GL_FLOAT, ssaoNoise.data()); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glBindTexture(GL_TEXTURE_2D, 0); + noiseTexture = create_noise_texture(); } -PostProcessing::~PostProcessing() = default; +PostProcessing::~PostProcessing() { + glDeleteTextures(1, &noiseTexture); +} void PostProcessing::use(DrawContext& context, bool gbufferPipeline) { const auto& vp = context.getViewport(); @@ -105,8 +115,9 @@ void PostProcessing::configureEffect( shader.uniform3f("u_cameraPos", camera.position); shader.uniform1f("u_timer", timer); shader.uniformMatrix("u_projection", camera.getProjection()); - shader.uniformMatrix("u_view", camera.getView()); - shader.uniformMatrix("u_inverseView", glm::inverse(camera.getView())); + const auto view = camera.getView(); + shader.uniformMatrix("u_view", view); + shader.uniformMatrix("u_inverseView", glm::inverse(view)); } void PostProcessing::renderDeferredShading( @@ -150,15 +161,15 @@ void PostProcessing::renderDeferredShading( gbuffer->bindSSAOBuffer(); glActiveTexture(GL_TEXTURE0); - + gbuffer->bindBuffers(); - auto& effect = assets.require("deferred_lighting"); - auto& shader = effect.use(); + auto& lightingEffect = assets.require("deferred_lighting"); + auto& lightingShader = lightingEffect.use(); configureEffect( context, - effect, - shader, + lightingEffect, + lightingShader, timer, camera ); diff --git a/src/graphics/core/PostProcessing.hpp b/src/graphics/core/PostProcessing.hpp index f05b64701..095e4e2b3 100644 --- a/src/graphics/core/PostProcessing.hpp +++ b/src/graphics/core/PostProcessing.hpp @@ -78,5 +78,5 @@ private: std::unique_ptr> quadMesh; std::vector> effectSlots; std::unique_ptr gbuffer; - uint noiseTexture; + uint noiseTexture = 0; }; From 229dadd9e0d662bbb2a336abb36289839051da77 Mon Sep 17 00:00:00 2001 From: Astazium <113135541+Astazium@users.noreply.github.com> Date: Thu, 17 Sep 2026 01:34:08 +0300 Subject: [PATCH 15/18] fix missing include --- src/graphics/core/PostProcessing.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/graphics/core/PostProcessing.cpp b/src/graphics/core/PostProcessing.cpp index 05682be04..ee93d1c36 100644 --- a/src/graphics/core/PostProcessing.cpp +++ b/src/graphics/core/PostProcessing.cpp @@ -13,6 +13,7 @@ #include "window/Camera.hpp" #include +#include // TODO: REFACTOR WHOLE RENDER ENGINE From ff77912f33fd3a84c0c97404dc19445ee60998e5 Mon Sep 17 00:00:00 2001 From: Astazium <113135541+Astazium@users.noreply.github.com> Date: Thu, 17 Sep 2026 02:09:42 +0300 Subject: [PATCH 16/18] revert create_noise_texture --- src/graphics/core/PostProcessing.cpp | 42 ++++++++++++---------------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/src/graphics/core/PostProcessing.cpp b/src/graphics/core/PostProcessing.cpp index ee93d1c36..f5be1abe1 100644 --- a/src/graphics/core/PostProcessing.cpp +++ b/src/graphics/core/PostProcessing.cpp @@ -19,29 +19,6 @@ using namespace advanced_pipeline; -static uint create_noise_texture() { - std::vector ssaoNoise; - for (unsigned int i = 0; i < 16; i++) { - glm::vec3 noise( - (rand() / static_cast(RAND_MAX)) * 2.0 - 1.0, - (rand() / static_cast(RAND_MAX)) * 2.0 - 1.0, - 0.0f - ); - ssaoNoise.push_back(noise); - } - - uint noiseTexture; - glGenTextures(1, &noiseTexture); - glBindTexture(GL_TEXTURE_2D, noiseTexture); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16F, 4, 4, 0, GL_RGB, GL_FLOAT, ssaoNoise.data()); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glBindTexture(GL_TEXTURE_2D, 0); - return noiseTexture; -} - PostProcessing::PostProcessing(size_t effectSlotsCount) : effectSlots(effectSlotsCount) { // Fullscreen quad mesh building @@ -55,7 +32,24 @@ PostProcessing::PostProcessing(size_t effectSlotsCount) }; quadMesh = std::make_unique>(meshData, 6); - noiseTexture = create_noise_texture(); + + std::vector ssaoNoise; + for (unsigned int i = 0; i < 16; i++) + { + glm::vec3 noise( + (rand() / static_cast(RAND_MAX)) * 2.0 - 1.0, + (rand() / static_cast(RAND_MAX)) * 2.0 - 1.0, + 0.0f); + ssaoNoise.push_back(noise); + } + glGenTextures(1, &noiseTexture); + glBindTexture(GL_TEXTURE_2D, noiseTexture); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16F, 4, 4, 0, GL_RGB, GL_FLOAT, ssaoNoise.data()); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glBindTexture(GL_TEXTURE_2D, 0); } PostProcessing::~PostProcessing() { From 68ced64a11522c35ae3a306efbf895abfcf3d6da Mon Sep 17 00:00:00 2001 From: Astazium <113135541+Astazium@users.noreply.github.com> Date: Sat, 19 Sep 2026 00:39:08 +0300 Subject: [PATCH 17/18] Update PostProcessing.cpp --- src/graphics/core/PostProcessing.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/graphics/core/PostProcessing.cpp b/src/graphics/core/PostProcessing.cpp index f5be1abe1..b50fad388 100644 --- a/src/graphics/core/PostProcessing.cpp +++ b/src/graphics/core/PostProcessing.cpp @@ -159,12 +159,12 @@ void PostProcessing::renderDeferredShading( gbuffer->bindBuffers(); - auto& lightingEffect = assets.require("deferred_lighting"); - auto& lightingShader = lightingEffect.use(); + auto& effect = assets.require("deferred_lighting"); + auto& shader = effect.use(); configureEffect( context, - lightingEffect, - lightingShader, + effect, + shader, timer, camera ); From 9e9615c80b35abcaa59bf28428d6aac19f0983cc Mon Sep 17 00:00:00 2001 From: Astazium <113135541+Astazium@users.noreply.github.com> Date: Sun, 20 Sep 2026 12:37:54 +0300 Subject: [PATCH 18/18] fix in vca docs --- doc/ru/vca.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/ru/vca.md b/doc/ru/vca.md index 795541dc1..c39fdbbcc 100644 --- a/doc/ru/vca.md +++ b/doc/ru/vca.md @@ -115,5 +115,5 @@ VCA файл состоит из набора директив, порядок >[!WARNING] -> Использование незадокументированных функций может иметь иметь любые незадокументированные последствия. +> Использование незадокументированных функций может иметь любые незадокументированные последствия.