Package org.dark.shaders.distortion
Interface DistortionAPI
- All Known Implementing Classes:
RippleDistortion,WaveDistortion
public interface DistortionAPI
An interface for managing distortion textures in the distortion shader.
- Since:
- Alpha 1.1
-
Method Summary
Modifier and TypeMethodDescriptionbooleanadvance(float amount) Runs once per frame.floatThe width of the visible arc's edge attenuation, in degrees.floatThe end of the current visible arc of the distortion, in degrees.floatThe start of the current visible arc of the distortion, in degrees.floatThe current facing direction of the distortion, in degrees.floatReturns the world-space quantity, in units, to distort by at the maximum distortion level (blue channel at 255).org.lwjgl.util.vector.Vector2fReturns the current location of the distortion.com.fs.starfarer.api.graphics.SpriteAPIThe sprite used to draw the distortion texture.booleanWhether the distortion should be flipped in magnitude.
-
Method Details
-
getIntensity
float getIntensity()Returns the world-space quantity, in units, to distort by at the maximum distortion level (blue channel at 255). The distortion engine will handle the transformation for you. Note that this function refers to the intensity scale of the distortion texture, not its size. Modify the texture's sprite directly to change its size directly.- Returns:
- The scaling factor to transform the blue channel by, in world space units.
- Since:
- Alpha 1.1
-
getLocation
org.lwjgl.util.vector.Vector2f getLocation()Returns the current location of the distortion.- Returns:
- The current location of the distortion.
- Since:
- Alpha 1.1
-
getFacing
float getFacing()The current facing direction of the distortion, in degrees. Should generally match the sprite's rotation.- Returns:
- The current facing direction of the distortion.
- Since:
- Alpha 1.1
-
getSprite
com.fs.starfarer.api.graphics.SpriteAPI getSprite()The sprite used to draw the distortion texture. The red channel corresponds to horizontal distortion vector, while the green channel corresponds to vertical distortion vector. The engine will normalize these values for you. The blue channel corresponds to distortion magnitude. For example, a pure white square as a distortion texture will copy a square of pixels somewhere to the top-right of the screen.- Returns:
- The sprite used to draw the distortion texture.
- Since:
- Alpha 1.1
-
isFlipped
boolean isFlipped()Whether the distortion should be flipped in magnitude. This simulates the effect of performing a horizontal-vertical inversion of the red and green color channels. For example, if the distortion normally looks like a sphere, it will instead look like a spherical hole.- Returns:
- Whether the magnitude should be flipped.
- Since:
- Alpha 1.1
-
getArcStart
float getArcStart()The start of the current visible arc of the distortion, in degrees. Note: the entire shader is visible if the arc spans 0 degrees.- Returns:
- The start of the current visible arc of the distortion, in degrees.
- Since:
- Alpha 1.11
-
getArcEnd
float getArcEnd()The end of the current visible arc of the distortion, in degrees. Note: the entire shader is visible if the arc spans 0 degrees.- Returns:
- The end of the current visible arc of the distortion, in degrees.
- Since:
- Alpha 1.11
-
getArcAttenuationWidth
float getArcAttenuationWidth()The width of the visible arc's edge attenuation, in degrees. Wider attenuation will make the transition smoother.- Returns:
- The width of the visible arc's edge attenuation, in degrees.
- Since:
- Beta 1.0
-
advance
boolean advance(float amount) Runs once per frame.- Parameters:
amount- Seconds since last frame.- Returns:
- True if the distortion object should be destroyed this frame, false if it should not be destroyed this frame.
- Since:
- Alpha 1.1
-