The camera hash (#cam=x,y,z,yaw,pitch) was read once at startup. A link
pasted into the address bar of a tab that already shows the viewer, or
Back/Forward between two links, changes only the hash: the page does not
reload and the camera stayed where it was. The viewer now applies the
hash again on hashchange; a hash that is not a camera link is ignored,
as at startup.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The help line offered Ctrl as the slow modifier for W A S D and Q/E, but
with a movement key held Ctrl makes a browser shortcut: Ctrl+W closes
the tab (a page cannot cancel it in Chromium or Firefox), Ctrl+S and
Ctrl+D open the save-page and bookmark dialogs and Ctrl+E moves the
focus to the address bar. The keydown handler leaves modified keys to
the browser, so slow flight forward lost the whole viewer, and every
other slow direction left the page.
Slow is now the C key, which no browser binds. Ctrl leaves the speed
alone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
loadWorld() read the body and parsed it in one try, so a 200 response whose
body read failed was reported as "could not be read as valid JSON".
The read and the parse now have separate stages, and the message names the
stage that failed. Tests cover a failed read, invalid JSON text and a valid body.
The free camera's wheel handler took every wheel event, so a trackpad's two-finger sideways scroll
(deltaX only, deltaY 0) hit the "deltaY >= 0" branch and divided the speed by 1.15 per event.
The handler now ignores an event whose horizontal component is larger than its vertical one, so a
pan does not slow the camera. test_viewer_streaming.cjs drives the captured wheel handler and
checks climb per frame: a sideways event keeps 4 m, a dominant horizontal diagonal keeps 4 m, and
one notch up gives 4.6 m (40 m/s * 1.15 * 0.1 s).
viewer/index.html calls loadWorld() at module scope, which creates an
AbortController and arms a setTimeout. This test's vm context provides
neither, so the Shift/Ctrl camera test died with 'AbortController is
not defined' (setTimeout next once it is added), and the viewer-tests
job fails on every PR: Node 24's vm context has only what the sandbox
gives it, as Node 20's does here. The globals are now in the sandbox,
with timers that never fire since the manifest has no chunks.
The help line says "Shift fast · Ctrl slow", and the speed factor tests
both Shift keys but only ControlLeft, so holding the right Ctrl key moved
at full speed.
The test runs the viewer's own main loop for one synthetic frame per key
and compares how far E climbs.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
--placements used to copy a model's geometry into every placement and keep
all copies until chunking (#1183 review: 22 GB for a 700 m box). Now each
model's OBJ is parsed once into a packed cache file, each chunk stores every
model it uses once, and the placements are instance transforms:
EXT_mesh_gpu_instancing by default (three.js GLTFLoader reads it), one plain
glTF node per placement with --instancing nodes, or the old baked copies
with --instancing bake. Chunks are written as soon as they are built; with
--jobs N, packing and chunk writing run in N processes, at most 4N jobs in
flight. Memory is about 100 bytes per placement plus the models of the
chunks being written.
Every instance TRS has a positive determinant. A negative XY scale is folded
into the rotation; a negative Z scale draws a mirrored copy of the mesh
(glTF Y negated, winding reversed). Zero-scale placements are counted as
degenerate_scale. iter_placements streams the rows load_placements selects,
with the same checks (load_placements is unchanged).
--lod-sets builds one chunk set per lodLevel tier (c_<tier>_<x>_<z>, with
the tier and grid cell in each chunk record) and writes lod_bands to
world.json: a camera-distance band per tier from the entities' median
childLodDist/lodDist. The viewer loads a tiered chunk while the horizontal
distance to its cell is in the band (32 m slack before unloading), so each
cell shows one tier; worlds without lod_bands stream as before, and the
manifest check rejects unknown tiers, unordered bands and missing cells.
glb_writer: pack_primitive and _MaterialTable are factored out of build_glb
(output unchanged), plus build_instanced_glb / write_instanced_glb and
instance_bounds.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>