Skip to content

Add the director to the golden_line example - #354

Merged
ASDAlexander77 merged 2 commits into
mainfrom
golden-line-director
Dec 5, 2026
Merged

ASDAlexander77 merged 2 commits into
mainfrom
golden-line-director

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

Summary

  • This PR adds the original's director to the golden_line example, from cameraman.js. It cuts from take to take every 6 to 10 seconds, in the original's running order:
    • Natural cuts: a cut is timed to a tunnel exit or a viaduct coming up, using naturalStart.
    • Jumps: when the next take needs somewhere else, the train is sent on down the line. The cut waits until that place has streamed in (up to 7 s), as the original's streamer does with its second focus.
  • Turning it on: -director, the D key, or the new Director checkbox in the panel.
  • Choosing by hand: the keys 1–5 and C, or the panel's radio buttons, now go through select. A take that needs somewhere else waits for that place to stream in before it cuts; it no longer jumps the train there at once.
  • Looking around: dragging with the left button turns the lens, within each shot's limits, eased as the original does.
  • Streaming: chunks and water bodies are kept around a second place. That place is built a piece every quarter second, or every frame once the cut waits for it.
  • Cuts: every cut now snaps the train and the water, as the original's onCut does. Before, our water.cut() was never called.
  • Bug fix: BridgeRig normalizes as three does (multiplying by 1 / length). This fixes a 1-ulp difference in the viaduct camera.

Verification

  • Cut sequence: the director's cuts match the original exactly over 900 s (107 cuts, 30 jumps; every pose sampled each second). The original's cameraman.js runs under node and ours under the tslang JIT, with the same stand-in streamer.
    • The live app (own, -director -hiddenWindow) makes the same cuts at the same times, with jumps to the same places.
  • Shot poses: the earlier rig pose dump (17 composed cases) is still identical.
  • Mouse look: the look maths matches three's rotateOnWorldAxis / rotateX / rotateZ to 9 decimals.
  • Frames: the golden_line views are byte-identical in gc, own and rc. Against main, the only change is the new checkbox in the panel. ctest -R golden_line passes 6/6.
  • Debug layers: a live director run across a jump is clean under Vulkan validation and the D3D12 debug layer.

Known

  • Main-thread cost: chunks are built on the main thread (the original builds them in web workers).
    • Preloading the next place costs about 18 frames of 70–110 ms, four a second, before each jump.
    • The jump frame itself takes about 0.3 s, mostly the grass rebuilding around the new camera, as on any jump before this PR.
  • Not ported yet: the throttle (W/S), photo mode, the headlight's beam on the line after dusk, and the sound.

🤖 Generated with Claude Code

ASDAlexander77 and others added 2 commits December 5, 2026 10:58
…ixes

pre-alpha146 fixes TSLANG 234-240 (and 242, 244 with them), so the golden_line
modules go back to the code the original writes:

- the rng.js / plume.js hashes in hex with >>> (no ushr/unsigned helpers)
- water empties one grid across cells; textures and plume empty their arrays
  through their locals
- treegen's emitTube reads `const pts = tube.pts`
- the station assigns its name with the rest of the plan
- the tender warps its coal lump with a closure, as tender.js does

Kept, because the real modules still fail under --own-fallback=error though
the small repros pass: world.ts's slot tables and bag refill, the saloon's
chair closures, traingeo's geoTake, the cab's limb closures (TSLANG 246).

Every example builds on gc and own; full ctest 535/535 on both; golden_line
frames and train dumps identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port the original's director (cameraman.js): director mode cuts from take to
take every 6 to 10 seconds in the original's running order, times a cut to a
tunnel exit or a viaduct coming up (naturalStart), and sends the train on down
the line when the next take needs somewhere else, cutting once that place has
streamed in (up to 7 s). -director, the D key or the panel's Director
checkbox turn it on; by hand the keys 1-5 and C (and the panel) select a
camera through the same wait, and dragging with the left button looks about
within each shot's limits.

The chunks and water bodies are kept about a second place (streamer.js's
second focus), built a piece every quarter second, or every frame once the
cut waits for it. Every cut now snaps the train and the water, as onCut does.
BridgeRig normalizes as three does (times 1 / length), fixing a 1-ulp
difference in the viaduct camera.

The cut sequence matches the original's bit for bit over 900 s (107 cuts, 30
jumps) under node vs the tslang JIT; the golden_line views are unchanged but
for the panel's new checkbox.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Base automatically changed from tslang-146-workarounds to main December 5, 2026 11:00
@ASDAlexander77
ASDAlexander77 merged commit db9ec90 into main Dec 5, 2026
2 checks passed
@ASDAlexander77
ASDAlexander77 deleted the golden-line-director branch December 5, 2026 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant