Class AbstractSorter
- java.lang.Object
-
- com.bombinggames.wurfelengine.core.sorting.AbstractSorter
-
- All Implemented Interfaces:
com.badlogic.gdx.ai.msg.Telegraph
- Direct Known Subclasses:
DepthValueSort
,NoSort
,TopologicalSort
public abstract class AbstractSorter extends java.lang.Object implements com.badlogic.gdx.ai.msg.Telegraph
Fills the camera content with blocks and entities into a list and sorts it in the order of the rendering, called the "depthlist". This is done every frame.
-
-
Field Summary
Fields Modifier and Type Field Description protected Camera
camera
protected GameView
gameView
protected java.util.LinkedList<RenderCell>
iteratorCache
-
Constructor Summary
Constructors Constructor Description AbstractSorter(Camera camera)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
bakeIteratorCache()
rebuilds the reference list for fields which will be called for the depthsorting.abstract void
createDepthList(java.util.LinkedList<AbstractGameObject> depthlist)
Sorts the list of game objects.protected int
getTopLevel()
get the topmost z level which should be renderedboolean
handleMessage(com.badlogic.gdx.ai.msg.Telegram msg)
abstract void
renderSorted()
Renders in sorted ordervoid
updateCacheIfOutdated()
updates the iterator cache.
-
-
-
Field Detail
-
camera
protected final Camera camera
-
iteratorCache
protected final java.util.LinkedList<RenderCell> iteratorCache
-
gameView
protected final GameView gameView
-
-
Constructor Detail
-
AbstractSorter
public AbstractSorter(Camera camera)
-
-
Method Detail
-
createDepthList
public abstract void createDepthList(java.util.LinkedList<AbstractGameObject> depthlist)
Sorts the list of game objects.- Parameters:
depthlist
-
-
renderSorted
public abstract void renderSorted()
Renders in sorted order
-
handleMessage
public boolean handleMessage(com.badlogic.gdx.ai.msg.Telegram msg)
- Specified by:
handleMessage
in interfacecom.badlogic.gdx.ai.msg.Telegraph
-
updateCacheIfOutdated
public void updateCacheIfOutdated()
updates the iterator cache. Gets called when the center of the camera changed.- See Also:
bakeIteratorCache()
-
bakeIteratorCache
protected void bakeIteratorCache()
rebuilds the reference list for fields which will be called for the depthsorting.
-
getTopLevel
protected int getTopLevel()
get the topmost z level which should be rendered- Returns:
-
-