summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-12-17 14:28:15 +0100
committerGitHub <noreply@github.com>2017-12-17 14:28:15 +0100
commitad3393743c2e505f68a12b20113f9c2bda88fa89 (patch)
tree788e795e1465e2458d58372a0868c419eb1d2568 /scene/3d
parent539fd14cf5940896c90eeb141e9bfee3b31c3ca9 (diff)
parent9ba134b46381e0d2e65eb548384626da20bf09a3 (diff)
Merge pull request #14760 from hpvb/add-several-unlikely-macros
Add several unlikely() macros
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/voxel_light_baker.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/scene/3d/voxel_light_baker.cpp b/scene/3d/voxel_light_baker.cpp
index 60e86362b3..032bccf1d3 100644
--- a/scene/3d/voxel_light_baker.cpp
+++ b/scene/3d/voxel_light_baker.cpp
@@ -1704,7 +1704,7 @@ Vector3 VoxelLightBaker::_compute_ray_trace_at_pos(const Vector3 &p_pos, const V
}
cell = bc->childs[child];
- if (cell == CHILD_EMPTY)
+ if (unlikely(cell == CHILD_EMPTY))
break;
half >>= 1;
@@ -1713,12 +1713,12 @@ Vector3 VoxelLightBaker::_compute_ray_trace_at_pos(const Vector3 &p_pos, const V
pos += advance;
}
- if (cell != CHILD_EMPTY) {
+ if (unlikely(cell != CHILD_EMPTY)) {
for (int i = 0; i < 6; i++) {
//anisotropic read light
float amount = direction.dot(aniso_normal[i]);
- if (amount < 0)
- amount = 0;
+ if (amount <= 0)
+ continue;
accum.x += light[cell].accum[i][0] * amount;
accum.y += light[cell].accum[i][1] * amount;
accum.z += light[cell].accum[i][2] * amount;