-
Notifications
You must be signed in to change notification settings - Fork 3
ModArmorShaderData
gamrguy edited this page Apr 29, 2018
·
4 revisions
This class is used to create custom programming for a shader, which can be applied to players, items, projectiles, or NPCs. Create a subclass of this class to utilize its features.
public Mod Mod // Access your Mod instance here.
public virtual string Name // The Name of this object. Defaults to class name; override to change it.
public int ShaderID // ID of this shader (contains numerical ID and mod name/shader name)
public virtual int? BoundItemID // Defaults to null; override to set an item ID to bind this shader to
public Color Primary // Primary color
public Color Secondary // Secondary color
public float Saturation // Saturation
public float Opacity // Opacity
public string PassName // Pass name; which visual effect to apply. ArmorColored by default.
public Effect Shader // Shader object that contains passes. Defaults to Main.PixelShader; change if using your own.
public Texture2D Image // Image to be used in the shader, typically as noise.
public virtual bool Autoload()
// Defaults to true; override to disable autoloading or run code on autoload.
public virtual void PreApply(Entity e, DrawData? drawData)
// Override this to run effects when the shader is applied.
// Change the color, pass name, etc.
public override void Apply(Entity e, DrawData? drawData)
// Override this to change how the shader itself applies.
// Not recommended unless you really know what you're doing.
public override TagCompound Save()
// Override to save custom data when this shader is saved.
public virtual void Load(TagCompound tag)
// Override to run code when this shader is loaded in by something.
- Changing
Primary
,Secondary
,Saturation
, orOpacity
will update the values locally inModArmorShaderData
and the hidden values inArmorShaderData
. To change only the hidden values (so as to keep the local values for future reference) useArmorShaderData
'sUseColor
,UseSaturation
, etc. methods. - To create a variety of shaders with similar function but different properties, consider disabling autoloading to add in the varieties yourself.