Commit Graph
4 Commits
Author SHA1 Message Date
Dejvino 34384ac4d8 tron-room-demo: fog toward the background color (fade into the void)
The fog target is now COL_BG instead of the steel haze: far geometry
converges exactly onto the void color, so the deck dissolves seamlessly
into the background instead of glowing against it.

This exposed and fixed a channel bug in fogMix: the green channel
divided by 64 instead of 32 (blended at half strength). It was
invisible while the fog color's green level matched the walls', but
fading toward g=0 left far walls tinted green. fogMix is now a
weighted average (c*(32-f) + fog*f) with per-channel rounding, exact
at both ends and unbiased in either direction.
2026-11-16 22:55:35 +01:00
Dejvino 89250d7f19 tron-room-demo: true depth fog (aerial perspective)
The old 'fog' was multiplicative darkening (color scaled toward black),
which reads as shading rather than atmosphere. Geometry now blends
toward a steel haze color (COL_FOG) with camera distance: fogAmt()
maps distance to a 0..32 fixed-point amount between FOG_NEAR/FOG_FAR,
and fogMix() lerps the 5/6/5 channels toward the haze with rounding.
Applied to box faces + top rims, floor quads, network links and
packets. Near geometry stays crisp and saturated; the far corners of
the deck dissolve into the haze, giving a real depth cue.
2026-11-16 22:53:20 +01:00
Dejvino 23b3c88caa tron-room-demo: store the framebuffer in panel wire order (fixes swapped colors on HW)
The ST7789 receives pixel bytes high-byte-first, and TFT_eSprite's
pushSprite sends the sprite buffer raw — which is why the sprite's own
primitives store colors byte-swapped (drawPixel: color = color>>8 |
color<<8). RoomViewCore wrote native little-endian values instead, so
every pixel reached the panel byte-swapped: BG 0x0002 showed as green
(0x0200), the fogged floor 0x0882 as pink (0x8208) — exactly the
symptoms reported from hardware.

The core now stores pixels in panel wire order (toWire byteswap on
store, one 16-bit rotate per pixel); the emulator blit unswaps before
the 565-to-8888 expansion, so its output is pixel-identical. Also add
-O2 to the firmware env: PlatformIO's default -Os optimizes for size
and was likely a large part of the 13 fps report.
2026-11-16 22:49:06 +01:00
Dejvino 5310079870 tron-room-demo: free-running hardware benchmark build for the T-Deck
Split the sketch into a device-agnostic renderer core (RoomViewCore.h:
RGB565 rasterizer, camera, world sim — no emulator dependencies) plus a
thin emulator shell (keyboard pump + the 565-to-8888 presentation blit).

Add fw/ as a self-contained PlatformIO project (own platformio.ini
pointing at the shared boards/, lib/ and src/netdeck headers — per-env
src_dir is not supported by PlatformIO, so NetDeck's top-level config
stays untouched). fw/RoomViewHW.ino is the firmware twin: the core
rasterizes directly into a TFT_eSprite's frameBuffer() (16-bit, PSRAM)
and presents with the proven NetDeck startWrite/pushSprite/endWrite
pattern. The loop free-runs and reports true throughput over USB serial
every 2 s: fps + average render vs. push split.

Verified: emulator render unchanged (smoke frame identical), pio
RoomViewHW env builds clean for ESP32-S3 (346 KB flash), make netdeck
dual build green.
2026-11-16 22:41:20 +01:00