Added an AoE visual on Ares' gauss nuke

This commit is contained in:
IbanPlay committed 2022-03-06 07:32:24 +01:00
1 parent 5c7b5cc1b2
commit eb98e109fa
4 files changed
+76

No files matched your search

+3
View File
@@ -27,6 +27,7 @@ namespace CalamityMod.Effects
public static Effect BasicTintShader;
public static Effect DoGDisintegrationShader;
public static Effect ArtAttackTrailShader;
public static Effect CircularAoETelegraph;
public static Effect BaseFusableParticleEdgeShader;
public static Effect AdditiveFusableParticleEdgeShader;
@@ -57,6 +58,7 @@ namespace CalamityMod.Effects
BasicTintShader = CalamityMod.Instance.GetEffect("Effects/BasicTint");
DoGDisintegrationShader = CalamityMod.Instance.GetEffect("Effects/DoGDisintegration");
ArtAttackTrailShader = CalamityMod.Instance.GetEffect("Effects/ArtAttackTrail");
CircularAoETelegraph = CalamityMod.Instance.GetEffect("Effects/CircularAoETelegraph");
BaseFusableParticleEdgeShader = CalamityMod.Instance.GetEffect("Effects/ParticleFusion/BaseFusableParticleEdgeShader");
AdditiveFusableParticleEdgeShader = CalamityMod.Instance.GetEffect("Effects/ParticleFusion/AdditiveFusableParticleEdgeShader");
@@ -85,6 +87,7 @@ namespace CalamityMod.Effects
GameShaders.Misc["CalamityMod:BasicTint"] = new MiscShaderData(new Ref<Effect>(BasicTintShader), "TintPass");
GameShaders.Misc["CalamityMod:DoGDisintegration"] = new MiscShaderData(new Ref<Effect>(DoGDisintegrationShader), "DisintegrationPass");
GameShaders.Misc["CalamityMod:ArtAttack"] = new MiscShaderData(new Ref<Effect>(ArtAttackTrailShader), "TrailPass");
GameShaders.Misc["CalamityMod:CircularAoETelegraph"] = new MiscShaderData(new Ref<Effect>(CircularAoETelegraph), "TelegraphPass");
GameShaders.Misc["CalamityMod:BaseFusableParticleEdge"] = new MiscShaderData(new Ref<Effect>(BaseFusableParticleEdgeShader), "ParticlePass");
GameShaders.Misc["CalamityMod:AdditiveFusableParticleEdge"] = new MiscShaderData(new Ref<Effect>(AdditiveFusableParticleEdgeShader), "ParticlePass");
+57
View File
@@ -0,0 +1,57 @@
sampler uImage0 : register(s0);
sampler uImage1 : register(s1);
float3 uColor; //Color of the telegraph zone
float3 uSecondaryColor; //Color of the outline
float uOpacity;
float uSaturation; //Saturation is being used as completion here. 0 = Telegraph start, 1 = Telegraph about to end
float uRotation;
float uTime;
float4 uSourceRect;
float2 uWorldPosition;
float uDirection;
float3 uLightSource;
float2 uImageSize0;
float2 uImageSize1;
float4 Recolor(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0
{
float3 color = uColor;
//this is the center of the sprite, coords work from 0 - 1
float2 center = float2(0.5, 0.5);
//get the length of the doubled distance, so that 0 = at the center of the sprite and 1 = at the very edge of the circle
float distanceFromCenter = length(coords - center) * 2;
//Crop the sprite into a circle
if (distanceFromCenter > 1)
return float4(0, 0, 0, 0);
//Make the brightness increase towards the edge
float opacity = 0.1 + (0.2 + 0.35 * pow(uSaturation, 2)) * distanceFromCenter;
//Brighten the very edge
if (distanceFromCenter > 0.995)
{
//Make the color get closer to the outline color. At halfway completion the transition is complete (so proud of them)
color = lerp(color, uSecondaryColor, min(uSaturation * 2, 1));
//Do the same for the opacity
opacity = lerp(opacity, 1, pow(uSaturation, 2)) * lerp(uOpacity, 1, min(uSaturation * 1.25, min(uOpacity + 0.1, 1)));
}
else
opacity = opacity * uOpacity;
color = color * opacity;
return float4(color, opacity);
}
technique Technique1
{
pass TelegraphPass
{
PixelShader = compile ps_2_0 Recolor();
}
}
Binary file not shown.
@@ -6,6 +6,7 @@ using Microsoft.Xna.Framework.Graphics;
using System;
using System.IO;
using Terraria;
using Terraria.Graphics.Shaders;
using Terraria.ID;
using Terraria.ModLoader;
@@ -142,6 +143,21 @@ namespace CalamityMod.Projectiles.Boss
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
{
spriteBatch.EnterShaderRegion();
Texture2D telegraphBase = ModContent.GetTexture("CalamityMod/Projectiles/InvisibleProj");
GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseOpacity(0.4f * MathHelper.Clamp((1 - projectile.timeLeft / (float)timeLeft) * 8f, 0, 1));
GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseColor(Color.Lerp(Color.Goldenrod, Color.Gold, 0.7f * (float)Math.Pow(0.5 + 0.5 * Math.Sin(Main.GlobalTime), 3)));
GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseSecondaryColor(Color.Lerp(Color.Yellow, Color.White, 0.5f));
GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseSaturation(1 - projectile.timeLeft / (float)timeLeft);
GameShaders.Misc["CalamityMod:CircularAoETelegraph"].Apply();
Vector2 drawPosition = projectile.Center - Main.screenPosition;
spriteBatch.Draw(telegraphBase, drawPosition, null, lightColor, 0, telegraphBase.Size() / 2f, 1070f, 0, 0);
spriteBatch.ExitShaderRegion();
CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1);
return false;
}