diff --git a/packages/ludic.render3d/scatter.ludic b/packages/ludic.render3d/scatter.ludic index 773a1b91..1a3aefdc 100644 --- a/packages/ludic.render3d/scatter.ludic +++ b/packages/ludic.render3d/scatter.ludic @@ -387,9 +387,9 @@ function layer_new(render3d_st: mut Render3dState, model: Model, cap: int, folia l.near = near l.cull = cull l.tint = v3_new(1.0, 1.0, 1.0) - # room for what the layer holds, not for what it might: 45 layers at full capacity up front were - # 0.4 GB, most of it never filled (plan 23 of maroon-lake) - l.have = min(cap, 256) + # the whole capacity up front: a game writes l.inst directly (Maroon Lake's prints, trees and + # rocks do), so a layer cannot start smaller than it may be written to + l.have = cap l.inst = floats(l.have * INST_FLOATS) l.scratch = floats(l.have * INST_FLOATS) l.last_cam = v3_new(100000.0, 0.0, 0.0) @@ -402,7 +402,9 @@ function layer_new(render3d_st: mut Render3dState, model: Model, cap: int, folia return l } -# room for n instances (at most the layer's cap), doubling what there is so a fill costs a few copies +# room for n instances (at most the layer's cap), doubling what there is so a fill costs a few copies; +# a caller writing l.inst itself reserves first +function layer_reserve(l: Layer, n: int) -> void { layer_room(l, n) } function layer_room(l: Layer, n: int) -> void { if n <= l.have { return } var want = max(l.have * 2, n)