Browse Source

Avoid crashing GIProbe bake with broken UV data, closes #25028

Juan Linietsky 6 years ago
parent
commit
6d7dfa6df8
1 changed files with 2 additions and 2 deletions
  1. 2 2
      scene/3d/voxel_light_baker.cpp

+ 2 - 2
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
 				if (lnormal == Vector3()) //just in case normal as nor provided
 					lnormal = normal;
 					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;
 				int ofs = uv_y * bake_texture_size + uv_x;
 				albedo_accum.r += p_material.albedo[ofs].r;
 				albedo_accum.r += p_material.albedo[ofs].r;