Fix T71795: Unproject with high clipping range sometimes results in nans
Differential Revision: https://developer.blender.org/D6311
This commit is contained in:
parent
56fc0f411f
commit
26e4f4a8c4
Notes:
blender-bot
2023-02-14 09:29:42 +01:00
Referenced by issue #71795, Too high clipping range + Auto Depth may send view location to oblivion
|
@ -535,6 +535,11 @@ bool GPU_matrix_unproject_precalc(struct GPUMatrixUnproject_Precalc *precalc,
|
|||
&precalc->dims.ymax,
|
||||
&precalc->dims.zmin,
|
||||
&precalc->dims.zmax);
|
||||
if (isinf(precalc->dims.zmax)) {
|
||||
/* We cannot retrieve the actual value of the clip_end.
|
||||
* Use `FLT_MAX` to avoid nans. */
|
||||
precalc->dims.zmax = FLT_MAX;
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
precalc->view[i] = (float)view[i];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue