Class PostProcessShader
- All Implemented Interfaces:
ShaderAPI
- Since:
- Beta 1.07
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.dark.shaders.util.ShaderAPI
ShaderAPI.RenderOrder -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final int[]protected final int[]protected intprotected int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method will be called for multiple shaders in a particular order, dictated by getRenderOrder().voiddestroy()This method is called when the current instance is destroyed, such as when the settings are reloaded.com.fs.starfarer.api.combat.CombatEngineLayersThis method determines the combat rendering layer in which the shader is run.This method determines the order in which the shader is inserted in the rendering queue.voidThis method is called at the beginning of each combat instance.booleanisCombat()This method returns whether this shader is rendered within a combat layer or not.booleanThis method returns whether this shader is enabled or not.voidrenderInScreenCoords(com.fs.starfarer.api.combat.ViewportAPI viewport) This method is called before advance() and before the UI is drawn.voidrenderInWorldCoords(com.fs.starfarer.api.combat.ViewportAPI viewport) This method is called before advance() and before the UI is drawn.static voidResets the post-processing shader to the default settings, taking into account color blindness options.static voidsetBlueHSL(boolean post, float hue, float saturation, float lightness) Sets the hue shift, saturation, and lightness for the blue color range.static voidsetContrast(boolean post, float amount) Sets the screen's contrast to the given amount.static voidsetGreenHSL(boolean post, float hue, float saturation, float lightness) Sets the hue shift, saturation, and lightness for the green color range.static voidsetHueShift(boolean post, float degrees) Shifts the screen's hue by the given amount.static voidsetLightness(boolean post, float amount) Sets the screen's lightness to the given amount.static voidsetMagentaHSL(boolean post, float hue, float saturation, float lightness) Sets the hue shift, saturation, and lightness for the magenta color range.static voidsetNoise(boolean post, float amount) Gives the screen some degree of black noise.static voidsetRedHSL(boolean post, float hue, float saturation, float lightness) Sets the hue shift, saturation, and lightness for the red color range.static voidsetSaturation(boolean post, float amount) Sets the screen's color saturation to the given amount.static voidsetScanLines(boolean post, float amount, int interval, int width) Gives the screen CRT-style scan lines.static voidsetTealHSL(boolean post, float hue, float saturation, float lightness) Sets the hue shift, saturation, and lightness for the teal color range.static voidsetYellowHSL(boolean post, float hue, float saturation, float lightness) Sets the hue shift, saturation, and lightness for the yellow color range.static voiduseExponentialDarkness(boolean post, boolean value) Sets the lightness function to use an exponential curve when lightness is below 1.static voiduseExponentialDesaturation(boolean post, boolean value) Sets the saturation function to use an exponential curve when saturation is below 1.
-
Field Details
-
indexPost
protected final int[] indexPost -
indexPre
protected final int[] indexPre -
programPost
protected int programPost -
programPre
protected int programPre
-
-
Constructor Details
-
PostProcessShader
public PostProcessShader()
-
-
Method Details
-
resetDefaults
public static void resetDefaults()Resets the post-processing shader to the default settings, taking into account color blindness options.- Since:
- Beta 1.07
-
setBlueHSL
public static void setBlueHSL(boolean post, float hue, float saturation, float lightness) Sets the hue shift, saturation, and lightness for the blue color range.Note: This must be called at minimum one frame after combat is initiated, because the settings are overridden by defaults (such as color blind mode) on the first frame. Note: color blind mode is a post-shader effect.
- Parameters:
post- Selects whether the effect should apply to the pre-shader or post-shader. Set to true to affect the entire screen including UI; set to false to exclude the main UI. Effects can be independently stacked/chained between both steps, as each is a separate shader object.hue- How much, in degrees, to shift the screen's hue by, for the given color range.saturation- The desired saturation, for the given color range.lightness- The desired lightness, for the given color range.- Since:
- Beta 1.07
-
setContrast
public static void setContrast(boolean post, float amount) Sets the screen's contrast to the given amount.Note: This must be called at minimum one frame after combat is initiated, because the settings are overridden by defaults (such as color blind mode) on the first frame. Note: color blind mode is a post-shader effect.
- Parameters:
post- Selects whether the effect should apply to the pre-shader or post-shader. Set to true to affect the entire screen including UI; set to false to exclude the main UI. Effects can be independently stacked/chained between both steps, as each is a separate shader object.amount- The desired contrast. 1 is the default; 0 is completely gray.- Since:
- Beta 1.07
-
setGreenHSL
public static void setGreenHSL(boolean post, float hue, float saturation, float lightness) Sets the hue shift, saturation, and lightness for the green color range.Note: This must be called at minimum one frame after combat is initiated, because the settings are overridden by defaults (such as color blind mode) on the first frame. Note: color blind mode is a post-shader effect.
- Parameters:
post- Selects whether the effect should apply to the pre-shader or post-shader. Set to true to affect the entire screen including UI; set to false to exclude the main UI. Effects can be independently stacked/chained between both steps, as each is a separate shader object.hue- How much, in degrees, to shift the screen's hue by, for the given color range.saturation- The desired saturation, for the given color range.lightness- The desired lightness, for the given color range.- Since:
- Beta 1.07
-
setHueShift
public static void setHueShift(boolean post, float degrees) Shifts the screen's hue by the given amount.Note: This must be called at minimum one frame after combat is initiated, because the settings are overridden by defaults (such as color blind mode) on the first frame. Note: color blind mode is a post-shader effect.
- Parameters:
post- Selects whether the effect should apply to the pre-shader or post-shader. Set to true to affect the entire screen including UI; set to false to exclude the main UI. Effects can be independently stacked/chained between both steps, as each is a separate shader object.degrees- How much, in degrees, to shift the screen's hue by. For reference, 0 degrees is red, 120 degrees is green, and 240 degrees is blue.- Since:
- Beta 1.07
-
setLightness
public static void setLightness(boolean post, float amount) Sets the screen's lightness to the given amount.Note: This must be called at minimum one frame after combat is initiated, because the settings are overridden by defaults (such as color blind mode) on the first frame. Note: color blind mode is a post-shader effect.
- Parameters:
post- Selects whether the effect should apply to the pre-shader or post-shader. Set to true to affect the entire screen including UI; set to false to exclude the main UI. Effects can be independently stacked/chained between both steps, as each is a separate shader object.amount- The desired lightness. 1 is the default; 0 is completely black.- Since:
- Beta 1.07
-
setMagentaHSL
public static void setMagentaHSL(boolean post, float hue, float saturation, float lightness) Sets the hue shift, saturation, and lightness for the magenta color range.Note: This must be called at minimum one frame after combat is initiated, because the settings are overridden by defaults (such as color blind mode) on the first frame. Note: color blind mode is a post-shader effect.
- Parameters:
post- Selects whether the effect should apply to the pre-shader or post-shader. Set to true to affect the entire screen including UI; set to false to exclude the main UI. Effects can be independently stacked/chained between both steps, as each is a separate shader object.hue- How much, in degrees, to shift the screen's hue by, for the given color range.saturation- The desired saturation, for the given color range.lightness- The desired lightness, for the given color range.- Since:
- Beta 1.07
-
setNoise
public static void setNoise(boolean post, float amount) Gives the screen some degree of black noise.Note: This must be called at minimum one frame after combat is initiated, because the settings are overridden by defaults (such as color blind mode) on the first frame. Note: color blind mode is a post-shader effect.
- Parameters:
post- Selects whether the effect should apply to the pre-shader or post-shader. Set to true to affect the entire screen including UI; set to false to exclude the main UI. Effects can be independently stacked/chained between both steps, as each is a separate shader object.amount- The desired screen noise intensity. 0 is the default (off); 1 is completely noisy.- Since:
- Beta 1.07
-
setRedHSL
public static void setRedHSL(boolean post, float hue, float saturation, float lightness) Sets the hue shift, saturation, and lightness for the red color range.Note: This must be called at minimum one frame after combat is initiated, because the settings are overridden by defaults (such as color blind mode) on the first frame. Note: color blind mode is a post-shader effect.
- Parameters:
post- Selects whether the effect should apply to the pre-shader or post-shader. Set to true to affect the entire screen including UI; set to false to exclude the main UI. Effects can be independently stacked/chained between both steps, as each is a separate shader object.hue- How much, in degrees, to shift the screen's hue by, for the given color range.saturation- The desired saturation, for the given color range.lightness- The desired lightness, for the given color range.- Since:
- Beta 1.07
-
setSaturation
public static void setSaturation(boolean post, float amount) Sets the screen's color saturation to the given amount.Note: This must be called at minimum one frame after combat is initiated, because the settings are overridden by defaults (such as color blind mode) on the first frame. Note: color blind mode is a post-shader effect.
- Parameters:
post- Selects whether the effect should apply to the pre-shader or post-shader. Set to true to affect the entire screen including UI; set to false to exclude the main UI. Effects can be independently stacked/chained between both steps, as each is a separate shader object.amount- The desired saturation. 1 is the default; 0 is completely monochrome.- Since:
- Beta 1.07
-
setScanLines
public static void setScanLines(boolean post, float amount, int interval, int width) Gives the screen CRT-style scan lines.Note: This must be called at minimum one frame after combat is initiated, because the settings are overridden by defaults (such as color blind mode) on the first frame. Note: color blind mode is a post-shader effect.
- Parameters:
post- Selects whether the effect should apply to the pre-shader or post-shader. Set to true to affect the entire screen including UI; set to false to exclude the main UI. Effects can be independently stacked/chained between both steps, as each is a separate shader object.amount- The desired scan line intensity. 0 is the default (off); 1 is completely black.interval- The interval, given in rows of pixels, by which scan lines are generated. For example, interval 3 means that there is one scan line per three rows of pixels.width- The width, in rows of pixels, of each scan line.- Since:
- Beta 1.07
-
setTealHSL
public static void setTealHSL(boolean post, float hue, float saturation, float lightness) Sets the hue shift, saturation, and lightness for the teal color range.Note: This must be called at minimum one frame after combat is initiated, because the settings are overridden by defaults (such as color blind mode) on the first frame. Note: color blind mode is a post-shader effect.
- Parameters:
post- Selects whether the effect should apply to the pre-shader or post-shader. Set to true to affect the entire screen including UI; set to false to exclude the main UI. Effects can be independently stacked/chained between both steps, as each is a separate shader object.hue- How much, in degrees, to shift the screen's hue by, for the given color range.saturation- The desired saturation, for the given color range.lightness- The desired lightness, for the given color range.- Since:
- Beta 1.07
-
setYellowHSL
public static void setYellowHSL(boolean post, float hue, float saturation, float lightness) Sets the hue shift, saturation, and lightness for the yellow color range.Note: This must be called at minimum one frame after combat is initiated, because the settings are overridden by defaults (such as color blind mode) on the first frame. Note: color blind mode is a post-shader effect.
- Parameters:
post- Selects whether the effect should apply to the pre-shader or post-shader. Set to true to affect the entire screen including UI; set to false to exclude the main UI. Effects can be independently stacked/chained between both steps, as each is a separate shader object.hue- How much, in degrees, to shift the screen's hue by, for the given color range.saturation- The desired saturation, for the given color range.lightness- The desired lightness, for the given color range.- Since:
- Beta 1.07
-
useExponentialDarkness
public static void useExponentialDarkness(boolean post, boolean value) Sets the lightness function to use an exponential curve when lightness is below 1. Note: If lightness is above 1, an exponential curve is always used.Note: This must be called at minimum one frame after combat is initiated, because the settings are overridden by defaults (such as color blind mode) on the first frame. Note: color blind mode is a post-shader effect.
- Parameters:
post- Selects whether the effect should apply to the pre-shader or post-shader. Set to true to affect the entire screen including UI; set to false to exclude the main UI. Effects can be independently stacked/chained between both steps, as each is a separate shader object.value- Whether to use exponential darkness. Default off.- Since:
- Beta 1.07
-
useExponentialDesaturation
public static void useExponentialDesaturation(boolean post, boolean value) Sets the saturation function to use an exponential curve when saturation is below 1. Note: If saturation is above 1, an exponential curve is always used.Note: This must be called at minimum one frame after combat is initiated, because the settings are overridden by defaults (such as color blind mode) on the first frame. Note: color blind mode is a post-shader effect.
- Parameters:
post- Selects whether the effect should apply to the pre-shader or post-shader. Set to true to affect the entire screen including UI; set to false to exclude the main UI. Effects can be independently stacked/chained between both steps, as each is a separate shader object.value- Whether to use exponential desaturation. Default off.- Since:
- Beta 1.07
-
advance
Description copied from interface:ShaderAPIThis method will be called for multiple shaders in a particular order, dictated by getRenderOrder(). Make sure that data updates and bookkeeping are done within an advance() method. -
destroy
public void destroy()Description copied from interface:ShaderAPIThis method is called when the current instance is destroyed, such as when the settings are reloaded. -
getRenderOrder
Description copied from interface:ShaderAPIThis method determines the order in which the shader is inserted in the rendering queue. This method is read every frame. Note that this is only used if isCombat() is false.- Specified by:
getRenderOrderin interfaceShaderAPI- Returns:
- The order by which the shader will render.
-
initCombat
public void initCombat()Description copied from interface:ShaderAPIThis method is called at the beginning of each combat instance.- Specified by:
initCombatin interfaceShaderAPI
-
isEnabled
public boolean isEnabled()Description copied from interface:ShaderAPIThis method returns whether this shader is enabled or not. -
renderInScreenCoords
public void renderInScreenCoords(com.fs.starfarer.api.combat.ViewportAPI viewport) Description copied from interface:ShaderAPIThis method is called before advance() and before the UI is drawn. Warning: only called if isCombat() is false!- Specified by:
renderInScreenCoordsin interfaceShaderAPI- Parameters:
viewport- The screen-based coordinates to draw with.
-
renderInWorldCoords
public void renderInWorldCoords(com.fs.starfarer.api.combat.ViewportAPI viewport) Description copied from interface:ShaderAPIThis method is called before advance() and before the UI is drawn.- Specified by:
renderInWorldCoordsin interfaceShaderAPI- Parameters:
viewport- The world-based coordinates to draw with.
-
getCombatLayer
public com.fs.starfarer.api.combat.CombatEngineLayers getCombatLayer()Description copied from interface:ShaderAPIThis method determines the combat rendering layer in which the shader is run. This method is read every frame. Note that this is only used if isCombat() is true.- Specified by:
getCombatLayerin interfaceShaderAPI- Returns:
- The layer in which the shader will render.
-
isCombat
public boolean isCombat()Description copied from interface:ShaderAPIThis method returns whether this shader is rendered within a combat layer or not.
-