diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-09-20 05:06:53 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-09-20 05:06:53 +0300 |
commit | 8377febcb710d339a683ab78de0eb795659553bc (patch) | |
tree | f13ce2282b7a5193aa889908e9054af5a249e297 /source/blender/editors/space_view3d/view3d_project.c | |
parent | 1a2e41a0f2499aa0339ceb49f199c28722e840dc (diff) | |
parent | c9df0ea1474781e97f9e5fdaa84c6643f14cd889 (diff) |
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_project.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_project.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c index 719530c7293..6e8b7c281ce 100644 --- a/source/blender/editors/space_view3d/view3d_project.c +++ b/source/blender/editors/space_view3d/view3d_project.c @@ -409,6 +409,24 @@ bool ED_view3d_win_to_ray_clipped( } /** + * Calculate a 3d viewpoint and direction vector from 2d window coordinates. + * This ray_start is located at the viewpoint, ray_normal is the direction towards mval. + * \param ar The region (used for the window width and height). + * \param mval The area relative 2d location (such as event->mval, converted into float[2]). + * \param r_ray_start The world-space point where the ray intersects the window plane. + * \param r_ray_normal The normalized world-space direction of towards mval. + * + * \note Ignores view near/far clipping, to take this into account use #ED_view3d_win_to_ray_clipped. + */ +void ED_view3d_win_to_ray( + const ARegion *ar, const float mval[2], + float r_ray_start[3], float r_ray_normal[3]) +{ + ED_view3d_win_to_origin(ar, mval, r_ray_start); + ED_view3d_win_to_vector(ar, mval, r_ray_normal); +} + +/** * Calculate a normalized 3d direction vector from the viewpoint towards a global location. * In orthographic view the resulting vector will match the view vector. * \param rv3d The region (used for the window width and height). |