public void AdditiveCall(SpriteBatch sb) { Texture2D WhiteMask = ModContent.GetTexture(Texture + "_Mask"); float whiteMaskOpacity = 1 - (Timer / PRE_LAUNCH_TIME); whiteMaskOpacity = Math.Max(whiteMaskOpacity, 0); whiteMaskOpacity = EaseFunction.EaseQuadOut.Ease(whiteMaskOpacity); sb.Draw(WhiteMask, projectile.Center - Main.screenPosition, projectile.DrawFrame(), Color.White * whiteMaskOpacity * projectile.Opacity, projectile.rotation, projectile.DrawFrame().Size() / 2, projectile.scale, SpriteEffects.None, 0); float blurLength = 200 * projectile.scale * whiteMaskOpacity * projectile.Opacity; float blurWidth = 25 * projectile.scale * whiteMaskOpacity * projectile.Opacity; Effect blurEffect = mod.GetEffect("Effects/BlurLine"); SquarePrimitive blurLine = new SquarePrimitive() { Position = projectile.Center - Main.screenPosition, Height = blurWidth, Length = blurLength, Rotation = 0, Color = Color.White * whiteMaskOpacity * projectile.Opacity }; PrimitiveRenderer.DrawPrimitiveShape(blurLine, blurEffect); }
public override void Draw(Effect effect, BasicEffect effect2, GraphicsDevice device) { if (Dead) { return; } //set the parameters for the shader Effect noiseTrailEffect = SpiritMod.Instance.GetEffect("Effects/MotionNoiseTrail"); noiseTrailEffect.Parameters["uTexture"].SetValue(SpiritMod.Instance.GetTexture("Textures/voronoiLooping")); noiseTrailEffect.Parameters["uColor"].SetValue(_color.ToVector4()); noiseTrailEffect.Parameters["progress"].SetValue(Main.GlobalTime * -1.5f); float length = (_startPoint - _endPoint).Length(); noiseTrailEffect.Parameters["xMod"].SetValue(length / 800f); noiseTrailEffect.Parameters["yMod"].SetValue(0.66f); Vector2 center = Vector2.Lerp(_startPoint, _endPoint, 0.5f); float rotation = (_startPoint - _endPoint).ToRotation(); Color lightColor = Lighting.GetColor((int)center.X / 16, (int)center.Y / 16); SquarePrimitive squarePrimitive = new SquarePrimitive { Height = _width, Length = length, Color = lightColor * _opacity, Position = center - Main.screenPosition, Rotation = rotation }; PrimitiveRenderer.DrawPrimitiveShape(squarePrimitive, noiseTrailEffect); }
public void AdditiveCall(SpriteBatch sb) { float blurLength = 100 * projectile.scale * projectile.Opacity; float blurWidth = 25 * projectile.scale * projectile.Opacity; Effect blurEffect = mod.GetEffect("Effects/BlurLine"); SquarePrimitive blurLine = new SquarePrimitive() { Position = projectile.Center - Main.screenPosition, Height = blurWidth, Length = blurLength, Rotation = projectile.velocity.X * .1f, Color = new Color(181, 245, 255) * .5f }; PrimitiveRenderer.DrawPrimitiveShape(blurLine, blurEffect); }
public void AdditiveCall(SpriteBatch sB) { Vector2 drawPosition = npc.Center + (Vector2.UnitY * npc.height / 4); if (LockedOn && npc.Distance(Target.Center) < FOLLOW_MAXRANGE) { Effect effect = mod.GetEffect("Effects/EmpowermentBeam"); effect.Parameters["uTexture"].SetValue(mod.GetTexture("Textures/Trails/Trail_2")); effect.Parameters["progress"].SetValue(Main.GlobalTime / 3); effect.Parameters["uColor"].SetValue(new Color(245, 59, 164).ToVector4()); effect.Parameters["uSecondaryColor"].SetValue(new Color(255, 138, 212).ToVector4()); Vector2 dist = Target.Center - drawPosition; TrianglePrimitive tri = new TrianglePrimitive() { TipPosition = drawPosition - Main.screenPosition, Rotation = dist.ToRotation(), Height = 100 + dist.Length() * 1.5f, Color = Color.White * BeamStrength, Width = 80 + ((Target.width + Target.height) * 0.5f) }; PrimitiveRenderer.DrawPrimitiveShape(tri, effect); } float blurLength = 250; float blurWidth = 25; Effect blurEffect = mod.GetEffect("Effects/BlurLine"); SquarePrimitive blurLine = new SquarePrimitive() { Position = drawPosition - Main.screenPosition, Height = blurWidth * flickerStrength, Length = blurLength * flickerStrength, Rotation = npc.rotation, Color = new Color(255, 138, 212) * flickerStrength }; PrimitiveRenderer.DrawPrimitiveShape(blurLine, blurEffect); sB.Draw(ModContent.GetTexture(Texture + "_Glow"), npc.Center - Main.screenPosition, npc.frame, Color.White, npc.rotation, npc.frame.Size() / 2, npc.scale, npc.spriteDirection < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); }
private void PreDrawOrbExtras(SpriteBatch sB, float scale, Color color) { Texture2D Lu1 = mod.GetTexture("Textures/T_Lu_Noise_31"); Texture2D Lu2 = mod.GetTexture("Textures/T_Lu_Noise_32"); void DrawMask(Texture2D tex, float opacity, float maskScale, float rotationDirection) => sB.Draw(tex, projectile.Center - Main.screenPosition, null, color * opacity, Main.GlobalTime * rotationDirection, tex.Size() / 2, scale * maskScale, SpriteEffects.None, 0); float rotationSpeed = 2f + Charge; DrawMask(Lu2, 0.15f, 0.06f, -rotationSpeed); DrawMask(Lu1, 0.15f, 0.06f, rotationSpeed); DrawMask(Lu2, 0.3f, 0.05f, -rotationSpeed); DrawMask(Lu1, 0.3f, 0.05f, rotationSpeed); DrawGodray.DrawGodrays(sB, projectile.Center - Main.screenPosition, color, 20 * scale * projectile.Opacity, 8 * scale * projectile.Opacity, 16); //not ideal, basically only stable because no sprites are drawn after this in the duration of the current spritebatch, as the current spritebatch is ended //convert to spritebatch drawing later if a suitable additive mask for a blur line is found? //alternatively just literally use the same ray texture godrays use they look basically the same when obscured float blurLength = 130 * scale * projectile.Opacity; float blurWidth = 9 * scale * projectile.Opacity; float flickerStrength = (((float)Math.Sin(Main.GlobalTime * 12) % 1) * 0.1f) + 1f; Effect blurEffect = mod.GetEffect("Effects/BlurLine"); var blurLine = new SquarePrimitive() { Position = projectile.Center - Main.screenPosition, Height = blurWidth * flickerStrength, Length = blurLength * flickerStrength, Rotation = 0, Color = color * flickerStrength }; PrimitiveRenderer.DrawPrimitiveShape(blurLine, blurEffect); }
private void DrawBeam() { float progress = AiTimer / LASER_TIME; float PowF(float power) => (float)Math.Pow(progress, power); Vector2 scale = new Vector2(BeamLength, MathHelper.Lerp(60, 10, PowF(0.75f))); float ColorLerp = PowF(2.5f); Color color = Color.Lerp(midBlue, darkBlue, ColorLerp); color *= 1 - PowF(2.5f) * 0.33f; color.A = 10; Vector2 position = projectile.Center + StaffTipDirection + (BeamDirection * BeamLength / 2) - Main.screenPosition; //Center between staff tip and beam end //Draw the beam and apply shader parameters Effect beamEffect = mod.GetEffect("Effects/Laser"); beamEffect.Parameters["uTexture"].SetValue(mod.GetTexture("Textures/Trails/Trail_1")); beamEffect.Parameters["Progress"].SetValue(Main.GlobalTime * 3f); beamEffect.Parameters["xMod"].SetValue(BeamLength / 150f); beamEffect.Parameters["yMod"].SetValue(2f); beamEffect.CurrentTechnique.Passes[0].Apply(); SquarePrimitive beam = new SquarePrimitive { Height = scale.Y, Length = scale.X, Rotation = BeamDirection.ToRotation(), Position = position, Color = color }; PrimitiveRenderer.DrawPrimitiveShape(beam, beamEffect); //Draw a visual effect for hitting tiles if (HittingTile) { float scaleMod = scale.Y / 60; Texture2D bloom = mod.GetTexture("Effects/Masks/CircleGradient"); Vector2 endPos = projectile.Center + StaffTipDirection + BeamDirection * BeamLength; Main.spriteBatch.Draw(bloom, endPos - Main.screenPosition, null, darkBlue, 0, bloom.Size() / 2, 0.5f * scaleMod, SpriteEffects.None, 0); float blurLength = 400 * scaleMod; float blurWidth = 12 * scaleMod; float flickerStrength = (((float)Math.Sin(Main.GlobalTime * 20) % 1) * 0.3f) + 1f; Effect blurEffect = mod.GetEffect("Effects/BlurLine"); for (int i = -1; i <= 1; i++) { float rotation = BeamDirection.ToRotation() + MathHelper.PiOver2 + (MathHelper.Pi / 6) * i; float size = 1 - Math.Abs(i * 0.5f); SquarePrimitive blurLine = new SquarePrimitive() { Position = endPos - Main.screenPosition, Height = blurWidth * flickerStrength * size, Length = blurLength * flickerStrength * size, Rotation = rotation, Color = Color.Lerp(lightCyan, Color.White, 0.25f) * (1 - ColorLerp) }; PrimitiveRenderer.DrawPrimitiveShape(blurLine, blurEffect); } } }