- static constexpr int ToIndex(const glm::vec3 &pos) {
- return int(pos.x) + int(pos.y) * Width() + int(pos.z) * Width() * Height();
+ static constexpr bool InBounds(const Chunk::Pos &pos) {
+ return
+ pos.x >= 0 && pos.x < Width() &&
+ pos.y >= 0 && pos.y < Height() &&
+ pos.z >= 0 && pos.z < Depth();
+ }
+ static constexpr int ToIndex(const Chunk::Pos &pos) {
+ return pos.x + pos.y * Width() + pos.z * Width() * Height();