|
Blender V4.3
|
#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_geom.h"#include "BLI_math_matrix.h"#include "BLI_math_rotation.h"#include "BLI_math_vector.h"#include "BKE_camera.h"#include "BKE_screen.hh"#include "GPU_matrix.hh"#include "ED_view3d.hh"Go to the source code of this file.
Macros | |
| #define | BL_ZERO_CLIP 0.001 |
Functions | |
| blender::float2 | ED_view3d_project_float_v2_m4 (const ARegion *region, const float co[3], const blender::float4x4 &mat) |
| void | ED_view3d_project_float_v3_m4 (const ARegion *region, const float co[3], float r_co[3], const float mat[4][4]) |
| eV3DProjStatus | ED_view3d_project_base (const ARegion *region, Base *base, float r_co[2]) |
| 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_ex (const RegionView3D *rv3d, const float co[3], bool *r_flip) |
| float | ED_view3d_calc_zfac (const RegionView3D *rv3d, const float co[3]) |
| float | ED_view3d_calc_depth_for_comparison (const RegionView3D *rv3d, const float co[3]) |
| static void | view3d_win_to_ray_segment (const 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 (Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, const float mval[2], const bool do_clip_planes, float r_ray_co[3], float r_ray_normal[3], float r_ray_start[3], float r_ray_end[3]) |
| bool | ED_view3d_win_to_ray_clipped (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 r_out[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 xy_delta[2], const float zfac, float r_out[3]) |
| void | ED_view3d_win_to_origin (const ARegion *region, const float mval[2], float r_out[3]) |
| void | ED_view3d_win_to_vector (const ARegion *region, const float mval[2], float r_out[3]) |
| bool | ED_view3d_win_to_segment_clipped (const Depsgraph *depsgraph, const ARegion *region, const 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 | |
| blender::float4x4 | ED_view3d_ob_project_mat_get (const RegionView3D *rv3d, const Object *ob) |
| blender::float4x4 | ED_view3d_ob_project_mat_get_from_obmat (const RegionView3D *rv3d, const blender::float4x4 &obmat) |
| void | ED_view3d_project_v3 (const ARegion *region, const float world[3], float r_region_co[3]) |
| void | ED_view3d_project_v2 (const ARegion *region, const float world[3], float r_region_co[2]) |
| bool | ED_view3d_unproject_v3 (const ARegion *region, float regionx, float regiony, float regionz, float world[3]) |
| #define BL_ZERO_CLIP 0.001 |
Definition at line 29 of file view3d_project.cc.
Referenced by ed_view3d_project__internal().
| float ED_view3d_calc_depth_for_comparison | ( | const RegionView3D * | rv3d, |
| const float | co[3] ) |
Calculate a depth value from co (result should only be used for comparison).
Definition at line 317 of file view3d_project.cc.
References dot_v3v3(), ED_view3d_calc_zfac(), RegionView3D::is_persp, and RegionView3D::viewinv.
Referenced by annotation_stroke_eraser_is_occluded().
| float ED_view3d_calc_zfac | ( | const RegionView3D * | rv3d, |
| const float | co[3] ) |
See ED_view3d_calc_zfac_ex doc-string.
Definition at line 312 of file view3d_project.cc.
References ED_view3d_calc_zfac_ex().
Referenced by annotation_stroke_convertcoords(), brush_edit_init(), blender::ed::sculpt_paint::calc_local_from_screen(), calculateZfac(), ED_view3d_calc_depth_for_comparison(), ED_view3d_cursor3d_position(), blender::ed::sculpt_paint::greasepencil::get_screen_projection_fn(), gpencil_stroke_convertcoords(), ViewOpsData::init_navigation(), mesh_bisect_interactive_calc(), move3d_get_translate(), paint_calc_object_space_radius(), blender::ed::greasepencil::pixel_radius_to_world_space_radius(), blender::io::grease_pencil::GreasePencilExporter::retrieve_objects(), view3d_zoom_border_exec(), and view_zoom_to_window_xy_3d().
| float ED_view3d_calc_zfac_ex | ( | const RegionView3D * | rv3d, |
| const float | co[3], | ||
| bool * | r_flip ) |
Calculate a depth value from co, use with ED_view3d_win_to_delta.
| r_flip | Set to zfac < 0.0 before the value is made signed. Since it's important in some cases to know if the value was flipped. |
co multiplied by rv3d->persmat matrix, with additional sanitation to ensure the result is never negative as this isn't useful for tool-code. Definition at line 289 of file view3d_project.cc.
References mul_project_m4_v3_zfac(), and RegionView3D::persmat.
Referenced by ED_view3d_calc_zfac(), and ED_view3d_cursor3d_position().
| bool ED_view3d_clip_segment | ( | const RegionView3D * | rv3d, |
| float | ray_start[3], | ||
| float | ray_end[3] ) |
Definition at line 363 of file view3d_project.cc.
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 | r_out[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. |
| r_out | The resulting normalized vector. |
Definition at line 424 of file view3d_project.cc.
References copy_v3_v3(), RegionView3D::is_persp, mul_m4_v4(), mul_v3_fl(), normalize_v3(), sub_v3_v3v3(), RegionView3D::viewinv, and RegionView3D::viewmat.
Referenced by add_vertex_invoke(), dial_ghostarc_get_angles(), gizmo_get_idot(), blender::ed::sculpt_paint::project_brush_radius(), update_location_for_2d_curve(), and v3d_cursor_plane_draw().
| blender::float4x4 ED_view3d_ob_project_mat_get | ( | const RegionView3D * | rv3d, |
| const Object * | ob ) |
Definition at line 699 of file view3d_project.cc.
References mul_m4_m4m4(), blender::MatBase< T, NumCol, NumRow, Alignment >::ptr(), RegionView3D::viewmat, and RegionView3D::winmat.
Referenced by blender::ed::sculpt_paint::CombOperationExecutor::comb_projected(), content_planes_from_clip_flag(), blender::ed::sculpt_paint::DeleteOperationExecutor::delete_projected(), ed_curves_select_pick(), edbm_rip_edge_invoke(), edbm_rip_invoke__edge(), edbm_rip_invoke__vert(), blender::ed::sculpt_paint::PuffOperationExecutor::find_curve_weights_projected(), blender::ed::sculpt_paint::find_curves_brush_position(), blender::ed::sculpt_paint::SmoothOperationExecutor::find_projected_smooth_factors(), blender::ed::sculpt_paint::CurvesEffectOperationExecutor::gather_influences_projected(), blender::ed::greasepencil::grease_pencil_primitive_invoke(), blender::ed::greasepencil::grease_pencil_primitive_modal(), blender::ed::sculpt_paint::gesture::init_from_lasso(), knifeproject_poly_from_object(), obedit_circle_select(), blender::ed::sculpt_paint::greasepencil::GrabOperation::on_stroke_begin(), paint_convert_bb_to_rect(), blender::ed::sculpt_paint::SelectionPaintOperationExecutor::paint_curve_selection_projected(), blender::ed::sculpt_paint::SelectionPaintOperationExecutor::paint_point_selection_projected(), blender::ed::sculpt_paint::PinchOperationExecutor::pinch_projected(), blender::ed::sculpt_paint::SnakeHookOperatorExecutor::projected_snake_hook(), blender::ed::sculpt_paint::DensitySubtractOperationExecutor::reduce_density_projected(), blender::ed::sculpt_paint::DensityAddOperationExecutor::sample_projected_with_symmetry(), blender::ed::sculpt_paint::sculpt_update_cache_invariants(), blender::ed::sculpt_paint::SlideOperationExecutor::slide(), blender::ed::sculpt_paint::vwpaint::update_cache_invariants(), EdgeSlideData::update_proj_mat(), VertSlideData::update_proj_mat(), view3d_box_select_exec(), and view3d_lasso_select().
| blender::float4x4 ED_view3d_ob_project_mat_get_from_obmat | ( | const RegionView3D * | rv3d, |
| const blender::float4x4 & | obmat ) |
Definition at line 709 of file view3d_project.cc.
References RegionView3D::viewmat, and RegionView3D::winmat.
Referenced by blender::ed::greasepencil::build_curves_2d_bvh_from_visible(), do_grease_pencil_box_select(), do_lasso_select_grease_pencil(), ed_grease_pencil_select_pick(), grease_pencil_circle_select(), proj_paint_state_viewport_init(), blender::ed::greasepencil::stroke_trim_execute(), and blender::ed::greasepencil::weight_sample_invoke().
| float ED_view3d_pixel_size | ( | const RegionView3D * | rv3d, |
| const float | co[3] ) |
Definition at line 279 of file view3d_project.cc.
References mul_project_m4_v3_zfac(), RegionView3D::persmat, and RegionView3D::pixsize.
Referenced by blender::ed::sculpt_paint::greasepencil::brush_radius_to_pixel_radius(), cage3d_draw_box_interaction(), cage3d_draw_circle_handles(), blender::ed::sculpt_paint::greasepencil::calculate_view_radii(), blender::io::grease_pencil::compute_drawing_bounds(), drawSnapping(), ED_view3d_cursor_snap_draw_util(), edbm_bevel_invoke(), edbm_inset_invoke(), blender::ed::greasepencil::get_boundary_bounds(), blender::ed::sculpt_paint::grease_pencil_fill_modal(), v3d_cursor_plane_draw(), blender::ed::object::voxel_size_edit_invoke(), and WIDGETGROUP_gizmo_draw_prepare().
| float ED_view3d_pixel_size_no_ui_scale | ( | const RegionView3D * | rv3d, |
| const float | co[3] ) |
Definition at line 284 of file view3d_project.cc.
References mul_project_m4_v3_zfac(), RegionView3D::persmat, and RegionView3D::pixsize.
Referenced by DRW_draw_cursor(), gizmo_button2d_bounds(), gizmo_ruler_draw(), knifetool_draw_angle(), and wm_gizmo_calculate_scale().
|
static |
perspmat is typically either:
Definition at line 103 of file view3d_project.cc.
References BL_ZERO_CLIP, BLI_assert, copy_v3_v3(), ED_view3d_clipping_test(), fabsf, flag, float, mul_m4_v4(), 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, vec4, and w().
Referenced by ED_view3d_project_float_ex(), ED_view3d_project_int_ex(), and ED_view3d_project_short_ex().
| eV3DProjStatus ED_view3d_project_base | ( | const ARegion * | region, |
| Base * | base, | ||
| float | r_co[2] ) |
Definition at line 83 of file view3d_project.cc.
References ED_view3d_project_float_global(), Base::object, ret, 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 202 of file view3d_project.cc.
References copy_v2_v2(), ed_view3d_project__internal(), flag, 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 258 of file view3d_project.cc.
References ED_view3d_project_float_ex(), flag, and RegionView3D::persmat.
Referenced by annotation_stroke_convertcoords(), applyFaceProject(), ApplySnapTranslation(), blender::ed::sculpt_paint::greasepencil::calculate_view_positions(), calculateCenterCursor(), blender::io::grease_pencil::compute_drawing_bounds(), ED_view3d_cursor3d_update(), ED_view3d_project_base(), blender::ed::greasepencil::get_boundary_bounds(), gizmo_button2d_bounds(), gizmo_ruler_draw(), gizmo_ruler_invoke(), gpencil_stroke_convertcoords(), knife_project_v2(), knifetool_draw_visible_angles(), mouse_select_object_center(), object_circle_select(), blender::ed::sculpt_paint::greasepencil::TintOperation::on_stroke_begin(), blender::ed::sculpt_paint::project_brush_radius(), blender::io::grease_pencil::GreasePencilExporter::project_to_screen(), projectFloatViewEx(), blender::ed::greasepencil::DrawingPlacement::reproject(), updateSelectedSnapPoint(), and view3d_ruler_pick().
| eV3DProjStatus ED_view3d_project_float_object | ( | const ARegion * | region, |
| const float | co[3], | ||
| float | r_co[2], | ||
| eV3DProjTest | flag ) |
Object space, use ED_view3d_init_mats_rv3d before calling.
Definition at line 266 of file view3d_project.cc.
References ED_view3d_check_mats_rv3d(), ED_view3d_project_float_ex(), flag, and RegionView3D::persmatob.
Referenced by ED_curve_editfont_select_pick(), ed_mesh_pick_face_vert__mpoly_find(), ed_mesh_pick_vert__mapFunc(), edbm_dupli_extrude_cursor_invoke(), EDBM_project_snap_verts(), find_closest_edge_in_poly(), gradientVertInit__mapFunc(), lattice_foreachScreenVert(), mball_foreachScreenElem(), mesh_foreachScreenFace__mapFunc(), mesh_foreachScreenVert__mapFunc(), meshobject_foreachScreenVert__mapFunc(), mouse_mesh_loop(), nurbs_foreachScreenVert(), paint_and_tex_color_alpha_intern(), view3d_project_segment_to_screen_with_clip_tag(), view3d_project_segment_to_screen_with_content_clip_planes(), vpaint_proj_dm_map_cosnos_update__map_cb(), and worldspace_to_screenspace().
| blender::float2 ED_view3d_project_float_v2_m4 | ( | const ARegion * | region, |
| const float | co[3], | ||
| const blender::float4x4 & | mat ) |
Definition at line 34 of file view3d_project.cc.
References copy_v3_v3(), float, mul_m4_v4(), blender::MatBase< T, NumCol, NumRow, Alignment >::ptr(), vec4, and zero_v2().
Referenced by blender::ed::greasepencil::build_curves_2d_bvh_from_visible(), blender::ed::sculpt_paint::CombOperationExecutor::comb_projected(), blender::ed::sculpt_paint::DeleteOperationExecutor::delete_projected(), edbm_rip_edge_invoke(), edbm_rip_edge_side_measure(), edbm_rip_edgedist_squared(), blender::ed::sculpt_paint::PuffOperationExecutor::find_curve_weights_projected(), blender::ed::sculpt_paint::find_curves_brush_position(), blender::ed::sculpt_paint::SmoothOperationExecutor::find_projected_smooth_factors(), blender::ed::sculpt_paint::CurvesEffectOperationExecutor::gather_influences_projected(), blender::ed::sculpt_paint::gesture::is_affected_lasso(), knifeproject_poly_from_object(), paint_convert_bb_to_rect(), blender::ed::sculpt_paint::PinchOperationExecutor::pinch_projected(), blender::ed::greasepencil::primitive_local_to_screen(), blender::ed::sculpt_paint::SnakeHookOperatorExecutor::projected_snake_hook(), blender::ed::sculpt_paint::DensityAddOperationExecutor::sample_projected_with_symmetry(), sculpt_apply_texture(), SCULPT_vertex_is_occluded(), blender::ed::curves::select_box(), blender::ed::curves::select_box_mask(), blender::ed::curves::select_circle(), blender::ed::curves::select_circle_mask(), blender::ed::curves::select_lasso(), and blender::ed::curves::select_lasso_mask().
| void ED_view3d_project_float_v3_m4 | ( | const ARegion * | region, |
| const float | co[3], | ||
| float | r_co[3], | ||
| const float | mat[4][4] ) |
Definition at line 57 of file view3d_project.cc.
References copy_v3_v3(), float, mul_m4_v4(), vec4, 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 179 of file view3d_project.cc.
References ed_view3d_project__internal(), flag, floorf, int, 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 240 of file view3d_project.cc.
References ED_view3d_project_int_ex(), flag, and RegionView3D::persmat.
Referenced by brush_cut(), DRW_draw_cursor(), gpencil_point_to_xy(), key_inside_circle(), key_inside_rect(), key_test_depth(), PE_lasso_select(), and projectIntViewEx().
| eV3DProjStatus ED_view3d_project_int_object | ( | const ARegion * | region, |
| const float | co[3], | ||
| int | r_co[2], | ||
| const eV3DProjTest | flag ) |
Definition at line 248 of file view3d_project.cc.
References ED_view3d_check_mats_rv3d(), ED_view3d_project_int_ex(), flag, and RegionView3D::persmatob.
| 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 157 of file view3d_project.cc.
References ed_view3d_project__internal(), flag, floorf, ret, V3D_PROJ_RET_OK, and V3D_PROJ_RET_OVERFLOW.
Referenced by DRW_text_cache_draw(), 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 222 of file view3d_project.cc.
References ED_view3d_project_short_ex(), flag, and RegionView3D::persmat.
| eV3DProjStatus ED_view3d_project_short_object | ( | const ARegion * | region, |
| const float | co[3], | ||
| short | r_co[2], | ||
| const eV3DProjTest | flag ) |
Definition at line 230 of file view3d_project.cc.
References ED_view3d_check_mats_rv3d(), ED_view3d_project_short_ex(), flag, and RegionView3D::persmatob.
Definition at line 723 of file view3d_project.cc.
References GPU_matrix_project_2fv(), RegionView3D::viewmat, and RegionView3D::winmat.
Referenced by blender::ed::sculpt_paint::min_distance_edit::calculate_points_per_side(), gizmo_preselect_elem_test_select(), blender::ed::sculpt_paint::min_distance_edit::min_distance_edit_draw(), blender::ed::sculpt_paint::paint_line_strokes_spacing(), blender::ed::sculpt_paint::paint_space_stroke(), and blender::ed::object::voxel_size_edit_invoke().
Convert between region relative coordinates (x,y) and depth component z and a point in world space.
Definition at line 715 of file view3d_project.cc.
References GPU_matrix_project_3fv(), RegionView3D::viewmat, and RegionView3D::winmat.
Referenced by blender::ed::sculpt_paint::cursor_draw_point_screen_space(), key_test_depth(), and blender::ed::object::object_transform_axis_target_calc_depth_init().
| bool ED_view3d_unproject_v3 | ( | const ARegion * | region, |
| float | regionx, | ||
| float | regiony, | ||
| float | regionz, | ||
| float | world[3] ) |
Definition at line 731 of file view3d_project.cc.
References GPU_matrix_unproject_3fv(), RegionView3D::viewinv, and RegionView3D::winmat.
Referenced by ED_view3d_autodist(), ED_view3d_autodist_simple(), ED_view3d_clipping_calc(), ED_view3d_depth_unproject_v3(), 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 482 of file view3d_project.cc.
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_factor(), madd_v3_v3v3fl(), RegionView3D::persinv, RegionView3D::persp, ray_point_factor_v3(), RV3D_CAMOB, Camera::sensor_fit, Camera::shiftx, Camera::shifty, and RegionView3D::viewinv.
Referenced by armature_click_extrude_invoke(), blender::ed::sculpt_paint::brush_delta_update(), blender::ed::sculpt_paint::CombOperationExecutor::comb_projected(), blender::ed::sculpt_paint::CombOperationExecutor::comb_spherical_with_symmetry(), curve_draw_invoke(), blender::ed::curves::curves_draw_invoke(), blender::ed::sculpt_paint::DeleteOperationExecutor::delete_spherical_with_symmetry(), depthdropper_depth_sample_pt(), ED_view3d_win_to_3d_int(), blender::ed::sculpt_paint::PuffOperationExecutor::find_curves_weights_spherical_with_symmetry(), blender::ed::sculpt_paint::SmoothOperationExecutor::find_spherical_smooth_factors_with_symmetry(), blender::ed::sculpt_paint::CurvesEffectOperationExecutor::gather_influences_projected(), blender::ed::sculpt_paint::CurvesEffectOperationExecutor::gather_influences_spherical(), blender::ed::sculpt_paint::trim::generate_geometry(), gizmo_window_project_3d(), ViewOpsData::init_navigation(), initBend(), knife_constrain_axis(), knifetool_raycast_planes(), blender::ed::sculpt_paint::gesture::line_calculate_plane_points(), mesh_bisect_interactive_calc(), blender::ed::sculpt_paint::SelectionPaintOperationExecutor::paint_curve_selection_spherical_with_symmetry(), blender::ed::sculpt_paint::SelectionPaintOperationExecutor::paint_point_selection_spherical_with_symmetry(), blender::ed::sculpt_paint::PinchOperationExecutor::pinch_projected(), blender::ed::sculpt_paint::PinchOperationExecutor::pinch_spherical_with_symmetry(), blender::ed::greasepencil::DrawingPlacement::project(), blender::ed::sculpt_paint::SnakeHookOperatorExecutor::projected_snake_hook(), screenspace_to_worldspace(), blender::ed::sculpt_paint::SnakeHookOperatorExecutor::spherical_snake_hook_with_symmetry(), blender::ed::curves::stroke_elem_project_fallback(), stroke_elem_project_fallback(), and v3d_cursor_snap_update().
| 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 535 of file view3d_project.cc.
References ED_view3d_win_to_3d(), and float.
Referenced by add_vertex_invoke(), ED_view3d_autodist(), ED_view3d_cursor3d_position(), edbm_dupli_extrude_cursor_invoke(), edbm_point_normals_modal(), edbm_polybuild_face_at_cursor_invoke(), edbm_polybuild_split_at_cursor_invoke(), extrude_points_from_selected_vertices(), gizmo_mesh_spin_redo_setup(), navigate_pivot_get(), view3d_preselect_update_preview_triangle_from_edge(), view3d_preselect_update_preview_triangle_from_vert(), view3d_ruler_item_project(), and viewcenter_pick_invoke().
| 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 545 of file view3d_project.cc.
References dot_m4_v3_row_z(), ED_view3d_win_to_origin(), ED_view3d_win_to_vector(), fabsf, RegionView3D::is_persp, isect_ray_plane_v3(), madd_v3_v3v3fl(), RegionView3D::persmat, RegionView3D::persp, and RV3D_CAMOB.
Referenced by calc_initial_placement_point_from_view(), dial_ghostarc_get_angles(), ED_view3d_win_to_3d_on_plane_int(), ED_view3d_win_to_3d_on_plane_with_fallback(), font_cursor_text_index_from_event(), blender::ed::sculpt_paint::trim::generate_geometry(), gizmo_3d_dial_matrixbasis_calc(), gizmo_window_project_2d(), blender::ed::greasepencil::grease_pencil_texture_gradient_exec(), blender::ed::greasepencil::DrawingPlacement::project(), blender::ed::curves::stroke_elem_project(), stroke_elem_project(), v3d_cursor_snap_update(), and view3d_win_to_3d_on_plane_maybe_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 577 of file view3d_project.cc.
References ED_view3d_win_to_3d_on_plane(), and float.
Referenced by gizmo_mesh_spin_redo_setup().
| bool ED_view3d_win_to_3d_on_plane_with_fallback | ( | const ARegion * | region, |
| const float | plane[4], | ||
| const float | mval[2], | ||
| 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 587 of file view3d_project.cc.
References closest_to_plane_v3(), copy_m4_m3(), ED_view3d_win_to_3d_on_plane(), isect_plane_plane_v3(), mat4, mul_m4_v3(), normalize_v3(), rotation_between_vecs_to_mat3(), and transform_pivot_set_m4().
Referenced by view3d_win_to_3d_on_plane_maybe_fallback().
| void ED_view3d_win_to_delta | ( | const ARegion * | region, |
| const float | xy_delta[2], | ||
| float | zfac, | ||
| float | r_out[3] ) |
Calculate a 3D difference vector from 2D window offset.
When the zfac is calculated based on a world-space location directly under the cursor, the value of r_out can be subtracted from RegionView3D.ofs to pan the view with the contents following the cursor perfectly (without sliding).
| region | The region (used for the window width and height). |
| xy_delta | 2D difference (in pixels) such as event->mval[0] - other_x. |
| zfac | The depth result typically calculated by ED_view3d_calc_zfac (see its doc-string for details). |
| r_out | The resulting world-space delta. |
Definition at line 622 of file view3d_project.cc.
References RegionView3D::persinv.
Referenced by annotation_stroke_convertcoords(), brush_edit_apply(), blender::ed::sculpt_paint::calc_local_from_screen(), convertViewVec(), blender::ed::sculpt_paint::greasepencil::get_screen_projection_fn(), gpencil_stroke_convertcoords(), mesh_bisect_interactive_calc(), move3d_get_translate(), paint_calc_object_space_radius(), blender::ed::greasepencil::pixel_radius_to_world_space_radius(), view3d_zoom_border_exec(), view_zoom_to_window_xy_3d(), and viewmove_apply().
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 float). |
| r_out | The resulting normalized world-space direction vector. |
Definition at line 638 of file view3d_project.cc.
References copy_v3_v3(), RegionView3D::is_persp, mul_project_m4_v3(), RegionView3D::persinv, RegionView3D::persp, RV3D_CAMOB, and RegionView3D::viewinv.
Referenced by ED_view3d_win_to_3d_on_plane(), ED_view3d_win_to_ray(), SCULPT_raycast_init(), 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 415 of file view3d_project.cc.
References ED_view3d_win_to_origin(), and ED_view3d_win_to_vector().
Referenced by gizmo_arrow_modal(), and blender::ed::object::object_transform_axis_target_calc_depth_init().
| bool ED_view3d_win_to_ray_clipped | ( | Depsgraph * | depsgraph, |
| const ARegion * | region, | ||
| const View3D * | v3d, | ||
| const float | mval[2], | ||
| float | r_ray_start[3], | ||
| float | r_ray_normal[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.
| 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 395 of file view3d_project.cc.
References depsgraph, and ED_view3d_win_to_ray_clipped_ex().
Referenced by EDBM_unified_findnearest_from_raycast(), and knife_snap_curr().
| bool ED_view3d_win_to_ray_clipped_ex | ( | Depsgraph * | depsgraph, |
| const ARegion * | region, | ||
| const View3D * | v3d, | ||
| const float | mval[2], | ||
| const bool | do_clip_planes, | ||
| float | r_ray_co[3], | ||
| float | r_ray_normal[3], | ||
| float | r_ray_start[3], | ||
| float | r_ray_end[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. 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 especially with orthographic 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]). |
| do_clip_planes | Optionally clip the start of the ray by the view clipping planes. |
| 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. |
| r_ray_end | The world-space end point of the segment. |
Definition at line 373 of file view3d_project.cc.
References depsgraph, ED_view3d_clip_segment(), and view3d_win_to_ray_segment().
Referenced by ED_transform_snap_object_project_all_view3d_ex(), ED_transform_snap_object_project_view3d_ex(), and ED_view3d_win_to_ray_clipped().
| bool ED_view3d_win_to_segment_clipped | ( | const Depsgraph * | depsgraph, |
| const ARegion * | region, | ||
| const View3D * | v3d, | ||
| const float | mval[2], | ||
| float | r_ray_start[3], | ||
| float | r_ray_end[3], | ||
| 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 676 of file view3d_project.cc.
References depsgraph, ED_view3d_clip_segment(), and view3d_win_to_ray_segment().
Referenced by BMBVH_EdgeVisible(), brush_add_count_iter(), imapaint_pick_face(), knife_find_line_hits(), knife_input_ray_segment(), blender::ed::sculpt_paint::min_distance_edit::min_distance_edit_invoke(), blender::ed::sculpt_paint::sample_curves_3d_brush(), blender::ed::sculpt_paint::sample_curves_surface_3d_brush(), blender::ed::sculpt_paint::AddOperationExecutor::sample_in_center_with_symmetry(), blender::ed::sculpt_paint::AddOperationExecutor::sample_projected(), blender::ed::sculpt_paint::DensityAddOperationExecutor::sample_projected_with_symmetry(), blender::ed::sculpt_paint::AddOperationExecutor::sample_spherical_with_symmetry(), and SCULPT_raycast_init().
Calculate a 3D direction vector from 2D window coordinates. The resulting direction points away from the view-point, making the result useful to perform ray-casts into a 3D scene. In orthographic view all input coordinates result in 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 float). |
| r_out | The resulting normalized world-space direction vector. |
Definition at line 659 of file view3d_project.cc.
References RegionView3D::is_persp, mul_project_m4_v3(), negate_v3_v3(), normalize_v3(), RegionView3D::persinv, sub_v3_v3(), and RegionView3D::viewinv.
Referenced by ED_view3d_win_to_3d(), ED_view3d_win_to_3d_on_plane(), ED_view3d_win_to_ray(), gizmo_find_intersected_3d_intern(), ViewOpsData::init_navigation(), mesh_bisect_interactive_calc(), and view3d_win_to_ray_segment().
|
static |
Definition at line 325 of file view3d_project.cc.
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, and RV3D_CAMOB.
Referenced by ED_view3d_win_to_ray_clipped_ex(), and ED_view3d_win_to_segment_clipped().