Class Smaa
java.lang.Object
gaiasky.render.postprocess.PostProcessorEffect
gaiasky.render.postprocess.effects.Antialiasing
gaiasky.render.postprocess.effects.Smaa
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
SMAA (Subpixel Morphological Antialiasing) post-processing effect.
Three passes, each with its own shader:
- Edge detection: marks pixels where a luma edge starts (left/top).
- Blending weights: finds the ends of each edge and looks up the area to blend in the precomputed area and search lookup tables.
- Neighbourhood blending: mixes each pixel with its neighbour along the edge, only where weights exist.
assets/shader/postprocess/smaa-LICENSE.md for the license and
attribution of the shaders and the lookup tables.-
Field Summary
Fields inherited from class PostProcessorEffect
disposables, disposed, enabled, enabledInCubemap, enabledInVRModifier and TypeFieldDescriptionprotected com.badlogic.gdx.utils.Array<com.badlogic.gdx.utils.Disposable> Array of disposables.protected booleanprotected booleanprotected booleanprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionSmaa(int viewportWidth, int viewportHeight, int quality) Creates the SMAA effect. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()Default implementation uses the resources in the disposables list.voidrebind()Concrete objects shall be responsible to recreate or rebind its own resources whenever its needed, usually when the OpenGL context is lost.voidrender(com.badlogic.gdx.graphics.glutils.FrameBuffer src, com.badlogic.gdx.graphics.glutils.FrameBuffer dest, GaiaSkyFrameBuffer full, GaiaSkyFrameBuffer half) Concrete objects shall implement its own rendering, given the source and destination buffers.voidsetViewportSize(int width, int height) voidupdateQuality(int quality) Updates the SMAA quality setting.voidRe-compiles the shaders of all filters in this effect.Methods inherited from class PostProcessorEffect
isEnabled, isEnabledInCubemap, isEnabledInVR, restoreViewport, setEnabled, setEnabledInCubemap, setEnabledInVR, setEnabledOptionsModifier and TypeMethodDescriptionbooleanWhether this effect is enabled and should be processed.booleanbooleanprotected voidrestoreViewport(com.badlogic.gdx.graphics.glutils.FrameBuffer dest) Convenience method to forward the call to the PostProcessor object while still being a non-publicly accessible method.voidsetEnabled(boolean enabled) Sets this effect enabled or not.voidsetEnabledInCubemap(boolean enabled) voidsetEnabledInVR(boolean enabled) voidsetEnabledOptions(boolean enabledInCubemap, boolean enabledInVR)
-
Constructor Details
-
Smaa
public Smaa(int viewportWidth, int viewportHeight, int quality) Creates the SMAA effect.- Parameters:
viewportWidth- The viewport width in pixels.viewportHeight- The viewport height in pixels.quality- The quality in [0,1,2], from worst to best.
-
-
Method Details
-
setViewportSize
public void setViewportSize(int width, int height) - Specified by:
setViewportSizein classAntialiasing
-
updateQuality
public void updateQuality(int quality) Updates the SMAA quality setting. Changing the quality requires new shader programs, so the filters are recreated.- Specified by:
updateQualityin classAntialiasing- Parameters:
quality- The quality in [0,1,2], from worst to best.
-
rebind
public void rebind()Description copied from class:PostProcessorEffectConcrete objects shall be responsible to recreate or rebind its own resources whenever its needed, usually when the OpenGL context is lost. E.g., frame buffer textures should be updated and shader parameters should be re-uploaded/rebound.- Specified by:
rebindin classPostProcessorEffect
-
render
public void render(com.badlogic.gdx.graphics.glutils.FrameBuffer src, com.badlogic.gdx.graphics.glutils.FrameBuffer dest, GaiaSkyFrameBuffer full, GaiaSkyFrameBuffer half) Description copied from class:PostProcessorEffectConcrete objects shall implement its own rendering, given the source and destination buffers.- Specified by:
renderin classPostProcessorEffect
-
updateShaders
public void updateShaders()Description copied from class:PostProcessorEffectRe-compiles the shaders of all filters in this effect.- Overrides:
updateShadersin classPostProcessorEffect
-
dispose
public void dispose()Description copied from class:PostProcessorEffectDefault implementation uses the resources in the disposables list.- Specified by:
disposein interfacecom.badlogic.gdx.utils.Disposable- Overrides:
disposein classPostProcessorEffect
-