public int IntOffset(int pos, int x, int y, int z) { return pos + x + z * width + y * width * height; }