mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-21 21:24:58 +01:00
fix(editor): the orthophoto only on the chunks of the heightmap terrain in memory, and laid onto the ground again once it comes (#417)
* fix(editor): the orthophoto only on the chunks of the heightmap terrain in memory, and laid onto the ground again once it comes Right after the editor started, the tiles of the orthophoto came from the disk cache at once and were fitted to the ground before the chunks of the heightmap terrain had come (on IRT the orthophoto was on at 24.5 s, the first chunk came at 24.5 s, the last one at 85 s). A tile with no ground under it, and none beside, stayed flat at the height of the layer (0 m, some 230 m under IRT); one partly over the ground had its holes filled from the points beside. Neither was fitted again when the ground came: only the guessed tiles were, by their middle and corners alone, and a tile with no chunk under it at all never got any. The overlay, drawn over everything, then slid with the camera (WASD, turning) instead of lying on the ground. Turning the orthophoto off and on hid it: by then the terrain was in and the tiles took their heights from it or from the edges of the tiles beside. - With the heightmap terrain (the terrain streamer active), a tile of the orthophoto, of the WMS layers and of Ctrl+~ is asked for and shown only where its chunks are in memory (terrain_streamer::ground_under): it waits while one is still to come, and where no chunk is nor will be there's no imagery at all. A scenery without the heightmap terrain is as before. - A tile remembers the points of its grid the ground didn't answer and is fitted again once the ground comes under any of them (every second point and the edges), not only the guessed tiles. No asset changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(editor): the orthophoto waits only for the chunks that will come at this distance, and lies on the other ground or the guess elsewhere After the reviews of maj00r and jerrrrycho on #417: - A tile is no longer dropped where no chunk of the heightmap terrain is nor will be. There it lies on whatever ground there is (terrain models) or on the NMT guess, as on master; a scenery with a few chunks, or with chunks removed, keeps its imagery around them. - A chunk counts as still to come only while it's being loaded or lies within the circle the streamer walks around the camera. The corners of the imagery in the 3D view, beyond that circle, no longer wait for chunks that won't load there: they lie on the guess and are sampled again when the camera comes near and the chunk loads. - terrain_streamer::ground_under() (true / false / empty) became ground_coming() (bool), the cover source of the orthophoto the coming source, and on_ground() waits_for_ground(), which only holds back a new tile. - In the scene (in_scene), the points a steep triangle leaves without a height but the heightmap terrain answers aren't kept as unanswered, so the tile isn't sampled again on every chunk that comes. The holes are counted from the heights again, as on master. --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -120,6 +120,10 @@ class editor_orthophoto
|
||||
// the heights the ground will have where there's none yet, as of the terrain model on its way: a tile laid out before its
|
||||
// ground comes lies there, or level with the tiles beside, rather than at the height of the layer far below or above
|
||||
void guess_source(height_query Query) { m_guess = std::move(Query); }
|
||||
// true while the ground under an XZ rectangle (Min/Max are x,z) is still to come. A new tile there waits for it, rather than
|
||||
// being laid out at the height of the layer; elsewhere it lies on whatever ground there is, or on the guess, as without it
|
||||
using coming_query = std::function<bool(glm::dvec2 const &Min, glm::dvec2 const &Max)>;
|
||||
void coming_source(coming_query Query) { m_coming = std::move(Query); }
|
||||
// the area the imagery is downloaded in, a polygon of PUWG 1992 (easting, northing): its tiles go to the disk cache in the
|
||||
// background, the products the settings ask for, and no tile outside it is asked for around the camera. Empty: no area, the
|
||||
// tiles around the camera as before
|
||||
@@ -239,6 +243,9 @@ class editor_orthophoto
|
||||
float height_max{0.0f};
|
||||
std::vector<glm::dvec3> surface; // upward facing ground triangles clipped to the tile (3 vertices each)
|
||||
bool guessed{false}; // no ground under it when sampled: the heights guessed, from the terrain model or the tiles beside
|
||||
// the points of the grid of the heights the ground didn't answer when sampled (rows north->south, as heights): filled from
|
||||
// the points beside or guessed, and sampled again once the ground comes under one of them
|
||||
std::vector<std::uint16_t> unanswered;
|
||||
// scene geometry
|
||||
scene::basic_section *section{nullptr}; // section holding the shape (nullptr = not in the scene)
|
||||
scene::basic_cell *cell{nullptr}; // set instead of the section's shape list when the shape is translucent
|
||||
@@ -262,6 +269,10 @@ class editor_orthophoto
|
||||
void release_tile(tile &Tile);
|
||||
texture_slot acquire_slot();
|
||||
void sample_ground(tile_key const &Key, tile &Tile);
|
||||
// the ground has come under a point of the tile which had none when it was sampled
|
||||
bool ground_came(tile_key const &Key, tile const &Tile) const;
|
||||
// a new tile isn't asked for yet: the ground under it is still to come
|
||||
bool waits_for_ground(tile_key const &Key) const;
|
||||
// the height of the ground sampled under a tile beside Own at the point, the tiles with guessed heights left out
|
||||
bool sampled_height(tile_key const &Own, double const X, double const Z, float &Height) const;
|
||||
void build_shape(tile_key const &Key, tile &Tile);
|
||||
@@ -281,6 +292,7 @@ class editor_orthophoto
|
||||
ground_query m_ground;
|
||||
height_query m_height;
|
||||
height_query m_guess;
|
||||
coming_query m_coming;
|
||||
scene::basic_region *m_region{nullptr}; // region the scene geometry was put into
|
||||
std::multimap<std::size_t, gfx::geometry_handle> m_free_chunks; // geometry chunks by capacity, reused between tiles
|
||||
// the scene opacity is baked into the textures, which means reading the tiles again; applied once the value settles
|
||||
|
||||
Reference in New Issue
Block a user