render3d: ground densities as LGD2 - empty tiles free, one-value tiles a word, deflated tiles, quantized
The first cut (LGD1) stored every tile of every layer raw, scale channel and all: 288 MB a map, which made Maroon's pack 803 MB. LGD2 keeps a tile index per layer (8 bytes a tile, read whole at the map's load): 0 all zero, 1 one value in the word, else an offset and a length, the top bit set when the bake deflated it (inflated into the tile cache with the runtime's z_inflate, a reused buffer; nothing per frame beyond the cache). A layer keeps its scale only where it varies, the density 6 bits and the scale 4 (the same integer arithmetic as the bake). The bake is maroon-lake's tools/bake/ground_density.py; the dev copy here writes the same format stored. Maroon 23.2 MB, Lamar 17.2 MB. The deflated flag is tested as a negative length: `b & 0x80000000` compiled to broken IR (an i32 `and` with a bare `-`), a compiler fault to fix separately. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
ea51307eaa
commit
4db972f4c8
3 changed files with 108 additions and 28 deletions
|
|
@ -854,6 +854,8 @@ export state Render3dState {
|
|||
gd_key: words = null
|
||||
gd_ref: words = null
|
||||
gd_slot_of: words = null
|
||||
gd_idx: words = null # every layer's tile index: (offset, or 0 empty / 1 one value; length or value)
|
||||
gd_zbuf: []byte = null # one tile's deflated bytes as read
|
||||
gd_hand: int = 0
|
||||
gd_trample_cb: fn(float, float) -> float = null
|
||||
gb_layer: int = -1 # the densities' layer the blades grow by; -1: the rules (grass_density.ludic)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue