High-res textures built on first use: no cost in the pixel-art style, the 128x128 atlas only when zoomed in
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fb71009110
commit
6ff1cc5f8d
2 files changed
+91
-20
No files matched your search
+8
-3
@@ -1406,7 +1406,7 @@ impl R3d {
|
||||
lava_fresh = true;
|
||||
}
|
||||
let ch = &mut self.chunks[(cz * self.ncx + cx) as usize];
|
||||
let atlas = if self.chunks_hd { &gfx.atlas_hd } else { &gfx.atlas };
|
||||
let atlas: &Texture2D = if self.chunks_hd { &gfx.atlas_hd } else { &gfx.atlas };
|
||||
let [m, o, l, k] = build_chunk(&g.map, a, &self.lava, cx, cz, atlas, self.wall_sub, self.chunks_hd);
|
||||
ch.mesh = m;
|
||||
ch.overlay = o;
|
||||
@@ -1652,8 +1652,8 @@ impl R3d {
|
||||
};
|
||||
let atlas = match tile {
|
||||
16 => &gfx.atlas,
|
||||
crate::gfx::HD_TILE => &gfx.atlas_hd,
|
||||
_ => &gfx.atlas_hd2,
|
||||
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() {
|
||||
@@ -1808,6 +1808,11 @@ impl R3d {
|
||||
// high) gives every texel nearly a pixel; fewer pixels would only turn it into noise
|
||||
let hd = self.pixel_rows >= crate::settings::HIGH_RES_ROWS as u32;
|
||||
let px_per_tile = world_rows / cam.view_h().max(0.1);
|
||||
if hd {
|
||||
// the detailed sprites are built on first use; that also measures the gear anchors,
|
||||
// which the gear below needs
|
||||
let _: &Texture2D = &gfx.hd_sprites;
|
||||
}
|
||||
for e in &g.ents {
|
||||
if !e.alive || e.held || unit_hidden(g, e) {
|
||||
continue;
|
||||
|
||||
Reference in new issue
Block a user