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-01-23 05:21:49 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-01-23 05:34:55 +0300
commit14d947dcadea7c9debe6c8a078a571eba6cb828c (patch)
treebaed2bc9dd567ab509133cd72984b11fec919f2e /source/blender/draw/modes/paint_weight_mode.c
parentc403508e41c67367d1fdd725065951063d5ae7b2 (diff)
DRW: generalize selecting between regular/clipped shaders
Each engine was doing this on its own. Move to DRWContextState, use an enum.
Diffstat (limited to 'source/blender/draw/modes/paint_weight_mode.c')
-rw-r--r--source/blender/draw/modes/paint_weight_mode.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/source/blender/draw/modes/paint_weight_mode.c b/source/blender/draw/modes/paint_weight_mode.c
index 5d8b02d872d..7d4b3cac41b 100644
--- a/source/blender/draw/modes/paint_weight_mode.c
+++ b/source/blender/draw/modes/paint_weight_mode.c
@@ -86,7 +86,7 @@ typedef struct PAINT_WEIGHT_Shaders {
/* *********** STATIC *********** */
static struct {
- PAINT_WEIGHT_Shaders sh_data[2];
+ PAINT_WEIGHT_Shaders sh_data[DRW_SHADER_SLOT_LEN];
int actdef;
} e_data = {NULL}; /* Engine data */
@@ -100,18 +100,10 @@ typedef struct PAINT_WEIGHT_PrivateData {
/* *********** FUNCTIONS *********** */
-static int PAINT_WEIGHT_sh_data_index_from_rv3d(const RegionView3D *rv3d)
-{
- if (rv3d->rflag & RV3D_CLIPPING) {
- return 1;
- }
- return 0;
-}
-
static void PAINT_WEIGHT_engine_init(void *UNUSED(vedata))
{
const DRWContextState *draw_ctx = DRW_context_state_get();
- PAINT_WEIGHT_Shaders *sh_data = &e_data.sh_data[PAINT_WEIGHT_sh_data_index_from_rv3d(draw_ctx->rv3d)];
+ PAINT_WEIGHT_Shaders *sh_data = &e_data.sh_data[draw_ctx->shader_slot];
const bool is_clip = (draw_ctx->rv3d->rflag & RV3D_CLIPPING) != 0;
if (is_clip) {
@@ -151,7 +143,7 @@ static void PAINT_WEIGHT_cache_init(void *vedata)
const DRWContextState *draw_ctx = DRW_context_state_get();
const View3D *v3d = draw_ctx->v3d;
RegionView3D *rv3d = draw_ctx->rv3d;
- PAINT_WEIGHT_Shaders *sh_data = &e_data.sh_data[PAINT_WEIGHT_sh_data_index_from_rv3d(rv3d)];
+ PAINT_WEIGHT_Shaders *sh_data = &e_data.sh_data[draw_ctx->shader_slot];
if (!stl->g_data) {
/* Alloc transient pointers */