Skip to content

GlobalShader

gamrguy edited this page Apr 29, 2018 · 3 revisions

GlobalShader

The GlobalShader class is where all of ShaderLib's hooks for applying shaders to various in-game objects are located. Create a subclass of this class to utilize its features.

Properties

public Mod Mod             // Access your Mod instance here
public virtual string Name // Name of this object; class name by default, override to change it

Methods

public virtual bool Autoload()
// True by default. 
// Override to disable autoloading or run code on autoload.

public virtual ShaderID ItemInventoryShader(Item item, SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale)
// Override to provide a shader when an item is in the inventory.
// Return the shader ID of the desired shader.

public virtual ShaderID ItemWorldShader(Item item, SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI)
// Override to provide a shader when an item is in the world.
// Return the shader ID of the desired shader.

public virtual int ProjectileShader(Projectile projectile, SpriteBatch spriteBatch, Color lightColor)
// Override to provide a shader for a projectile.
// Return the shader ID of the desired shader.

public virtual int NPCShader(NPC npc, SpriteBatch spriteBatch, Color drawColor)
// Override to provide a shader for an NPC.
// Return the shader ID of the desired shader.

public virtual void PlayerShader(ref PlayerShaderData data, PlayerDrawInfo drawInfo)
// Override to apply shaders to various parts of the player character.
// The PlayerShaderData object contains properties for the body, face, default clothes, and more.
// Simply change values on the PlayerShaderData to apply those shader IDs.

public virtual void HeldItemShader(ref int shaderID, Item item, PlayerDrawInfo drawInfo)
// Override to apply a shader to the player's currently held item.
// This means swinging swords, held guns, etc. - but not items represented by projectiles.
// Change the incoming ref to apply the shader.
Clone this wiki locally