library: light: spot: fix constructors
The vector was not normalized on input in the SpotLight constructor...
This commit is contained in:
parent
ebe00365d1
commit
3ef827cabf
|
@ -22,7 +22,7 @@ impl SpotLight {
|
||||||
) -> Self {
|
) -> Self {
|
||||||
SpotLight {
|
SpotLight {
|
||||||
position,
|
position,
|
||||||
direction,
|
direction: direction.normalize(),
|
||||||
cosine_value: (fov_rad / 2.).cos(),
|
cosine_value: (fov_rad / 2.).cos(),
|
||||||
color,
|
color,
|
||||||
}
|
}
|
||||||
|
@ -35,12 +35,12 @@ impl SpotLight {
|
||||||
fov_deg: f32,
|
fov_deg: f32,
|
||||||
color: LinearColor,
|
color: LinearColor,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
SpotLight {
|
SpotLight::radians_new(
|
||||||
position,
|
position,
|
||||||
direction,
|
direction,
|
||||||
cosine_value: (std::f32::consts::PI * fov_deg / 360.).cos(),
|
std::f32::consts::PI * fov_deg / 180.,
|
||||||
color,
|
color,
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue