Commit Graph

42 Commits

Author SHA1 Message Date
39d3dc489b glb_writer: harden JSON/transform/primitive validation and shared path guard (GLB-WRITER-VALIDATION-HARDENING) 2026-11-25 01:14:25 +01:00
9a892a3dc6 Merge pull request #3580 from Kam471 2026-11-22 17:02:49 -05:00
24bed02de4 glb_writer: keep inline comments out of continuations
A backslash inside an inline comment ended the logical line and swallowed the next face. Split the comment before testing for a continuation; a backslash in the code before the comment still continues.
2026-11-22 21:08:18 +00:00
fbfd3ff562 glb_writer: join split OBJ lines before parsing
Join physical OBJ lines that end in a backslash into one logical line with a separating space, skipping blank and comment lines inside a continuation.
2026-11-22 20:57:51 +00:00
4aca557b89 Merge pull request #3083 from Vonsek 2026-11-22 15:14:40 -05:00
021da1d4e5 Merge pull request #2905 from Vonsek 2026-11-22 15:13:02 -05:00
b25dabe264 Merge pull request #2902 from kapitche 2026-11-22 15:13:00 -05:00
caf67be85e Merge pull request #2671 from Vonsek 2026-11-22 15:11:20 -05:00
4a0319ba21 fix(assets): retain collinear OBJ corners in visible triangles
A zero-area triangle can swallow the UV at a collinear boundary vertex. Use the existing ear clipping path when a first-corner fan contains one.
2026-11-22 20:19:41 +01:00
52188b7c7e fix(assets): use stored transforms for GPU instance bounds
The GPU instancing accessors round transforms to float32. Bounding a mesh with the source values can miss the transformed geometry stored in the GLB.
2026-11-22 19:39:32 +01:00
d5935df1de glb_writer: refuse an output path that is the input OBJ 2026-11-22 13:38:31 -05:00
85f59988a0 Merge pull request #2714 from FreddyxS 2026-11-22 13:17:16 -05:00
b5654ad722 Merge pull request #2517 from Vonsek 2026-11-22 13:15:52 -05:00
9ebbe920d7 merge: preserve upstream changes alongside the asset fix 2026-11-22 19:08:50 +01:00
881de92f47 Fix GLB extension and core chunk ordering 2026-11-22 18:58:41 +01:00
24cda1e605 fix(tools): keep OBJ smoothing boundaries in generated normals
Adjacent faces with different smoothing groups or disabled smoothing require separate generated normals at shared positions.
2026-11-22 18:48:22 +01:00
bdda2a5da5 fix(tools): keep indexed materials in instanced GLB exports
The instanced writer resolves its materials from packed primitives, so dropping an indexed binding during packing made the mesh use default clay.
2026-11-22 18:19:47 +01:00
799ad414e5 Merge pull request #2293 from Vonsek 2026-11-22 11:43:53 -05:00
3da17e3707 Merge pull request #2092 from Vonsek 2026-11-22 11:41:44 -05:00
39e0b14964 fix(tools): preserve finite OBJ normal directions
Squaring finite components could turn a valid normal into the fallback direction. Normalize with a stable length and rescale only when the length cannot preserve the direction.
2026-11-22 17:36:49 +01:00
f1029d387f fix(tools): preserve the first record in BOM-prefixed OBJ input
The byte order mark prevents a UTF-8 OBJ parser from recognizing the first keyword. Handle the marker identically for on-disk and in-memory input.
2026-11-22 16:47:25 +01:00
fa5986c791 Merge pull request #1990 from Shrey Ratna 2026-11-22 10:40:10 -05:00
54eb276565 glb_writer: validate geometry before generating normals 2026-11-22 15:22:21 +00:00
c25e2773f7 GLB writer: preserve hard edges next to explicit OBJ normals 2026-11-22 15:14:19 +01:00
f698bf2206 tools: a path outside the console's code page no longer crashes a tool's output
On Windows a redirected stdout uses the console's ANSI code page, and python -I ignores PYTHONUTF8 and
PYTHONIOENCODING, so a caller path with a character outside that code page ended a run with
UnicodeEncodeError as soon as a tool printed it. #1406 fixed make_game.py; every CLI tool in tools/ now starts
its __main__ block the same way (stdout errors="replace").

tests/test_tool_stdout_encoding.py checks every tool's __main__ block and reruns two measured crashes
(analyze_4240_full.py, meshlet_page.py) with a private-use-named input. Found by @abilliontokens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 11:27:00 +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
8ae863728b Merge pull request #1098 from nicolas 2026-11-22 02:09:05 -05:00
3b48fbd26e Merge pull request #1056 from nicolas 2026-11-22 01:38:08 -05:00
62dc9cb8cd Triangulate concave OBJ faces within their outlines 2026-11-21 23:35:34 -07:00
03cb0331c3 Merge pull request #1000 from bbareth 2026-11-22 01:08:16 -05:00
7dc224de25 Preserve material opacity and cutouts in GLB output 2026-11-21 22:58:40 -07:00
830cb0d20d glb_writer.py: an external buffer is checked against its own byteLength
read_glb_summary() took buffers[0]'s limit from the embedded BIN chunk even
when the buffer has a uri, so a legal external buffer with no BIN chunk made
every bufferView "exceed buffer 0 (... > 0)". An external buffer's limit is
now its declared byteLength (which must be a non-negative int); the BIN
chunk check applies only to an embedded buffer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 06:35:38 +01:00
430265a0ed file_mode: find a new file's mode with a probe file, not by flipping the umask
glb_writer._output_mode and rtti_scan._report_mode read the umask with
os.umask(0) then os.umask(mask). The umask is process-wide, so any thread
creating a file in that window got mask 0. A probe file created with mode
0666 gives the same bits (and honours a directory's default ACL) without
changing anything. Raised by kapitche on #750 and #728.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 10:39:11 +05:30
85e8388080 Merge pull request #866 from sanuk369 2026-11-21 23:15:36 -05:00
808c947ccf glb_writer: read the umask under a lock
_output_mode reads the umask by setting it to 0 and back, and the umask is
process-wide. Two threads publishing new GLBs could interleave so that the
process stayed at umask 0 and one file got mode 0666. A module lock makes the
set-and-restore atomic for every writer here.
2026-11-22 09:30:14 +05:30
51a4788028 GLB writer: smooth generated normals across OBJ UV seams 2026-11-22 04:47:49 +01:00
18c8092cc8 glb_writer: a published GLB keeps the replaced file's permission bits
The staging file comes from NamedTemporaryFile, which creates it 0600, so
every GLB written since #425 has been owner-only on Linux. The staging file
now gets the replaced file's mode, or 0666 minus the umask for a new one,
before the replace. Same issue @VictorJulianiR found in rtti_scan (#750).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:55:46 +00:00
7410f5d37f glb_writer: retry a replace hit by a sharing violation; test ab_control_flow's metadata filters
Follow-ups to review points on two merged PRs.

#425 (@SourNuht): write_glb said overlapping writers all publish complete
files, but on Windows os.replace onto the same destination raises
PermissionError while another writer is replacing it. 8 threads x 40 writes
to one path failed 43-152 of 320 calls. A replace that hits PermissionError is
now retried with a short backoff (about 1.3 s in total), Windows only; a lasting
hold still raises and leaves the old file. Other errors are not retried.

#441 (@ToxicmaggotRP): the stage, binding and feature filters were never
reached by the tests (the rejected entries had no files, so they dropped out
earlier), and only dispatch-side instability was tested. Tests only; each of
those filters now fails a test when removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:22:37 +00:00
513adfd8a0 Merge pull request #425 from SourNuht 2026-11-21 19:14:02 -05:00
6fcbd4f61c glb_writer: isolate staging files for overlapping exports
Use a unique same-directory staging file and close it before atomic replacement. Preserve unrelated sibling .tmp files and clean only this writer's staging file on failure. AI-assisted (Codex).
2026-11-21 15:41:01 -08:00
56cd8afe83 glb_writer.py: keep mirrored OBJ faces front-facing 2026-11-22 00:13:17 +01:00
691527329c tools, viewer: add stdlib world.json/.glb chunk builder and harden viewer 2026-11-21 16:10:06 -03:00