mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 17:35:34 -04:00
allow far plane to go further out
This commit is contained in:
parent
864f8c4f08
commit
9d14c7867b
@ -369,6 +369,14 @@ ConfigVariableDouble default_far
|
|||||||
("default-far", 100000.0,
|
("default-far", 100000.0,
|
||||||
PRC_DESC("The default far clipping distance for all cameras."));
|
PRC_DESC("The default far clipping distance for all cameras."));
|
||||||
|
|
||||||
|
ConfigVariableDouble lens_far_limit
|
||||||
|
("lens-far-limit", 0.0000001,
|
||||||
|
PRC_DESC("This number is used to reduce the effect of numeric inaccuracies "
|
||||||
|
"in Lens::extrude(). It should be a very small, positive number, "
|
||||||
|
"almost zero; set it larger if Lens::extrude() returns values "
|
||||||
|
"that appear meaningless, and set it smaller if you appear to be "
|
||||||
|
"unable to move the far plane out far enough."));
|
||||||
|
|
||||||
ConfigVariableDouble default_fov
|
ConfigVariableDouble default_fov
|
||||||
("default-fov", 30.0,
|
("default-fov", 30.0,
|
||||||
PRC_DESC("The default field of view in degrees for all cameras. This is "
|
PRC_DESC("The default field of view in degrees for all cameras. This is "
|
||||||
|
@ -1360,7 +1360,7 @@ extrude_impl(const LPoint3f &point2d, LPoint3f &near_point, LPoint3f &far_point)
|
|||||||
LVecBase4f full(point2d[0], point2d[1], -1.0f, 1.0f);
|
LVecBase4f full(point2d[0], point2d[1], -1.0f, 1.0f);
|
||||||
full = projection_mat_inv.xform(full);
|
full = projection_mat_inv.xform(full);
|
||||||
|
|
||||||
float recip_full3 = 1.0f / max(full[3], 0.00001f);
|
float recip_full3 = 1.0 / max((double)full[3], (double)lens_far_limit);
|
||||||
near_point.set(full[0] * recip_full3,
|
near_point.set(full[0] * recip_full3,
|
||||||
full[1] * recip_full3,
|
full[1] * recip_full3,
|
||||||
full[2] * recip_full3);
|
full[2] * recip_full3);
|
||||||
@ -1374,7 +1374,7 @@ extrude_impl(const LPoint3f &point2d, LPoint3f &near_point, LPoint3f &far_point)
|
|||||||
// past infinity and comes back in behind the lens, which is just
|
// past infinity and comes back in behind the lens, which is just
|
||||||
// crazy. Truncating it to zero keeps the far plane from moving
|
// crazy. Truncating it to zero keeps the far plane from moving
|
||||||
// too far out.
|
// too far out.
|
||||||
float recip_full3 = 1.0f / max(full[3], 0.00001f);
|
float recip_full3 = 1.0 / max((double)full[3], (double)lens_far_limit);
|
||||||
far_point.set(full[0] * recip_full3,
|
far_point.set(full[0] * recip_full3,
|
||||||
full[1] * recip_full3,
|
full[1] * recip_full3,
|
||||||
full[2] * recip_full3);
|
full[2] * recip_full3);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user