Octree File Format¶
The Inexor octree format describes the structure of the maps (and even models) created in Inexor.
Terminology¶
To keep the documentation consistent, we use the following terms:
World: the full scene or map that is loaded by the engine.Octree: one tree-shaped voxel structure inside a world.Cube: one node inside an octree. A cube can be empty, solid, indented, or split into 8 octants.
When this page refers to a cube, it always means the octree node and not the whole world.
Octree¶
The orange are coordinates of the corner, the pink of the block.
The position of a block is always the (0, 0, 0) corner coordinates.
Corner and Block Order
If blocks or corners are ordered, they use this order.
ID |
Coordinate |
|---|---|
0 |
(0, 0, 0) |
1 |
(0, 0, 1) |
2 |
(0, 1, 0) |
3 |
(0, 1, 1) |
4 |
(1, 0, 0) |
5 |
(1, 0, 1) |
6 |
(1, 1, 0) |
7 |
(1, 1, 1) |
Order of Faces
The following order of faces is used:
ID |
Name |
Normal vector |
|---|---|---|
0 |
left |
(-1, 0, 0) |
1 |
right |
(1, 0, 0) |
2 |
front |
(0, 1, 0) |
3 |
back |
(0, -1, 0) |
4 |
top |
(0, 0, 1) |
5 |
bottom |
(0, 0, -1) |
Order of Indices on Face
The following corner indices are associated to the faces:
ID |
Indices |
|---|---|
0 |
0, 1, 2, 3 |
1 |
4, 5, 6, 7 |
2 |
0, 1, 4, 5 |
3 |
2, 3, 6, 7 |
4 |
1, 3, 5, 7 |
5 |
0, 2, 4, 6 |
Edge Order
All edges are going into the positive direction of the axis.
The beginning of the edge is always the smaller corner id.
If you look at a face, the edges are always numbered with an offset of 3.
The edges are ordered counter-clockwise starting from the axis.
A negative ID indicates the reverse direction (-axis).
ID |
Corner ID Tuple |
|---|---|
0 |
(0, 4) |
1 |
(0, 2) |
2 |
(0, 1) |
3 |
(2, 6) |
4 |
(1, 3) |
5 |
(4, 5) |
6 |
(3, 7) |
7 |
(5, 7) |
8 |
(6, 7) |
9 |
(1, 5) |
10 |
(4, 6) |
11 |
(2, 3) |
Indentation
Every cube can be indented at each corner to all axis by 8 steps. In total there are 9 position/level on each axis. The following diagram shows the indentation levels of Corner 1 on the x-axis.
Neighbors
ID |
Relative Coordinates |
|---|---|
0 |
(-1, -1, -1) |
1 |
(-1, -1, 0) |
2 |
(-1, -1, 1) |
3 |
(-1, 0, -1) |
4 |
(-1, 0, 0) |
5 |
(-1, 0, 1) |
6 |
(-1, 1, -1) |
7 |
(-1, 1, 0) |
8 |
(-1, 1, 1) |
9 |
(0, -1, -1) |
10 |
(0, -1, 0) |
11 |
(0, -1, 1) |
12 |
(0, 0, -1) |
13 |
(0, 0, 1) |
14 |
(0, 1, -1) |
15 |
(0, 1, 0) |
16 |
(0, 1, 1) |
17 |
(1, -1, -1) |
18 |
(1, -1, 0) |
19 |
(1, -1, 1) |
20 |
(1, 0, -1) |
21 |
(1, 0, 0) |
22 |
(1, 0, 1) |
23 |
(1, 1, -1) |
24 |
(1, 1, 0) |
25 |
(1, 1, 1) |
Format Specification¶
Using this binary format syntax.
Cube Types
- 0 - EMPTY
The cube does not exist, nothing to render.
- 1 - SOLID
One solid cube.
- 2 - NORMAL
An indented cube, with at least one intended corner.
- 3 - OCTANT
The octree is subdivided into 8 sub cubes.
Note
The Format numbers are just to difference between the formats and not to describe an versioning.