diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-03-09 19:39:24 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-03-09 19:39:24 +0400 |
commit | 2433404e4b90581fe65c8259e58baeee14259638 (patch) | |
tree | ae18da5ef1eebbe12869bf72b8575f570295daa1 /source/blender/editors/space_view3d | |
parent | 85f15bb0ed1ee74a86c7877877fc99579bd5605c (diff) |
add inline function mul_project_m4_v3_zfac() to get the z-depth value from a vector & mat4x4
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_project.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 6 |
2 files changed, 2 insertions, 8 deletions
diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c index 27d0010e75b..a74db71175f 100644 --- a/source/blender/editors/space_view3d/view3d_project.c +++ b/source/blender/editors/space_view3d/view3d_project.c @@ -276,9 +276,7 @@ eV3DProjStatus ED_view3d_project_float_object(ARegion *ar, const float co[3], fl */ float ED_view3d_calc_zfac(RegionView3D *rv3d, const float co[3], bool *r_flip) { - float zfac = (rv3d->persmat[0][3] * co[0]) + - (rv3d->persmat[1][3] * co[1]) + - (rv3d->persmat[2][3] * co[2]) + rv3d->persmat[3][3]; + float zfac = mul_project_m4_v3_zfac(rv3d->persmat, co); if (r_flip) { *r_flip = (zfac < 0.0f); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 5d2a351b233..d5fce1ba313 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1560,11 +1560,7 @@ static void UNUSED_FUNCTION(view3d_align_axis_to_vector)(View3D *v3d, RegionView float ED_view3d_pixel_size(RegionView3D *rv3d, const float co[3]) { - return (rv3d->persmat[3][3] + ( - rv3d->persmat[0][3] * co[0] + - rv3d->persmat[1][3] * co[1] + - rv3d->persmat[2][3] * co[2]) - ) * rv3d->pixsize * U.pixelsize; + return mul_project_m4_v3_zfac(rv3d->persmat, co) * rv3d->pixsize * U.pixelsize; } float ED_view3d_radius_to_persp_dist(const float angle, const float radius) |