Quad tree neighbors solved
Since the old thread is 10 days old I started a new one.
In short I figured out how to get the N,S,E and W neighbors of any node in the tree.
NW - NE, SW
- East = NE
- South = SW
NE - NW,SE
- West = NE
- South = SE
SW - NW, SE
- East = SE
- West = NW
SE - NE,SW
- West = SW
- North = NE
Code:
...
...
UINT NW_id = pNode->BuildQuadTree(pNode->NW, ...
UINT NE_id = pNode->BuildQuadTree(pNode->NE, ...
UINT SW_id = pNode->BuildQuadTree(pNode->SW, ...
UINT SE_id = pNode->BuildQuadTree(pNode->SE, ...
pNode->NW->E_id = NE_id;
pNode->NW->S_id = SW_id;
pNode->NE->W_id = NW_id;
pNode->NE->S_id = SE_id;
pNode->SW->E_id = SE_id;
pNode->SW->N_id = NW_id;
pNode->SE->W_id = SW_id;
pNode->SE->N_id = NE_id;
...
...
So during render:
Code:
...
if (getNode(pNode->W_id)->LOD != pNode->LOD)
{
//West patch LOD does not match current patch LOD
//West side of current patch must be altered to 'seam' into neighbor patch
}
...
...
Of course more checks need to be in place to see if the patch has a valid N,S,E,W neighbor but that's quite simple.