Octree to hold voxels lod levels, single Octant has 16x16x16 voxels.
Need to get neighbor voxels for Octant on all 6 faces (neighbor must not have childs) to create correct mesh borders for seamless mesh.
Face can have several neighbors or part of neighbor.
For example:
Octant has scale 64, one neighbor has scale 32 -> one Octant side voxel computes from 4(2x2) neighbor voxels,
Another neighbor has scale 16 -> one Octant side voxel computes from 16(4x4) voxels.
Third neighbor has scale 1 -> One octant side voxel computes from 4096(64*64) voxels.
Octant can have too many neighbours, need to add some restriction.
When neighbor is updated - set "mesh borders out of date" flag
Current bad solution: don't get neighbors, so render all side voxels.
My ideas:
solution 1:
{
p_neighbours[Face::FACE_COUNT] in Octant
create Octant neighbours for all childs on creating
create Octant neighbours when childs are removed
update meshs_borders flag when neighbour changed
Octant with childs has invalid Octant neighbours
problems:
Octant can have too many neighbours with different scales, or part of neighbour
hard to code and maintain, too much cases to solve
Octant still can have too many neighbours
}
solution 2:
{
don't store neighbour pointers in childs
instead get neighbour every time by coordinates
same problems as in prev solution, and new:
can't update "mesh borders out of date" flag when creating or removing childs
}