Class CoveredByCameraIterator
- java.lang.Object
-
- com.bombinggames.wurfelengine.core.map.Iterators.CoveredByCameraIterator
-
- All Implemented Interfaces:
java.util.Iterator<RenderCell>
public class CoveredByCameraIterator extends java.lang.Object implements java.util.Iterator<RenderCell>
A map iterator which loops only over the chunks covered by the camera (0-8). Loops over the map areas covered by the camera.
-
-
Constructor Summary
Constructors Constructor Description CoveredByCameraIterator(RenderStorage renderStorage, Camera camera, int startingZ, int topLevel)
Starts at z = -1.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int[]
getCurrentIndex()
get the indices position relative to a 3x3 chunk matrix.boolean
hasNext()
RenderCell
next()
Returns the next element in the iteration.void
reset(int centerCoordX, int centerCoordY)
void
setTopLimitZ(int zLimit)
set the top/last limit of the iteration.
-
-
-
Constructor Detail
-
CoveredByCameraIterator
public CoveredByCameraIterator(RenderStorage renderStorage, Camera camera, int startingZ, int topLevel)
Starts at z = -1.- Parameters:
renderStorage
-camera
- camera which center is usedstartingZ
- to loop over ground level pass -1topLevel
- the top limit of the z axis
-
-
Method Detail
-
reset
public void reset(int centerCoordX, int centerCoordY)
-
setTopLimitZ
public void setTopLimitZ(int zLimit)
set the top/last limit of the iteration.- Parameters:
zLimit
-
-
next
public RenderCell next() throws java.util.NoSuchElementException
Returns the next element in the iteration.- Specified by:
next
in interfacejava.util.Iterator<RenderCell>
- Returns:
- Can return null.
- Throws:
java.util.NoSuchElementException
-
getCurrentIndex
public int[] getCurrentIndex()
get the indices position relative to a 3x3 chunk matrix.- Returns:
- copy safe
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<RenderCell>
- Returns:
-
-