SUNENGINE 0.0.2
A simple and bright C++ game engine.
 
Loading...
Searching...
No Matches
TerrainRectangleArea::Iterator Class Reference

Iterator for traversing terrain cells in a rectangular area. More...

#include <TerrainRectangleArea.h>

Public Member Functions

 Iterator (const Terrain *terrain, int xStart, int xEnd, int zStart, int zEnd, int x, int z)
 Constructs an iterator.
 
Iteratoroperator++ ()
 Advances the iterator to the next cell.
 
bool operator!= (const Iterator &other) const
 Checks if two iterators are not equal.
 
CollisionVolumeAABB GetCellAABB () const
 Gets the AABB of the current cell.
 
std::pair< int, int > GetCellIndices () const
 Gets the indices of the current cell.
 

Private Attributes

const TerrainpTerrain
 Pointer to the terrain.
 
int currX
 
int currZ
 Current cell indices.
 
int xStart
 
int xEnd
 
int zStart
 
int zEnd
 Start and end indices.
 

Detailed Description

Iterator for traversing terrain cells in a rectangular area.

Constructor & Destructor Documentation

◆ Iterator()

TerrainRectangleArea::Iterator::Iterator ( const Terrain * terrain,
int xStart,
int xEnd,
int zStart,
int zEnd,
int x,
int z )

Constructs an iterator.

Parameters
terrainPointer to the Terrain.
xStartStarting X index.
xEndEnding X index (inclusive).
zStartStarting Z index.
zEndEnding Z index (inclusive).
xCurrent X index.
zCurrent Z index.
Here is the caller graph for this function:

Member Function Documentation

◆ GetCellAABB()

CollisionVolumeAABB TerrainRectangleArea::Iterator::GetCellAABB ( ) const

Gets the AABB of the current cell.

Returns
The cell's CollisionVolumeAABB.

◆ GetCellIndices()

std::pair< int, int > TerrainRectangleArea::Iterator::GetCellIndices ( ) const

Gets the indices of the current cell.

Returns
Pair of (x, z) indices.

◆ operator!=()

bool TerrainRectangleArea::Iterator::operator!= ( const Iterator & other) const

Checks if two iterators are not equal.

Parameters
otherIterator to compare.
Returns
True if not equal, false otherwise.
Here is the call graph for this function:

◆ operator++()

TerrainRectangleArea::Iterator & TerrainRectangleArea::Iterator::operator++ ( )

Advances the iterator to the next cell.

Returns
Reference to this iterator.

The documentation for this class was generated from the following files: