High-res tiles also in 128x128 for close views

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-07 21:29:58 +01:00
1 parent 8197b07ac5
commit 9df16607ed
24 files changed
+83 -41

No files matched your search

+24 -2
View File
@@ -1587,9 +1587,31 @@ impl R3d {
self.lit.set_uniform("LightCount", count);
// wrapped so the shader keeps its precision (the flow speeds are whole tiles per period)
self.lit.set_uniform("Time", (time % 1000.0) as f32);
// high-res: the 128x128 tiles where a tile gets nearly that many pixels, else the 64x64
// ones (same layout: the chunks keep their uvs, only the texture changes)
let hd_tiles = self.chunks_hd;
self.lit.set_uniform("AtlasSize", if hd_tiles { vec2(crate::gfx::ATLAS_HD_W, crate::gfx::ATLAS_HD_H) } else { vec2(ATLAS_W, ATLAS_H) });
self.lit.set_uniform("CellSize", if hd_tiles { crate::gfx::HD_TILE as f32 } else { 16.0 });
let rows = pix.map_or(screen_height() * screen_dpi_scale(), |(_, th, _)| th as f32);
let tile = if !hd_tiles {
16
} else if rows / cam.view_h().max(0.1) >= crate::gfx::HD_TILE2 as f32 * 0.85 {
crate::gfx::HD_TILE2
} else {
crate::gfx::HD_TILE
};
let atlas = match tile {
16 => &gfx.atlas,
crate::gfx::HD_TILE => &gfx.atlas_hd,
_ => &gfx.atlas_hd2,
};
for ch in self.chunks.iter_mut() {
for mesh in [&mut ch.mesh, &mut ch.overlay].into_iter().flatten() {
if mesh.texture.as_ref() != Some(atlas) {
mesh.texture = Some(atlas.clone());
}
}
}
self.lit.set_uniform("AtlasSize", vec2((crate::gfx::ATLAS_COLS * tile) as f32, (crate::gfx::ATLAS_ROWS * tile) as f32));
self.lit.set_uniform("CellSize", tile as f32);
self.lit.set_uniform("HdLiquid", if hd_tiles { 1.0f32 } else { 0.0 });
gl_use_material(&self.lit);
for cz in 0..self.ncz {