Package arc.fx

Class FxProcessor

java.lang.Object
arc.fx.FxProcessor
All Implemented Interfaces:
Disposable

public final class FxProcessor extends Object implements Disposable
Provides a way to beginCapture the rendered scene to an off-screen buffer and to apply a chain of effects on it before rendering to screen.

Effects can be added or removed via addEffect(FxFilter) and removeEffect(FxFilter).

  • Constructor Details

    • FxProcessor

      public FxProcessor()
    • FxProcessor

      public FxProcessor(int w, int h)
    • FxProcessor

      public FxProcessor(Pixmap.Format fboFormat, int bufferWidth, int bufferHeight)
    • FxProcessor

      public FxProcessor(Pixmap.Format fboFormat, int bufferWidth, int bufferHeight, boolean depth, boolean stencil)
  • Method Details

    • dispose

      public void dispose()
      Description copied from interface: Disposable
      Releases all resources of this object.
      Specified by:
      dispose in interface Disposable
    • resize

      public void resize(int width, int height)
    • rebind

      public void rebind()
    • getWidth

      public int getWidth()
    • getHeight

      public int getHeight()
    • isDisabled

      public boolean isDisabled()
    • setDisabled

      public void setDisabled(boolean disabled)
      Sets whether or not the post-processor should be disabled
    • isBlendingEnabled

      public boolean isBlendingEnabled()
    • setBlendingEnabled

      public void setBlendingEnabled(boolean blendingEnabled)
      Enables OpenGL blending for the effect chain rendering stage. Disabled by default.
    • getFramebufferFormat

      public Pixmap.Format getFramebufferFormat()
      Returns the internal framebuffer format, computed from the parameters specified during construction. NOTE: the returned Format will be valid after construction and NOT early!
    • setBufferTextureParams

      public void setBufferTextureParams(Texture.TextureWrap u, Texture.TextureWrap v, Texture.TextureFilter min, Texture.TextureFilter mag)
    • setTextureFilter

      public void setTextureFilter(Texture.TextureFilter filter)
    • isCapturing

      public boolean isCapturing()
    • isApplyingEffects

      public boolean isApplyingEffects()
    • hasResult

      public boolean hasResult()
    • getResultBuffer

      public FrameBuffer getResultBuffer()
      Returns:
      the last active destination buffer.
    • getPingPongBuffer

      public PingPongBuffer getPingPongBuffer()
      Returns:
      the internal ping-pong buffer.
    • hasEnabledEffects

      public boolean hasEnabledEffects()
    • addEffect

      public void addEffect(FxFilter effect)
      Adds an effect to the effect chain and transfers ownership to the VfxManager. The order of the inserted effects IS important, since effects will be applied in a FIFO fashion, the first added is the first being applied.

      For more control over the order supply the effect with a priority - addEffect(FxFilter, int).

      See Also:
    • addEffect

      public void addEffect(FxFilter effect, int priority)
    • removeEffect

      public void removeEffect(FxFilter effect)
      Removes the specified effect from the effect chain.
    • removeAllEffects

      public void removeAllEffects()
      Removes all effects from the effect chain.
    • setEffectPriority

      public void setEffectPriority(FxFilter effect, int priority)
      Changes the order of the effect in the effect chain.
    • clear

      public void clear()
      Cleans up managed PingPongBuffers' with Color.clear.
    • clear

      public void clear(Color color)
      Cleans up managed PingPongBuffers' with specified color.
    • begin

      public boolean begin()
      Starts capturing the scene.
      Returns:
      true or false, whether or not capturing has been initiated. Capturing will fail if the manager is disabled or capturing is already started.
    • end

      public boolean end()
      Stops capturing the scene.
      Returns:
      false if there was no capturing before that call.
    • applyEffects

      public void applyEffects()
      Applies the effect chain, if there is one.
    • render

      public void render()
    • render

      public void render(int x, int y, int width, int height)
    • render

      public void render(FrameBuffer output)