From 3ef827cabf05b1c3ac880a22ae458c510de2d2d2 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Wed, 18 Mar 2020 14:37:16 +0100 Subject: [PATCH] library: light: spot: fix constructors The vector was not normalized on input in the SpotLight constructor... --- src/light/spot_light.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/light/spot_light.rs b/src/light/spot_light.rs index 0bc763f..97a941a 100644 --- a/src/light/spot_light.rs +++ b/src/light/spot_light.rs @@ -22,7 +22,7 @@ impl SpotLight { ) -> Self { SpotLight { position, - direction, + direction: direction.normalize(), cosine_value: (fov_rad / 2.).cos(), color, } @@ -35,12 +35,12 @@ impl SpotLight { fov_deg: f32, color: LinearColor, ) -> Self { - SpotLight { + SpotLight::radians_new( position, direction, - cosine_value: (std::f32::consts::PI * fov_deg / 360.).cos(), + std::f32::consts::PI * fov_deg / 180., color, - } + ) } }