Commit Graph

24 Commits

Author SHA1 Message Date
08f1822374 Viewer: show WebGL startup failures in the overlay 2026-11-22 15:26:47 +01:00
48002bd265 Merge pull request #1425 from bbareth 2026-11-22 06:38:01 -05:00
02ba5f28b2 Viewer: hide cached LOD chunks outside their draw band 2026-11-22 12:18:39 +01:00
342ba8cd41 Viewer: report an invalid explicit --world directory 2026-11-22 12:13:12 +01:00
3696b3706e Merge pull request #1352 from jakeefr 2026-11-22 05:37:53 -05:00
867910e329 viewer: a port in use is one line, and Ctrl+C stops the server without a traceback
Starting serve.py while a viewer is still running on the port ended in an OSError traceback from socketserver, and
stopping it with Ctrl+C in a KeyboardInterrupt one. The first is now an argument error that names the port and
points at --port 0; the second prints "viewer: stopped" and closes the socket.

tests/test_viewer_serve.py: two tests, both fail on the old code. The Ctrl+C one is skipped on Windows and gives
its child the default SIGINT disposition, so it also passes under a runner that has SIGINT ignored.
2026-11-22 10:04:47 +00:00
99a40c54b1 world_build: instanced placements with bounded memory, and LOD chunk sets
--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>
2026-11-22 10:02:54 +00:00
09db8acbba Merge pull request #993 from bobcatchris 2026-11-22 01:08:13 -05:00
e53ce0d54d viewer: test the serve.py guards, and make a bad --port a usage error
viewer/serve.py holds the DNS-rebinding Host check, the /world/ traversal
resolver and the 403s in front of them, and nothing tested it: the CI viewer
job runs only the streaming tests. tests/test_viewer_serve.py covers the Host
allow/deny matrix, path resolution (.., encoded %2e%2e, backslashes, NUL,
drive letters, reserved device names, directories, a symlink out of the
world) and the HTTP layer on a loopback server (200 with no-store, the .glb
MIME type, HEAD, query strings, 403 for a foreign Host and for traversal).

--port was a plain int, so 70000 or -1 reached socketserver and ended in
OverflowError; 0 bound a free port but printed the URL of port 0. It is now
an argparse type limited to 0-65535, and the message prints the bound port.

Negative control on main: the CLI test fails (exit 1 with a traceback) and
port_number does not exist. With the change: 21/21. The node viewer tests
still pass 29/29. Standard library only, temporary world folder, no game data.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-21 23:34:13 -06:00
86bb28b7b1 Viewer: defer chunk bounds helpers until requested 2026-11-22 05:12:09 +01:00
d54b9c3628 Merge pull request #824 from FreddyxS 2026-11-21 22:37:50 -05:00
93f319bb52 Viewer: track original materials outside glTF extras 2026-11-22 04:32:02 +01:00
2c3c14f3be Viewer: select generated terrain from world mode 2026-11-22 04:20:23 +01:00
06a8593f63 Viewer: resolve GLB dependencies after redirects 2026-11-22 02:23:55 +01:00
21ec948cf2 Release decoded bitmaps when a viewer chunk is discarded 2026-11-21 21:45:05 -03:00
a42b5e2c75 Skip unnecessary viewer chunk candidate scans 2026-11-22 00:35:52 +01:00
5da04fd204 Validate world manifests before viewer startup 2026-11-21 23:48:40 +01:00
c8081eb0ba Cancel distant viewer chunk downloads after camera moves 2026-11-21 23:12:33 +01:00
bc9e77c8ba Merge pull request #213 from Jonathan 2026-11-21 16:37:30 -05:00
0c17741bf4 Viewer: retry failed chunk loads with bounded backoff 2026-11-21 17:29:15 -04:00
ed9c90a463 viewer/serve.py: answer only requests addressed to 127.0.0.1 or localhost (DNS rebinding)
The viewer binds to 127.0.0.1, which keeps other machines out but not
other web pages: a page on any site can point its own domain at 127.0.0.1
(DNS rebinding) and then fetch http://<its domain>:8765/world/... as
same-origin, reading world.json and the .glb chunks built from the
player's copy. Those requests still carry the page's domain in the Host
header.

send_head now refuses (403) any request whose Host is not 127.0.0.1,
localhost or [::1] (any port, any case, trailing dot allowed). A request
with no Host header (a local tool, never a browser) is still served.

tests/test_world_build.py: host_allowed cases, and a live-server test
where Host rebind.example gets 403 without the world data while
localhost/127.0.0.1 get 200. Both fail on main.

AI-assisted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:28:32 +03:00
691527329c tools, viewer: add stdlib world.json/.glb chunk builder and harden viewer 2026-11-21 16:10:06 -03:00
4f1ff7d85b Replace local drive paths with placeholders
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 15:59:05 -05:00
db0dc8bd5e Initial commit: Leonida, build-it-yourself PC port groundwork
Shader pipeline (carve, FSSM unpack, gfx1013 disassembly, RDNA2 to SPIR-V),
asset export via rpf9-explorer's Core (submodule), PE loader and shim
skeleton, and make_game.py, which builds from the user's own copy of the game.
No game data, keys or executables are included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 15:22:16 -05:00