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:
authorClément Foucault <foucault.clem@gmail.com>2019-05-26 02:42:36 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-05-27 13:58:14 +0300
commitf3fc872171203e51109b6500bbaa969933997209 (patch)
tree158a8fe5565428686f0629ef2d77853d1edcea2a /source/blender/draw/modes/paint_texture_mode.c
parent01f5ef82afddcdb078644ce6b63ce370784b2a84 (diff)
Cleanup: Paint Overlays: Remove DRW_STATE_OFFSET_*
Diffstat (limited to 'source/blender/draw/modes/paint_texture_mode.c')
-rw-r--r--source/blender/draw/modes/paint_texture_mode.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/source/blender/draw/modes/paint_texture_mode.c b/source/blender/draw/modes/paint_texture_mode.c
index ee8ec78e91b..7c87a6d402c 100644
--- a/source/blender/draw/modes/paint_texture_mode.c
+++ b/source/blender/draw/modes/paint_texture_mode.c
@@ -128,14 +128,17 @@ typedef struct PAINT_TEXTURE_PrivateData {
/* face-mask */
DRWShadingGroup *lwire_select_shgrp;
DRWShadingGroup *face_select_shgrp;
+
+ DRWView *view_wires;
} PAINT_TEXTURE_PrivateData; /* Transient data */
/* *********** FUNCTIONS *********** */
/* Init Textures, Framebuffers, Storage and Shaders.
* It is called for every frames. */
-static void PAINT_TEXTURE_engine_init(void *UNUSED(vedata))
+static void PAINT_TEXTURE_engine_init(void *vedata)
{
+ PAINT_TEXTURE_StorageList *stl = ((PAINT_TEXTURE_Data *)vedata)->stl;
const DRWContextState *draw_ctx = DRW_context_state_get();
PAINT_TEXTURE_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
@@ -185,6 +188,14 @@ static void PAINT_TEXTURE_engine_init(void *UNUSED(vedata))
.defs = (const char *[]){sh_cfg_data->def, NULL},
});
}
+
+ if (!stl->g_data) {
+ /* Alloc transient pointers */
+ stl->g_data = MEM_mallocN(sizeof(*stl->g_data), __func__);
+ stl->g_data->shgroup_image_array = NULL;
+ }
+
+ stl->g_data->view_wires = DRW_view_create_with_zoffset(draw_ctx->rv3d, 1.0f);
}
static DRWShadingGroup *create_texture_paint_shading_group(PAINT_TEXTURE_PassList *psl,
@@ -222,12 +233,6 @@ static void PAINT_TEXTURE_cache_init(void *vedata)
PAINT_TEXTURE_PassList *psl = ((PAINT_TEXTURE_Data *)vedata)->psl;
PAINT_TEXTURE_StorageList *stl = ((PAINT_TEXTURE_Data *)vedata)->stl;
- if (!stl->g_data) {
- /* Alloc transient pointers */
- stl->g_data = MEM_mallocN(sizeof(*stl->g_data), __func__);
- stl->g_data->shgroup_image_array = NULL;
- }
-
const DRWContextState *draw_ctx = DRW_context_state_get();
PAINT_TEXTURE_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
@@ -296,9 +301,8 @@ static void PAINT_TEXTURE_cache_init(void *vedata)
/* Face Mask */
{
- DRWPass *pass = DRW_pass_create("Wire Mask Pass",
- (DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH |
- DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_OFFSET_NEGATIVE));
+ DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL;
+ DRWPass *pass = DRW_pass_create("Wire Mask Pass", state);
DRWShadingGroup *shgrp = DRW_shgroup_create(sh_data->wire_select_overlay, pass);
DRW_shgroup_uniform_block(shgrp, "globalsBlock", G_draw.block_ubo);
@@ -311,10 +315,9 @@ static void PAINT_TEXTURE_cache_init(void *vedata)
}
{
-
- DRWPass *pass = DRW_pass_create("Face Mask Pass",
- DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH |
- DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND);
+ DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL |
+ DRW_STATE_BLEND;
+ DRWPass *pass = DRW_pass_create("Face Mask Pass", state);
DRWShadingGroup *shgrp = DRW_shgroup_create(sh_data->face_select_overlay, pass);
static float col[4] = {1.0f, 1.0f, 1.0f, 0.2f};
DRW_shgroup_uniform_vec4(shgrp, "color", col, 1);
@@ -405,6 +408,7 @@ static void PAINT_TEXTURE_draw_scene(void *vedata)
{
PAINT_TEXTURE_PassList *psl = ((PAINT_TEXTURE_Data *)vedata)->psl;
PAINT_TEXTURE_FramebufferList *fbl = ((PAINT_TEXTURE_Data *)vedata)->fbl;
+ PAINT_TEXTURE_StorageList *stl = ((PAINT_TEXTURE_Data *)vedata)->stl;
/* Default framebuffer and texture */
DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
@@ -415,7 +419,11 @@ static void PAINT_TEXTURE_draw_scene(void *vedata)
DRW_draw_pass(psl->image_faces);
DRW_draw_pass(psl->face_select_overlay);
+
+ DRW_view_set_active(stl->g_data->view_wires);
DRW_draw_pass(psl->wire_select_overlay);
+
+ DRW_view_set_active(NULL);
}
/* Cleanup when destroying the engine.