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:
authorJulian Eisel <julian@blender.org>2020-03-26 23:03:42 +0300
committerJulian Eisel <julian@blender.org>2020-03-26 23:18:45 +0300
commitc94b6209861ca7cc3985b53474feed7d94c0221a (patch)
tree752054f0dca1338cda5cf8ad4f6d18573fcca3b9 /source/blender/editors/include/ED_view3d.h
parent357ed79cb93f9d655501a828c6cddd68282de62d (diff)
parentafb1a64ccb81b7ed792f64151986f40f53af8da5 (diff)
Merge branch 'master' into wm-drag-drop-rewrite
Diffstat (limited to 'source/blender/editors/include/ED_view3d.h')
-rw-r--r--source/blender/editors/include/ED_view3d.h217
1 files changed, 113 insertions, 104 deletions
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 37ffb1b9d6d..bb065ee0008 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -24,6 +24,10 @@
#ifndef __ED_VIEW3D_H__
#define __ED_VIEW3D_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* ********* exports for space_view3d/ module ********** */
struct ARegion;
struct BMEdge;
@@ -41,7 +45,6 @@ struct EditBone;
struct GPUOffScreen;
struct GPUViewport;
struct ID;
-struct ImBuf;
struct MVert;
struct Main;
struct MetaElem;
@@ -80,7 +83,7 @@ typedef struct ViewContext {
struct ViewLayer *view_layer;
struct Object *obact;
struct Object *obedit;
- struct ARegion *ar;
+ struct ARegion *region;
struct View3D *v3d;
struct wmWindow *win;
struct RegionView3D *rv3d;
@@ -90,13 +93,31 @@ typedef struct ViewContext {
typedef struct ViewDepths {
unsigned short w, h;
- short x, y; /* only for temp use for sub-rects, added to ar->winx/y */
+ short x, y; /* only for temp use for sub-rects, added to region->winx/y */
float *depths;
double depth_range[2];
bool damaged;
} ViewDepths;
+typedef struct ViewDrawOffscreenContext {
+ struct Depsgraph *depsgraph;
+ struct Scene *scene;
+ int drawtype;
+ struct View3D *v3d;
+ struct ARegion *region;
+ int winx;
+ int winy;
+ float viewmat[4][4];
+ float winmat[4][4];
+ bool do_sky;
+ bool is_persp;
+ const char *viewname;
+ const bool do_color_management;
+ struct GPUOffScreen *ofs;
+ struct GPUViewport *viewport;
+} ViewDrawOffscreenContext;
+
/* Rotate 3D cursor on placement. */
enum eV3DCursorOrient {
V3D_CURSOR_ORIENT_NONE = 0,
@@ -139,12 +160,12 @@ void ED_view3d_to_object(const struct Depsgraph *depsgraph,
void ED_view3d_lastview_store(struct RegionView3D *rv3d);
/* Depth buffer */
-void ED_view3d_depth_update(struct ARegion *ar);
+void ED_view3d_depth_update(struct ARegion *region);
float ED_view3d_depth_read_cached(const struct ViewContext *vc, const int mval[2]);
bool ED_view3d_depth_read_cached_normal(const ViewContext *vc,
const int mval[2],
float r_normal[3]);
-bool ED_view3d_depth_unproject(const struct ARegion *ar,
+bool ED_view3d_depth_unproject(const struct ARegion *region,
const int mval[2],
const double depth,
float r_location_world[3]);
@@ -257,61 +278,61 @@ void pose_foreachScreenBone(struct ViewContext *vc,
/* *** end iterators *** */
/* view3d_project.c */
-void ED_view3d_project_float_v2_m4(const struct ARegion *ar,
+void ED_view3d_project_float_v2_m4(const struct ARegion *region,
const float co[3],
float r_co[2],
float mat[4][4]);
-void ED_view3d_project_float_v3_m4(const struct ARegion *ar,
+void ED_view3d_project_float_v3_m4(const struct ARegion *region,
const float co[3],
float r_co[3],
float mat[4][4]);
-eV3DProjStatus ED_view3d_project_base(const struct ARegion *ar, struct Base *base);
+eV3DProjStatus ED_view3d_project_base(const struct ARegion *region, struct Base *base);
/* *** short *** */
-eV3DProjStatus ED_view3d_project_short_ex(const struct ARegion *ar,
+eV3DProjStatus ED_view3d_project_short_ex(const struct 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_short_global(const struct ARegion *ar,
+eV3DProjStatus ED_view3d_project_short_global(const struct ARegion *region,
const float co[3],
short r_co[2],
const eV3DProjTest flag);
-eV3DProjStatus ED_view3d_project_short_object(const struct ARegion *ar,
+eV3DProjStatus ED_view3d_project_short_object(const struct ARegion *region,
const float co[3],
short r_co[2],
const eV3DProjTest flag);
/* *** int *** */
-eV3DProjStatus ED_view3d_project_int_ex(const struct ARegion *ar,
+eV3DProjStatus ED_view3d_project_int_ex(const struct 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_int_global(const struct ARegion *ar,
+eV3DProjStatus ED_view3d_project_int_global(const struct ARegion *region,
const float co[3],
int r_co[2],
const eV3DProjTest flag);
-eV3DProjStatus ED_view3d_project_int_object(const struct ARegion *ar,
+eV3DProjStatus ED_view3d_project_int_object(const struct ARegion *region,
const float co[3],
int r_co[2],
const eV3DProjTest flag);
/* *** float *** */
-eV3DProjStatus ED_view3d_project_float_ex(const struct ARegion *ar,
+eV3DProjStatus ED_view3d_project_float_ex(const struct 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_float_global(const struct ARegion *ar,
+eV3DProjStatus ED_view3d_project_float_global(const struct ARegion *region,
const float co[3],
float r_co[2],
const eV3DProjTest flag);
-eV3DProjStatus ED_view3d_project_float_object(const struct ARegion *ar,
+eV3DProjStatus ED_view3d_project_float_object(const struct ARegion *region,
const float co[3],
float r_co[2],
const eV3DProjTest flag);
@@ -322,21 +343,21 @@ float ED_view3d_pixel_size_no_ui_scale(const struct RegionView3D *rv3d, const fl
float ED_view3d_calc_zfac(const struct RegionView3D *rv3d, const float co[3], bool *r_flip);
bool ED_view3d_clip_segment(const struct RegionView3D *rv3d, float ray_start[3], float ray_end[3]);
bool ED_view3d_win_to_ray_clipped(struct Depsgraph *depsgraph,
- const struct ARegion *ar,
+ const struct ARegion *region,
const struct View3D *v3d,
const float mval[2],
float ray_start[3],
float ray_normal[3],
const bool do_clip);
bool ED_view3d_win_to_ray_clipped_ex(struct Depsgraph *depsgraph,
- const struct ARegion *ar,
+ const struct ARegion *region,
const struct View3D *v3d,
const float mval[2],
float r_ray_co[3],
float r_ray_normal[3],
float r_ray_start[3],
bool do_clip);
-void ED_view3d_win_to_ray(const struct ARegion *ar,
+void ED_view3d_win_to_ray(const struct ARegion *region,
const float mval[2],
float r_ray_start[3],
float r_ray_normal[3]);
@@ -344,33 +365,33 @@ void ED_view3d_global_to_vector(const struct RegionView3D *rv3d,
const float coord[3],
float vec[3]);
void ED_view3d_win_to_3d(const struct View3D *v3d,
- const struct ARegion *ar,
+ const struct ARegion *region,
const float depth_pt[3],
const float mval[2],
float r_out[3]);
void ED_view3d_win_to_3d_int(const struct View3D *v3d,
- const struct ARegion *ar,
+ const struct ARegion *region,
const float depth_pt[3],
const int mval[2],
float r_out[3]);
-bool ED_view3d_win_to_3d_on_plane(const struct ARegion *ar,
+bool ED_view3d_win_to_3d_on_plane(const struct 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 struct ARegion *ar,
+bool ED_view3d_win_to_3d_on_plane_int(const struct ARegion *region,
const float plane[4],
const int mval[2],
const bool do_clip,
float r_out[3]);
-void ED_view3d_win_to_delta(const struct ARegion *ar,
+void ED_view3d_win_to_delta(const struct ARegion *region,
const float mval[2],
float out[3],
const float zfac);
-void ED_view3d_win_to_origin(const struct ARegion *ar, const float mval[2], float out[3]);
-void ED_view3d_win_to_vector(const struct ARegion *ar, const float mval[2], float out[3]);
+void ED_view3d_win_to_origin(const struct ARegion *region, const float mval[2], float out[3]);
+void ED_view3d_win_to_vector(const struct ARegion *region, const float mval[2], float out[3]);
bool ED_view3d_win_to_segment_clipped(struct Depsgraph *depsgraph,
- const struct ARegion *ar,
+ const struct ARegion *region,
struct View3D *v3d,
const float mval[2],
float r_ray_start[3],
@@ -383,9 +404,9 @@ void ED_view3d_ob_project_mat_get_from_obmat(const struct RegionView3D *rv3d,
float obmat[4][4],
float pmat[4][4]);
-void ED_view3d_project(const struct ARegion *ar, const float world[3], float region[3]);
+void ED_view3d_project(const struct ARegion *region, const float world[3], float r_region_co[3]);
bool ED_view3d_unproject(
- const struct ARegion *ar, float regionx, float regiony, float regionz, float world[3]);
+ const struct ARegion *region, float regionx, float regiony, float regionz, float world[3]);
/* end */
@@ -410,21 +431,21 @@ void ED_view3d_polygon_offset(const struct RegionView3D *rv3d, const float dist)
void ED_view3d_calc_camera_border(const struct Scene *scene,
struct Depsgraph *depsgraph,
- const struct ARegion *ar,
+ const struct ARegion *region,
const struct View3D *v3d,
const struct RegionView3D *rv3d,
struct rctf *r_viewborder,
const bool no_shift);
void ED_view3d_calc_camera_border_size(const struct Scene *scene,
struct Depsgraph *depsgraph,
- const struct ARegion *ar,
+ const struct ARegion *region,
const struct View3D *v3d,
const struct RegionView3D *rv3d,
float r_size[2]);
bool ED_view3d_calc_render_border(const struct Scene *scene,
struct Depsgraph *depsgraph,
struct View3D *v3d,
- struct ARegion *ar,
+ struct ARegion *region,
struct rcti *rect);
void ED_view3d_clipping_calc_from_boundbox(float clip[6][4],
@@ -432,7 +453,7 @@ void ED_view3d_clipping_calc_from_boundbox(float clip[6][4],
const bool is_flip);
void ED_view3d_clipping_calc(struct BoundBox *bb,
float planes[4][4],
- const struct ARegion *ar,
+ const struct ARegion *region,
const struct Object *ob,
const struct rcti *rect);
void ED_view3d_clipping_local(struct RegionView3D *rv3d, float mat[4][4]);
@@ -446,22 +467,22 @@ void ED_view3d_clipping_disable(void);
float ED_view3d_radius_to_dist_persp(const float angle, const float radius);
float ED_view3d_radius_to_dist_ortho(const float lens, const float radius);
float ED_view3d_radius_to_dist(const struct View3D *v3d,
- const struct ARegion *ar,
+ const struct ARegion *region,
const struct Depsgraph *depsgraph,
const char persp,
const bool use_aspect,
const float radius);
-void imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], unsigned pos);
+void imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], unsigned int pos);
/* backbuffer select and draw support */
void ED_view3d_backbuf_depth_validate(struct ViewContext *vc);
-int ED_view3d_backbuf_sample_size_clamp(struct ARegion *ar, const float dist);
+int ED_view3d_backbuf_sample_size_clamp(struct ARegion *region, const float dist);
void ED_view3d_select_id_validate(struct ViewContext *vc);
bool ED_view3d_autodist(struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
const int mval[2],
float mouse_worldloc[3],
@@ -470,17 +491,20 @@ bool ED_view3d_autodist(struct Depsgraph *depsgraph,
/* only draw so ED_view3d_autodist_simple can be called many times after */
void ED_view3d_autodist_init(struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
int mode);
-bool ED_view3d_autodist_simple(struct ARegion *ar,
+bool ED_view3d_autodist_simple(struct ARegion *region,
const int mval[2],
float mouse_worldloc[3],
int margin,
float *force_depth);
-bool ED_view3d_autodist_depth(struct ARegion *ar, const int mval[2], int margin, float *depth);
-bool ED_view3d_autodist_depth_seg(
- struct ARegion *ar, const int mval_sta[2], const int mval_end[2], int margin, float *depth);
+bool ED_view3d_autodist_depth(struct ARegion *region, const int mval[2], int margin, float *depth);
+bool ED_view3d_autodist_depth_seg(struct ARegion *region,
+ const int mval_sta[2],
+ const int mval_end[2],
+ int margin,
+ float *depth);
/* select */
#define MAXPICKELEMS 2500
@@ -524,7 +548,7 @@ void ED_view3d_viewcontext_init(struct bContext *C,
struct Depsgraph *depsgraph);
void ED_view3d_viewcontext_init_object(struct ViewContext *vc, struct Object *obact);
void view3d_operator_needs_opengl(const struct bContext *C);
-void view3d_region_operator_needs_opengl(struct wmWindow *win, struct ARegion *ar);
+void view3d_region_operator_needs_opengl(struct wmWindow *win, struct ARegion *region);
/* XXX should move to BLI_math */
bool edge_inside_circle(const float cent[2],
@@ -537,6 +561,9 @@ struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C);
bool ED_view3d_context_user_region(struct bContext *C,
struct View3D **r_v3d,
struct ARegion **r_ar);
+bool ED_view3d_area_user_region(const struct ScrArea *sa,
+ const struct View3D *v3d,
+ struct ARegion **r_ar);
bool ED_operator_rv3d_user_region_poll(struct bContext *C);
void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d);
@@ -557,73 +584,37 @@ void ED_draw_object_facemap(struct Depsgraph *depsgraph,
const float col[4],
const int facemap);
-struct RenderEngineType *ED_view3d_engine_type(struct Scene *scene, int drawtype);
+struct RenderEngineType *ED_view3d_engine_type(const struct Scene *scene, int drawtype);
bool ED_view3d_context_activate(struct bContext *C);
-void ED_view3d_draw_offscreen(struct Depsgraph *depsgraph,
- struct Scene *scene,
- int drawtype,
- struct View3D *v3d,
- struct ARegion *ar,
- int winx,
- int winy,
- float viewmat[4][4],
- float winmat[4][4],
- bool do_sky,
- bool is_persp,
- const char *viewname,
- const bool do_color_management,
- struct GPUOffScreen *ofs,
- struct GPUViewport *viewport);
-void ED_view3d_draw_setup_view(struct wmWindow *win,
+void ED_view3d_draw_setup_view(const struct wmWindowManager *wm,
+ struct wmWindow *win,
struct Depsgraph *depsgraph,
struct Scene *scene,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
float viewmat[4][4],
float winmat[4][4],
const struct rcti *rect);
-struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Depsgraph *depsgraph,
- struct Scene *scene,
- int drawtype,
- struct View3D *v3d,
- struct ARegion *ar,
- int sizex,
- int sizey,
- unsigned int flag,
- int alpha_mode,
- const char *viewname,
- struct GPUOffScreen *ofs,
- char err_out[256]);
-struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(struct Depsgraph *depsgraph,
- struct Scene *scene,
- struct View3DShading *shading_override,
- int drawtype,
- struct Object *camera,
- int width,
- int height,
- unsigned int flag,
- unsigned int draw_flags,
- int alpha_mode,
- const char *viewname,
- struct GPUOffScreen *ofs,
- char err_out[256]);
-
struct Base *ED_view3d_give_base_under_cursor(struct bContext *C, const int mval[2]);
struct Object *ED_view3d_give_object_under_cursor(struct bContext *C, const int mval[2]);
bool ED_view3d_is_object_under_cursor(struct bContext *C, const int mval[2]);
-void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *ar, bool do_clip);
+void ED_view3d_quadview_update(struct ScrArea *sa, struct ARegion *region, bool do_clip);
void ED_view3d_update_viewmat(struct Depsgraph *depsgraph,
- struct Scene *scene,
+ const struct Scene *scene,
struct View3D *v3d,
- struct ARegion *ar,
+ struct ARegion *region,
float viewmat[4][4],
float winmat[4][4],
const struct rcti *rect,
bool offscreen);
-bool ED_view3d_quat_from_axis_view(const char view, float quat[4]);
-char ED_view3d_quat_to_axis_view(const float quat[4], const float epsilon);
+bool ED_view3d_quat_from_axis_view(const char view, const char view_axis_roll, float quat[4]);
+bool ED_view3d_quat_to_axis_view(const float viewquat[4],
+ const float epsilon,
+ char *r_view,
+ char *r_view_axis_rotation);
+
char ED_view3d_lock_view_from_index(int index);
char ED_view3d_axis_view_opposite(char view);
bool ED_view3d_lock(struct RegionView3D *rv3d);
@@ -644,7 +635,7 @@ void ED_view3d_persp_switch_from_camera(const struct Depsgraph *depsgraph,
const char persp);
bool ED_view3d_persp_ensure(const struct Depsgraph *depsgraph,
struct View3D *v3d,
- struct ARegion *ar);
+ struct ARegion *region);
/* camera lock functions */
bool ED_view3d_camera_lock_check(const struct View3D *v3d, const struct RegionView3D *rv3d);
@@ -661,7 +652,7 @@ bool ED_view3d_camera_lock_sync(const struct Depsgraph *depsgraph,
struct View3D *v3d,
struct RegionView3D *rv3d);
-bool ED_view3d_camera_autokey(struct Scene *scene,
+bool ED_view3d_camera_autokey(const struct Scene *scene,
struct ID *id_key,
struct bContext *C,
const bool do_rotate,
@@ -683,18 +674,20 @@ bool ED_view3d_distance_set_from_location(struct RegionView3D *rv3d,
const float dist_co[3],
const float dist_min);
-float ED_scene_grid_scale(struct Scene *scene, const char **grid_unit);
-float ED_view3d_grid_scale(struct Scene *scene, struct View3D *v3d, const char **grid_unit);
-void ED_view3d_grid_steps(struct Scene *scene,
+float ED_scene_grid_scale(const struct Scene *scene, const char **r_grid_unit);
+float ED_view3d_grid_scale(const struct Scene *scene,
+ struct View3D *v3d,
+ const char **r_grid_unit);
+void ED_view3d_grid_steps(const struct Scene *scene,
struct View3D *v3d,
struct RegionView3D *rv3d,
float *r_grid_steps);
float ED_view3d_grid_view_scale(struct Scene *scene,
struct View3D *v3d,
struct RegionView3D *rv3d,
- const char **grid_unit);
+ const char **r_grid_unit);
-void ED_scene_draw_fps(struct Scene *scene, int xoffset, int *yoffset);
+void ED_scene_draw_fps(const struct Scene *scene, int xoffset, int *yoffset);
/* view matrix properties utilities */
/* unused */
@@ -708,7 +701,7 @@ void ED_view3d_operator_properties_viewmat_get(struct wmOperator *op,
#endif
/* render */
-void ED_view3d_stop_render_preview(struct wmWindowManager *wm, struct ARegion *ar);
+void ED_view3d_stop_render_preview(struct wmWindowManager *wm, struct ARegion *region);
void ED_view3d_shade_update(struct Main *bmain, struct View3D *v3d, struct ScrArea *sa);
#define XRAY_ALPHA(v3d) \
@@ -721,9 +714,9 @@ void ED_view3d_shade_update(struct Main *bmain, struct View3D *v3d, struct ScrAr
/* view3d_draw_legacy.c */
/* Try avoid using these more move out of legacy. */
-void ED_view3d_draw_bgpic_test(struct Scene *scene,
+void ED_view3d_draw_bgpic_test(const struct Scene *scene,
struct Depsgraph *depsgraph,
- struct ARegion *ar,
+ struct ARegion *region,
struct View3D *v3d,
const bool do_foreground,
const bool do_camera_frame);
@@ -736,11 +729,27 @@ void ED_view3d_gizmo_mesh_preselect_get_active(struct bContext *C,
/* space_view3d.c */
void ED_view3d_buttons_region_layout_ex(const struct bContext *C,
- struct ARegion *ar,
+ struct ARegion *region,
const char *category_override);
/* view3d_view.c */
bool ED_view3d_local_collections_set(struct Main *bmain, struct View3D *v3d);
void ED_view3d_local_collections_reset(struct bContext *C, const bool reset_all);
+#ifdef WITH_XR_OPENXR
+void ED_view3d_xr_mirror_update(const struct ScrArea *area,
+ const struct View3D *v3d,
+ const bool enable);
+void ED_view3d_xr_shading_update(struct wmWindowManager *wm,
+ const View3D *v3d,
+ const struct Scene *scene);
+bool ED_view3d_is_region_xr_mirror_active(const struct wmWindowManager *wm,
+ const struct View3D *v3d,
+ const struct ARegion *region);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __ED_VIEW3D_H__ */