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
1 changed files with 4 additions and 4 deletions
|
|
@ -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,
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue