Class RenderChunk
- java.lang.Object
-
- com.bombinggames.wurfelengine.core.map.rendering.RenderChunk
-
public class RenderChunk extends java.lang.Object
Stores display data for aChunk
.
This may is outdated:
If a cell contains no block/air then the sharedCELLOUTSIDE
is used.
-
-
Field Summary
Fields Modifier and Type Field Description static RenderCell
CELLOUTSIDE
In theory if in a cell is no data available use this block.
-
Constructor Summary
Constructors Constructor Description RenderChunk(Chunk chunk)
With init
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
clearPool()
clears the pool to free memoryprotected void
dispose()
protected boolean
getCameraAccess()
If not used can be removed.RenderCell
getCell(int x, int y, int z)
Cells above the map return RenderChunk.CELLOUTSIDE.RenderCell
getCell(Coordinate coord)
protected RenderCell
getCellByIndex(int x, int y, int z)
int
getChunkX()
int
getChunkY()
RenderCell[][][]
getData()
get the pointer to the dataDataIterator3D<RenderCell>
getIterator(int startingZ, int limitZ)
Returns an iterator which iterates over the data in this chunk.int
getTopLeftCoordinateX()
int
getTopLeftCoordinateY()
void
initData()
fills every render cell based on the data from the mapprotected void
resetClipping()
Resets the clipping for every block.void
resetShadingFor(int idexX, int idexY, int idexZ)
Resets the shading for one block.protected void
setCameraAccess(boolean b)
Camera used this chunk this frame?
-
-
-
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 chunky
- coordinate, must be contained in this chunkz
- 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 posidexY
- index posidexZ
- 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:
-
getChunkX
public int getChunkX()
- Returns:
- See Also:
Chunk.getChunkX()
-
getChunkY
public int getChunkY()
- Returns:
- See Also:
Chunk.getChunkY()
-
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()
-
-