Changeset View
Changeset View
Standalone View
Standalone View
source/blender/draw/intern/draw_manager_data.c
| Show First 20 Lines • Show All 628 Lines • ▼ Show 20 Lines | void DRW_shgroup_call_generate_add(DRWShadingGroup *shgroup, | ||||
| call->generate.user_data = user_data; | call->generate.user_data = user_data; | ||||
| #ifdef USE_GPU_SELECT | #ifdef USE_GPU_SELECT | ||||
| call->select_id = DST.select_id; | call->select_id = DST.select_id; | ||||
| #endif | #endif | ||||
| BLI_LINKS_APPEND(&shgroup->calls, call); | BLI_LINKS_APPEND(&shgroup->calls, call); | ||||
| } | } | ||||
| /* This function tests if the current draw engine draws the vertex colors | |||||
| * It is used when drawing sculpts | |||||
| * | |||||
| * XXX: should we use a callback to a the draw engine to retrieve this | |||||
| * setting, this makes the draw manager more clean? */ | |||||
| static bool DRW_draw_vertex_color_active(const DRWContextState *draw_ctx) | |||||
| { | |||||
| View3D *v3d = draw_ctx->v3d; | |||||
| return v3d->shading.type == OB_SOLID && v3d->shading.color_type == V3D_SHADING_VERTEX_COLOR; | |||||
| } | |||||
| static void sculpt_draw_cb(DRWShadingGroup *shgroup, | static void sculpt_draw_cb(DRWShadingGroup *shgroup, | ||||
| void (*draw_fn)(DRWShadingGroup *shgroup, GPUBatch *geom), | void (*draw_fn)(DRWShadingGroup *shgroup, GPUBatch *geom), | ||||
| void *user_data) | void *user_data) | ||||
| { | { | ||||
| Object *ob = user_data; | Object *ob = user_data; | ||||
| /* XXX should be ensured before but sometime it's not... go figure (see T57040). */ | /* XXX should be ensured before but sometime it's not... go figure (see T57040). */ | ||||
| PBVH *pbvh = BKE_sculpt_object_pbvh_ensure(DST.draw_ctx.depsgraph, ob); | PBVH *pbvh = BKE_sculpt_object_pbvh_ensure(DST.draw_ctx.depsgraph, ob); | ||||
| const DRWContextState *drwctx = DRW_context_state_get(); | const DRWContextState *drwctx = DRW_context_state_get(); | ||||
| int fast_mode = 0; | int fast_mode = 0; | ||||
| if (drwctx->evil_C != NULL) { | if (drwctx->evil_C != NULL) { | ||||
| Paint *p = BKE_paint_get_active_from_context(drwctx->evil_C); | Paint *p = BKE_paint_get_active_from_context(drwctx->evil_C); | ||||
| if (p && (p->flags & PAINT_FAST_NAVIGATE)) { | if (p && (p->flags & PAINT_FAST_NAVIGATE)) { | ||||
| fast_mode = drwctx->rv3d->rflag & RV3D_NAVIGATING; | fast_mode = drwctx->rv3d->rflag & RV3D_NAVIGATING; | ||||
| } | } | ||||
| } | } | ||||
| if (pbvh) { | if (pbvh) { | ||||
| BKE_pbvh_draw_cb( | const bool show_vcol = DRW_draw_vertex_color_active(drwctx); | ||||
| pbvh, NULL, NULL, fast_mode, false, false, (void (*)(void *, GPUBatch *))draw_fn, shgroup); | BKE_pbvh_draw_cb(pbvh, | ||||
| NULL, | |||||
| NULL, | |||||
| fast_mode, | |||||
| false, | |||||
| false, | |||||
| show_vcol, | |||||
| (void (*)(void *, GPUBatch *))draw_fn, | |||||
| shgroup); | |||||
| } | } | ||||
| } | } | ||||
| static void sculpt_draw_wires_cb(DRWShadingGroup *shgroup, | static void sculpt_draw_wires_cb(DRWShadingGroup *shgroup, | ||||
| void (*draw_fn)(DRWShadingGroup *shgroup, GPUBatch *geom), | void (*draw_fn)(DRWShadingGroup *shgroup, GPUBatch *geom), | ||||
| void *user_data) | void *user_data) | ||||
| { | { | ||||
| Object *ob = user_data; | Object *ob = user_data; | ||||
| /* XXX should be ensured before but sometime it's not... go figure (see T57040). */ | /* XXX should be ensured before but sometime it's not... go figure (see T57040). */ | ||||
| PBVH *pbvh = BKE_sculpt_object_pbvh_ensure(DST.draw_ctx.depsgraph, ob); | PBVH *pbvh = BKE_sculpt_object_pbvh_ensure(DST.draw_ctx.depsgraph, ob); | ||||
| const DRWContextState *drwctx = DRW_context_state_get(); | const DRWContextState *drwctx = DRW_context_state_get(); | ||||
| int fast_mode = 0; | int fast_mode = 0; | ||||
| if (drwctx->evil_C != NULL) { | if (drwctx->evil_C != NULL) { | ||||
| Paint *p = BKE_paint_get_active_from_context(drwctx->evil_C); | Paint *p = BKE_paint_get_active_from_context(drwctx->evil_C); | ||||
| if (p && (p->flags & PAINT_FAST_NAVIGATE)) { | if (p && (p->flags & PAINT_FAST_NAVIGATE)) { | ||||
| fast_mode = drwctx->rv3d->rflag & RV3D_NAVIGATING; | fast_mode = drwctx->rv3d->rflag & RV3D_NAVIGATING; | ||||
| } | } | ||||
| } | } | ||||
| if (pbvh) { | if (pbvh) { | ||||
| BKE_pbvh_draw_cb( | BKE_pbvh_draw_cb(pbvh, | ||||
| pbvh, NULL, NULL, fast_mode, true, false, (void (*)(void *, GPUBatch *))draw_fn, shgroup); | NULL, | ||||
| NULL, | |||||
| fast_mode, | |||||
| true, | |||||
| false, | |||||
| false, | |||||
| (void (*)(void *, GPUBatch *))draw_fn, | |||||
| shgroup); | |||||
| } | } | ||||
| } | } | ||||
| void DRW_shgroup_call_sculpt_add(DRWShadingGroup *shgroup, Object *ob, float (*obmat)[4]) | void DRW_shgroup_call_sculpt_add(DRWShadingGroup *shgroup, Object *ob, float (*obmat)[4]) | ||||
| { | { | ||||
| DRW_shgroup_call_generate_add(shgroup, sculpt_draw_cb, ob, obmat); | DRW_shgroup_call_generate_add(shgroup, sculpt_draw_cb, ob, obmat); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 670 Lines • Show Last 20 Lines | |||||