add overlay blending mode
This commit is contained in:
@@ -159,7 +159,7 @@
|
||||
</node>
|
||||
<border dir="col" align="center" grow="1" width="1" flood-events="1">
|
||||
<node height="30" pad="1" width="100%" dir="row">
|
||||
<combobox id="blend-mode" text="Normal" width="100%" height="30" combo-list="Normal,Multiply,Screen,Color Dodge" default="0"/>
|
||||
<combobox id="blend-mode" text="Normal" width="100%" height="30" combo-list="Normal,Multiply,Screen,Color Dodge,Overlay" default="0"/>
|
||||
</node>
|
||||
<node height="20" pad="1" width="100%" dir="row">
|
||||
<slider-h id="tip-size" width="1" grow="1" value=".25"/>
|
||||
|
||||
@@ -105,11 +105,13 @@ void App::initShaders()
|
||||
"vec3 blend_multiply(vec4 base, vec4 stroke, float alpha_tot) { return mix(stroke.rgb, mix(base.rgb, base.rgb*stroke.rgb, stroke.a/alpha_tot), base.a/alpha_tot); }\n"
|
||||
"vec3 blend_screen(vec4 base, vec4 stroke, float alpha_tot) { return mix(stroke.rgb, mix(base.rgb, 1.0-(1.0-base.rgb)*(1.0-stroke.rgb), stroke.a/alpha_tot), base.a/alpha_tot); }\n"
|
||||
"vec3 blend_colorDodge(vec4 base, vec4 stroke, float alpha_tot) { return mix(stroke.rgb, mix(base.rgb, base.rgb/(1.0-stroke.rgb), stroke.a/alpha_tot), base.a/alpha_tot); }\n"
|
||||
"vec3 blend_overlay(vec4 base, vec4 stroke, float alpha_tot) { return mix(stroke.rgb, mix(base.rgb, mix(2.0*base.rgb*stroke.rgb, 1.0-2.0*(1.0-base.rgb)*(1.0-stroke.rgb), floor(base.rgb*2.0)), stroke.a/alpha_tot), base.a/alpha_tot); }\n"
|
||||
"vec3 blend(vec4 base, vec4 stroke, float alpha_tot, int mode) { switch(mode){\n"
|
||||
" case 0: return blend_normal(base, stroke, alpha_tot);"
|
||||
" case 1: return blend_multiply(base, stroke, alpha_tot);"
|
||||
" case 2: return blend_screen(base, stroke, alpha_tot);"
|
||||
" case 3: return blend_colorDodge(base, stroke, alpha_tot);"
|
||||
" case 4: return blend_overlay(base, stroke, alpha_tot);"
|
||||
"}}\n"
|
||||
"void main(){\n"
|
||||
" mediump vec4 base = texture(tex, uv.xy);\n"
|
||||
|
||||
Reference in New Issue
Block a user