Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-02-10 03:06:22 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-02-10 03:16:31 +0300
commit0b6dbbc306b0a7e60abe36968d154241bb90c1df (patch)
treed22a40e3e73f80bc1150cffe1fde866f1f602865 /source/blender/draw/modes/edit_lattice_mode.c
parent16d7967c2b404cbe6719192e073c7685376f6ab1 (diff)
Cleanup: move clipping shader lib & define into struct
Also compare clipping with the draw context instead of accessing the RegionView3D, currently they're matching but this might not always be the case.
Diffstat (limited to 'source/blender/draw/modes/edit_lattice_mode.c')
-rw-r--r--source/blender/draw/modes/edit_lattice_mode.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/source/blender/draw/modes/edit_lattice_mode.c b/source/blender/draw/modes/edit_lattice_mode.c
index 97471ef39e1..7ac24ac8e77 100644
--- a/source/blender/draw/modes/edit_lattice_mode.c
+++ b/source/blender/draw/modes/edit_lattice_mode.c
@@ -29,7 +29,6 @@
#include "draw_common.h"
-extern char datatoc_gpu_shader_cfg_world_clip_lib_glsl[];
extern char datatoc_common_globals_lib_glsl[];
extern char datatoc_edit_lattice_overlay_loosevert_vert_glsl[];
@@ -137,12 +136,10 @@ static void EDIT_LATTICE_engine_init(void *vedata)
const DRWContextState *draw_ctx = DRW_context_state_get();
EDIT_LATTICE_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
- const bool is_clip = (draw_ctx->rv3d->rflag & RV3D_CLIPPING) != 0;
- if (is_clip) {
+ if (draw_ctx->sh_cfg == GPU_SHADER_CFG_CLIPPED) {
DRW_state_clip_planes_set_from_rv3d(draw_ctx->rv3d);
}
- const char *world_clip_lib_or_empty = is_clip ? datatoc_gpu_shader_cfg_world_clip_lib_glsl : "";
- const char *world_clip_def_or_empty = is_clip ? "#define USE_WORLD_CLIP_PLANES\n" : "";
+ const GPUShaderConfigData *sh_cfg_data = &GPU_shader_cfg_data[draw_ctx->sh_cfg];
if (!sh_data->wire) {
sh_data->wire = GPU_shader_get_builtin_shader_with_config(GPU_SHADER_3D_SMOOTH_COLOR, draw_ctx->sh_cfg);
@@ -151,7 +148,7 @@ static void EDIT_LATTICE_engine_init(void *vedata)
if (!sh_data->overlay_vert) {
sh_data->overlay_vert = GPU_shader_create_from_arrays({
.vert = (const char *[]){
- world_clip_lib_or_empty,
+ sh_cfg_data->lib,
datatoc_common_globals_lib_glsl,
datatoc_edit_lattice_overlay_loosevert_vert_glsl,
NULL},
@@ -159,7 +156,7 @@ static void EDIT_LATTICE_engine_init(void *vedata)
datatoc_common_globals_lib_glsl,
datatoc_edit_lattice_overlay_frag_glsl,
NULL},
- .defs = (const char *[]){world_clip_def_or_empty, NULL},
+ .defs = (const char *[]){sh_cfg_data->def, NULL},
});
}