Fix invisible torch flames (halo hid them); thin wisp of torch smoke

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-05 16:13:37 +01:00
1 parent c5378d0774
commit 77fa142d9d
2 files changed
+23 -6

No files matched your search

+7 -1
View File
@@ -2698,7 +2698,6 @@ fn draw_torch_stand(x: f32, z: f32) {
// sway and flicker; a soft halo around it (the smoke comes from particles.rs)
fn draw_torch_flame((x, z): (f32, f32), base: f32, k: f32, t: f32) {
let flick = 0.8 + 0.2 * (t * 13.0 + k * 2.1).sin() + 0.1 * (t * 29.0 + k * 0.7).sin();
draw_sphere(vec3(x, base + 0.1, z), 0.24 * flick, None, Color::new(1.0, 0.55, 0.15, 0.16));
let n = 6;
for i in 0..n {
let f = i as f32 / (n - 1) as f32;
@@ -2713,6 +2712,9 @@ fn draw_torch_flame((x, z): (f32, f32), base: f32, k: f32, t: f32) {
};
draw_cube(vec3(x + sway, h, z + sway2), Vec3::splat(size), None, Color::new(c.x, c.y, c.z, 0.95 - f * 0.4));
}
// the halo last: the glow material writes depth, so anything drawn after it inside the
// sphere would be hidden
draw_sphere(vec3(x, base + 0.1, z), 0.24 * flick, None, Color::new(1.0, 0.55, 0.15, 0.16));
}
// particles that glow (embers, sparks, smoke, flashes, shock waves)
@@ -2774,6 +2776,10 @@ fn draw_parts_glow(g: &Game) {
let life = (p.t / p.max).clamp(0.0, 1.0);
let at = vec3(p.x, p.h, p.y);
match p.kind {
WISP => {
// a thin thread of smoke: small pixels that fade, they do not grow
draw_cube(at, Vec3::splat(p.size), None, Color::new(c.r, c.g, c.b, 0.55 * (1.0 - life)));
}
EMBER | SPARK | MOTE | SPLASH => {
let s = p.size * (1.0 - life * 0.6);
draw_cube(at, Vec3::splat(s), None, Color::new(c.r, c.g, c.b, 1.0 - life * life));