Merge branch 'r3d/layer-hotfix' into lang/foundations
This commit is contained in:
commit
edaec666d1
1 changed files with 6 additions and 4 deletions
|
|
@ -387,9 +387,9 @@ function layer_new(render3d_st: mut Render3dState, model: Model, cap: int, folia
|
||||||
l.near = near
|
l.near = near
|
||||||
l.cull = cull
|
l.cull = cull
|
||||||
l.tint = v3_new(1.0, 1.0, 1.0)
|
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
|
# the whole capacity up front: a game writes l.inst directly (Maroon Lake's prints, trees and
|
||||||
# 0.4 GB, most of it never filled (plan 23 of maroon-lake)
|
# rocks do), so a layer cannot start smaller than it may be written to
|
||||||
l.have = min(cap, 256)
|
l.have = cap
|
||||||
l.inst = floats(l.have * INST_FLOATS)
|
l.inst = floats(l.have * INST_FLOATS)
|
||||||
l.scratch = floats(l.have * INST_FLOATS)
|
l.scratch = floats(l.have * INST_FLOATS)
|
||||||
l.last_cam = v3_new(100000.0, 0.0, 0.0)
|
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
|
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 {
|
function layer_room(l: Layer, n: int) -> void {
|
||||||
if n <= l.have { return }
|
if n <= l.have { return }
|
||||||
var want = max(l.have * 2, n)
|
var want = max(l.have * 2, n)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue