Skip to content

Commit

Permalink
Refactored glsl shaders
Browse files Browse the repository at this point in the history
  • Loading branch information
Monsterovich committed Oct 30, 2024
1 parent c862cef commit 3ca4bb5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
16 changes: 9 additions & 7 deletions data/base/shaders/tcmask_instanced.frag
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,13 @@ vec3 blendAddEffectLighting(vec3 a, vec3 b) {
return min(a + b, vec3(1.0));
}

vec4 applyShieldFuzzEffect(vec4 color) {
float cycle = 0.66 + 0.66 * graphicsCycle;
vec3 col = vec3(random(vec2(color.x * cycle, color.y * cycle)));
col.b *= 1.5;
return vec4(col, color.a / 6.0);
}

void main()
{
// unpack inputs
Expand Down Expand Up @@ -426,10 +433,7 @@ void main()
#ifdef NEWGL
if (shieldEffect == 1)
{
float cycle = 0.66 + 0.66 * graphicsCycle;
vec3 col = vec3(random(vec2(fragColour.x * cycle, fragColour.y * cycle)));
col.b *= 1.5;
FragColor = vec4(col, fragColour.a / 6.0);
FragColor = applyShieldFuzzEffect(fragColour);
}
else
{
Expand All @@ -438,9 +442,7 @@ void main()
#else
if (shieldEffect == 1)
{
vec3 col = vec3(random(vec2(fragColour.x * cycle, fragColour.y * cycle)));
col.b *= 1.5;
gl_FragColor = vec4(col, fragColour.a / 6.0);
gl_FragColor = applyShieldFuzzEffect(fragColour);
}
else
{
Expand Down
12 changes: 8 additions & 4 deletions data/base/shaders/vk/tcmask_instanced.frag
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,13 @@ vec3 blendAddEffectLighting(vec3 a, vec3 b) {
return min(a + b, vec3(1.0));
}

vec4 applyShieldFuzzEffect(vec4 color) {
float cycle = 0.66 + 0.66 * graphicsCycle;
vec3 col = vec3(random(vec2(color.x * cycle, color.y * cycle)));
col.b *= 1.5;
return vec4(col, color.a / 6.0);
}

void main()
{
// unpack inputs
Expand Down Expand Up @@ -388,10 +395,7 @@ void main()

if (shieldEffect == 1)
{
float cycle = 0.66 + 0.66 * graphicsCycle;
vec3 col = vec3(random(vec2(fragColour.x * cycle, fragColour.y * cycle)));
col.b *= 1.5;
FragColor = vec4(col, fragColour.a / 6.0);
FragColor = applyShieldFuzzEffect(fragColour);
}
else
{
Expand Down

0 comments on commit 3ca4bb5

Please sign in to comment.