Implements perspective transforms like in maplibre-gl-js
This fundamentally reworks how the far distance plane is calculated. First I wanted to implement it like in maplibre-gl-js. Though that appraoch did not allow yaw AND pitch in both directions. It only allowed pitch in a single direction (only 90°, not the full 180°).
It works in all directions and should also be way faster to calculate.
This PR also fixes the amount of tiles that are whown for the current zoom. If calculates the appropriate zoom level based on the current zoom and takes into account the resolution of tiles.
Implements perspective transforms like in maplibre-gl-jsThis fundamentally reworks how the far distance plane is calculated. First I wanted to implement it like in maplibre-gl-js. Though that appraoch did not allow yaw AND pitch in both directions. It only allowed pitch in a single direction (only 90°, not the full 180°).
The new approach is dicussed here: https://gamedev.stackexchange.com/questions/207328/calculation-of-far-distance-plane-based-on-yaw-and-pitch-for-a-map-renderer
It works in all directions and should also be way faster to calculate.
This PR also fixes the amount of tiles that are whown for the current zoom. If calculates the appropriate zoom level based on the current zoom and takes into account the resolution of tiles.