17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 08:39:19 +02:00

Heightmap terrain: .tch chunk packs, streaming with LOD, terrain painting, water and modifiers - terrain/<name>/terrain.yaml + <px>_<pz>.tch packs of 16x16 chunks (250 m, 0.5/1/2/5 m spacing), slices with crc-32 and optional zstd (vendored zstd 1.5.6 in ref/zstd) - heightmap_terrain [name] endheightmap_terrain directive replaces editorterrain - streamer: worker threads, camera + look-ahead loading, geomipmap LOD with skirts, pooled geometry - mat_terrain shader: up to 8 painted layer materials per chunk via texture arrays (opengl33); other renderers fall back to the dominant material - water bodies (outline + level), terrain modifiers (vertical profile shaping kept non-destructive) - F11 Terrain work mode rebuilt: chunks, sculpt, smooth, paint, point spacing, water tools

This commit is contained in:
2026-10-09 21:02:25 +02:00
parent bbccce0e29
commit 35bda3778c
26 changed files with 52888 additions and 1624 deletions

View File

@@ -616,6 +616,8 @@ bool opengl33_renderer::Render()
}
// generate new frame
opengl_texture::reset_unit_cache();
// textures of new heightmap terrain layers go to the arrays the terrain shader reads them from
m_terrainmaterials.update();
if( EditorModeFlag ) {
// the editor moves and resizes model instances in place, which leaves the copies of their bounds out of date
++m_instanceboundsversion;
@@ -2417,6 +2419,20 @@ IMaterial const *opengl33_renderer::Material(material_handle const Material) con
return &m_materials.material(Material);
}
material_handle opengl33_renderer::Terrain_Material(material_handle const Reuse, std::vector<gfx::terrain_layer> const &Layers, int const Samples, std::uint8_t const *Weights, glm::vec3 const &Placement)
{
auto const material{m_terrainmaterials.make(Reuse, Layers, Samples, Weights, Placement)};
if (material != null_handle)
return material;
// the terrain shader can't be used, the chunk makes do with a plain material
return gfx_renderer::Terrain_Material(Reuse, Layers, Samples, Weights, Placement);
}
void opengl33_renderer::Terrain_Release(material_handle const Material)
{
m_terrainmaterials.release(Material);
}
opengl_material &opengl33_renderer::Material(material_handle const Material)
{
return m_materials.material(Material);