mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-18 17:19:18 +02:00
Choose terrain levels from what the screen can resolve
Levels changed at fixed distances - 512 m, 1 km, 2 km and on - whatever the window, the field of view or the zoom. Now a level is used out to the distance where one of its sample spacings covers terraindetail pixels on screen, 3 by default, which follows from the viewport height and the vertical field of view with the zoom applied; each level doubles the spacing, so each doubles the distance. Zooming in or a taller window pushes detail further, a coarser setting pulls it in. The finest range never drops below four tile sides, which the morphing needs to close the seams. Levels and morphing both follow the finest range the last scan used, so they always agree, and a change of more than a percent - a zoom, a resize - triggers a rescan. tools/terraincook/seamcheck.py now also tries finest ranges of 5.7 and 11.3 tiles, and finds no gap in any of them. terraindetail is in the ini and on a slider in the debug panel; the panel's level table and the residency line in the log show the resulting ranges. On baltyk the current window works out to 484 m, so the 512 m minimum applies and nothing changes by default; a scenery setting terraindetail 1 got 1349 m, and the samples on the gpu went from 3 MB to 10 MB with it.
This commit is contained in:
@@ -71,6 +71,11 @@ public:
|
||||
// how far from the viewpoint terrain is drawn, in metres
|
||||
void range( float const Range ) { m_range = Range; }
|
||||
float range() const { return m_range; }
|
||||
// what the screen can resolve: the viewport's pixels per unit of size over distance, and
|
||||
// how many pixels a sample spacing may cover. decides how far each level reaches
|
||||
void detail( double const Pixelsperunit, double const Pixels );
|
||||
// the finest level's range the tiles in range were last worked out with
|
||||
float finest() const { return static_cast<float>( m_finest ); }
|
||||
|
||||
// metres between samples at the finest level; a scenery's fields are drawn from the
|
||||
// finest to the coarsest so that the depth test keeps the better surface
|
||||
@@ -135,6 +140,10 @@ private:
|
||||
std::unordered_map<std::int64_t, std::uint32_t> m_wantedlevel;
|
||||
glm::dvec3 m_scanpoint { 0.0 };
|
||||
float m_scanrange { -1.f };
|
||||
// the finest level's range the screen asks for, and the one the last scan used. levels and
|
||||
// morphing both follow the scanned one, so they always agree
|
||||
double m_finestwanted { 0.0 };
|
||||
double m_finest { 0.0 };
|
||||
std::unordered_map<std::int64_t, resident_tile> m_tiles;
|
||||
// one index buffer per mip level, over a grid of that level's sample count. vertices
|
||||
// are computed in the shader from gl_VertexID, so there is no vertex buffer at all.
|
||||
|
||||
Reference in New Issue
Block a user