4 ms·
Ok maybe I'm an idiot but wouldn't the simplest algorithm be 1) Choose highest building. Draw it's roof horizontal only. 2) Repeat 1) choosing building by nex
by SillyUsername 2y ago
Ok maybe I'm an idiot but wouldn't the simplest algorithm be
1) Choose highest building. Draw it's roof horizontal only.
2) Repeat 1) choosing building by next height lower, unless lower building roof within range of an existing rendered roof x+width, then exclude that building from rendering.
3) Once all buildings roofs drawn, draw the building side verticals downwards from each until they hit a roof or ground (either from a cache or detecting pixel colour), in which case stop.
- soegaard 2y agoHow do you efficiently choose the highest building in step 1?
- SillyUsername 2y agoYes so I see your point, it'd need a pre-sort by height which is a double iteration of the arrays.
- soegaard 2y ago> 2) Repeat 1) choosing building by next height lower, unless lower building roof within range of an existing rendered roof x+width, then exclude that building from rendering. How do you implement the unless-part?
- deleted 2y ago[deleted]