SUNENGINE 0.0.2
A simple and bright C++ game engine.
 
Loading...
Searching...
No Matches
TerrainRectangleArea.h
1// TerrainRectangleArea.h
2#pragma once
3
4class Terrain;
6
15{
16public:
22 {
23 public:
34 Iterator(const Terrain* terrain, int xStart, int xEnd, int zStart, int zEnd, int x, int z);
35
41
47 bool operator!=(const Iterator& other) const;
48
54
59 std::pair<int, int> GetCellIndices() const;
60
61 private:
63 int currX, currZ;
64 int xStart, xEnd, zStart, zEnd;
65 };
66
75 TerrainRectangleArea(const Terrain* terrain, int xStart, int zStart, int xEnd, int zEnd);
76
81 Iterator begin() const;
82
87 Iterator end() const;
88
89private:
91 int xStart, zStart, xEnd, zEnd;
92};
Represents an axis-aligned bounding box (AABB) collision volume.
Definition CollisionVolumeAABB.h:23
Represents a 3D terrain generated from a heightmap.
Definition Terrain.h:18
Iterator for traversing terrain cells in a rectangular area.
Definition TerrainRectangleArea.h:22
CollisionVolumeAABB GetCellAABB() const
Gets the AABB of the current cell.
Definition TerrainRectangleArea.cpp:51
int zEnd
Start and end indices.
Definition TerrainRectangleArea.h:64
const Terrain * pTerrain
Pointer to the terrain.
Definition TerrainRectangleArea.h:62
std::pair< int, int > GetCellIndices() const
Gets the indices of the current cell.
Definition TerrainRectangleArea.cpp:57
Iterator & operator++()
Advances the iterator to the next cell.
Definition TerrainRectangleArea.cpp:33
int currZ
Current cell indices.
Definition TerrainRectangleArea.h:63
bool operator!=(const Iterator &other) const
Checks if two iterators are not equal.
Definition TerrainRectangleArea.cpp:45
Iterator(const Terrain *terrain, int xStart, int xEnd, int zStart, int zEnd, int x, int z)
Constructs an iterator.
Definition TerrainRectangleArea.cpp:27
Iterator begin() const
Returns an iterator to the beginning of the area.
Definition TerrainRectangleArea.cpp:11
int zEnd
Start and end indices.
Definition TerrainRectangleArea.h:91
TerrainRectangleArea(const Terrain *terrain, int xStart, int zStart, int xEnd, int zEnd)
Constructs a rectangular area for iteration.
Definition TerrainRectangleArea.cpp:7
const Terrain * pTerrain
Pointer to the terrain.
Definition TerrainRectangleArea.h:90
Iterator end() const
Returns an iterator to the end of the area.
Definition TerrainRectangleArea.cpp:17