summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2022-07-05 18:30:56 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2022-07-05 18:32:44 +0200
commitaa9403bcdaa459bd490cf854ffdf71963a39d5bb (patch)
treed5681cef29a04dd0868528a46df01785eead5954 /scene/3d
parent5f386fecf0769626e19d6bb42e11f7663659d9b6 (diff)
Clamp VoxelGI extents to reasonable values to avoid breaking baking
This also prevents crashes when resizing a VoxelGI's extents to 0 on any axis.
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/voxel_gi.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/scene/3d/voxel_gi.cpp b/scene/3d/voxel_gi.cpp
index d81b59b3fc..ae231026a7 100644
--- a/scene/3d/voxel_gi.cpp
+++ b/scene/3d/voxel_gi.cpp
@@ -272,7 +272,8 @@ VoxelGI::Subdiv VoxelGI::get_subdiv() const {
}
void VoxelGI::set_extents(const Vector3 &p_extents) {
- extents = p_extents;
+ // Prevent very small extents as these break baking if other extents are set very high.
+ extents = Vector3(MAX(1.0, p_extents.x), MAX(1.0, p_extents.y), MAX(1.0, p_extents.z));
update_gizmos();
}