|
Blender
V2.93
|
#include "DNA_camera_types.h"#include "DNA_object_types.h"#include "DNA_scene_types.h"#include "DNA_screen_types.h"#include "DNA_view3d_types.h"#include "BLI_sys_types.h"#include "BLI_math_vector.h"#include "BKE_camera.h"#include "BKE_screen.h"#include "GPU_matrix.h"#include "ED_view3d.h"Go to the source code of this file.
Macros | |
| #define | BL_ZERO_CLIP 0.001 |
Functions | |
| void | ED_view3d_project_float_v2_m4 (const ARegion *region, const float co[3], float r_co[2], float mat[4][4]) |
| void | ED_view3d_project_float_v3_m4 (const ARegion *region, const float co[3], float r_co[3], float mat[4][4]) |
| eV3DProjStatus | ED_view3d_project_base (const struct ARegion *region, struct Base *base) |
| static eV3DProjStatus | ed_view3d_project__internal (const ARegion *region, const float perspmat[4][4], const bool is_local, const float co[3], float r_co[2], const eV3DProjTest flag) |
| eV3DProjStatus | ED_view3d_project_short_ex (const ARegion *region, float perspmat[4][4], const bool is_local, const float co[3], short r_co[2], const eV3DProjTest flag) |
| eV3DProjStatus | ED_view3d_project_int_ex (const ARegion *region, float perspmat[4][4], const bool is_local, const float co[3], int r_co[2], const eV3DProjTest flag) |
| eV3DProjStatus | ED_view3d_project_float_ex (const ARegion *region, float perspmat[4][4], const bool is_local, const float co[3], float r_co[2], const eV3DProjTest flag) |
| eV3DProjStatus | ED_view3d_project_short_global (const ARegion *region, const float co[3], short r_co[2], const eV3DProjTest flag) |
| eV3DProjStatus | ED_view3d_project_short_object (const ARegion *region, const float co[3], short r_co[2], const eV3DProjTest flag) |
| eV3DProjStatus | ED_view3d_project_int_global (const ARegion *region, const float co[3], int r_co[2], const eV3DProjTest flag) |
| eV3DProjStatus | ED_view3d_project_int_object (const ARegion *region, const float co[3], int r_co[2], const eV3DProjTest flag) |
| eV3DProjStatus | ED_view3d_project_float_global (const ARegion *region, const float co[3], float r_co[2], const eV3DProjTest flag) |
| eV3DProjStatus | ED_view3d_project_float_object (const ARegion *region, const float co[3], float r_co[2], const eV3DProjTest flag) |
| float | ED_view3d_pixel_size (const RegionView3D *rv3d, const float co[3]) |
| float | ED_view3d_pixel_size_no_ui_scale (const RegionView3D *rv3d, const float co[3]) |
| float | ED_view3d_calc_zfac (const RegionView3D *rv3d, const float co[3], bool *r_flip) |
| static void | view3d_win_to_ray_segment (struct Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, const float mval[2], float r_ray_co[3], float r_ray_dir[3], float r_ray_start[3], float r_ray_end[3]) |
| bool | ED_view3d_clip_segment (const RegionView3D *rv3d, float ray_start[3], float ray_end[3]) |
| bool | ED_view3d_win_to_ray_clipped_ex (struct Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, const float mval[2], float r_ray_co[3], float r_ray_normal[3], float r_ray_start[3], bool do_clip_planes) |
| bool | ED_view3d_win_to_ray_clipped (struct Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, const float mval[2], float r_ray_start[3], float r_ray_normal[3], const bool do_clip_planes) |
| void | ED_view3d_win_to_ray (const ARegion *region, const float mval[2], float r_ray_start[3], float r_ray_normal[3]) |
| void | ED_view3d_global_to_vector (const RegionView3D *rv3d, const float coord[3], float vec[3]) |
| void | ED_view3d_win_to_3d (const View3D *v3d, const ARegion *region, const float depth_pt[3], const float mval[2], float r_out[3]) |
| void | ED_view3d_win_to_3d_int (const View3D *v3d, const ARegion *region, const float depth_pt[3], const int mval[2], float r_out[3]) |
| bool | ED_view3d_win_to_3d_on_plane (const ARegion *region, const float plane[4], const float mval[2], const bool do_clip, float r_out[3]) |
| bool | ED_view3d_win_to_3d_on_plane_int (const ARegion *region, const float plane[4], const int mval[2], const bool do_clip, float r_out[3]) |
| bool | ED_view3d_win_to_3d_on_plane_with_fallback (const ARegion *region, const float plane[4], const float mval[2], const bool do_clip, const float plane_fallback[4], float r_out[3]) |
| void | ED_view3d_win_to_delta (const ARegion *region, const float mval[2], float out[3], const float zfac) |
| void | ED_view3d_win_to_origin (const ARegion *region, const float mval[2], float out[3]) |
| void | ED_view3d_win_to_vector (const ARegion *region, const float mval[2], float out[3]) |
| bool | ED_view3d_win_to_segment_clipped (struct Depsgraph *depsgraph, const ARegion *region, View3D *v3d, const float mval[2], float r_ray_start[3], float r_ray_end[3], const bool do_clip_planes) |
Utility functions for projection | |
| void | ED_view3d_ob_project_mat_get (const RegionView3D *rv3d, Object *ob, float r_pmat[4][4]) |
| void | ED_view3d_ob_project_mat_get_from_obmat (const RegionView3D *rv3d, const float obmat[4][4], float r_pmat[4][4]) |
| void | ED_view3d_project (const struct ARegion *region, const float world[3], float r_region_co[3]) |
| bool | ED_view3d_unproject (const struct ARegion *region, float regionx, float regiony, float regionz, float world[3]) |
| #define BL_ZERO_CLIP 0.001 |
Definition at line 41 of file view3d_project.c.
| float ED_view3d_calc_zfac | ( | const RegionView3D * | rv3d, |
| const float | co[3], | ||
| bool * | r_flip | ||
| ) |
Calculate a depth value from co, use with ED_view3d_win_to_delta
Definition at line 310 of file view3d_project.c.
References mul_project_m4_v3_zfac(), and RegionView3D::persmat.
| bool ED_view3d_clip_segment | ( | const RegionView3D * | rv3d, |
| float | ray_start[3], | ||
| float | ray_end[3] | ||
| ) |
Definition at line 371 of file view3d_project.c.
References RegionView3D::clip, clip_segment_v3_plane_n(), RegionView3D::rflag, and RV3D_CLIPPING.
Referenced by ED_view3d_win_to_ray_clipped_ex(), and ED_view3d_win_to_segment_clipped().
| void ED_view3d_global_to_vector | ( | const RegionView3D * | rv3d, |
| const float | coord[3], | ||
| float | vec[3] | ||
| ) |
Calculate a normalized 3d direction vector from the viewpoint towards a global location. In orthographic view the resulting vector will match the view vector.
| rv3d | The region (used for the window width and height). |
| coord | The world-space location. |
| vec | The resulting normalized vector. |
Definition at line 470 of file view3d_project.c.
References copy_v3_v3(), RegionView3D::is_persp, mul_m4_v4(), mul_v3_fl(), normalize_v3(), sub_v3_v3v3(), RegionView3D::viewinv, and RegionView3D::viewmat.
| void ED_view3d_ob_project_mat_get | ( | const RegionView3D * | rv3d, |
| Object * | ob, | ||
| float | r_pmat[4][4] | ||
| ) |
Definition at line 791 of file view3d_project.c.
References mul_m4_m4m4(), Object::obmat, RegionView3D::viewmat, and RegionView3D::winmat.
| void ED_view3d_ob_project_mat_get_from_obmat | ( | const RegionView3D * | rv3d, |
| const float | obmat[4][4], | ||
| float | r_pmat[4][4] | ||
| ) |
Definition at line 799 of file view3d_project.c.
References mul_m4_m4m4(), RegionView3D::viewmat, and RegionView3D::winmat.
| float ED_view3d_pixel_size | ( | const RegionView3D * | rv3d, |
| const float | co[3] | ||
| ) |
Definition at line 297 of file view3d_project.c.
References mul_project_m4_v3_zfac(), RegionView3D::persmat, and RegionView3D::pixsize.
| float ED_view3d_pixel_size_no_ui_scale | ( | const RegionView3D * | rv3d, |
| const float | co[3] | ||
| ) |
Definition at line 302 of file view3d_project.c.
References mul_project_m4_v3_zfac(), RegionView3D::persmat, and RegionView3D::pixsize.
| void ED_view3d_project | ( | const struct ARegion * | region, |
| const float | world[3], | ||
| float | r_region_co[3] | ||
| ) |
Convert between region relative coordinates (x,y) and depth component z and a point in world space.
Definition at line 812 of file view3d_project.c.
References GPU_matrix_project(), ARegion::regiondata, RegionView3D::viewmat, RegionView3D::winmat, ARegion::winx, ARegion::winy, and world.
Referenced by cursor_draw_point_screen_space(), gizmo_preselect_elem_test_select(), key_test_depth(), object_transform_axis_target_calc_depth_init(), paint_line_strokes_spacing(), paint_space_stroke(), and voxel_size_edit_invoke().
|
static |
Definition at line 117 of file view3d_project.c.
References BL_ZERO_CLIP, BLI_assert, copy_v3_v3(), ED_view3d_clipping_test(), fabsf, float(), mul_m4_v4(), ARegion::regiondata, RegionView3D::rflag, RV3D_CLIPPING, V3D_PROJ_RET_CLIP_BB, V3D_PROJ_RET_CLIP_FAR, V3D_PROJ_RET_CLIP_NEAR, V3D_PROJ_RET_CLIP_WIN, V3D_PROJ_RET_CLIP_ZERO, V3D_PROJ_RET_OK, V3D_PROJ_TEST_ALL, V3D_PROJ_TEST_CLIP_BB, V3D_PROJ_TEST_CLIP_FAR, V3D_PROJ_TEST_CLIP_NEAR, V3D_PROJ_TEST_CLIP_WIN, V3D_PROJ_TEST_CLIP_ZERO, w(), ARegion::winx, and ARegion::winy.
Referenced by ED_view3d_project_float_ex(), ED_view3d_project_int_ex(), and ED_view3d_project_short_ex().
| eV3DProjStatus ED_view3d_project_base | ( | const struct ARegion * | region, |
| struct Base * | base | ||
| ) |
Definition at line 100 of file view3d_project.c.
References ED_view3d_project_short_global(), IS_CLIPPED, Base::object, Object::obmat, ret, Base::sx, Base::sy, V3D_PROJ_RET_OK, and V3D_PROJ_TEST_CLIP_DEFAULT.
Referenced by do_lasso_select_objects(), and object_mouse_select_menu().
| eV3DProjStatus ED_view3d_project_float_ex | ( | const ARegion * | region, |
| float | perspmat[4][4], | ||
| const bool | is_local, | ||
| const float | co[3], | ||
| float | r_co[2], | ||
| const eV3DProjTest | flag | ||
| ) |
Definition at line 214 of file view3d_project.c.
References copy_v2_v2(), ed_view3d_project__internal(), CCL_NAMESPACE_BEGIN::isfinite(), ret, V3D_PROJ_RET_OK, and V3D_PROJ_RET_OVERFLOW.
Referenced by ED_view3d_project_float_global(), and ED_view3d_project_float_object().
| eV3DProjStatus ED_view3d_project_float_global | ( | const ARegion * | region, |
| const float | co[3], | ||
| float | r_co[2], | ||
| const eV3DProjTest | flag | ||
| ) |
Definition at line 275 of file view3d_project.c.
References ED_view3d_project_float_ex(), RegionView3D::persmat, and ARegion::regiondata.
| eV3DProjStatus ED_view3d_project_float_object | ( | const ARegion * | region, |
| const float | co[3], | ||
| float | r_co[2], | ||
| const eV3DProjTest | flag | ||
| ) |
Definition at line 284 of file view3d_project.c.
References ED_view3d_check_mats_rv3d, ED_view3d_project_float_ex(), RegionView3D::persmatob, and ARegion::regiondata.
| void ED_view3d_project_float_v2_m4 | ( | const ARegion * | region, |
| const float | co[3], | ||
| float | r_co[2], | ||
| float | mat[4][4] | ||
| ) |
Definition at line 49 of file view3d_project.c.
References copy_v3_v3(), float(), mul_m4_v4(), ARegion::winx, ARegion::winy, and zero_v2().
| void ED_view3d_project_float_v3_m4 | ( | const ARegion * | region, |
| const float | co[3], | ||
| float | r_co[3], | ||
| float | mat[4][4] | ||
| ) |
Definition at line 74 of file view3d_project.c.
References copy_v3_v3(), float(), mul_m4_v4(), ARegion::winx, ARegion::winy, and zero_v3().
| eV3DProjStatus ED_view3d_project_int_ex | ( | const ARegion * | region, |
| float | perspmat[4][4], | ||
| const bool | is_local, | ||
| const float | co[3], | ||
| int | r_co[2], | ||
| const eV3DProjTest | flag | ||
| ) |
Definition at line 192 of file view3d_project.c.
References ed_view3d_project__internal(), floorf, ret, V3D_PROJ_RET_OK, and V3D_PROJ_RET_OVERFLOW.
Referenced by ED_view3d_project_int_global(), and ED_view3d_project_int_object().
| eV3DProjStatus ED_view3d_project_int_global | ( | const ARegion * | region, |
| const float | co[3], | ||
| int | r_co[2], | ||
| const eV3DProjTest | flag | ||
| ) |
Definition at line 255 of file view3d_project.c.
References ED_view3d_project_int_ex(), RegionView3D::persmat, and ARegion::regiondata.
| eV3DProjStatus ED_view3d_project_int_object | ( | const ARegion * | region, |
| const float | co[3], | ||
| int | r_co[2], | ||
| const eV3DProjTest | flag | ||
| ) |
Definition at line 264 of file view3d_project.c.
References ED_view3d_check_mats_rv3d, ED_view3d_project_int_ex(), RegionView3D::persmatob, and ARegion::regiondata.
| eV3DProjStatus ED_view3d_project_short_ex | ( | const ARegion * | region, |
| float | perspmat[4][4], | ||
| const bool | is_local, | ||
| const float | co[3], | ||
| short | r_co[2], | ||
| const eV3DProjTest | flag | ||
| ) |
Definition at line 170 of file view3d_project.c.
References ed_view3d_project__internal(), floorf, ret, V3D_PROJ_RET_OK, and V3D_PROJ_RET_OVERFLOW.
Referenced by ED_view3d_project_short_global(), and ED_view3d_project_short_object().
| eV3DProjStatus ED_view3d_project_short_global | ( | const ARegion * | region, |
| const float | co[3], | ||
| short | r_co[2], | ||
| const eV3DProjTest | flag | ||
| ) |
Definition at line 235 of file view3d_project.c.
References ED_view3d_project_short_ex(), RegionView3D::persmat, and ARegion::regiondata.
Referenced by ED_view3d_project_base().
| eV3DProjStatus ED_view3d_project_short_object | ( | const ARegion * | region, |
| const float | co[3], | ||
| short | r_co[2], | ||
| const eV3DProjTest | flag | ||
| ) |
Definition at line 244 of file view3d_project.c.
References ED_view3d_check_mats_rv3d, ED_view3d_project_short_ex(), RegionView3D::persmatob, and ARegion::regiondata.
| bool ED_view3d_unproject | ( | const struct ARegion * | region, |
| float | regionx, | ||
| float | regiony, | ||
| float | regionz, | ||
| float | world[3] | ||
| ) |
Definition at line 821 of file view3d_project.c.
References GPU_matrix_unproject(), ARegion::regiondata, RegionView3D::viewmat, RegionView3D::winmat, ARegion::winx, ARegion::winy, and world.
Referenced by ED_view3d_autodist(), ED_view3d_autodist_simple(), ED_view3d_clipping_calc(), ED_view3d_depth_unproject(), knife_input_ray_segment(), point_is_visible(), and view3d_zoom_border_exec().
| void ED_view3d_win_to_3d | ( | const View3D * | v3d, |
| const ARegion * | region, | ||
| const float | depth_pt[3], | ||
| const float | mval[2], | ||
| float | r_out[3] | ||
| ) |
Calculate a 3d location from 2d window coordinates.
| region | The region (used for the window width and height). |
| depth_pt | The reference location used to calculate the Z depth. |
| mval | The area relative location (such as event->mval converted to floats). |
| r_out | The resulting world-space location. |
Definition at line 535 of file view3d_project.c.
References BKE_camera_sensor_fit(), BKE_screen_view3d_zoom_to_fac(), RegionView3D::camdx, RegionView3D::camdy, View3D::camera, CAMERA_SENSOR_FIT_HOR, RegionView3D::camzoom, copy_v3_v3(), Object::data, ED_view3d_win_to_vector(), fabsf, float(), RegionView3D::is_persp, isect_ray_plane_v3(), madd_v3_v3v3fl(), RegionView3D::persinv, RegionView3D::persp, plane_from_point_normal_v3(), ray_point_factor_v3(), ARegion::regiondata, RV3D_CAMOB, Camera::sensor_fit, Camera::shiftx, Camera::shifty, RegionView3D::viewinv, ARegion::winx, and ARegion::winy.
Referenced by ED_view3d_win_to_3d_int().
| void ED_view3d_win_to_3d_int | ( | const View3D * | v3d, |
| const ARegion * | region, | ||
| const float | depth_pt[3], | ||
| const int | mval[2], | ||
| float | r_out[3] | ||
| ) |
Definition at line 591 of file view3d_project.c.
References ED_view3d_win_to_3d().
| bool ED_view3d_win_to_3d_on_plane | ( | const ARegion * | region, |
| const float | plane[4], | ||
| const float | mval[2], | ||
| const bool | do_clip, | ||
| float | r_out[3] | ||
| ) |
Definition at line 601 of file view3d_project.c.
References ED_view3d_win_to_origin(), ED_view3d_win_to_vector(), isect_ray_plane_v3(), and madd_v3_v3v3fl().
Referenced by ED_view3d_win_to_3d_on_plane_int(), and ED_view3d_win_to_3d_on_plane_with_fallback().
| bool ED_view3d_win_to_3d_on_plane_int | ( | const ARegion * | region, |
| const float | plane[4], | ||
| const int | mval[2], | ||
| const bool | do_clip, | ||
| float | r_out[3] | ||
| ) |
Definition at line 618 of file view3d_project.c.
References ED_view3d_win_to_3d_on_plane().
| bool ED_view3d_win_to_3d_on_plane_with_fallback | ( | const ARegion * | region, |
| const float | plane[4], | ||
| const float | mval[2], | ||
| const bool | do_clip, | ||
| const float | plane_fallback[4], | ||
| float | r_out[3] | ||
| ) |
A wrapper for ED_view3d_win_to_3d_on_plane that projects onto plane_fallback then maps this back to plane.
This is intended to be used when plane is orthogonal to the views Z axis where projecting the mval doesn't work well (or fail completely when exactly aligned).
Definition at line 635 of file view3d_project.c.
References closest_to_plane_v3(), copy_m4_m3(), ED_view3d_win_to_3d_on_plane(), isect_plane_plane_v3(), mul_m4_v3(), normalize_v3(), rotation_between_vecs_to_mat3(), and transform_pivot_set_m4().
| void ED_view3d_win_to_delta | ( | const ARegion * | region, |
| const float | mval[2], | ||
| float | out[3], | ||
| const float | zfac | ||
| ) |
Calculate a 3d difference vector from 2d window offset. note that ED_view3d_calc_zfac() must be called first to determine the depth used to calculate the delta.
| region | The region (used for the window width and height). |
| mval | The area relative 2d difference (such as event->mval[0] - other_x). |
| out | The resulting world-space delta. |
Definition at line 678 of file view3d_project.c.
References RegionView3D::persinv, ARegion::regiondata, ARegion::winx, and ARegion::winy.
Calculate a 3d origin from 2d window coordinates.
| region | The region (used for the window width and height). |
| mval | The area relative 2d location (such as event->mval converted to floats). |
| out | The resulting normalized world-space direction vector. |
Definition at line 704 of file view3d_project.c.
References copy_v3_v3(), RegionView3D::is_persp, mul_project_m4_v3(), RegionView3D::persinv, RegionView3D::persp, ARegion::regiondata, RV3D_CAMOB, RegionView3D::viewinv, ARegion::winx, and ARegion::winy.
Referenced by ED_view3d_win_to_3d_on_plane(), ED_view3d_win_to_ray(), and view3d_win_to_ray_segment().
| void ED_view3d_win_to_ray | ( | const ARegion * | region, |
| const float | mval[2], | ||
| float | r_ray_start[3], | ||
| float | r_ray_normal[3] | ||
| ) |
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.
| region | The region (used for the window width and height). |
| mval | The area relative 2d location (such as event->mval, converted into float[2]). |
| r_ray_start | The world-space point where the ray intersects the window plane. |
| r_ray_normal | The normalized world-space direction of towards mval. |
Definition at line 454 of file view3d_project.c.
References ED_view3d_win_to_origin(), and ED_view3d_win_to_vector().
| bool ED_view3d_win_to_ray_clipped | ( | struct Depsgraph * | depsgraph, |
| const ARegion * | region, | ||
| const View3D * | v3d, | ||
| const float | mval[2], | ||
| float | r_ray_start[3], | ||
| float | r_ray_normal[3], | ||
| const bool | do_clip_planes | ||
| ) |
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. ray_start is clipped by the view near limit so points in front of it are always in view. In orthographic view the resulting ray_normal will match the view vector.
| region | The region (used for the window width and height). |
| v3d | The 3d viewport (used for near clipping value). |
| mval | The area relative 2d location (such as event->mval, converted into float[2]). |
| r_ray_start | The world-space point where the ray intersects the window plane. |
| r_ray_normal | The normalized world-space direction of towards mval. |
| do_clip_planes | Optionally clip the start of the ray by the view clipping planes. |
Definition at line 431 of file view3d_project.c.
References depsgraph, ED_view3d_win_to_ray_clipped_ex(), and NULL.
| bool ED_view3d_win_to_ray_clipped_ex | ( | struct Depsgraph * | depsgraph, |
| const ARegion * | region, | ||
| const View3D * | v3d, | ||
| const float | mval[2], | ||
| float | r_ray_co[3], | ||
| float | r_ray_normal[3], | ||
| float | r_ray_start[3], | ||
| bool | do_clip_planes | ||
| ) |
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. ray_start is clipped by the view near limit so points in front of it are always in view. In orthographic view the resulting ray_normal will match the view vector. This version also returns the ray_co point of the ray on window plane, useful to fix precision issues esp. with ortho view, where default ray_start is set rather far away.
| region | The region (used for the window width and height). |
| v3d | The 3d viewport (used for near clipping value). |
| mval | The area relative 2d location (such as event->mval, converted into float[2]). |
| r_ray_co | The world-space point where the ray intersects the window plane. |
| r_ray_normal | The normalized world-space direction of towards mval. |
| r_ray_start | The world-space starting point of the ray. |
| do_clip_planes | Optionally clip the start of the ray by the view clipping planes. |
Definition at line 396 of file view3d_project.c.
References depsgraph, ED_view3d_clip_segment(), ARegion::regiondata, and view3d_win_to_ray_segment().
Referenced by ED_view3d_win_to_ray_clipped().
| bool ED_view3d_win_to_segment_clipped | ( | struct Depsgraph * | depsgraph, |
| const ARegion * | region, | ||
| View3D * | v3d, | ||
| const float | mval[2], | ||
| float | r_ray_start[3], | ||
| float | r_ray_end[3], | ||
| const bool | do_clip_planes | ||
| ) |
Calculate a 3d segment from 2d window coordinates. This ray_start is located at the viewpoint, ray_end is a far point. ray_start and ray_end are clipped by the view near and far limits so points along this line are always in view. In orthographic view all resulting segments will be parallel.
| region | The region (used for the window width and height). |
| v3d | The 3d viewport (used for near and far clipping range). |
| mval | The area relative 2d location (such as event->mval, converted into float[2]). |
| r_ray_start | The world-space starting point of the segment. |
| r_ray_end | The world-space end point of the segment. |
| do_clip_planes | Optionally clip the ray by the view clipping planes. |
Definition at line 769 of file view3d_project.c.
References depsgraph, ED_view3d_clip_segment(), NULL, ARegion::regiondata, and view3d_win_to_ray_segment().
Calculate a 3d direction vector from 2d window coordinates. This direction vector starts and the view in the direction of the 2d window coordinates. In orthographic view all window coordinates yield the same vector.
| region | The region (used for the window width and height). |
| mval | The area relative 2d location (such as event->mval converted to floats). |
| out | The resulting normalized world-space direction vector. |
Definition at line 738 of file view3d_project.c.
References RegionView3D::is_persp, mul_project_m4_v3(), negate_v3_v3(), normalize_v3(), RegionView3D::persinv, ARegion::regiondata, sub_v3_v3(), RegionView3D::viewinv, ARegion::winx, and ARegion::winy.
Referenced by ED_view3d_win_to_3d(), ED_view3d_win_to_3d_on_plane(), ED_view3d_win_to_ray(), and view3d_win_to_ray_segment().
|
static |
Definition at line 333 of file view3d_project.c.
References View3D::clip_end, depsgraph, ED_view3d_clip_range_get(), ED_view3d_win_to_origin(), ED_view3d_win_to_vector(), RegionView3D::is_persp, madd_v3_v3v3fl(), RegionView3D::persp, ARegion::regiondata, and RV3D_CAMOB.
Referenced by ED_view3d_win_to_ray_clipped_ex(), and ED_view3d_win_to_segment_clipped().