summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2019-01-17 10:58:34 -0300
committerJuan Linietsky <reduzio@gmail.com>2019-01-17 10:58:34 -0300
commit6d7dfa6df83e20590184612d0e93489d0547ac35 (patch)
tree764c1fe397f7c8cc15b50f07093d736ca1182af4
parent7478f468b2a2fd107a610575c5a6ffed340f0d53 (diff)
Avoid crashing GIProbe bake with broken UV data, closes #25028
-rw-r--r--scene/3d/voxel_light_baker.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/scene/3d/voxel_light_baker.cpp b/scene/3d/voxel_light_baker.cpp
index cdf0a06e36..30e38c8ee2 100644
--- a/scene/3d/voxel_light_baker.cpp
+++ b/scene/3d/voxel_light_baker.cpp
@@ -342,8 +342,8 @@ void VoxelLightBaker::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p
if (lnormal == Vector3()) //just in case normal as nor provided
lnormal = normal;
- int uv_x = CLAMP(Math::fposmod(uv.x, 1.0f) * bake_texture_size, 0, bake_texture_size - 1);
- int uv_y = CLAMP(Math::fposmod(uv.y, 1.0f) * bake_texture_size, 0, bake_texture_size - 1);
+ int uv_x = CLAMP(int(Math::fposmod(uv.x, 1.0f) * bake_texture_size), 0, bake_texture_size - 1);
+ int uv_y = CLAMP(int(Math::fposmod(uv.y, 1.0f) * bake_texture_size), 0, bake_texture_size - 1);
int ofs = uv_y * bake_texture_size + uv_x;
albedo_accum.r += p_material.albedo[ofs].r;