From 34cb2bfdd5a0258bec1c997d9780d77787ee5a90 Mon Sep 17 00:00:00 2001 From: eliotbyte Date: Sat, 1 Nov 2025 23:50:44 +0300 Subject: [PATCH] fix function naming --- src/graphics/render/BlocksRenderer.cpp | 32 +++++++++++++------------- src/graphics/render/ChunksRenderer.cpp | 12 +++++----- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/graphics/render/BlocksRenderer.cpp b/src/graphics/render/BlocksRenderer.cpp index 1468e20e5..c937ff95c 100644 --- a/src/graphics/render/BlocksRenderer.cpp +++ b/src/graphics/render/BlocksRenderer.cpp @@ -17,26 +17,26 @@ static constexpr float kChunkCenterBias = 0.5f; static constexpr float kAoNormalPush = 0.75f; static constexpr float kFaceOffsetEps = 1e-3f; -static inline void expandAabbPoint(AABB& aabb, bool& init, const glm::vec3& p) { +static inline void expand_aabb_point(AABB& aabb, bool& init, const glm::vec3& p) { if (!init) { aabb.a = aabb.b = p; init = true; } else { aabb.addPoint(p); } } -static inline float applyDirectionalFactor(float d) { +static inline float apply_directional_factor(float d) { return (1.0f - DIRECTIONAL_LIGHT_FACTOR) + d * DIRECTIONAL_LIGHT_FACTOR; } -static inline void expandAabb4( +static inline void expand_aabb_4( AABB& aabb, bool& init, const glm::vec3& p0, const glm::vec3& p1, const glm::vec3& p2, const glm::vec3& p3 ) { - expandAabbPoint(aabb, init, p0); - expandAabbPoint(aabb, init, p1); - expandAabbPoint(aabb, init, p2); - expandAabbPoint(aabb, init, p3); + expand_aabb_point(aabb, init, p0); + expand_aabb_point(aabb, init, p1); + expand_aabb_point(aabb, init, p2); + expand_aabb_point(aabb, init, p3); } -static inline void fillTexfaces( +static inline void fill_texfaces( const ContentGfxCache& cache, blockid_t id, uint8_t variantId, bool densePass, UVRegion (&out)[6] @@ -147,7 +147,7 @@ void BlocksRenderer::face( // Expand local opaque AABB while vertices are still in chunk-local space if (!densePass) { - expandAabb4(localAabb, localAabbInit, p0, p1, p2, p3); + expand_aabb_4(localAabb, localAabbInit, p0, p1, p2, p3); } } @@ -187,7 +187,7 @@ void BlocksRenderer::faceAO( float s = kChunkCenterBias; if (lights) { const auto nZ = glm::normalize(Z); - float d = applyDirectionalFactor(glm::dot(nZ, SUN_VECTOR)); + float d = apply_directional_factor(glm::dot(nZ, SUN_VECTOR)); auto axisX = glm::normalize(X); auto axisY = glm::normalize(Y); @@ -204,7 +204,7 @@ void BlocksRenderer::faceAO( vertexAO(p2, region.u2, region.v2, tint, nh, axisX, axisY, axisZ); vertexAO(p3, region.u1, region.v2, tint, nh, axisX, axisY, axisZ); if (!densePass) { - expandAabb4(localAabb, localAabbInit, p0, p1, p2, p3); + expand_aabb_4(localAabb, localAabbInit, p0, p1, p2, p3); } } else { auto axisZ = glm::normalize(Z); @@ -218,7 +218,7 @@ void BlocksRenderer::faceAO( vertex(p2, region.u2, region.v2, tint, axisZ, 1); vertex(p3, region.u1, region.v2, tint, axisZ, 1); if (!densePass) { - expandAabb4(localAabb, localAabbInit, p0, p1, p2, p3); + expand_aabb_4(localAabb, localAabbInit, p0, p1, p2, p3); } } index(0, 1, 2, 0, 2, 3); @@ -241,7 +241,7 @@ void BlocksRenderer::face( float s = kChunkCenterBias; const auto nZ = glm::normalize(Z); if (lights) { - float d = applyDirectionalFactor(glm::dot(nZ, SUN_VECTOR)); + float d = apply_directional_factor(glm::dot(nZ, SUN_VECTOR)); tint *= d; } const auto nZ2 = lights ? nZ : Z; @@ -404,7 +404,7 @@ void BlocksRenderer::blockCustomModel( continue; } - float d = applyDirectionalFactor(glm::dot(n, SUN_VECTOR)); + float d = apply_directional_factor(glm::dot(n, SUN_VECTOR)); glm::vec3 t = glm::cross(r, n); for (int i = 0; i < 3; i++) { @@ -576,7 +576,7 @@ void BlocksRenderer::render( continue; } UVRegion texfaces[6]; - fillTexfaces(cache, id, variantId, densePass, texfaces); + fill_texfaces(cache, id, variantId, densePass, texfaces); int x = i % CHUNK_W; int y = i / (CHUNK_D * CHUNK_W); int z = (i / CHUNK_D) % CHUNK_W; @@ -648,7 +648,7 @@ SortingMeshData BlocksRenderer::renderTranslucent( continue; } UVRegion texfaces[6]; - fillTexfaces(cache, id, variantId, densePass, texfaces); + fill_texfaces(cache, id, variantId, densePass, texfaces); int x = i % CHUNK_W; int y = i / (CHUNK_D * CHUNK_W); int z = (i / CHUNK_D) % CHUNK_W; diff --git a/src/graphics/render/ChunksRenderer.cpp b/src/graphics/render/ChunksRenderer.cpp index f5c95a29c..070ab82d0 100644 --- a/src/graphics/render/ChunksRenderer.cpp +++ b/src/graphics/render/ChunksRenderer.cpp @@ -23,12 +23,12 @@ namespace { struct CullingBounds { glm::vec3 min; glm::vec3 max; }; static constexpr float kChunkCenterBias = 0.5f; -static inline bool hasVolume(const AABB& aabb) { +static inline bool has_volume(const AABB& aabb) { auto s = aabb.size(); return s.x > 0.0f || s.y > 0.0f || s.z > 0.0f; } -static inline CullingBounds computeChunkCullingBounds( +static inline CullingBounds compute_chunk_culling_bounds( const Chunk& chunk, const std::unordered_map& meshes ) { @@ -41,7 +41,7 @@ static inline CullingBounds computeChunkCullingBounds( auto it = meshes.find({chunk.x, chunk.z}); if (it != meshes.end()) { const auto& aabb = it->second.localAabb; - if (hasVolume(aabb)) { + if (has_volume(aabb)) { min = glm::vec3(chunk.x * CHUNK_W + aabb.min().x + kChunkCenterBias, (std::max)(static_cast(chunk.bottom), aabb.min().y + kChunkCenterBias), chunk.z * CHUNK_D + aabb.min().z + kChunkCenterBias); @@ -214,7 +214,7 @@ const Mesh* ChunksRenderer::retrieveChunk( chunk->updateHeights(); } if (culling) { - const auto bounds = computeChunkCullingBounds(*chunk, meshes); + const auto bounds = compute_chunk_culling_bounds(*chunk, meshes); if (!frustum.isBoxVisible(bounds.min, bounds.max)) return nullptr; } return mesh; @@ -247,7 +247,7 @@ void ChunksRenderer::drawShadowsPass( pos.x * CHUNK_W + kChunkCenterBias, kChunkCenterBias, pos.y * CHUNK_D + kChunkCenterBias ); - const auto bounds = computeChunkCullingBounds(*chunk, meshes); + const auto bounds = compute_chunk_culling_bounds(*chunk, meshes); if (!frustum.isBoxVisible(bounds.min, bounds.max)) { continue; } @@ -366,7 +366,7 @@ void ChunksRenderer::drawSortedMeshes(const Camera& camera, Shader& shader) { } if (culling) { - const auto bounds = computeChunkCullingBounds(*chunk, meshes); + const auto bounds = compute_chunk_culling_bounds(*chunk, meshes); if (!frustum.isBoxVisible(bounds.min, bounds.max)) continue; }