Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/engines/overlay/overlay_edit_mesh.c
| Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | void OVERLAY_edit_mesh_cache_init(OVERLAY_Data *vedata) | ||||
| DefaultTextureList *dtxl = DRW_viewport_texture_list_get(); | DefaultTextureList *dtxl = DRW_viewport_texture_list_get(); | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| ToolSettings *tsettings = draw_ctx->scene->toolsettings; | ToolSettings *tsettings = draw_ctx->scene->toolsettings; | ||||
| View3D *v3d = draw_ctx->v3d; | View3D *v3d = draw_ctx->v3d; | ||||
| bool select_vert = pd->edit_mesh.select_vert = (tsettings->selectmode & SCE_SELECT_VERTEX) != 0; | bool select_vert = pd->edit_mesh.select_vert = (tsettings->selectmode & SCE_SELECT_VERTEX) != 0; | ||||
| bool select_face = pd->edit_mesh.select_face = (tsettings->selectmode & SCE_SELECT_FACE) != 0; | bool select_face = pd->edit_mesh.select_face = (tsettings->selectmode & SCE_SELECT_FACE) != 0; | ||||
| bool select_edge = pd->edit_mesh.select_edge = (tsettings->selectmode & SCE_SELECT_EDGE) != 0; | bool select_edge = pd->edit_mesh.select_edge = (tsettings->selectmode & SCE_SELECT_EDGE) != 0; | ||||
| bool do_occlude_wire = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_OCCLUDE_WIRE) != 0; | |||||
| bool show_face_dots = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACE_DOT) != 0 || | bool show_face_dots = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_FACE_DOT) != 0 || | ||||
jbakker: rename to do_retopology | |||||
| pd->edit_mesh.do_zbufclip; | pd->edit_mesh.do_zbufclip; | ||||
| pd->edit_mesh.ghost_ob = 0; | pd->edit_mesh.ghost_ob = 0; | ||||
| pd->edit_mesh.edit_ob = 0; | pd->edit_mesh.edit_ob = 0; | ||||
| pd->edit_mesh.do_faces = true; | pd->edit_mesh.do_faces = true; | ||||
| pd->edit_mesh.do_edges = true; | pd->edit_mesh.do_edges = true; | ||||
| int *mask = shdata->data_mask; | int *mask = shdata->data_mask; | ||||
| Show All 21 Lines | if ((tsettings->selectmode & SCE_SELECT_EDGE) == 0) { | ||||
| } | } | ||||
| else { | else { | ||||
| pd->edit_mesh.do_edges = false; | pd->edit_mesh.do_edges = false; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| float backwire_opacity = (pd->edit_mesh.do_zbufclip) ? v3d->overlay.backwire_opacity : 1.0f; | float backwire_opacity = (pd->edit_mesh.do_zbufclip) ? v3d->overlay.backwire_opacity : 1.0f; | ||||
| float face_alpha = (do_occlude_wire || !pd->edit_mesh.do_faces) ? 0.0f : 1.0f; | float face_alpha = (!pd->edit_mesh.do_faces) ? 0.0f : 1.0f; | ||||
| GPUTexture **depth_tex = (pd->edit_mesh.do_zbufclip) ? &dtxl->depth : &txl->dummy_depth_tx; | GPUTexture **depth_tex = (pd->edit_mesh.do_zbufclip) ? &dtxl->depth : &txl->dummy_depth_tx; | ||||
| if (select_face && !pd->edit_mesh.do_faces && pd->edit_mesh.do_edges) { | if (select_face && !pd->edit_mesh.do_faces && pd->edit_mesh.do_edges) { | ||||
| /* Force display of face centers in this case because that's | /* Force display of face centers in this case because that's | ||||
| * the only way to see if a face is selected. */ | * the only way to see if a face is selected. */ | ||||
| show_face_dots = true; | show_face_dots = true; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 155 Lines • ▼ Show 20 Lines | static void overlay_edit_mesh_add_ob_to_pass(OVERLAY_PrivateData *pd, Object *ob, bool in_front) | ||||
| } | } | ||||
| } | } | ||||
| void OVERLAY_edit_mesh_cache_populate(OVERLAY_Data *vedata, Object *ob) | void OVERLAY_edit_mesh_cache_populate(OVERLAY_Data *vedata, Object *ob) | ||||
| { | { | ||||
| OVERLAY_PrivateData *pd = vedata->stl->pd; | OVERLAY_PrivateData *pd = vedata->stl->pd; | ||||
| struct GPUBatch *geom = NULL; | struct GPUBatch *geom = NULL; | ||||
| bool do_in_front = (ob->dtx & OB_DRAWXRAY) != 0; | bool do_in_front = (ob->dtx & OB_DRAWXRAY) != 0; | ||||
| bool do_occlude_wire = (pd->edit_mesh.flag & V3D_OVERLAY_EDIT_OCCLUDE_WIRE) != 0; | |||||
| bool do_show_weight = (pd->edit_mesh.flag & V3D_OVERLAY_EDIT_WEIGHT) != 0; | bool do_show_weight = (pd->edit_mesh.flag & V3D_OVERLAY_EDIT_WEIGHT) != 0; | ||||
Done Inline ActionsTest if this is still needed. If not needed we should remove this line and its uses. jbakker: Test if this is still needed. If not needed we should remove this line and its uses. | |||||
| bool do_show_mesh_analysis = (pd->edit_mesh.flag & V3D_OVERLAY_EDIT_STATVIS) != 0; | bool do_show_mesh_analysis = (pd->edit_mesh.flag & V3D_OVERLAY_EDIT_STATVIS) != 0; | ||||
| bool fnormals_do = (pd->edit_mesh.flag & V3D_OVERLAY_EDIT_FACE_NORMALS) != 0; | bool fnormals_do = (pd->edit_mesh.flag & V3D_OVERLAY_EDIT_FACE_NORMALS) != 0; | ||||
| bool vnormals_do = (pd->edit_mesh.flag & V3D_OVERLAY_EDIT_VERT_NORMALS) != 0; | bool vnormals_do = (pd->edit_mesh.flag & V3D_OVERLAY_EDIT_VERT_NORMALS) != 0; | ||||
| bool lnormals_do = (pd->edit_mesh.flag & V3D_OVERLAY_EDIT_LOOP_NORMALS) != 0; | bool lnormals_do = (pd->edit_mesh.flag & V3D_OVERLAY_EDIT_LOOP_NORMALS) != 0; | ||||
| if (do_show_weight) { | if (do_show_weight) { | ||||
| geom = DRW_cache_mesh_surface_weights_get(ob); | geom = DRW_cache_mesh_surface_weights_get(ob); | ||||
| DRW_shgroup_call_no_cull(pd->edit_mesh_weight_grp, geom, ob); | DRW_shgroup_call_no_cull(pd->edit_mesh_weight_grp, geom, ob); | ||||
| } | } | ||||
| else if (do_show_mesh_analysis && !pd->xray_enabled) { | else if (do_show_mesh_analysis && !pd->xray_enabled) { | ||||
| geom = DRW_cache_mesh_surface_mesh_analysis_get(ob); | geom = DRW_cache_mesh_surface_mesh_analysis_get(ob); | ||||
| if (geom) { | if (geom) { | ||||
| DRW_shgroup_call_no_cull(pd->edit_mesh_analysis_grp, geom, ob); | DRW_shgroup_call_no_cull(pd->edit_mesh_analysis_grp, geom, ob); | ||||
| } | } | ||||
| } | } | ||||
| if (do_occlude_wire || do_in_front) { | if (do_in_front) { | ||||
| geom = DRW_cache_mesh_surface_get(ob); | geom = DRW_cache_mesh_surface_get(ob); | ||||
| DRW_shgroup_call_no_cull(pd->edit_mesh_depth_grp[do_in_front], geom, ob); | DRW_shgroup_call_no_cull(pd->edit_mesh_depth_grp[do_in_front], geom, ob); | ||||
| } | } | ||||
| if (vnormals_do || lnormals_do || fnormals_do) { | if (vnormals_do || lnormals_do || fnormals_do) { | ||||
| struct GPUBatch *normal_geom = DRW_cache_normal_arrow_get(); | struct GPUBatch *normal_geom = DRW_cache_normal_arrow_get(); | ||||
| if (vnormals_do) { | if (vnormals_do) { | ||||
| geom = DRW_mesh_batch_cache_get_edit_vnors(ob->data); | geom = DRW_mesh_batch_cache_get_edit_vnors(ob->data); | ||||
| ▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | if (pd->edit_mesh.do_zbufclip) { | ||||
| DRW_view_set_active(pd->view_edit_edges); | DRW_view_set_active(pd->view_edit_edges); | ||||
| DRW_draw_pass(psl->edit_mesh_edges_ps[NOT_IN_FRONT]); | DRW_draw_pass(psl->edit_mesh_edges_ps[NOT_IN_FRONT]); | ||||
| DRW_view_set_active(pd->view_edit_verts); | DRW_view_set_active(pd->view_edit_verts); | ||||
| DRW_draw_pass(psl->edit_mesh_verts_ps[NOT_IN_FRONT]); | DRW_draw_pass(psl->edit_mesh_verts_ps[NOT_IN_FRONT]); | ||||
| } | } | ||||
| else { | else { | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | |||||
| View3D *v3d = draw_ctx->v3d; | |||||
| DRW_draw_pass(psl->edit_mesh_normals_ps); | DRW_draw_pass(psl->edit_mesh_normals_ps); | ||||
| overlay_edit_mesh_draw_components(psl, pd, false); | overlay_edit_mesh_draw_components(psl, pd, false); | ||||
| if (v3d->shading.type == OB_SOLID && pd->edit_mesh.ghost_ob == 1 && | |||||
| pd->edit_mesh.edit_ob == 1) { | |||||
| /* In the case of single ghost object edit (common case for retopology): | |||||
| * we clear the depth buffer so that only the depth of the retopo mesh | |||||
| * is occluding the edit cage. */ | |||||
| GPU_framebuffer_clear_depth(fbl->overlay_default_fb, 1.0f); | |||||
| } | |||||
| if (!DRW_pass_is_empty(psl->edit_mesh_depth_ps[IN_FRONT])) { | |||||
| DRW_view_set_active(NULL); | |||||
| DRW_draw_pass(psl->edit_mesh_depth_ps[IN_FRONT]); | DRW_draw_pass(psl->edit_mesh_depth_ps[IN_FRONT]); | ||||
| } | |||||
| overlay_edit_mesh_draw_components(psl, pd, true); | overlay_edit_mesh_draw_components(psl, pd, true); | ||||
| } | } | ||||
| } | } | ||||
rename to do_retopology