Switching mode: [V] - edit quad tree [B] - 2d mode [H] - 2d mode with FOV culling [N] - 3d mode Editor: [Arrow keys/WASD] - move cursor [I] - go down in tree, divides quad if needed [O] - go up in tree [R] - change quad color / merge subquads 2d modes: [Arrow keys/WASD] - move [Space] - do the algorithm step by step (press and hold to step automatically) 3d mode: [Arrow keys/WASD] - move
The scene is the same as in https://scratch.mit.edu/projects/1275048692/ but the algorithm is different. How it works: At first it puts the the tile that the camera is in into a linked list. Then it repeatedly selects a tile in the list that has been reached in all possible ways*, and replaces it with its visible neighbours. After repeating this for enough times, the list contains the visible tiles in left to right order. The algorithm is run for each quadrant separately, because then we can always use the same sign of X/Y to go away from the camera * all possible ways through the hole that we are looking through currently; if the tile is visible through multiple holes then it will be processed multiple times.