Make lit world shaders respect renderer.alpha via u_alpha.
Melee swipe fade set alpha but SPRITE_LIGHTING_FRAG ignored it; slash FX stayed fully opaque until removal.
@@ -72,6 +72,7 @@ const SPRITE_LIGHTING_FRAG = [
72
72
"precision mediump float;",
73
73
"varying vec2 v_texCoord;",
74
74
"uniform sampler2D u_texture;",
75
"uniform float u_alpha;",
75
76
"uniform float u_darkness;",
76
77
"uniform float u_strength;",
77
78
"uniform vec3 u_flashColor;",
@@ -88,7 +89,7 @@ const SPRITE_LIGHTING_FRAG = [
88
89
" }",
89
90
" rgb = mix(rgb, vec3(0.0), u_darkness);",
90
91
" rgb = mix(rgb, u_flashColor, u_strength);",
91
" gl_FragColor = vec4(rgb, color.a);",
92
" gl_FragColor = vec4(rgb, color.a * u_alpha);",
92
93
"}"
93
94
].join("\n");
94
95
@@ -96,6 +97,7 @@ const WATER_GROUND_FRAG = [
96
97
"precision mediump float;",
97
98
"varying vec2 v_texCoord;",
98
99
"uniform sampler2D u_texture;",
100
"uniform float u_alpha;",
99
101
"uniform float u_ambientDark;",
100
102
"uniform float u_litNW;",
101
103
"uniform float u_litNE;",
@@ -130,7 +132,7 @@ const WATER_GROUND_FRAG = [
130
132
" float lit = mix(litTop, litBottom, v_texCoord.y);",
131
133
" float darkness = u_ambientDark * (1.0 - lit);",
132
134
" rgb = mix(rgb, vec3(0.0), darkness);",
133
" gl_FragColor = vec4(rgb, color.a);",
135
" gl_FragColor = vec4(rgb, color.a * u_alpha);",
134
136
"}"
135
137
].join("\n");
136
138
@@ -139,6 +141,7 @@ const TINT_LIT_SPRITE_FRAG = [
139
141
"precision mediump float;",
140
142
"varying vec2 v_texCoord;",
141
143
"uniform sampler2D u_texture;",
144
"uniform float u_alpha;",
142
145
"uniform float u_darkness;",
143
146
"uniform float u_strength;",
144
147
"uniform vec3 u_flashColor;",
@@ -164,7 +167,7 @@ const TINT_LIT_SPRITE_FRAG = [
164
167
" }",
165
168
" rgb = mix(rgb, vec3(0.0), u_darkness);",
166
169
" rgb = mix(rgb, u_flashColor, u_strength);",
167
" gl_FragColor = vec4(rgb, color.a);",
170
" gl_FragColor = vec4(rgb, color.a * u_alpha);",
168
171
"}"
169
172
].join("\n");
170
173
@@ -175,6 +178,7 @@ const DUAL_TINT_LIT_SPRITE_FRAG = [
175
178
"precision mediump float;",
176
179
"varying vec2 v_texCoord;",
177
180
"uniform sampler2D u_texture;",
181
"uniform float u_alpha;",
178
182
"uniform float u_darkness;",
179
183
"uniform float u_strength;",
180
184
"uniform vec3 u_flashColor;",
@@ -220,7 +224,7 @@ const DUAL_TINT_LIT_SPRITE_FRAG = [
220
224
" }",
221
225
" rgb = mix(rgb, vec3(0.0), u_darkness);",
222
226
" rgb = mix(rgb, u_flashColor, u_strength);",
223
" gl_FragColor = vec4(rgb, color.a);",
227
" gl_FragColor = vec4(rgb, color.a * u_alpha);",
224
228
"}"
225
229
].join("\n");
226
230
@@ -263,6 +267,7 @@ const TIGHT_FIT_TINT_LIT_SPRITE_FRAG = [
263
267
"varying vec2 v_texCoord;",
264
268
"uniform sampler2D u_texture;",
265
269
"uniform sampler2D u_secondary;",
270
"uniform float u_alpha;",
266
271
"uniform float u_darkness;",
267
272
"uniform float u_strength;",
268
273
"uniform vec3 u_flashColor;",
@@ -289,7 +294,7 @@ const TIGHT_FIT_TINT_LIT_SPRITE_FRAG = [
289
294
" }",
290
295
" rgb = mix(rgb, vec3(0.0), u_darkness);",
291
296
" rgb = mix(rgb, u_flashColor, u_strength);",
292
" float alpha = min(tightFitBodyAlpha(), color.a);",
297
" float alpha = min(tightFitBodyAlpha(), color.a) * u_alpha;",
293
298
" if (alpha <= 0.0) { discard; }",
294
299
" gl_FragColor = vec4(rgb, alpha);",
295
300
"}"
@@ -301,6 +306,7 @@ const TIGHT_FIT_LIT_SPRITE_FRAG = [
301
306
"varying vec2 v_texCoord;",
302
307
"uniform sampler2D u_texture;",
303
308
"uniform sampler2D u_secondary;",
309
"uniform float u_alpha;",
304
310
"uniform float u_darkness;",
305
311
"uniform float u_strength;",
306
312
"uniform vec3 u_flashColor;",
@@ -318,7 +324,7 @@ const TIGHT_FIT_LIT_SPRITE_FRAG = [
318
324
" }",
319
325
" rgb = mix(rgb, vec3(0.0), u_darkness);",
320
326
" rgb = mix(rgb, u_flashColor, u_strength);",
321
" float alpha = min(tightFitBodyAlpha(), color.a);",
327
" float alpha = min(tightFitBodyAlpha(), color.a) * u_alpha;",
322
328
" if (alpha <= 0.0) { discard; }",
323
329
" gl_FragColor = vec4(rgb, alpha);",
324
330
"}"
@@ -329,6 +335,7 @@ const ATLAS_LIGHTING_FRAG = [
329
335
"varying vec2 v_texCoord;",
330
336
"uniform sampler2D u_texture;",
331
337
"uniform sampler2D u_secondary;",
338
"uniform float u_alpha;",
332
339
"uniform float u_ambientDark;",
333
340
"uniform float u_lightRow;",
334
341
"void main() {",
@@ -341,7 +348,7 @@ const ATLAS_LIGHTING_FRAG = [
341
348
" float lit = texture2D(u_secondary, lightUV).r;",
342
349
" float darkness = u_ambientDark * (1.0 - lit);",
343
350
" vec3 rgb = mix(color.rgb, vec3(0.0), darkness);",
344
" gl_FragColor = vec4(rgb, color.a);",
351
" gl_FragColor = vec4(rgb, color.a * u_alpha);",
345
352
"}"
346
353
].join("\n");
347
354
@@ -72,6 +72,7 @@ const SPRITE_LIGHTING_FRAG = [72
"precision mediump float;",72
"precision mediump float;",73
"varying vec2 v_texCoord;",73
"varying vec2 v_texCoord;",74
"uniform sampler2D u_texture;",74
"uniform sampler2D u_texture;",75
"uniform float u_alpha;",75
"uniform float u_darkness;",76
"uniform float u_darkness;",76
"uniform float u_strength;",77
"uniform float u_strength;",77
"uniform vec3 u_flashColor;",78
"uniform vec3 u_flashColor;",@@ -88,7 +89,7 @@ const SPRITE_LIGHTING_FRAG = [88
" }",89
" }",89
" rgb = mix(rgb, vec3(0.0), u_darkness);",90
" rgb = mix(rgb, vec3(0.0), u_darkness);",90
" rgb = mix(rgb, u_flashColor, u_strength);",91
" rgb = mix(rgb, u_flashColor, u_strength);",91
" gl_FragColor = vec4(rgb, color.a);",92
" gl_FragColor = vec4(rgb, color.a * u_alpha);",92
"}"93
"}"93
].join("\n");94
].join("\n");94
95
@@ -96,6 +97,7 @@ const WATER_GROUND_FRAG = [96
"precision mediump float;",97
"precision mediump float;",97
"varying vec2 v_texCoord;",98
"varying vec2 v_texCoord;",98
"uniform sampler2D u_texture;",99
"uniform sampler2D u_texture;",100
"uniform float u_alpha;",99
"uniform float u_ambientDark;",101
"uniform float u_ambientDark;",100
"uniform float u_litNW;",102
"uniform float u_litNW;",101
"uniform float u_litNE;",103
"uniform float u_litNE;",@@ -130,7 +132,7 @@ const WATER_GROUND_FRAG = [130
" float lit = mix(litTop, litBottom, v_texCoord.y);",132
" float lit = mix(litTop, litBottom, v_texCoord.y);",131
" float darkness = u_ambientDark * (1.0 - lit);",133
" float darkness = u_ambientDark * (1.0 - lit);",132
" rgb = mix(rgb, vec3(0.0), darkness);",134
" rgb = mix(rgb, vec3(0.0), darkness);",133
" gl_FragColor = vec4(rgb, color.a);",135
" gl_FragColor = vec4(rgb, color.a * u_alpha);",134
"}"136
"}"135
].join("\n");137
].join("\n");136
138
@@ -139,6 +141,7 @@ const TINT_LIT_SPRITE_FRAG = [139
"precision mediump float;",141
"precision mediump float;",140
"varying vec2 v_texCoord;",142
"varying vec2 v_texCoord;",141
"uniform sampler2D u_texture;",143
"uniform sampler2D u_texture;",144
"uniform float u_alpha;",142
"uniform float u_darkness;",145
"uniform float u_darkness;",143
"uniform float u_strength;",146
"uniform float u_strength;",144
"uniform vec3 u_flashColor;",147
"uniform vec3 u_flashColor;",@@ -164,7 +167,7 @@ const TINT_LIT_SPRITE_FRAG = [164
" }",167
" }",165
" rgb = mix(rgb, vec3(0.0), u_darkness);",168
" rgb = mix(rgb, vec3(0.0), u_darkness);",166
" rgb = mix(rgb, u_flashColor, u_strength);",169
" rgb = mix(rgb, u_flashColor, u_strength);",167
" gl_FragColor = vec4(rgb, color.a);",170
" gl_FragColor = vec4(rgb, color.a * u_alpha);",168
"}"171
"}"169
].join("\n");172
].join("\n");170
173
@@ -175,6 +178,7 @@ const DUAL_TINT_LIT_SPRITE_FRAG = [175
"precision mediump float;",178
"precision mediump float;",176
"varying vec2 v_texCoord;",179
"varying vec2 v_texCoord;",177
"uniform sampler2D u_texture;",180
"uniform sampler2D u_texture;",181
"uniform float u_alpha;",178
"uniform float u_darkness;",182
"uniform float u_darkness;",179
"uniform float u_strength;",183
"uniform float u_strength;",180
"uniform vec3 u_flashColor;",184
"uniform vec3 u_flashColor;",@@ -220,7 +224,7 @@ const DUAL_TINT_LIT_SPRITE_FRAG = [220
" }",224
" }",221
" rgb = mix(rgb, vec3(0.0), u_darkness);",225
" rgb = mix(rgb, vec3(0.0), u_darkness);",222
" rgb = mix(rgb, u_flashColor, u_strength);",226
" rgb = mix(rgb, u_flashColor, u_strength);",223
" gl_FragColor = vec4(rgb, color.a);",227
" gl_FragColor = vec4(rgb, color.a * u_alpha);",224
"}"228
"}"225
].join("\n");229
].join("\n");226
230
@@ -263,6 +267,7 @@ const TIGHT_FIT_TINT_LIT_SPRITE_FRAG = [263
"varying vec2 v_texCoord;",267
"varying vec2 v_texCoord;",264
"uniform sampler2D u_texture;",268
"uniform sampler2D u_texture;",265
"uniform sampler2D u_secondary;",269
"uniform sampler2D u_secondary;",270
"uniform float u_alpha;",266
"uniform float u_darkness;",271
"uniform float u_darkness;",267
"uniform float u_strength;",272
"uniform float u_strength;",268
"uniform vec3 u_flashColor;",273
"uniform vec3 u_flashColor;",@@ -289,7 +294,7 @@ const TIGHT_FIT_TINT_LIT_SPRITE_FRAG = [289
" }",294
" }",290
" rgb = mix(rgb, vec3(0.0), u_darkness);",295
" rgb = mix(rgb, vec3(0.0), u_darkness);",291
" rgb = mix(rgb, u_flashColor, u_strength);",296
" rgb = mix(rgb, u_flashColor, u_strength);",292
" float alpha = min(tightFitBodyAlpha(), color.a);",297
" float alpha = min(tightFitBodyAlpha(), color.a) * u_alpha;",293
" if (alpha <= 0.0) { discard; }",298
" if (alpha <= 0.0) { discard; }",294
" gl_FragColor = vec4(rgb, alpha);",299
" gl_FragColor = vec4(rgb, alpha);",295
"}"300
"}"@@ -301,6 +306,7 @@ const TIGHT_FIT_LIT_SPRITE_FRAG = [301
"varying vec2 v_texCoord;",306
"varying vec2 v_texCoord;",302
"uniform sampler2D u_texture;",307
"uniform sampler2D u_texture;",303
"uniform sampler2D u_secondary;",308
"uniform sampler2D u_secondary;",309
"uniform float u_alpha;",304
"uniform float u_darkness;",310
"uniform float u_darkness;",305
"uniform float u_strength;",311
"uniform float u_strength;",306
"uniform vec3 u_flashColor;",312
"uniform vec3 u_flashColor;",@@ -318,7 +324,7 @@ const TIGHT_FIT_LIT_SPRITE_FRAG = [318
" }",324
" }",319
" rgb = mix(rgb, vec3(0.0), u_darkness);",325
" rgb = mix(rgb, vec3(0.0), u_darkness);",320
" rgb = mix(rgb, u_flashColor, u_strength);",326
" rgb = mix(rgb, u_flashColor, u_strength);",321
" float alpha = min(tightFitBodyAlpha(), color.a);",327
" float alpha = min(tightFitBodyAlpha(), color.a) * u_alpha;",322
" if (alpha <= 0.0) { discard; }",328
" if (alpha <= 0.0) { discard; }",323
" gl_FragColor = vec4(rgb, alpha);",329
" gl_FragColor = vec4(rgb, alpha);",324
"}"330
"}"@@ -329,6 +335,7 @@ const ATLAS_LIGHTING_FRAG = [329
"varying vec2 v_texCoord;",335
"varying vec2 v_texCoord;",330
"uniform sampler2D u_texture;",336
"uniform sampler2D u_texture;",331
"uniform sampler2D u_secondary;",337
"uniform sampler2D u_secondary;",338
"uniform float u_alpha;",332
"uniform float u_ambientDark;",339
"uniform float u_ambientDark;",333
"uniform float u_lightRow;",340
"uniform float u_lightRow;",334
"void main() {",341
"void main() {",@@ -341,7 +348,7 @@ const ATLAS_LIGHTING_FRAG = [341
" float lit = texture2D(u_secondary, lightUV).r;",348
" float lit = texture2D(u_secondary, lightUV).r;",342
" float darkness = u_ambientDark * (1.0 - lit);",349
" float darkness = u_ambientDark * (1.0 - lit);",343
" vec3 rgb = mix(color.rgb, vec3(0.0), darkness);",350
" vec3 rgb = mix(color.rgb, vec3(0.0), darkness);",344
" gl_FragColor = vec4(rgb, color.a);",351
" gl_FragColor = vec4(rgb, color.a * u_alpha);",345
"}"352
"}"346
].join("\n");353
].join("\n");347
354