Skip to content

Commit 10673da

Browse files
committed
Graphics is as Graphics does
1 parent 9e1b8c4 commit 10673da

2 files changed

Lines changed: 5 additions & 31 deletions

File tree

src/renderer/webgl/shaders/Graphics-frag.js

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,7 @@ module.exports = [
1111
'',
1212
'void main()',
1313
'{',
14-
' vec4 texture = texture2D(uMainSampler, outTexCoord);',
15-
' vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a);',
16-
'',
17-
' // Multiply texture tint',
18-
' vec4 color = texture * texel;',
19-
'',
20-
' if (outTintEffect == 1.0)',
21-
' {',
22-
' // Solid color + texture alpha',
23-
' color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a);',
24-
' }',
25-
' else if (outTintEffect == 2.0)',
26-
' {',
27-
' // Solid color, no texture',
28-
' color = texel;',
29-
' }',
14+
' vec4 color = vec4(outTint.bgr * outTint.a, outTint.a);',
3015
'',
3116
' gl_FragColor = color;',
3217
'}',

src/renderer/webgl/shaders/src/Graphics.frag

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,13 @@ varying vec2 outTexCoord;
88
varying float outTintEffect;
99
varying vec4 outTint;
1010

11+
// uniform vec2 repeat = vec2(2, 2);
12+
1113
void main()
1214
{
13-
vec4 texture = texture2D(uMainSampler, outTexCoord);
14-
vec4 texel = vec4(outTint.bgr * outTint.a, outTint.a);
15-
16-
// Multiply texture tint
17-
vec4 color = texture * texel;
15+
// pixel = v_colour * texture2D(t0, vec2(mod(tex_coords.x * repeat.x, 1), mod(tex_coords.y * repeat.y, 1)));
1816

19-
if (outTintEffect == 1.0)
20-
{
21-
// Solid color + texture alpha
22-
color.rgb = mix(texture.rgb, outTint.bgr * outTint.a, texture.a);
23-
}
24-
else if (outTintEffect == 2.0)
25-
{
26-
// Solid color, no texture
27-
color = texel;
28-
}
17+
vec4 color = vec4(outTint.bgr * outTint.a, outTint.a);
2918

3019
gl_FragColor = color;
3120
}

0 commit comments

Comments
 (0)