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,SpriteRenderer,TessellationRenderer
public abstract class AbstractRenderSystem
extends Object
implements IRenderSystem, Comparable<IRenderSystem>
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final float[]protected final com.badlogic.gdx.math.Vector3protected 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
ConstructorsModifierConstructorDescriptionprotectedAbstractRenderSystem(SceneRenderer sceneRenderer, RenderGroup rg, float[] alphas, ExtShaderProgram[] programs) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddCameraUpCubemapMode(ExtShaderProgram shaderProgram, ICamera camera) Adds the camera up vector (only in non-cubemap mode) to compute the billboard rotation.voidaddDepthBufferUniforms(ExtShaderProgram shaderProgram, ICamera camera) Uniforms needed to compute the logarithmic depth buffer.protected voidaddEffectsUniforms(ExtShaderProgram shaderProgram, ICamera camera) protected voidaddGravWaveUniforms(ExtShaderProgram shaderProgram) voidvoidprotected voidaddRelativisticUniforms(ExtShaderProgram shaderProgram, ICamera camera) protected voidaddVRScale(ExtShaderProgram shaderProgram) intvoiddispose()floatgetAlpha(com.badlogic.ashley.core.Entity entity) floatgetAlpha(IRenderable renderable) Computes the alpha opacity value of a given renderable using its component typesfloatprotected ExtShaderProgramprotected ExtShaderProgramgetShaderProgram(ExtShaderProgram[] programs) protected voidInitializes metadata or essential uniforms in the shader program.voidrender(List<IRenderable> renderables, ICamera camera, double t, RenderingContext rc) Renders the given list of renderable objects.abstract voidrenderStud(List<IRenderable> renderables, ICamera camera, double t) voidvoidresize(int w, int h) Resize the current render target with the given width and height.protected voidrun(com.badlogic.gdx.utils.Array<AbstractRenderSystem.RenderSystemRunnable> runnables, List<IRenderable> renderables, ICamera camera) voidupdateBatchSize(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
-
aux3f
protected final com.badlogic.gdx.math.Vector3 aux3f
-
-
Constructor Details
-
AbstractRenderSystem
protected AbstractRenderSystem(SceneRenderer sceneRenderer, RenderGroup rg, float[] alphas, ExtShaderProgram[] programs)
-
-
Method Details
-
getRenderGroup
- Specified by:
getRenderGroupin interfaceIRenderSystem
-
render
Description copied from interface:IRenderSystemRenders the given list of renderable objects.- Specified by:
renderin 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:IRenderSystemResize the current render target with the given width and height.- Specified by:
resizein interfaceIRenderSystem- Parameters:
w- The new width.h- The new height.
-
updateBatchSize
public void updateBatchSize(int w, int h) Description copied from interface:IRenderSystemUpdates the size of object batches, if any.- Specified by:
updateBatchSizein 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.
-
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:
disposein interfacecom.badlogic.gdx.utils.Disposable
-
resetFlags
public void resetFlags() -
compareTo
- Specified by:
compareToin interfaceComparable<IRenderSystem>
-