player(starfield): X-wing gliding into the nebula - #101
Open
eetu wants to merge 3 commits into
Open
Conversation
Adds the maquette X-wing (software-projected triangles, no three.js) as a foreground element in the Starfield viz. It's baked once to a cached buffer at a rear-3/4 hero pose (rotX 0.5, rotY 0 — engines toward the camera, nose up into the glow, canopy on the spine), then stamped each frame at bottom-centre with a cheap 2D transform: a slow glide bob plus a low-frequency turbulence sway/bank that swells with the music, and a soft engine wash that breathes on the beat. No per-frame re-projection (3k+ tris) — friendly to the Pi. Model lives at packages/player/src/models/xwing.js (verbatim maquette export, prettier-ignored; typed via xwing.d.ts).
The nose (the max-z end of the model, not the small z=-0.92 tail cone) was pointing toward the camera. Rotating the hero pose 180° about Y (rotY 0 → π, keeping rotX 0.5) points the nose up into the distance toward the nebula core — we see the rear/engines, ship receding to centre. Fixes the nose-down grievance.
Replace the software triangle-painter maquette with a real 3D model, precompiled from data/model.glb at author time and drawn live by a tiny WebGL renderer — no three.js in the runtime bundle. - scripts/gen-xwing.mjs: author-time extractor (run when the glb changes). Uses glTF-Transform as a DEV dependency — robust to any re-export (KHR_mesh_quantization, EXT_meshopt_compression, Draco, emissive-strength, interleaving). Bakes the node hierarchy into world space, merges every mesh, keys by a material table, and emits xwing.geometry.ts (base64 typed arrays, bundle-ready). - xwing-render.ts: minimal WebGL renderer — one Lambert program with a depth buffer (glitch-free), per-vertex material colour + baked emissive engine glow. Intrinsic rotation (Rx·Ry·Rz, Z innermost) so rotZ rolls about the fuselage. - Starfield: the ship holds a rear-3/4-from-above heading, nose up to the far nebula core, adrift on slow music-INDEPENDENT space eddies (lengthwise roll + all-axis tremor); near-orthographic telephoto so there's no perspective ballooning; eases near + still on pause. Drops the old maquette xwing.js/.d.ts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Embeds the LLM-modeled X-wing (a maquette export — software-projected triangles, no three.js) into the
Starfieldviz, which was always stubbed for it ("A 3D ship model will be brought in later").rotX 0.5, rotY 0) — engines toward the camera, nose pointing up into the nebula glow, canopy on the spine. (Found empirically by rendering an orientation grid.)Model at
packages/player/src/models/xwing.js(verbatim maquette artifact, prettier-ignored; typed viaxwing.d.ts). SharedStarfield, so both tracker + party get it.typecheck 0/0, both apps build clean. (Verified the framing headlessly against the real nebula backdrop.)