mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 09:23:03 -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 fNear = do_get_near(lens_cdata);
|
||||||
PN_stdfloat a, b;
|
PN_stdfloat a, b;
|
||||||
|
|
||||||
|
// Take the limits if either near or far is infinite.
|
||||||
if (cinf(fFar)) {
|
if (cinf(fFar)) {
|
||||||
a = 1;
|
a = 1;
|
||||||
b = -2 * fNear;
|
b = -2 * fNear;
|
||||||
|
} else if (cinf(fNear)) {
|
||||||
|
// This is valid if the near/far planes are inverted.
|
||||||
|
a = -1;
|
||||||
|
b = 2 * fFar;
|
||||||
} else {
|
} else {
|
||||||
PN_stdfloat far_minus_near = fFar-fNear;
|
PN_stdfloat far_minus_near = fFar-fNear;
|
||||||
a = (fFar + fNear);
|
a = (fFar + fNear);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user