Package gaiasky.scene.system.render
Class SceneRenderer
java.lang.Object
gaiasky.scene.system.render.SceneRenderer
- All Implemented Interfaces:
IObserver
,ISceneRenderer
Initializes the render infrastructure renders the scene using different render systems.
-
Field Summary
Modifier and TypeFieldDescriptionfloat[]
Alpha values for each type.com.badlogic.gdx.graphics.glutils.FrameBuffer[][]
Map<com.badlogic.ashley.core.Entity,
com.badlogic.gdx.math.Matrix4> Map containing the combined matrix for each model body.Map<com.badlogic.ashley.core.Entity,
com.badlogic.gdx.graphics.Texture> Map containing the shadow map for each model body.long[]
Contains the last update time of each of the flagsContains the flags representing each type's visibility -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
allOn
(ComponentTypes comp) Checks if the component types are all onfloat
alpha
(ComponentTypes comp) Computes the alpha of this component types by multiplying the alphas of all componentsvoid
dispose()
void
doneLoading
(com.badlogic.gdx.assets.AssetManager manager) Actually initializes all the clockwork of this renderer using the assets in the given manager.com.badlogic.gdx.graphics.glutils.FrameBuffer
Returns the post-processing glow frame buffer.Gets the current render process.void
initialize
(com.badlogic.gdx.assets.AssetManager manager) Initializes the renderer, sending all the necessary assets to the manager for loading.boolean
isOn
(int ordinal) boolean
Checks if a given component type is onvoid
Event notification call.void
render
(ICamera camera, double t, int rw, int rh, int tw, int th, com.badlogic.gdx.graphics.glutils.FrameBuffer fb, IPostProcessor.PostProcessBean ppb) void
renderGlowPass
(ICamera camera, com.badlogic.gdx.graphics.glutils.FrameBuffer frameBuffer) Renders the glow pass for the light glow.Returnst he render lists of this renderer.void
renderScene
(ICamera camera, double t, RenderingContext renderContext) Renders the scene.protected void
renderSystem
(ICamera camera, double t, RenderingContext renderContext, Class<? extends IRenderSystem> systemClass) Renders all the systems which are of the given class.protected void
renderSystems
(ICamera camera, double t, RenderingContext renderContext, Class<?>... systemClasses) Renders all the systems which are of one of the given classes.void
Resets the render flags for all systems.void
resize
(int tw, int th, int rw, int rh) Resizes the scene renderer and all its sub-renderers and assets, but not the render systems.void
resize
(int tw, int th, int rw, int rh, boolean resizeRenderSys) Resizes the scene renderer and all its sub-renderers and assets.void
resizeRenderSystems
(int tw, int th, int rw, int rh) Resizes the render systems of this renderer.void
setRendering
(boolean rendering) void
This must be called when all the rendering for the current frame has finished.void
-
Field Details
-
visible
Contains the flags representing each type's visibility -
times
public long[] timesContains the last update time of each of the flags -
alphas
public float[] alphasAlpha values for each type. -
shadowMapFb
public com.badlogic.gdx.graphics.glutils.FrameBuffer[][] shadowMapFb -
smTexMap
Map containing the shadow map for each model body. -
smCombinedMap
Map containing the combined matrix for each model body.
-
-
Constructor Details
-
SceneRenderer
-
-
Method Details
-
initialize
public void initialize(com.badlogic.gdx.assets.AssetManager manager) Description copied from interface:ISceneRenderer
Initializes the renderer, sending all the necessary assets to the manager for loading.- Specified by:
initialize
in interfaceISceneRenderer
- Parameters:
manager
- The asset manager.
-
doneLoading
public void doneLoading(com.badlogic.gdx.assets.AssetManager manager) Description copied from interface:ISceneRenderer
Actually initializes all the clockwork of this renderer using the assets in the given manager.- Specified by:
doneLoading
in interfaceISceneRenderer
- Parameters:
manager
- The asset manager.
-
setRendering
public void setRendering(boolean rendering) -
renderListsFront
Description copied from interface:ISceneRenderer
Returnst he render lists of this renderer.- Specified by:
renderListsFront
in interfaceISceneRenderer
-
renderListsBack
-
renderGlowPass
public void renderGlowPass(ICamera camera, com.badlogic.gdx.graphics.glutils.FrameBuffer frameBuffer) Description copied from interface:ISceneRenderer
Renders the glow pass for the light glow.- Specified by:
renderGlowPass
in interfaceISceneRenderer
- Parameters:
camera
- The camera.frameBuffer
- The frame buffer.
-
render
public void render(ICamera camera, double t, int rw, int rh, int tw, int th, com.badlogic.gdx.graphics.glutils.FrameBuffer fb, IPostProcessor.PostProcessBean ppb) -
getRenderProcess
Description copied from interface:ISceneRenderer
Gets the current render process.- Specified by:
getRenderProcess
in interfaceISceneRenderer
- Returns:
- The render mode.
-
getGlowFrameBuffer
public com.badlogic.gdx.graphics.glutils.FrameBuffer getGlowFrameBuffer()Description copied from interface:ISceneRenderer
Returns the post-processing glow frame buffer.- Specified by:
getGlowFrameBuffer
in interfaceISceneRenderer
- Returns:
- The glow frame buffer.
-
renderScene
Renders the scene.- Specified by:
renderScene
in interfaceISceneRenderer
- Parameters:
camera
- The camera to use.t
- The time in seconds since the start.renderContext
- The render context.
-
renderSystem
protected void renderSystem(ICamera camera, double t, RenderingContext renderContext, Class<? extends IRenderSystem> systemClass) Renders all the systems which are of the given class.- Parameters:
camera
- The camera to use.t
- The time in seconds since the start.renderContext
- The render context.systemClass
- The class.
-
renderSystems
protected void renderSystems(ICamera camera, double t, RenderingContext renderContext, Class<?>... systemClasses) Renders all the systems which are of one of the given classes.- Parameters:
camera
- The camera to use.t
- The time in seconds since the start.renderContext
- The render context.systemClasses
- The classes.
-
swapRenderLists
public void swapRenderLists()This must be called when all the rendering for the current frame has finished. -
isOn
Checks if a given component type is on- Specified by:
isOn
in interfaceISceneRenderer
- Parameters:
comp
- The component- Returns:
- Whether the component is on
-
allOn
Checks if the component types are all on- Specified by:
allOn
in interfaceISceneRenderer
- Parameters:
comp
- The components- Returns:
- Whether the components are all on
-
alpha
Computes the alpha of this component types by multiplying the alphas of all components- Parameters:
comp
- The components- Returns:
- The alpha value
-
isOn
public boolean isOn(int ordinal) -
notify
Description copied from interface:IObserver
Event notification call. -
resize
public void resize(int tw, int th, int rw, int rh) Resizes the scene renderer and all its sub-renderers and assets, but not the render systems.- Parameters:
tw
- New target (screen) width.th
- New target (screen) height.rw
- New render buffer width.rh
- New render buffer height.
-
resize
public void resize(int tw, int th, int rw, int rh, boolean resizeRenderSys) Resizes the scene renderer and all its sub-renderers and assets.- Parameters:
tw
- New target (screen) width.th
- New target (screen) height.rw
- New render buffer width.rh
- New render buffer height.resizeRenderSys
- Also resize all render systems.
-
resizeRenderSystems
public void resizeRenderSystems(int tw, int th, int rw, int rh) Resizes the render systems of this renderer.- Parameters:
tw
- New target (screen) width.th
- New target (screen) height.rw
- New render buffer width.rh
- New render buffer height.
-
dispose
public void dispose() -
updateLineRenderSystem
public void updateLineRenderSystem() -
resetRenderSystemFlags
public void resetRenderSystemFlags()Resets the render flags for all systems.
-