Class AbstractSorter

  • All Implemented Interfaces:
    Direct Known Subclasses:
    DepthValueSort, NoSort, TopologicalSort

    public abstract class AbstractSorter
    extends java.lang.Object
    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 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.
        depthlist -
      • renderSorted

        public abstract void renderSorted​()
        Renders in sorted order
      • handleMessage

        public boolean handleMessage​( msg)
        Specified by:
        handleMessage in interface
      • updateCacheIfOutdated

        public void updateCacheIfOutdated​()
        updates the iterator cache. Gets called when the center of the camera changed.
        See Also:
      • 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