diff options
Diffstat (limited to 'source/blender/draw')
3 files changed, 18 insertions, 20 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c index e5872dbac50..da5ab0c3122 100644 --- a/source/blender/draw/engines/workbench/workbench_deferred.c +++ b/source/blender/draw/engines/workbench/workbench_deferred.c @@ -567,16 +567,15 @@ void workbench_deferred_engine_init(WORKBENCH_Data *vedata) /* Prepass */ { DRWShadingGroup *grp; - const bool do_cull = CULL_BACKFACE_ENABLED(wpd); + DRWState clip_state = WORLD_CLIPPING_ENABLED(wpd) ? DRW_STATE_CLIP_PLANES : 0; + DRWState cull_state = CULL_BACKFACE_ENABLED(wpd) ? DRW_STATE_CULL_BACK : 0; + DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL; - int state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL; - psl->prepass_pass = DRW_pass_create("Prepass", - (do_cull) ? state | DRW_STATE_CULL_BACK : state); - psl->prepass_hair_pass = DRW_pass_create("Prepass", state); + psl->prepass_pass = DRW_pass_create("Prepass", state | cull_state | clip_state); + psl->prepass_hair_pass = DRW_pass_create("Prepass", state | clip_state); - psl->ghost_prepass_pass = DRW_pass_create("Prepass Ghost", - (do_cull) ? state | DRW_STATE_CULL_BACK : state); - psl->ghost_prepass_hair_pass = DRW_pass_create("Prepass Ghost", state); + psl->ghost_prepass_pass = DRW_pass_create("Prepass Ghost", state | cull_state | clip_state); + psl->ghost_prepass_hair_pass = DRW_pass_create("Prepass Ghost", state | clip_state); psl->ghost_resolve_pass = DRW_pass_create("Resolve Ghost Depth", DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_ALWAYS); @@ -807,18 +806,19 @@ void workbench_deferred_cache_init(WORKBENCH_Data *vedata) * this in a clean way. */ if (OIT_ENABLED(wpd)) { - const bool do_cull = CULL_BACKFACE_ENABLED(wpd); - const int cull_state = (do_cull) ? DRW_STATE_CULL_BACK : 0; + DRWState clip_state = WORLD_CLIPPING_ENABLED(wpd) ? DRW_STATE_CLIP_PLANES : 0; + DRWState cull_state = CULL_BACKFACE_ENABLED(wpd) ? DRW_STATE_CULL_BACK : 0; /* Transparency Accum */ { /* Same as forward but here we use depth test to * not bleed through other solid objects. */ - int state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_OIT | DRW_STATE_DEPTH_LESS | cull_state; + int state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS | DRW_STATE_BLEND_OIT | cull_state | + clip_state; psl->transparent_accum_pass = DRW_pass_create("Transparent Accum", state); } /* Depth */ { - int state = DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS | cull_state; + int state = DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS | cull_state | clip_state; psl->object_outline_pass = DRW_pass_create("Transparent Depth", state); } /* OIT Composite */ diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c index 80b274e9b76..87f3b28c665 100644 --- a/source/blender/draw/engines/workbench/workbench_forward.c +++ b/source/blender/draw/engines/workbench/workbench_forward.c @@ -387,17 +387,19 @@ void workbench_forward_engine_init(WORKBENCH_Data *vedata) }); workbench_volume_cache_init(vedata); - const bool do_cull = CULL_BACKFACE_ENABLED(wpd); - const int cull_state = (do_cull) ? DRW_STATE_CULL_BACK : 0; + + DRWState clip_state = WORLD_CLIPPING_ENABLED(wpd) ? DRW_STATE_CLIP_PLANES : 0; + DRWState cull_state = CULL_BACKFACE_ENABLED(wpd) ? DRW_STATE_CULL_BACK : 0; /* Transparency Accum */ { - int state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_OIT | cull_state; + int state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_OIT | cull_state | clip_state; psl->transparent_accum_pass = DRW_pass_create("Transparent Accum", state); } /* Depth */ { - int state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS | cull_state; + int state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS | cull_state | + clip_state; psl->object_outline_pass = DRW_pass_create("Object Outline Pass", state); } /* Composite */ diff --git a/source/blender/draw/engines/workbench/workbench_materials.c b/source/blender/draw/engines/workbench/workbench_materials.c index 45d49448490..37e2945a701 100644 --- a/source/blender/draw/engines/workbench/workbench_materials.c +++ b/source/blender/draw/engines/workbench/workbench_materials.c @@ -331,10 +331,6 @@ void workbench_material_shgroup_uniform(WORKBENCH_PrivateData *wpd, if (use_highlight) { DRW_shgroup_uniform_float(grp, "materialRoughness", &material->roughness, 1); } - - if (WORLD_CLIPPING_ENABLED(wpd)) { - DRW_shgroup_state_enable(grp, DRW_STATE_CLIP_PLANES); - } } void workbench_material_copy(WORKBENCH_MaterialData *dest_material, |