Skip to content

Commit 236637c

Browse files
committed
add extended blend modes support
1 parent cc672af commit 236637c

File tree

5 files changed

+6135
-1465
lines changed

5 files changed

+6135
-1465
lines changed

Data/Base.rte/Shaders/Background.frag

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
#version 130
1+
#version 330
2+
#extension GL_KHR_blend_equation_advanced: enable
23

34
in vec2 textureUV;
45
in vec4 vertexColor;
56

7+
#ifdef GL_KHR_blend_equation_advanced
8+
layout(blend_support_all_equations) out vec4 FragColor;
9+
#else
610
out vec4 FragColor;
7-
11+
#endif
812
uniform sampler2D rteTexture;
913
uniform sampler2D rtePalette;
10-
uniform vec4 rteColor;
11-
uniform bool drawMasked;
14+
uniform vec4 rteColor = vec4(1.0);
15+
uniform bool rteBlendInvert = false;
16+
uniform bool drawMasked = false;
1217

1318

1419
vec4 texture2DAA(sampler2D tex, vec2 uv) {
@@ -25,5 +30,9 @@ void main() {
2530
if (red==0 && drawMasked) {
2631
discard;
2732
}
28-
FragColor = texture2DAA(rtePalette, vec2(red * rteColor.r * vertexColor.r, 0.0)) * vec4(vec3(1.0), rteColor.a * vertexColor.a);
33+
if (!rteBlendInvert) {
34+
FragColor = texture2DAA(rtePalette, vec2(red * vertexColor.r, 0.0)) * vec4(rteColor.rgb, rteColor.a * vertexColor.a);
35+
} else {
36+
FragColor = vec4(vec3(1.0), 0.0) - (texture2DAA(rtePalette, vec2(red * vertexColor.r, 0.0)) * vec4(rteColor.rgb, rteColor.a * vertexColor.a));
37+
}
2938
}

0 commit comments

Comments
 (0)