mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 00:32:57 -04:00
gobj: support infinite near distance in PerspectiveLens
Useful when rendering with near/far planes flipped around.
This commit is contained in:
parent
eafab53729
commit
cf240d95c1
@ -71,9 +71,14 @@ do_compute_projection_mat(Lens::CData *lens_cdata) {
|
||||
PN_stdfloat fNear = do_get_near(lens_cdata);
|
||||
PN_stdfloat a, b;
|
||||
|
||||
// Take the limits if either near or far is infinite.
|
||||
if (cinf(fFar)) {
|
||||
a = 1;
|
||||
b = -2 * fNear;
|
||||
} else if (cinf(fNear)) {
|
||||
// This is valid if the near/far planes are inverted.
|
||||
a = -1;
|
||||
b = 2 * fFar;
|
||||
} else {
|
||||
PN_stdfloat far_minus_near = fFar-fNear;
|
||||
a = (fFar + fNear);
|
||||
|
Loading…
x
Reference in New Issue
Block a user