Package arc.fx
Class FxProcessor
java.lang.Object
arc.fx.FxProcessor
- All Implemented Interfaces:
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 Summary
ConstructorDescriptionFxProcessor
(int w, int h) FxProcessor
(Pixmap.Format fboFormat, int bufferWidth, int bufferHeight) FxProcessor
(Pixmap.Format fboFormat, int bufferWidth, int bufferHeight, boolean depth, boolean stencil) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an effect to the effect chain and transfers ownership to the VfxManager.void
void
Applies the effect chain, if there is one.boolean
begin()
Starts capturing the scene.void
clear()
Cleans up managedPingPongBuffer
s' withColor.clear
.void
Cleans up managedPingPongBuffer
s' with specified color.void
dispose()
Releases all resources of this object.boolean
end()
Stops capturing the scene.Returns the internal framebuffer format, computed from the parameters specified during construction.int
int
getWidth()
boolean
boolean
boolean
boolean
boolean
boolean
void
rebind()
void
Removes all effects from the effect chain.void
removeEffect
(FxFilter effect) Removes the specified effect from the effect chain.void
render()
void
render
(int x, int y, int width, int height) void
render
(FrameBuffer output) void
resize
(int width, int height) void
setBlendingEnabled
(boolean blendingEnabled) Enables OpenGL blending for the effect chain rendering stage.void
setBufferTextureParams
(Texture.TextureWrap u, Texture.TextureWrap v, Texture.TextureFilter min, Texture.TextureFilter mag) void
setDisabled
(boolean disabled) Sets whether or not the post-processor should be disabledvoid
setEffectPriority
(FxFilter effect, int priority) Changes the order of the effect in the effect chain.void
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface arc.util.Disposable
isDisposed
-
Constructor Details
-
FxProcessor
public FxProcessor() -
FxProcessor
public FxProcessor(int w, int h) -
FxProcessor
-
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 interfaceDisposable
-
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
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
-
isCapturing
public boolean isCapturing() -
isApplyingEffects
public boolean isApplyingEffects() -
hasResult
public boolean hasResult() -
getResultBuffer
- Returns:
- the last active destination buffer.
-
getPingPongBuffer
- Returns:
- the internal ping-pong buffer.
-
hasEnabledEffects
public boolean hasEnabledEffects() -
addEffect
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
-
removeEffect
Removes the specified effect from the effect chain. -
removeAllEffects
public void removeAllEffects()Removes all effects from the effect chain. -
setEffectPriority
Changes the order of the effect in the effect chain. -
clear
public void clear()Cleans up managedPingPongBuffer
s' withColor.clear
. -
clear
Cleans up managedPingPongBuffer
s' 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
-