From 681661dbed121c7b81e9129c57df5eadb03c1009 Mon Sep 17 00:00:00 2001 From: mano-wii Date: Fri, 15 Mar 2019 16:02:55 -0300 Subject: GPU: Simplify select shaders. The shaders are: `GPU_SHADER_3D_FLAT_SELECT_ID` and `GPU_SHADER_3D_UNIFORM_SELECT_ID`. This commit allows the drawing of the mesh select ids to be done on a 32UI format texture. This simplifies the shader that previously acted on the backbuffer and had to do an uint to rgba conversion. Differential Revision: https://developer.blender.org/D4350 --- source/blender/editors/include/ED_mesh.h | 12 ++++++------ source/blender/editors/include/ED_view3d.h | 26 +++++++++++++++++--------- 2 files changed, 23 insertions(+), 15 deletions(-) (limited to 'source/blender/editors/include') diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 7318df8adab..e8c5e0dd789 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -237,7 +237,7 @@ void EDBM_project_snap_verts(struct bContext *C, struct ARegion *ar, struct BMEd /* editface.c */ void paintface_flush_flags(struct bContext *C, struct Object *ob, short flag); bool paintface_mouse_select(struct bContext *C, struct Object *ob, const int mval[2], bool extend, bool deselect, bool toggle); -int do_paintface_box_select(struct ViewContext *vc, struct rcti *rect, int sel_op); +int do_paintface_box_select(struct ViewContext *vc, const struct rcti *rect, int sel_op); void paintface_deselect_all_visible(struct bContext *C, struct Object *ob, int action, bool flush_flags); void paintface_select_linked(struct bContext *C, struct Object *ob, const int mval[2], const bool select); bool paintface_minmax(struct Object *ob, float r_min[3], float r_max[3]); @@ -365,9 +365,9 @@ int *mesh_get_x_mirror_faces(struct Object *ob, struct BMEditMesh *em, struct Me int ED_mesh_mirror_get_vert(struct Object *ob, int index); -bool ED_mesh_pick_vert(struct bContext *C, struct Object *ob, const int mval[2], unsigned int *index, int size, bool use_zbuf); -bool ED_mesh_pick_face(struct bContext *C, struct Object *ob, const int mval[2], unsigned int *index, int size); -bool ED_mesh_pick_face_vert(struct bContext *C, struct Object *ob, const int mval[2], unsigned int *index, int size); +bool ED_mesh_pick_vert(struct bContext *C, struct Object *ob, const int mval[2], unsigned int *index, int dist_px, bool use_zbuf); +bool ED_mesh_pick_face(struct bContext *C, struct Object *ob, const int mval[2], unsigned int *index, int dist_px); +bool ED_mesh_pick_face_vert(struct bContext *C, struct Object *ob, const int mval[2], unsigned int *index, int dist_px); struct MDeformVert *ED_mesh_active_dvert_get_em(struct Object *ob, struct BMVert **r_eve); @@ -377,8 +377,8 @@ struct MDeformVert *ED_mesh_active_dvert_get_only(struct Object *ob); void EDBM_mesh_stats_multi(struct Object **objects, const uint objects_len, int totelem[3], int totelem_sel[3]); void EDBM_mesh_elem_index_ensure_multi(struct Object **objects, const uint objects_len, const char htype); -#define ED_MESH_PICK_DEFAULT_VERT_SIZE 50 -#define ED_MESH_PICK_DEFAULT_FACE_SIZE 3 +#define ED_MESH_PICK_DEFAULT_VERT_DIST 25 +#define ED_MESH_PICK_DEFAULT_FACE_DIST 1 #define USE_LOOPSLIDE_HACK diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 131069bfb5f..e8cd6ebf5f3 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -348,16 +348,24 @@ float ED_view3d_radius_to_dist( void imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], unsigned pos); /* backbuffer select and draw support */ -void ED_view3d_backbuf_validate_with_select_mode(struct ViewContext *vc, short select_mode); -void ED_view3d_backbuf_validate(struct ViewContext *vc); -struct ImBuf *ED_view3d_backbuf_read( - struct ViewContext *vc, int xmin, int ymin, int xmax, int ymax); -unsigned int ED_view3d_backbuf_sample_rect( - struct ViewContext *vc, const int mval[2], int size, - unsigned int min, unsigned int max, float *r_dist); -int ED_view3d_backbuf_sample_size_clamp(struct ARegion *ar, const float dist); -unsigned int ED_view3d_backbuf_sample( +void ED_view3d_backbuf_depth_validate(struct ViewContext *vc); +int ED_view3d_backbuf_sample_size_clamp(struct ARegion *ar, const float dist); + +void ED_view3d_select_id_validate(struct ViewContext *vc); +void ED_view3d_select_id_validate_with_select_mode( + struct ViewContext *vc, short select_mode); + +uint ED_view3d_select_id_sample( struct ViewContext *vc, int x, int y); +uint *ED_view3d_select_id_read( + struct ViewContext *vc, + int xmin, int ymin, int xmax, int ymax, + uint *r_buf_len); +uint *ED_view3d_select_id_read_rect( + struct ViewContext *vc, const struct rcti *rect, uint *r_buf_len); +uint ED_view3d_select_id_read_nearest( + struct ViewContext *vc, const int mval[2], + const uint min, const uint max, uint *r_dist); bool ED_view3d_autodist( struct Depsgraph *depsgraph, struct ARegion *ar, struct View3D *v3d, -- cgit v1.2.3