Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-09-20 04:26:31 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-09-20 04:26:31 +0300
commit6a01f62df44cf8d55711ce3a7224f86721547bd5 (patch)
tree926f6ae36481c8b340d8bf7e45799a80c16f6dae /source/blender/editors/space_view3d/view3d_project.c
parent2c30922e2c64b90015a121d8efea2c2743376666 (diff)
parent470407ec3bac11ae5a5c6174a6e9630caa1a42f7 (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.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c
index 91e255aec82..ec5f28b56f3 100644
--- a/source/blender/editors/space_view3d/view3d_project.c
+++ b/source/blender/editors/space_view3d/view3d_project.c
@@ -539,6 +539,31 @@ void ED_view3d_win_to_3d_int(
ED_view3d_win_to_3d(v3d, ar, depth_pt, mval_fl, r_out);
}
+bool ED_view3d_win_to_3d_on_plane(
+ const ARegion *ar,
+ const float plane[4], const float mval[2],
+ float r_out[3])
+{
+ float ray_co[3], ray_no[3];
+ ED_view3d_win_to_origin(ar, mval, ray_co);
+ ED_view3d_win_to_vector(ar, mval, ray_no);
+ float lambda;
+ if (isect_ray_plane_v3(ray_co, ray_no, plane, &lambda, false)) {
+ madd_v3_v3v3fl(r_out, ray_co, ray_no, lambda);
+ return true;
+ }
+ return false;
+}
+
+bool ED_view3d_win_to_3d_on_plane_int(
+ const ARegion *ar,
+ const float plane[4], const int mval[2],
+ float r_out[3])
+{
+ const float mval_fl[2] = {mval[0], mval[1]};
+ return ED_view3d_win_to_3d_on_plane(ar, plane, mval_fl, r_out);
+}
+
/**
* Calculate a 3d difference vector from 2d window offset.
* note that ED_view3d_calc_zfac() must be called first to determine