mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 16:59:19 +02:00
The camera-ring visual load replays the twin once per distance ring, and each pass had to read every node's header + X Y Z tokens (~8 tokens through the cParser pipeline) just to decide whether the node is in the current ring -- expensive when a scenery has a million flora instances. Bump the twin format to v7: a visual model node's marker now carries its local position (3 f32), captured at bake time from the node's first three numbers. The reader hands the position out (scenery_binary_reader::node_position), and the deserializer ring-tests a model and skips it in O(1) over the marker span, straight from the dispatch loop, without deserialize_node decoding any of its tokens. deserialize_model uses the same marker position for its own ring test so the two decisions agree exactly (a node near a ring boundary can't be dropped by both adjacent rings). Shapes/older twins have no marker position and fall back to the token-based test. The per-frame visual budget is factored into VISUAL_BUDGET_MS. Verified: td.scn rebakes to v7, no duplicates, no unexpected tokens, completes ~1s. tomaszewo (1M+ flora) stays memory-bounded with no duplicates; full streaming is still paced by walking every node per ring (the remaining cost is the replay pipeline itself, which a spatial section index would address). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
33 KiB
33 KiB