GPencil: Rename Overlay blend mode to Hard Light

Differential Revision: https://developer.blender.org/D7280
This commit is contained in:
2020-03-30 18:18:37 +02:00
parent 6428da84ed
commit 100896e080
4 changed files with 9 additions and 9 deletions

View File

@@ -314,12 +314,12 @@ GPENCIL_tLayer *gpencil_layer_cache_add(GPENCIL_PrivateData *pd,
break; break;
case eGplBlendMode_Multiply: case eGplBlendMode_Multiply:
case eGplBlendMode_Divide: case eGplBlendMode_Divide:
case eGplBlendMode_Overlay: case eGplBlendMode_HardLight:
state |= DRW_STATE_BLEND_MUL; state |= DRW_STATE_BLEND_MUL;
break; break;
} }
if (ELEM(gpl->blend_mode, eGplBlendMode_Subtract, eGplBlendMode_Overlay)) { if (ELEM(gpl->blend_mode, eGplBlendMode_Subtract, eGplBlendMode_HardLight)) {
/* For these effect to propagate, we need a signed floating point buffer. */ /* For these effect to propagate, we need a signed floating point buffer. */
pd->use_signed_fb = true; pd->use_signed_fb = true;
} }
@@ -336,7 +336,7 @@ GPENCIL_tLayer *gpencil_layer_cache_add(GPENCIL_PrivateData *pd,
DRW_shgroup_stencil_mask(grp, 0xFF); DRW_shgroup_stencil_mask(grp, 0xFF);
DRW_shgroup_call_procedural_triangles(grp, NULL, 1); DRW_shgroup_call_procedural_triangles(grp, NULL, 1);
if (gpl->blend_mode == eGplBlendMode_Overlay) { if (gpl->blend_mode == eGplBlendMode_HardLight) {
/* We cannot do custom blending on MultiTarget framebuffers. /* We cannot do custom blending on MultiTarget framebuffers.
* Workaround by doing 2 passes. */ * Workaround by doing 2 passes. */
grp = DRW_shgroup_create(sh, tgp_layer->blend_ps); grp = DRW_shgroup_create(sh, tgp_layer->blend_ps);

View File

@@ -77,12 +77,12 @@ layout(std140) uniform gpLightBlock
/* Must match eGPLayerBlendModes */ /* Must match eGPLayerBlendModes */
#define MODE_REGULAR 0 #define MODE_REGULAR 0
#define MODE_OVERLAY 1 #define MODE_HARDLIGHT 1
#define MODE_ADD 2 #define MODE_ADD 2
#define MODE_SUB 3 #define MODE_SUB 3
#define MODE_MULTIPLY 4 #define MODE_MULTIPLY 4
#define MODE_DIVIDE 5 #define MODE_DIVIDE 5
#define MODE_OVERLAY_SECOND_PASS 999 #define MODE_HARDLIGHT_SECOND_PASS 999
void blend_mode_output( void blend_mode_output(
int blend_mode, vec4 color, float opacity, out vec4 frag_color, out vec4 frag_revealage) int blend_mode, vec4 color, float opacity, out vec4 frag_color, out vec4 frag_revealage)
@@ -104,7 +104,7 @@ void blend_mode_output(
color.a *= opacity; color.a *= opacity;
frag_revealage = frag_color = clamp(1.0 / max(vec4(1e-6), 1.0 - color * color.a), 0.0, 1e18); frag_revealage = frag_color = clamp(1.0 / max(vec4(1e-6), 1.0 - color * color.a), 0.0, 1e18);
break; break;
case MODE_OVERLAY: case MODE_HARDLIGHT:
/* Reminder: Blending func is multiply blend (dst.rgba * src.rgba).*/ /* Reminder: Blending func is multiply blend (dst.rgba * src.rgba).*/
/** /**
* We need to separate the overlay equation into 2 term (one mul and one add). * We need to separate the overlay equation into 2 term (one mul and one add).
@@ -122,7 +122,7 @@ void blend_mode_output(
frag_revealage = frag_color = 2.0 * s + 2.0 * color * (1.0 - s * 2.0); frag_revealage = frag_color = 2.0 * s + 2.0 * color * (1.0 - s * 2.0);
frag_revealage = max(vec4(0.0), frag_revealage); frag_revealage = max(vec4(0.0), frag_revealage);
break; break;
case MODE_OVERLAY_SECOND_PASS: case MODE_HARDLIGHT_SECOND_PASS:
/* Reminder: Blending func is additive blend (dst.rgba + src.rgba).*/ /* Reminder: Blending func is additive blend (dst.rgba + src.rgba).*/
color = mix(vec4(0.5), color, color.a * opacity); color = mix(vec4(0.5), color, color.a * opacity);
frag_revealage = frag_color = (-1.0 + 2.0 * color) * step(-0.5, -color); frag_revealage = frag_color = (-1.0 + 2.0 * color) * step(-0.5, -color);

View File

@@ -468,7 +468,7 @@ typedef enum eGPDlayer_OnionFlag {
/* layer blend_mode */ /* layer blend_mode */
typedef enum eGPLayerBlendModes { typedef enum eGPLayerBlendModes {
eGplBlendMode_Regular = 0, eGplBlendMode_Regular = 0,
eGplBlendMode_Overlay = 1, eGplBlendMode_HardLight = 1,
eGplBlendMode_Add = 2, eGplBlendMode_Add = 2,
eGplBlendMode_Subtract = 3, eGplBlendMode_Subtract = 3,
eGplBlendMode_Multiply = 4, eGplBlendMode_Multiply = 4,

View File

@@ -114,7 +114,7 @@ static const EnumPropertyItem rna_enum_gplayer_move_type_items[] = {
static const EnumPropertyItem rna_enum_layer_blend_modes_items[] = { static const EnumPropertyItem rna_enum_layer_blend_modes_items[] = {
{eGplBlendMode_Regular, "REGULAR", 0, "Regular", ""}, {eGplBlendMode_Regular, "REGULAR", 0, "Regular", ""},
{eGplBlendMode_Overlay, "OVERLAY", 0, "Overlay", ""}, {eGplBlendMode_HardLight, "HARDLIGHT", 0, "Hard Light", ""},
{eGplBlendMode_Add, "ADD", 0, "Add", ""}, {eGplBlendMode_Add, "ADD", 0, "Add", ""},
{eGplBlendMode_Subtract, "SUBTRACT", 0, "Subtract", ""}, {eGplBlendMode_Subtract, "SUBTRACT", 0, "Subtract", ""},
{eGplBlendMode_Multiply, "MULTIPLY", 0, "Multiply", ""}, {eGplBlendMode_Multiply, "MULTIPLY", 0, "Multiply", ""},