Class GlowFilter
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
A filter that implements a glow effect using a shader.
This filter takes light sources (positions, intensities, and colors) and the depth buffer of the
scene to render a glow effect occluded by the objects in front of each light. It is used as a
sub-component of the LightGlow effect.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class Filter
Filter.Parameter -
Field Summary
Fields inherited from class Filter
defines, fragmentShaderName, inputBuffer, inputTexture, outputBuffer, program, quad, u_texture0, u_texture1, u_texture2, u_texture3, vertexShaderNameModifier and TypeFieldDescriptionprotected Stringprotected Stringprotected com.badlogic.gdx.graphics.glutils.FrameBufferprotected com.badlogic.gdx.graphics.Textureprotected com.badlogic.gdx.graphics.glutils.FrameBufferprotected com.badlogic.gdx.graphics.glutils.ShaderProgramprotected static final FullscreenQuadprotected static final intprotected static final intprotected static final intprotected static final intprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.badlogic.gdx.graphics.Texturecom.badlogic.gdx.graphics.Textureprotected voidThis method will get called just before a rendering operation occurs.voidrebind()voidsetBackBufferScale(float s) voidsetDepthTexelSize(float width, float height) Sets the size of one texel of the depth buffer, in uv coordinates.voidsetDepthTexture(com.badlogic.gdx.graphics.Texture tex) voidsetFovFactor(float fovFactor) Sets the field of view factor of the camera.voidsetLightColors(float[] colors) voidsetLightDepths(float[] depths) Sets the distance from the camera to each light, in the same space as the depth buffer.voidsetLightGlowTexture(com.badlogic.gdx.graphics.Texture tex) voidsetLightIntensities(float[] intensities) Sets the glow intensity of each light, in [0,1], computed from its apparent magnitude.voidsetLightPositions(int nLights, float[] vec) voidsetLightViewAngles(float[] ang) voidsetNLights(int nLights) voidsetOcclusionEnabled(boolean enabled) Enables or disables the occlusion of the lights by the geometry in front of them.voidsetTextureScale(float scl) Sets the maximum halo radius, in pixels at the reference height.voidsetViewportSize(float width, float height) voidsetZFarK(float zfar, float k) Sets the z-far and K of the logarithmic depth buffer, to recover a distance from a depth value.Methods inherited from class Filter
dispose, endParams, realRender, render, setInput, setInput, setOutput, setParam, setParam, setParam, setParam, setParam, setParam, setParam, setParam, setParam, setParams, setParams, setParams, setParams, setParams, setParams, setParams, setParams, setParams, setParamsv, setParamv, updateProgram, updateProgramModifier and TypeMethodDescriptionvoiddispose()protected voidShould be called after any one or more setParams method calls.protected voidfinal voidrender()setInput(com.badlogic.gdx.graphics.glutils.FrameBuffer input) setInput(com.badlogic.gdx.graphics.Texture input) setOutput(com.badlogic.gdx.graphics.glutils.FrameBuffer output) protected voidsetParam(Filter.Parameter param, boolean value) protected voidsetParam(Filter.Parameter param, float value) protected voidsetParam(Filter.Parameter param, int value) protected voidsetParam(Filter.Parameter param, com.badlogic.gdx.graphics.Color value) protected GlowFiltersetParam(Filter.Parameter param, com.badlogic.gdx.math.Matrix3 value) protected GlowFiltersetParam(Filter.Parameter param, com.badlogic.gdx.math.Matrix4 value) protected voidsetParam(Filter.Parameter param, com.badlogic.gdx.math.Vector2 value) protected voidsetParam(Filter.Parameter param, com.badlogic.gdx.math.Vector3 value) protected voidsetParam(Filter.Parameter param, com.badlogic.gdx.math.Vector4 value) protected GlowFiltersetParams(Filter.Parameter param, boolean value) protected GlowFiltersetParams(Filter.Parameter param, float value) Sets the parameter to the specified value for this filter.protected GlowFiltersetParams(Filter.Parameter param, int value) protected GlowFiltersetParams(Filter.Parameter param, com.badlogic.gdx.graphics.Color value) protected GlowFiltersetParams(Filter.Parameter param, com.badlogic.gdx.math.Matrix3 value) protected GlowFiltersetParams(Filter.Parameter param, com.badlogic.gdx.math.Matrix4 value) protected GlowFiltersetParams(Filter.Parameter param, com.badlogic.gdx.math.Vector2 value) protected GlowFiltersetParams(Filter.Parameter param, com.badlogic.gdx.math.Vector3 value) protected GlowFiltersetParams(Filter.Parameter param, com.badlogic.gdx.math.Vector4 value) protected GlowFiltersetParamsv(Filter.Parameter param, float[] values, int offset, int length) protected GlowFiltersetParamv(Filter.Parameter param, float[] values, int offset, int length) voidDisposes the current shader, reloads it from disk and re-compiles it.voidupdateProgram(com.badlogic.gdx.graphics.glutils.ShaderProgram program) Caution, disposes of the current program and updates it with the new one.
-
Constructor Details
-
GlowFilter
public GlowFilter(int width, int height)
-
-
Method Details
-
setBackBufferScale
public void setBackBufferScale(float s) -
setFovFactor
public void setFovFactor(float fovFactor) Sets the field of view factor of the camera. -
setViewportSize
public void setViewportSize(float width, float height) -
setLightPositions
public void setLightPositions(int nLights, float[] vec) -
setNLights
public void setNLights(int nLights) -
setLightViewAngles
public void setLightViewAngles(float[] ang) -
setLightIntensities
public void setLightIntensities(float[] intensities) Sets the glow intensity of each light, in [0,1], computed from its apparent magnitude. -
setLightDepths
public void setLightDepths(float[] depths) Sets the distance from the camera to each light, in the same space as the depth buffer. -
setZFarK
public void setZFarK(float zfar, float k) Sets the z-far and K of the logarithmic depth buffer, to recover a distance from a depth value. -
setDepthTexelSize
public void setDepthTexelSize(float width, float height) Sets the size of one texel of the depth buffer, in uv coordinates. -
setOcclusionEnabled
public void setOcclusionEnabled(boolean enabled) Enables or disables the occlusion of the lights by the geometry in front of them. -
setLightColors
public void setLightColors(float[] colors) -
setTextureScale
public void setTextureScale(float scl) Sets the maximum halo radius, in pixels at the reference height. -
getLightGlowTexture
public com.badlogic.gdx.graphics.Texture getLightGlowTexture() -
setLightGlowTexture
public void setLightGlowTexture(com.badlogic.gdx.graphics.Texture tex) -
getDepthTexture
public com.badlogic.gdx.graphics.Texture getDepthTexture() -
setDepthTexture
public void setDepthTexture(com.badlogic.gdx.graphics.Texture tex) -
rebind
public void rebind()- Specified by:
rebindin classFilter<GlowFilter>
-
onBeforeRender
protected void onBeforeRender()Description copied from class:FilterThis method will get called just before a rendering operation occurs.- Specified by:
onBeforeRenderin classFilter<GlowFilter>
-