Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/modes/overlay_mode.c
| Show First 20 Lines • Show All 207 Lines • ▼ Show 20 Lines | static void overlay_cache_init(void *vedata) | ||||
| } | } | ||||
| { | { | ||||
| /* Face Orientation Pass */ | /* Face Orientation Pass */ | ||||
| DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_BLEND_ALPHA; | DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_BLEND_ALPHA; | ||||
| psl->face_orientation_pass = DRW_pass_create("Face Orientation", state); | psl->face_orientation_pass = DRW_pass_create("Face Orientation", state); | ||||
| g_data->face_orientation_shgrp = DRW_shgroup_create(sh_data->face_orientation, | g_data->face_orientation_shgrp = DRW_shgroup_create(sh_data->face_orientation, | ||||
| psl->face_orientation_pass); | psl->face_orientation_pass); | ||||
| if (rv3d->rflag & RV3D_CLIPPING) { | if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) { | ||||
| DRW_shgroup_state_enable(g_data->face_orientation_shgrp, DRW_STATE_CLIP_PLANES); | DRW_shgroup_state_enable(g_data->face_orientation_shgrp, DRW_STATE_CLIP_PLANES); | ||||
| } | } | ||||
| } | } | ||||
| { | { | ||||
| /* Wireframe */ | /* Wireframe */ | ||||
| const bool use_select = (DRW_state_is_select() || DRW_state_is_depth()); | const bool use_select = (DRW_state_is_select() || DRW_state_is_depth()); | ||||
| GPUShader *face_wires_sh = use_select ? sh_data->select_wireframe : sh_data->face_wireframe; | GPUShader *face_wires_sh = use_select ? sh_data->select_wireframe : sh_data->face_wireframe; | ||||
| ▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Lines | |||||
| static void overlay_cache_populate(void *vedata, Object *ob) | static void overlay_cache_populate(void *vedata, Object *ob) | ||||
| { | { | ||||
| OVERLAY_Data *data = vedata; | OVERLAY_Data *data = vedata; | ||||
| OVERLAY_StorageList *stl = data->stl; | OVERLAY_StorageList *stl = data->stl; | ||||
| OVERLAY_PrivateData *pd = stl->g_data; | OVERLAY_PrivateData *pd = stl->g_data; | ||||
| const DRWContextState *draw_ctx = DRW_context_state_get(); | const DRWContextState *draw_ctx = DRW_context_state_get(); | ||||
| View3D *v3d = draw_ctx->v3d; | View3D *v3d = draw_ctx->v3d; | ||||
| RegionView3D *rv3d = draw_ctx->rv3d; | |||||
| if ((ob->dt < OB_WIRE) || (!DRW_object_is_renderable(ob) && (ob->dt != OB_WIRE))) { | if ((ob->dt < OB_WIRE) || (!DRW_object_is_renderable(ob) && (ob->dt != OB_WIRE))) { | ||||
| return; | return; | ||||
| } | } | ||||
| if (DRW_object_is_renderable(ob) && pd->overlay.flag & V3D_OVERLAY_FACE_ORIENTATION) { | if (DRW_object_is_renderable(ob) && pd->overlay.flag & V3D_OVERLAY_FACE_ORIENTATION) { | ||||
| struct GPUBatch *geom = DRW_cache_object_surface_get(ob); | struct GPUBatch *geom = DRW_cache_object_surface_get(ob); | ||||
| if (geom) { | if (geom) { | ||||
| ▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | if ((!pd->show_overlays) || | ||||
| if (geom || use_sculpt_pbvh) { | if (geom || use_sculpt_pbvh) { | ||||
| if (is_wire && is_xray) { | if (is_wire && is_xray) { | ||||
| shgrp = DRW_shgroup_create_sub(pd->face_wires_xray_shgrp); | shgrp = DRW_shgroup_create_sub(pd->face_wires_xray_shgrp); | ||||
| } | } | ||||
| else { | else { | ||||
| shgrp = DRW_shgroup_create_sub(pd->face_wires_shgrp); | shgrp = DRW_shgroup_create_sub(pd->face_wires_shgrp); | ||||
| } | } | ||||
| if (draw_ctx->rv3d->rflag & RV3D_CLIPPING) { | if (RV3D_CLIPPING_ENABLED(v3d, rv3d)) { | ||||
| DRW_shgroup_state_enable(shgrp, DRW_STATE_CLIP_PLANES); | DRW_shgroup_state_enable(shgrp, DRW_STATE_CLIP_PLANES); | ||||
| } | } | ||||
| float wire_step_param = 10.0f; | float wire_step_param = 10.0f; | ||||
| if (!use_sculpt_pbvh) { | if (!use_sculpt_pbvh) { | ||||
| wire_step_param = (all_wires) ? 1.0f : pd->wire_step_param; | wire_step_param = (all_wires) ? 1.0f : pd->wire_step_param; | ||||
| } | } | ||||
| DRW_shgroup_uniform_float_copy(shgrp, "wireStepParam", wire_step_param); | DRW_shgroup_uniform_float_copy(shgrp, "wireStepParam", wire_step_param); | ||||
| ▲ Show 20 Lines • Show All 113 Lines • Show Last 20 Lines | |||||