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:
authorJeroen Bakker <j.bakker@atmind.nl>2019-04-16 15:00:16 +0300
committerJeroen Bakker <j.bakker@atmind.nl>2019-04-23 13:05:33 +0300
commitee701baff8caf6d184fa245e170c1e67981e2608 (patch)
tree0e84a0829141682cedfdf9770e755a3e9f833282 /source/blender/draw/intern
parentc9ed39925a51fc421a734027c2ef386157392f3b (diff)
Workbench: Support Active Vertex Color
Currently it is not possible to view the vertex colors of an object. To optimize the workflow, workbench will need to support Vertex Colors. The Vertex Colors is a new option in `shading->color_type`. When objects do not have vertex color, the objects will be rendered with the `V3D_SHADING_OBJECT_COLOR`. In order to support vertex colors in workbench the current texture/solid shading structure is migrated to a primary shaders and fallback shaders. Fix: T57000 Reviewers: brecht, fclem Differential Revision: https://developer.blender.org/D4694
Diffstat (limited to 'source/blender/draw/intern')
-rw-r--r--source/blender/draw/intern/draw_manager_data.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c
index 4a9f4fe910b..77f84976165 100644
--- a/source/blender/draw/intern/draw_manager_data.c
+++ b/source/blender/draw/intern/draw_manager_data.c
@@ -634,6 +634,17 @@ void DRW_shgroup_call_generate_add(DRWShadingGroup *shgroup,
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,
void (*draw_fn)(DRWShadingGroup *shgroup, GPUBatch *geom),
void *user_data)
@@ -654,8 +665,16 @@ static void sculpt_draw_cb(DRWShadingGroup *shgroup,
}
if (pbvh) {
- BKE_pbvh_draw_cb(
- pbvh, NULL, NULL, fast_mode, false, false, (void (*)(void *, GPUBatch *))draw_fn, shgroup);
+ const bool show_vcol = DRW_draw_vertex_color_active(drwctx);
+ BKE_pbvh_draw_cb(pbvh,
+ NULL,
+ NULL,
+ fast_mode,
+ false,
+ false,
+ show_vcol,
+ (void (*)(void *, GPUBatch *))draw_fn,
+ shgroup);
}
}
@@ -679,8 +698,15 @@ static void sculpt_draw_wires_cb(DRWShadingGroup *shgroup,
}
if (pbvh) {
- BKE_pbvh_draw_cb(
- pbvh, NULL, NULL, fast_mode, true, false, (void (*)(void *, GPUBatch *))draw_fn, shgroup);
+ BKE_pbvh_draw_cb(pbvh,
+ NULL,
+ NULL,
+ fast_mode,
+ true,
+ false,
+ false,
+ (void (*)(void *, GPUBatch *))draw_fn,
+ shgroup);
}
}