fix crash in light textures example (#20161)
# Objective scaling the point light to zero caused a crash ## Solution clamp the scale for all the lights
This commit is contained in:
parent
3fc49f00c1
commit
d28d18e2ff
@ -540,14 +540,16 @@ fn process_scale_input(
|
||||
|
||||
for (mut transform, selection) in &mut scale_selections {
|
||||
if app_status.selection == *selection {
|
||||
transform.scale *= 1.0 + mouse_motion.delta.x * SCALE_SPEED;
|
||||
transform.scale = (transform.scale * (1.0 + mouse_motion.delta.x * SCALE_SPEED))
|
||||
.clamp(Vec3::splat(0.01), Vec3::splat(5.0));
|
||||
}
|
||||
}
|
||||
|
||||
for (mut spotlight, selection) in &mut spotlight_selections {
|
||||
if app_status.selection == *selection {
|
||||
spotlight.outer_angle =
|
||||
(spotlight.outer_angle * (1.0 + mouse_motion.delta.x * SCALE_SPEED)).min(FRAC_PI_4);
|
||||
spotlight.outer_angle = (spotlight.outer_angle
|
||||
* (1.0 + mouse_motion.delta.x * SCALE_SPEED))
|
||||
.clamp(0.01, FRAC_PI_4);
|
||||
spotlight.inner_angle = spotlight.outer_angle;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user