DoorKeeper/include/implem/tileiterator.inl

47 lines
1.1 KiB
Text
Raw Normal View History

namespace dk {
template <typename T, size_t D>
TileIterator<T, D>::TileIterator() :
m_pos(CoordinateScalarType()),
m_from(CoordinateScalarType()),
m_to(CoordinateScalarType()),
m_areafrom(CoordinateScalarType()),
m_areato(CoordinateScalarType()),
m_total(CoordinateScalarType())
{
}
template <typename T, size_t D>
TileIterator<T, D>::TileIterator (const coords& parFrom, const coords& parTo) :
m_pos(parFrom),
m_from(parFrom),
m_to(parTo),
m_areafrom(parFrom),
m_areato(parTo),
m_total(parTo - parFrom)
{
}
template <typename T, size_t D>
TileIterator<T, D>::TileIterator (const coords& parFrom, const coords& parTo, const coords& parAreaFrom, const coords& parAreaTo, const coords& parTotal) :
m_pos(parFrom),
m_from(parFrom),
m_to(parTo),
m_areafrom(parAreaFrom),
m_areato(parAreaTo),
m_total(parTotal)
{
}
template <typename T, size_t D>
void TileIterator<T, D>::increment() {
for (size_t d = 0; d < D - 1; ++d) {
++m_pos[d];
if (m_pos[d] >= m_areato[d])
m_pos[d] = m_areafrom[d];
else
return;
}
++m_pos[D - 1];
}
} //namespace dk