[Bf-blender-cvs] [dc686e1d820] greasepencil-object: Simplify use of VFX shading groups
Antonio Vazquez
noreply at git.blender.org
Sun Dec 10 10:20:37 CET 2017
Commit: dc686e1d8209c1928a4dde50bcef8e5420dbee77
Author: Antonio Vazquez
Date: Sun Dec 10 10:16:51 2017 +0100
Branches: greasepencil-object
https://developer.blender.org/rBdc686e1d8209c1928a4dde50bcef8e5420dbee77
Simplify use of VFX shading groups
The drawing functions was using an additional shading group pointer that it was not used, so it can be removed.
===================================================================
M source/blender/draw/engines/gpencil/gpencil_engine.c
M source/blender/draw/engines/gpencil/gpencil_engine.h
M source/blender/draw/engines/gpencil/gpencil_vfx.c
===================================================================
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index ff233c8e2b9..df34beeed64 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -524,14 +524,14 @@ static int gpencil_object_cache_compare_zdepth(const void *a1, const void *a2)
/* helper to draw VFX pass */
static void gpencil_draw_vfx_pass(DRWPass *vfxpass, DRWPass *copypass,
- GPENCIL_FramebufferList *fbl, DRWShadingGroup *init, DRWShadingGroup *end)
+ GPENCIL_FramebufferList *fbl, DRWShadingGroup *shgrp)
{
float clearcol[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
DRW_framebuffer_bind(fbl->vfx_color_fb_b);
DRW_framebuffer_clear(true, true, false, clearcol, 1.0f);
/* flip pass */
- DRW_draw_pass_subset(vfxpass, init, end);
+ DRW_draw_pass_subset(vfxpass, shgrp, shgrp);
/* copy pass from b to a */
DRW_framebuffer_bind(fbl->vfx_color_fb_a);
DRW_framebuffer_clear(true, true, false, clearcol, 1.0f);
@@ -563,61 +563,61 @@ static void gpencil_vfx_passes(void *vedata, tGPencilObjectCache *cache)
* Wave pass is always evaluated first.
*/
DRW_draw_pass_subset(psl->vfx_wave_pass,
- cache->init_vfx_wave_sh,
- cache->end_vfx_wave_sh);
+ cache->vfx_wave_sh,
+ cache->vfx_wave_sh);
/* --------------
* Blur passes (use several passes to get better quality)
* --------------*/
- if ((cache->init_vfx_blur_sh_1) && (cache->init_vfx_blur_sh_1)) {
+ if (cache->vfx_blur_sh_1) {
DRW_framebuffer_bind(fbl->vfx_color_fb_b);
DRW_framebuffer_clear(true, true, false, clearcol, 1.0f);
/* pass 1 */
DRW_draw_pass_subset(psl->vfx_blur_pass_1,
- cache->init_vfx_blur_sh_1,
- cache->end_vfx_blur_sh_1);
+ cache->vfx_blur_sh_1,
+ cache->vfx_blur_sh_1);
/* pass 2 */
DRW_framebuffer_bind(fbl->vfx_color_fb_a);
DRW_draw_pass_subset(psl->vfx_blur_pass_2,
- cache->init_vfx_blur_sh_2,
- cache->end_vfx_blur_sh_2);
+ cache->vfx_blur_sh_2,
+ cache->vfx_blur_sh_2);
/* pass 3 */
DRW_framebuffer_bind(fbl->vfx_color_fb_b);
DRW_draw_pass_subset(psl->vfx_blur_pass_3,
- cache->init_vfx_blur_sh_3,
- cache->end_vfx_blur_sh_3);
+ cache->vfx_blur_sh_3,
+ cache->vfx_blur_sh_3);
/* pass 4 */
DRW_framebuffer_bind(fbl->vfx_color_fb_a);
DRW_draw_pass_subset(psl->vfx_blur_pass_4,
- cache->init_vfx_blur_sh_4,
- cache->end_vfx_blur_sh_4);
+ cache->vfx_blur_sh_4,
+ cache->vfx_blur_sh_4);
}
/* --------------
* Pixelate pass
* --------------*/
- if ((cache->init_vfx_pixel_sh) && (cache->end_vfx_pixel_sh)) {
+ if (cache->vfx_pixel_sh) {
gpencil_draw_vfx_pass(psl->vfx_pixel_pass, psl->vfx_copy_pass,
- fbl, cache->init_vfx_pixel_sh, cache->end_vfx_pixel_sh);
+ fbl, cache->vfx_pixel_sh);
}
/* --------------
* Swirl pass
* --------------*/
- if ((cache->init_vfx_swirl_sh) && (cache->end_vfx_swirl_sh)) {
+ if (cache->vfx_swirl_sh) {
gpencil_draw_vfx_pass(psl->vfx_swirl_pass, psl->vfx_copy_pass,
- fbl, cache->init_vfx_swirl_sh, cache->end_vfx_swirl_sh);
+ fbl, cache->vfx_swirl_sh);
}
/* --------------
* Flip pass
* --------------*/
- if ((cache->init_vfx_flip_sh) && (cache->end_vfx_flip_sh)) {
+ if (cache->vfx_flip_sh) {
gpencil_draw_vfx_pass(psl->vfx_flip_pass, psl->vfx_copy_pass,
- fbl, cache->init_vfx_flip_sh, cache->end_vfx_flip_sh);
+ fbl, cache->vfx_flip_sh);
}
/* --------------
* Light pass
* --------------*/
- if ((cache->init_vfx_light_sh) && (cache->end_vfx_light_sh)) {
+ if (cache->vfx_light_sh) {
gpencil_draw_vfx_pass(psl->vfx_light_pass, psl->vfx_copy_pass,
- fbl, cache->init_vfx_light_sh, cache->end_vfx_light_sh);
+ fbl, cache->vfx_light_sh);
}
}
@@ -770,7 +770,7 @@ static void GPENCIL_draw_scene(void *vedata)
/* vfx modifiers passes
* if any vfx modifier exist, the init_vfx_wave_sh will be not NULL.
*/
- if ((cache->init_vfx_wave_sh) && (cache->end_vfx_wave_sh) && (!GP_SIMPLIFY_VFX(ts, playing))) {
+ if ((cache->vfx_wave_sh) && (!GP_SIMPLIFY_VFX(ts, playing))) {
/* add vfx and combine result with default framebuffer */
gpencil_vfx_passes(vedata, cache);
/* Combine with default scene buffer always using tx_a as source texture */
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index 740a81bac6a..2d0bb090e95 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -112,29 +112,20 @@ typedef struct GPencilVFXLight {
typedef struct tGPencilObjectCache {
struct Object *ob;
int init_grp, end_grp;
- DRWShadingGroup *init_vfx_wave_sh;
- DRWShadingGroup *end_vfx_wave_sh;
+ DRWShadingGroup *vfx_wave_sh;
- DRWShadingGroup *init_vfx_blur_sh_1;
- DRWShadingGroup *end_vfx_blur_sh_1;
- DRWShadingGroup *init_vfx_blur_sh_2;
- DRWShadingGroup *end_vfx_blur_sh_2;
- DRWShadingGroup *init_vfx_blur_sh_3;
- DRWShadingGroup *end_vfx_blur_sh_3;
- DRWShadingGroup *init_vfx_blur_sh_4;
- DRWShadingGroup *end_vfx_blur_sh_4;
+ DRWShadingGroup *vfx_blur_sh_1;
+ DRWShadingGroup *vfx_blur_sh_2;
+ DRWShadingGroup *vfx_blur_sh_3;
+ DRWShadingGroup *vfx_blur_sh_4;
- DRWShadingGroup *init_vfx_pixel_sh;
- DRWShadingGroup *end_vfx_pixel_sh;
+ DRWShadingGroup *vfx_pixel_sh;
- DRWShadingGroup *init_vfx_swirl_sh;
- DRWShadingGroup *end_vfx_swirl_sh;
+ DRWShadingGroup *vfx_swirl_sh;
- DRWShadingGroup *init_vfx_flip_sh;
- DRWShadingGroup *end_vfx_flip_sh;
+ DRWShadingGroup *vfx_flip_sh;
- DRWShadingGroup *init_vfx_light_sh;
- DRWShadingGroup *end_vfx_light_sh;
+ DRWShadingGroup *vfx_light_sh;
float zdepth;
} tGPencilObjectCache;
diff --git a/source/blender/draw/engines/gpencil/gpencil_vfx.c b/source/blender/draw/engines/gpencil/gpencil_vfx.c
index 35f60aa47f7..ad275397198 100644
--- a/source/blender/draw/engines/gpencil/gpencil_vfx.c
+++ b/source/blender/draw/engines/gpencil/gpencil_vfx.c
@@ -106,13 +106,7 @@ static void DRW_gpencil_vfx_copy(
DRW_shgroup_uniform_buffer(vfx_shgrp, "strokeColor", &e_data->temp_fbcolor_color_tx);
DRW_shgroup_uniform_buffer(vfx_shgrp, "strokeDepth", &e_data->temp_fbcolor_depth_tx);
- /* set first effect sh */
- if (cache->init_vfx_wave_sh == NULL) {
- cache->init_vfx_wave_sh = vfx_shgrp;
- }
-
- /* set last effect sh */
- cache->end_vfx_wave_sh = vfx_shgrp;
+ cache->vfx_wave_sh = vfx_shgrp;
}
/* Wave Distorsion VFX */
@@ -147,13 +141,7 @@ static void DRW_gpencil_vfx_wave(
DRW_shgroup_uniform_int(vfx_shgrp, "orientation", &stl->vfx[ob_idx].vfx_wave.orientation, 1);
DRW_shgroup_uniform_vec2(vfx_shgrp, "wsize", DRW_viewport_size_get(), 1);
- /* set first effect sh */
- if (cache->init_vfx_wave_sh == NULL) {
- cache->init_vfx_wave_sh = vfx_shgrp;
- }
-
- /* set last effect sh */
- cache->end_vfx_wave_sh = vfx_shgrp;
+ cache->vfx_wave_sh = vfx_shgrp;
}
/* Gaussian Blur VFX
@@ -186,14 +174,7 @@ static void DRW_gpencil_vfx_blur(
DRW_shgroup_uniform_buffer(vfx_shgrp, "strokeDepth", &e_data->vfx_fbcolor_depth_tx_a);
DRW_shgroup_uniform_float(vfx_shgrp, "blurx", &stl->vfx[ob_idx].vfx_blur.x, 1);
DRW_shgroup_uniform_float(vfx_shgrp, "blury", &stl->vfx[ob_idx].vfx_blur.y, 1);
-
- /* set first effect sh */
- if (cache->init_vfx_blur_sh_1 == NULL) {
- cache->init_vfx_blur_sh_1 = vfx_shgrp;
- }
-
- /* set last effect sh */
- cache->end_vfx_blur_sh_1 = vfx_shgrp;
+ cache->vfx_blur_sh_1 = vfx_shgrp;
/* === Pass 2 === */
vfx_shgrp = DRW_shgroup_create(e_data->gpencil_vfx_blur_sh, psl->vfx_blur_pass_2);
@@ -203,14 +184,7 @@ static void DRW_gpencil_vfx_blur(
DRW_shgroup_uniform_buffer(vfx_shgrp, "strokeDepth", &e_data->vfx_fbcolor_depth_tx_b);
DRW_shgroup_uniform_float(vfx_shgrp, "blurx", &stl->vfx[ob_idx].vfx_blur.x, 1);
DRW_shgroup_uniform_float(vfx_shgrp, "blury", &stl->vfx[ob_idx].vfx_blur.y, 1);
-
- /* set first effect sh */
- if (cache->init_vfx_blur_sh_2 == NULL) {
- cache->init_vfx_blur_sh_2 = vfx_shgrp;
- }
-
- /* set last effect sh */
- cache->end_vfx_blur_sh_2 = vfx_shgrp;
+ cache->vfx_blur_sh_2 = vfx_shgrp;
/* === Pass 3 === */
vfx_shgrp = DRW_shgroup_create(e_data->gpencil_vfx_blur_sh, psl->vfx_blur_pass_3);
@@ -220,14 +194,7 @@ static void DRW_gpencil_vfx_blur(
DRW_shgroup_uniform_buffer(vfx_shgrp, "strokeDepth", &e_data->vfx_fbcolor_depth_tx_a);
DRW_shgroup_uniform_float(vfx_shgrp, "blurx", &stl->vfx[ob_idx].vfx_blur.x, 1);
DRW_shgroup_uniform_float(vfx_shgrp, "blury", &stl->vfx[ob_idx].vfx_blur.y, 1);
-
- /* set first effect sh */
- if (cache->init_vfx_blur_sh_3 == NULL) {
- cache->init_vfx_blur_sh_3 = vfx_shgrp;
- }
-
- /* set last effect sh */
- cache->end_vfx_blur_sh_3 = vfx_shgrp;
+ cache->vfx_blur_sh_3 = vfx_shgrp;
/* === Pass 4 === */
vfx_shgrp = DRW_shgroup_create(e_data->gpencil_vfx_blur_sh, psl->vfx_blur_pass_4);
@@ -237,14 +204,7 @@ static void DRW_gpencil_vfx_blur(
DRW_shgroup_uniform_buffer(vfx_shgrp, "strokeDepth", &e_data->vfx_fbcolor_depth_tx_b);
DRW_shgroup_uniform_float(vfx_shgrp, "blurx", &stl->vfx[ob_idx].vfx_blur.x, 1);
DRW_shgroup_uniform_float(vfx_shgrp, "blury", &stl->vfx[ob_idx].vfx_blur.y, 1);
-
- /* set first effect sh */
- if (cache->init_vfx_blur_sh_4 == NULL) {
- cache->init_vfx_blur_sh_4 = vfx_shgrp;
- }
-
- /* set last effect sh */
- cache->end_vfx_blur_sh_4 = vfx_shgrp;
+ cache->vfx_blur_sh_4 = vfx_shgrp;
}
/* Pixelate VFX */
@@ -283,14 +243,8 @@ static void DRW_gpencil_vfx_pixel(
DRW_shgroup_uniform_float(vfx_shgrp, "pixsize", DRW_viewport_pixelsize_get(), 1);
DRW_shgroup_uniform_float(vfx_shgrp, "pixelsize", &U.pixelsize, 1);
DRW_shgroup_uniform_int(vfx_shgrp, "pixfactor", &gpd->pixfactor, 1);
-
- /* set first effect sh */
- if (cache->init_vfx_pixel_sh == NULL) {
- cache->init_vfx_pixel_sh = vfx_shgrp;
- }
-
- /* set last effect sh */
- cache->end_vfx_pixel_sh = vfx_shgrp;
+
+ cache->vfx_pixel_sh = vfx_shgrp;
}
/* Swirl VFX */
@@ -336,13 +290,7 @@ static void DRW_gpencil_vfx_swirl(
DRW_shgroup_uniform_float(vfx_shgrp, "pixelsize", &U.pixelsize, 1);
DRW_shgroup_uniform_int(vfx_shgrp, "pixfactor", &gpd->pixfactor, 1);
- /* set first effect sh */
- if (cache->init_vfx_swirl_sh == NULL) {
- cache->init_vfx_swirl_sh = vfx_shgrp;
- }
-
- /
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list