Structs:PPShader
Jump to navigation
Jump to search
The PPShader struct contains functions that interact with post-processing shaders. Post-processing shaders are shaders that affect the whole viewport and are defined with the HardwareShader block in GLDEFS.
Note: When called in play scope, PPShader methods will affect all players' viewports. If there's a need to only enable the shader for a specific player, a manual check is needed to ensure they're the console player. For example, if a shader is to be applied when the player picks up a custom powerup, it could be done like this:
override void InitEffect()
{
Super.InitEffect();
if (owner && owner.player && owner.PlayerNumber() == consoleplayer)
{
PPShader.SetEnabled("MyShader", true);
}
}
Methods
All of the methods are defined as native and clearscope.
Static
- clearscope static void SetEnabled(string shaderName, bool enable)
- Toggles the specified shader on or off. shaderName is the name of the shader (the .fp file under the /shaders/ folder in the PK3). If enable is
true
, enables the shader; otherwise disables it.
- clearscope static void SetUniform1f(string shaderName, string uniformName, float value)
- clearscope static void SetUniform2f(string shaderName, string uniformName, vector2 value)
- clearscope static void SetUniform3f(string shaderName, string uniformName, vector3 value)
- clearscope static void SetUniform1i(string shaderName, string uniformName, int value)
- These modify the value specified by the uniformName in the specified shader. value is the new value.