diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2021-08-04 16:46:42 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2021-08-04 16:46:54 +0300 |
commit | 145270d8d7c6812de9fd1ba50cc51ffc53953881 (patch) | |
tree | 761b100ca6640abb6b729109d5ab59b7dd24f19c /source/blender/gpu/intern | |
parent | e5d4a0c5596daaae14251872755df1e71e54e108 (diff) |
Fix T90427: Center View to Mouse broken
rBfb87d236edb7 made the values returned by `projmat_dimensions` more
standardized following the documentations. But the functions in Blender
that called `projmat_dimensions` followed a proposal that these values
corresponded to a distance of 1m of clip.
Adjust these functions to follow the new algorithm.
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r-- | source/blender/gpu/intern/gpu_matrix.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/gpu/intern/gpu_matrix.cc b/source/blender/gpu/intern/gpu_matrix.cc index 6eb9cb823d5..efa04568401 100644 --- a/source/blender/gpu/intern/gpu_matrix.cc +++ b/source/blender/gpu/intern/gpu_matrix.cc @@ -532,17 +532,17 @@ static void gpu_mul_invert_projmat_m4_unmapped_v3_with_precalc( const struct GPUMatrixUnproject_Precalc *precalc, float co[3]) { /* 'precalc->dims' is the result of 'projmat_dimensions(proj, ...)'. */ - co[0] = precalc->dims.xmin + co[0] * (precalc->dims.xmax - precalc->dims.xmin); - co[1] = precalc->dims.ymin + co[1] * (precalc->dims.ymax - precalc->dims.ymin); + co[0] = (float)scalenormd(precalc->dims.xmin, precalc->dims.xmax, co[0]); + co[1] = (float)scalenormd(precalc->dims.ymin, precalc->dims.ymax, co[1]); if (precalc->is_persp) { - co[2] = precalc->dims.zmax * precalc->dims.zmin / + co[2] = (precalc->dims.zmax * precalc->dims.zmin) / (precalc->dims.zmax + co[2] * (precalc->dims.zmin - precalc->dims.zmax)); - co[0] *= co[2]; - co[1] *= co[2]; + co[0] *= co[2] / precalc->dims.zmin; + co[1] *= co[2] / precalc->dims.zmin; } else { - co[2] = precalc->dims.zmin + co[2] * (precalc->dims.zmax - precalc->dims.zmin); + co[2] = (float)scalenormd(precalc->dims.zmin, precalc->dims.zmax, co[2]); } co[2] *= -1; } |