mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-03 02:48:32 -06:00
Add decrement operators in ChunkIndex for calculation of parent index
This commit is contained in:
@@ -58,6 +58,26 @@ namespace openspace {
|
||||
return ChunkIndex(x / 2, y / 2, level - 1);
|
||||
}
|
||||
|
||||
ChunkIndex& ChunkIndex::operator--() {
|
||||
x /= 2;
|
||||
y /= 2;
|
||||
level--;
|
||||
return *this;
|
||||
}
|
||||
|
||||
ChunkIndex ChunkIndex::operator--(int) {
|
||||
ChunkIndex tmp(*this);
|
||||
--(*this);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
ChunkIndex& ChunkIndex::operator-=(unsigned int levels) {
|
||||
x <<= levels;
|
||||
y <<= levels;
|
||||
level -= levels;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Gets the tile at a specified offset from this tile.
|
||||
|
||||
@@ -71,6 +71,11 @@ struct ChunkIndex {
|
||||
}
|
||||
|
||||
ChunkIndex parent() const;
|
||||
|
||||
ChunkIndex& operator--();
|
||||
ChunkIndex operator--(int);
|
||||
|
||||
ChunkIndex& operator-=(unsigned int levels);
|
||||
|
||||
bool isWestChild() const {
|
||||
return x % 2 == 0;
|
||||
@@ -88,6 +93,7 @@ struct ChunkIndex {
|
||||
return y % 2 == 1;
|
||||
}
|
||||
|
||||
|
||||
ChunkIndex child(Quad q) const;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user