Class RenderChunk



  • public class RenderChunk
    extends java.lang.Object
    Stores display data for a Chunk.

    This may is outdated:
    If a cell contains no block/air then the shared CELLOUTSIDE is used.
    • Field Detail

      • CELLOUTSIDE

        public static final RenderCell CELLOUTSIDE
        In theory if in a cell is no data available use this block. Uses air internally.
        block-by-block differences must not be used because this is a shared object. Topological Depth Sort needs individual containers. If the topolgogical sort would be removed from the engine this could be again be used.
    • Constructor Detail

      • RenderChunk

        public RenderChunk​(Chunk chunk)
        With init
        Parameters:
        chunk - linked chunk which is then rendered
    • Method Detail

      • clearPool

        public static void clearPool​()
        clears the pool to free memory
      • initData

        public void initData​()
        fills every render cell based on the data from the map
      • getCell

        public RenderCell getCell​(Coordinate coord)
        Parameters:
        coord - only coordinates which are in this chunk
        Returns:
      • getCell

        public RenderCell getCell​(int x,
                                  int y,
                                  int z)
        Cells above the map return RenderChunk.CELLOUTSIDE.
        Parameters:
        x - coordinate, must be contained in this chunk
        y - coordinate, must be contained in this chunk
        z - coordinate, must be contained in this chunk
        Returns:
        should not return null unless something went wrong.
      • getData

        public RenderCell[][][] getData​()
        get the pointer to the data
        Returns:
      • resetClipping

        protected void resetClipping​()
        Resets the clipping for every block.
      • resetShadingFor

        public void resetShadingFor​(int idexX,
                                    int idexY,
                                    int idexZ)
        Resets the shading for one block. Calculates drop shadow from blocks above.
        Parameters:
        idexX - index pos
        idexY - index pos
        idexZ - index pos
      • getTopLeftCoordinateX

        public int getTopLeftCoordinateX​()
        Returns:
      • getTopLeftCoordinateY

        public int getTopLeftCoordinateY​()
        Returns:
      • getIterator

        public DataIterator3D<RenderCell> getIterator​(int startingZ,
                                                      int limitZ)
        Returns an iterator which iterates over the data in this chunk.
        Parameters:
        startingZ -
        limitZ - the last layer (including).
        Returns:
      • getCellByIndex

        protected RenderCell getCellByIndex​(int x,
                                            int y,
                                            int z)
        Parameters:
        x -
        y -
        z -
        Returns:
      • getCameraAccess

        protected boolean getCameraAccess​()
        If not used can be removed.
        Returns:
        true if a camera rendered this chunk this frame.
      • setCameraAccess

        protected void setCameraAccess​(boolean b)
        Camera used this chunk this frame?
        Parameters:
        b -
      • dispose

        protected void dispose​()