Wood: giant mushrooms underground, felled by imps; wooden bridges and doors cost wood
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c5adc3e902
commit
398bb95681
28 files changed
+447
-31
No files matched your search
@@ -401,6 +401,17 @@ impl MB {
|
||||
);
|
||||
}
|
||||
}
|
||||
// An axis-aligned box without its bottom (plants: stems, caps, trunks, crowns)
|
||||
fn boxy(&mut self, lo: Vec3, hi: Vec3, cell: u32, c: [u8; 4], top: [u8; 4]) {
|
||||
let (a, b) = cell_uv(cell);
|
||||
let uv = [vec2(a.x, b.y), vec2(b.x, b.y), vec2(b.x, a.y), vec2(a.x, a.y)];
|
||||
let (x0, y0, z0, x1, y1, z1) = (lo.x, lo.y, lo.z, hi.x, hi.y, hi.z);
|
||||
self.quad([vec3(x0, y1, z0), vec3(x1, y1, z0), vec3(x1, y1, z1), vec3(x0, y1, z1)], uv, [top; 4], [Vec3::Y; 4]);
|
||||
self.quad([vec3(x0, y0, z0), vec3(x1, y0, z0), vec3(x1, y1, z0), vec3(x0, y1, z0)], uv, [c; 4], [-Vec3::Z; 4]);
|
||||
self.quad([vec3(x1, y0, z1), vec3(x0, y0, z1), vec3(x0, y1, z1), vec3(x1, y1, z1)], uv, [c; 4], [Vec3::Z; 4]);
|
||||
self.quad([vec3(x0, y0, z1), vec3(x0, y0, z0), vec3(x0, y1, z0), vec3(x0, y1, z1)], uv, [c; 4], [-Vec3::X; 4]);
|
||||
self.quad([vec3(x1, y0, z0), vec3(x1, y0, z1), vec3(x1, y1, z1), vec3(x1, y1, z0)], uv, [c; 4], [Vec3::X; 4]);
|
||||
}
|
||||
// Thin strip lying on a surface (normal n) from p to q, used for tile outlines
|
||||
fn strip(&mut self, p: Vec3, q: Vec3, n: Vec3, w: f32, c: [u8; 4]) {
|
||||
let side = (q - p).cross(n).normalize_or_zero() * (w * 0.5);
|
||||
@@ -834,6 +845,31 @@ fn build_chunk(map: &Map, amb: &[f32], glow: &[f32], cx: i32, cz: i32, atlas: &T
|
||||
}
|
||||
// room decor
|
||||
let dc = col(lava_lit(Vec3::splat(amb_at(amb, xf + 0.5, zf + 0.5)), lava_at(glow, xf + 0.5, zf + 0.5)), 1.0);
|
||||
if t.plant() {
|
||||
// a giant mushroom or a tree (marked for felling: a yellow tint)
|
||||
let (cx, cz) = (xf + 0.5, zf + 0.5);
|
||||
let a = amb_at(amb, cx, cz);
|
||||
let lg = lava_at(glow, cx, cz);
|
||||
let tint = |v: Vec3| col(lava_lit(if t.marked { v * vec3(1.3, 1.15, 0.5) } else { v }, lg), 1.0);
|
||||
let s = 0.85 + 0.1 * (t.var & 3) as f32;
|
||||
if t.kind == Kind::Mushroom {
|
||||
let h = 0.75 * s;
|
||||
let sc = tint(Vec3::splat(a.max(0.35)));
|
||||
mb.boxy(vec3(cx - 0.12, 0.0, cz - 0.12), vec3(cx + 0.12, h, cz + 0.12), T_STEM, sc, sc);
|
||||
// the cap glows a little in the dark
|
||||
let cc = tint(Vec3::splat(a.max(0.7)));
|
||||
mb.boxy(vec3(cx - 0.42 * s, h, cz - 0.42 * s), vec3(cx + 0.42 * s, h + 0.26, cz + 0.42 * s), T_CAP, cc, cc);
|
||||
mb.boxy(vec3(cx - 0.26 * s, h + 0.26, cz - 0.26 * s), vec3(cx + 0.26 * s, h + 0.38, cz + 0.26 * s), T_CAP, cc, cc);
|
||||
} else {
|
||||
let tc = tint(Vec3::splat(a.max(0.3)));
|
||||
mb.boxy(vec3(cx - 0.12, 0.0, cz - 0.12), vec3(cx + 0.12, 0.9 * s, cz + 0.12), T_BARK, tc, tc);
|
||||
let lc = tint(Vec3::splat(a.max(0.3) * 0.9));
|
||||
let top = tint(Vec3::splat(a.max(0.3) * 1.1));
|
||||
let leaves = T_LEAVES + (t.var as u32 & 1);
|
||||
mb.boxy(vec3(cx - 0.48, 0.75 * s, cz - 0.48), vec3(cx + 0.48, 1.55 * s, cz + 0.48), leaves, lc, top);
|
||||
mb.boxy(vec3(cx - 0.3, 1.55 * s, cz - 0.3), vec3(cx + 0.3, 1.95 * s, cz + 0.3), leaves, lc, top);
|
||||
}
|
||||
}
|
||||
// wear and tear: grit and cracks on plain floors
|
||||
if matches!(t.kind, Kind::Floor) {
|
||||
let hsh = (x as u32).wrapping_mul(2654435761) ^ (z as u32).wrapping_mul(2246822519);
|
||||
@@ -3083,6 +3119,8 @@ pub fn minimap_color(tile: &Tile) -> [u8; 4] {
|
||||
Kind::LavaBridge => [130, 120, 115, 255],
|
||||
Kind::Drawbridge => [120, 80, 50, 255],
|
||||
Kind::Obsidian => [60, 40, 70, 255],
|
||||
Kind::Mushroom => [150, 90, 200, 255],
|
||||
Kind::Tree => [40, 100, 40, 255],
|
||||
Kind::Shard => [255, 60, 120, 255],
|
||||
Kind::Aerie => [170, 140, 90, 255],
|
||||
Kind::Steel => [150, 160, 180, 255],
|
||||
|
||||
Reference in new issue
Block a user