Package gaiasky.render.system
Class AbstractRenderSystem
java.lang.Object
gaiasky.render.system.AbstractRenderSystem
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
,IRenderSystem
,Comparable<IRenderSystem>
- Direct Known Subclasses:
BillboardRenderer
,FontRenderSystem
,ImmediateModeRenderSystem
,ModelRenderer
,ParticleSystemRenderSystem
,ShapeRenderer
,TessellationRenderer
public abstract class AbstractRenderSystem
extends Object
implements IRenderSystem, Comparable<IRenderSystem>
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected final float[]
protected final Vector3d
protected final com.badlogic.gdx.math.Vector3
protected Comparator
<IRenderable> Comparator of renderables, in case of needprotected com.badlogic.gdx.utils.Array
<AbstractRenderSystem.RenderSystemRunnable> protected com.badlogic.gdx.utils.Array
<AbstractRenderSystem.RenderSystemRunnable> protected final ExtShaderProgram[]
protected final SceneRenderer
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractRenderSystem
(SceneRenderer sceneRenderer, RenderGroup rg, float[] alphas, ExtShaderProgram[] programs) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addCameraUpCubemapMode
(ExtShaderProgram shaderProgram, ICamera camera) Adds the camera up vector (only in non-cubemap mode) to compute the billboard rotation.protected void
addDepthBufferUniforms
(ExtShaderProgram shaderProgram, ICamera camera) Uniforms needed to compute the logarithmic depth buffer.protected void
addEffectsUniforms
(ExtShaderProgram shaderProgram, ICamera camera) protected void
addGravWaveUniforms
(ExtShaderProgram shaderProgram) void
void
protected void
addPreviousFrameUniforms
(ExtShaderProgram shaderProgram, ICamera camera) Uniforms needed for the velocity bufferprotected void
addRelativisticUniforms
(ExtShaderProgram shaderProgram, ICamera camera) protected void
addVRScale
(ExtShaderProgram shaderProgram) int
void
dispose()
float
getAlpha
(com.badlogic.ashley.core.Entity entity) float
getAlpha
(IRenderable renderable) Computes the alpha opacity value of a given renderable using its component typesfloat
protected ExtShaderProgram
protected ExtShaderProgram
getShaderProgram
(ExtShaderProgram[] programs) protected void
Initializes metadata or essential uniforms in the shader program.void
render
(List<IRenderable> renderables, ICamera camera, double t, RenderingContext rc) Renders the given list of renderable objects.abstract void
renderStud
(List<IRenderable> renderables, ICamera camera, double t) void
void
resize
(int w, int h) Resize the current render target with the given width and height.protected void
run
(com.badlogic.gdx.utils.Array<AbstractRenderSystem.RenderSystemRunnable> runnables, List<IRenderable> renderables, ICamera camera) void
updateBatchSize
(int w, int h) Updates the size of object batches, if any.
-
Field Details
-
sceneRenderer
-
programs
-
alphas
protected final float[] alphas -
rc
-
comp
Comparator of renderables, in case of need -
preRunners
-
postRunners
-
auxf
protected final com.badlogic.gdx.math.Vector3 auxf -
auxd
-
-
Constructor Details
-
AbstractRenderSystem
protected AbstractRenderSystem(SceneRenderer sceneRenderer, RenderGroup rg, float[] alphas, ExtShaderProgram[] programs)
-
-
Method Details
-
getRenderGroup
- Specified by:
getRenderGroup
in interfaceIRenderSystem
-
render
Description copied from interface:IRenderSystem
Renders the given list of renderable objects.- Specified by:
render
in interfaceIRenderSystem
- Parameters:
renderables
- The list of objects to render.camera
- The camera object.t
- The time, in seconds, since the session start.rc
- The rendering context object.
-
renderStud
-
addPreRunnables
-
addPostRunnables
-
run
protected void run(com.badlogic.gdx.utils.Array<AbstractRenderSystem.RenderSystemRunnable> runnables, List<IRenderable> renderables, ICamera camera) -
getAlpha
Computes the alpha opacity value of a given renderable using its component types- Parameters:
renderable
- The renderable- Returns:
- The alpha value as the product of all the alphas of its component types.
-
getAlpha
public float getAlpha(com.badlogic.ashley.core.Entity entity) -
getAlpha
-
resize
public void resize(int w, int h) Description copied from interface:IRenderSystem
Resize the current render target with the given width and height.- Specified by:
resize
in interfaceIRenderSystem
- Parameters:
w
- The new width.h
- The new height.
-
updateBatchSize
public void updateBatchSize(int w, int h) Description copied from interface:IRenderSystem
Updates the size of object batches, if any.- Specified by:
updateBatchSize
in interfaceIRenderSystem
- Parameters:
w
- The new width.h
- The new height.
-
addEffectsUniforms
-
addVRScale
-
addRelativisticUniforms
-
addGravWaveUniforms
-
addDepthBufferUniforms
Uniforms needed to compute the logarithmic depth buffer. They never change, so only add if not present.- Parameters:
shaderProgram
- The program.camera
- The camera.
-
addPreviousFrameUniforms
Uniforms needed for the velocity buffer- Parameters:
shaderProgram
- The programcamera
- The camera
-
addCameraUpCubemapMode
Adds the camera up vector (only in non-cubemap mode) to compute the billboard rotation. In regular mode, we use the camera up vector to have screen-aligned billboards. In cubemap mode(s), we use a global up direction.- Parameters:
shaderProgram
- The program.camera
- The camera.
-
getShaderProgram
-
getShaderProgram
-
initShaderProgram
protected void initShaderProgram()Initializes metadata or essential uniforms in the shader program. -
dispose
public void dispose()- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
-
resetFlags
public void resetFlags() -
compareTo
- Specified by:
compareTo
in interfaceComparable<IRenderSystem>
-