7 #include "VoxelFarmConfig.h"
11 #include "ExternalMutex.h"
31 id |= (
CellId)level << (CELL_BITS_X + CELL_BITS_Y + CELL_BITS_Z);
32 id |= (
CellId)x << (CELL_BITS_Y + CELL_BITS_Z);
33 id |= (
CellId)y << (CELL_BITS_Z);
39 inline void unpackCellId(CellId
id,
int &level,
int &x,
int &y,
int &z)
41 level = (int)(
id >> (CELL_BITS_X + CELL_BITS_Y + CELL_BITS_Z));
42 id &= ~((
CellId)level << (CELL_BITS_X + CELL_BITS_Y + CELL_BITS_Z));
44 x = (int)(
id >> (CELL_BITS_Y + CELL_BITS_Z));
45 id &= ~((
CellId)x << (CELL_BITS_Y + CELL_BITS_Z));
47 y = (int)(
id >> CELL_BITS_Z);
48 id &= ~((
CellId)y << CELL_BITS_Z);
57 MapIndex(
int aKeyLevel,
char* aIndexPath);
60 bool cellIsEmpty(CellId cell,
int level,
int x,
int y,
int z);
62 TMap<CellId, Cells*> cache;
67 Cells* loadSection(CellId key);
72 bool CellSort(
const CellId& a,
const CellId& b);
77 int level, xc, yc, zc;
81 for (
int qz = 0; qz < 2; qz++)
82 for (
int qx = 0; qx < 2; qx++)
83 for (
int qy = 0; qy < 2; qy++)
92 childCells[qx][qy][qz] = childId;
CellId packCellId(int level, int x, int y, int z)
Compose a CellId from the location of a Cell in the octree.
const int CELL_BITS_Y
Bits to encode octree Y coordinate in Cell Id.
Contains all classes and functions for the VoxelFarm engine.
An index of which Cells are empty and which ones contain information. For offline mode only...
TSet< CellId > Cells
A set of cells.
const int CELL_BITS_X
Bits to encode octree X coordinate in Cell Id.
const int CELL_BITS_Z
Bits to encode octree Z coordinate in Cell Id.
unsigned __int64 CellId
A 64bit integer that identifies a single world octree Cell.
bool CellSort(const CellId &a, const CellId &b)
A sorting criteria for cells in a scene so closer cells appear first.
void unpackCellId(CellId id, int &level, int &x, int &y, int &z)
Obtain location of a Cell in the octree from its CellId identifier.
bool cellIsEmpty(CellId cell, int level, int x, int y, int z)
Returns whether a cell has data.
void getChildCells(CellId cell, CellId childCells[2][2][2])
Given a cell's ID computes its eight children.