samples/blocks/src/ChunkManager.cpp
//remember this might be negative if checking out of bounds
//chunks!
remember this might be negative if checking out of bounds
chunks!
remember this might be negative if checking out of bounds chunks!
std::int32_t positionToIndex(glm::ivec3 pos)
    {
        if (pos.x < 0 || pos.x >= WorldConst::ChunksPerSide) return -1;
        if (pos.y < 0 || pos.y >= WorldConst::ChunksPerSide) return -1;
        if (pos.z < 0 || pos.z >= WorldConst::ChunksPerSide) return -1;
        return pos.x + WorldConst::ChunksPerSide * (pos.y + WorldConst::ChunksPerSide * pos.z);
    }
std :: int32_t positionToIndex ( glm :: ivec3 pos ) { if ( pos . x < 0 || pos . x > = WorldConst :: ChunksPerSide ) return -1 ; if ( pos . y < 0 || pos . y > = WorldConst :: ChunksPerSide ) return -1 ; if ( pos . z < 0 || pos . z > = WorldConst :: ChunksPerSide ) return -1 ; return pos . x + WorldConst :: ChunksPerSide * ( pos . y + WorldConst :: ChunksPerSide * pos . z ) ; }
remember this might be negative if checking out of bounds
chunks!
remember this might be negative if checking out of bounds chunks!