From 8acb0749fb386436c15d7f3a23ad2441d5fdb856 Mon Sep 17 00:00:00 2001 From: Onran <100285264+Onran0@users.noreply.github.com> Date: Sun, 25 Feb 2024 14:06:14 +0900 Subject: [PATCH] minor optimize --- src/lighting/LightSolver.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/lighting/LightSolver.cpp b/src/lighting/LightSolver.cpp index d103b65b..12e09d5d 100644 --- a/src/lighting/LightSolver.cpp +++ b/src/lighting/LightSolver.cpp @@ -58,9 +58,11 @@ void LightSolver::solve(){ remqueue.pop(); for (int i = 0; i < 6; i++) { - int x = entry.x+coords[i*3+0]; - int y = entry.y+coords[i*3+1]; - int z = entry.z+coords[i*3+2]; + int imul3 = i*3; + int x = entry.x+coords[imul3]; + int y = entry.y+coords[imul3+1]; + int z = entry.z+coords[imul3+2]; + Chunk* chunk = chunks->getChunkByVoxel(x,y,z); if (chunk) { int lx = x - chunk->x * CHUNK_W; @@ -85,9 +87,11 @@ void LightSolver::solve(){ addqueue.pop(); for (int i = 0; i < 6; i++) { - int x = entry.x+coords[i*3+0]; - int y = entry.y+coords[i*3+1]; - int z = entry.z+coords[i*3+2]; + int imul3 = i*3; + int x = entry.x+coords[imul3]; + int y = entry.y+coords[imul3+1]; + int z = entry.z+coords[imul3+2]; + Chunk* chunk = chunks->getChunkByVoxel(x,y,z); if (chunk) { int lx = x - chunk->x * CHUNK_W;