terraria-source-code/Graphics/Effects/Filter.cs
2021-10-26 12:45:26 -04:00

49 lines
1.5 KiB
C#

// Decompiled with JetBrains decompiler
// Type: Terraria.Graphics.Effects.Filter
// Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null
// MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83
// Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe
using Microsoft.Xna.Framework;
using Terraria.Graphics.Shaders;
namespace Terraria.Graphics.Effects
{
public class Filter : GameEffect
{
public bool Active;
private ScreenShaderData _shader;
public bool IsHidden;
public Filter(ScreenShaderData shader, EffectPriority priority = EffectPriority.VeryLow)
{
this._shader = shader;
this._priority = priority;
}
public void Update(GameTime gameTime)
{
this._shader.UseGlobalOpacity(this.Opacity);
this._shader.Update(gameTime);
}
public void Apply() => this._shader.Apply();
public ScreenShaderData GetShader() => this._shader;
public override void Activate(Vector2 position, params object[] args)
{
this._shader.UseGlobalOpacity(this.Opacity);
this._shader.UseTargetPosition(position);
this.Active = true;
}
public override void Deactivate(params object[] args) => this.Active = false;
public bool IsInUse() => this.Active || (double) this.Opacity > 0.0;
public bool IsActive() => this.Active;
public override bool IsVisible() => (double) this.GetShader().CombinedOpacity > 0.0 && !this.IsHidden;
}
}