Update ONLY the active instance count (and re-upload the [0,count) matrix range), leaving _capacity
— and therefore the already-allocated GPU buffer — untouched. This is the way to vary how many instances
draw FRAME-TO-FRAME on an established thin-instanced mesh WITHOUT recreating the GPU buffer (which would
invalidate any cached render/shadow bundle that captured the old buffer handle). Pre-size the buffer once
with setThinInstances(mesh, matrices, capacity), then call this each update with count <= capacity.
Count changes promote cached direct draws to stable indirect arguments, so the bundle stays valid.
Caller must keep writing into the SAME matrices array the mesh already references. No-op if the mesh
isn't thin-instanced yet.
Update ONLY the active instance count (and re-upload the [0,count) matrix range), leaving
_capacity— and therefore the already-allocated GPU buffer — untouched. This is the way to vary how many instances draw FRAME-TO-FRAME on an established thin-instanced mesh WITHOUT recreating the GPU buffer (which would invalidate any cached render/shadow bundle that captured the old buffer handle). Pre-size the buffer once withsetThinInstances(mesh, matrices, capacity), then call this each update withcount <= capacity. Count changes promote cached direct draws to stable indirect arguments, so the bundle stays valid. Caller must keep writing into the SAMEmatricesarray the mesh already references. No-op if the mesh isn't thin-instanced yet.