17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-06 03:28:37 +01:00

fix(editor): the orthophoto which comes before the terrain under it lies where the terrain will be, at the heights of the terrain model with the offset of the scenery, or level with the tiles beside along its edges, not flat at the height of the layer far below; the squares of the model asked for, and the tile laid onto the terrain or the model once either comes

mapstate logs how many tiles lie on the ground and how many at guessed heights.
This commit is contained in:
maj00r
2026-10-24 18:13:15 +02:00
parent e322947300
commit da336b9530
5 changed files with 124 additions and 2 deletions

View File

@@ -99,8 +99,15 @@ class editor_orthophoto
void settings(config const &Config);
void ground_source(ground_query Query) { m_ground = std::move(Query); }
void height_source(height_query Query) { m_height = std::move(Query); }
// 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); }
// samples the ground again (after it was edited); tiles are refitted progressively
void refit();
// the tiles lying at guessed heights sampled again where the ground has come under them
void ground_arrived();
// the tiles with the ground sampled under them, and of these the ones at guessed heights
std::pair<std::size_t, std::size_t> grounded() const;
// takes the scene geometry out of the region (e.g. when the editor is left); it's re-created on the next update
void detach_scene();
// true for geometry created by the layer, so ground queries can skip it
@@ -183,6 +190,7 @@ class editor_orthophoto
float height_min{0.0f};
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
// 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
@@ -200,6 +208,8 @@ class editor_orthophoto
void release_tile(tile &Tile);
texture_slot acquire_slot();
void sample_ground(tile_key const &Key, tile &Tile);
// 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);
void remove_shape(tile &Tile);
void release_geometry(tile &Tile);
@@ -221,6 +231,7 @@ class editor_orthophoto
int m_texture_count{0};
ground_query m_ground;
height_query m_height;
height_query m_guess;
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