Allow inverted near far for inverted depth fp32 (#509)
* removed assertion for inverted near far * added extra assertion * adding checks for ratio too small or far and near plane too close to each other * using comparing macro * PR feedback
This commit is contained in:
parent
2c7ee50ef4
commit
c96cd57efc
1 changed files with 6 additions and 5 deletions
|
@ -117,10 +117,11 @@ impl<S: BaseFloat> From<PerspectiveFov<S>> for Matrix4<S> {
|
||||||
"The vertical field of view cannot be greater than a half turn, found: {:?}",
|
"The vertical field of view cannot be greater than a half turn, found: {:?}",
|
||||||
persp.fovy
|
persp.fovy
|
||||||
);
|
);
|
||||||
|
|
||||||
assert!(
|
assert!(
|
||||||
persp.aspect > S::zero(),
|
abs_diff_ne!(persp.aspect.abs(), S::zero()),
|
||||||
"The aspect ratio cannot be below zero, found: {:?}",
|
"The absolute aspect ratio cannot be zero, found: {:?}",
|
||||||
persp.aspect
|
persp.aspect.abs()
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
persp.near > S::zero(),
|
persp.near > S::zero(),
|
||||||
|
@ -133,8 +134,8 @@ impl<S: BaseFloat> From<PerspectiveFov<S>> for Matrix4<S> {
|
||||||
persp.far
|
persp.far
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
persp.far > persp.near,
|
abs_diff_ne!(persp.far, persp.near),
|
||||||
"The far plane cannot be closer than the near plane, found: far: {:?}, near: {:?}",
|
"The far plane and near plane are too close, found: far: {:?}, near: {:?}",
|
||||||
persp.far,
|
persp.far,
|
||||||
persp.near
|
persp.near
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue