OptionallayerMask: numberFourError INVALID_SCENE_GRAPH in a development build when
layerMask is not an integer in [0, 0xffffffff] (§85) — a NaN mask would
otherwise empty the list with no diagnostic at all. §85 lets a production
build drop expensive validation, and this one costs bytes in every shipped
bundle for a mistake that is an authoring error by construction, so it is
gated: measured at ~115 B gzip on ui-demo, deleted entirely by
__FOUR_DEV__: false (R-38, 2026-08-08). The check itself,
@fourjs/scene's assertLayerMask, is unconditional there — @fourjs/scene is a
§33 simulation package and may not branch on the build mode at all.
Builds the sorted render list for
root's subtree intoout, and returnsout(§64).World matrices are not resolved here. Each item's
worldMatrixis a reference to the node's own matrix, so the list is only as fresh as the lastresolveWorldTransformspass — which §7 requires the frame to run before render-item generation anyway, and which theApplicationcomposition root already runs before itsrenderlisteners. Keeping resolution out of this function is what lets the two passes stay separately schedulable (§64 lists them as distinct stages) and what makes the item generation free.outis truncated to the number of items generated, so a list that shrinks does not leave stale items behind. The items themselves are pooled peroutarray: after a rebuild the array contains the same item objects, with new contents and possibly in a new order. Two consequences worth stating —outarrays (they then have independent pools), which is the normal way to render several viewports.Allocates nothing in the steady state: no items, no matrices, no math objects. The first few frames grow the pool to the scene's item count and then stop.
layerMask(§46, §64 stage 2; R-38, 2026-08-08)Only nodes sharing a bit with
layerMaskgenerate items; their children are traversed regardless, because §46 layers do not inherit (seecollect). The default isALL_LAYERS, which makes the test true for every node whose mask is non-zero — i.e. every node that has not been explicitly removed from all layers — so a caller that omits it gets exactly the list it got before the parameter existed, in exactly the same order.This is the build-time half of §46 filtering, for the caller that builds one list per view. The other half is RenderItem's
layerssnapshot, which lets one shared list be filtered per view byview-list.ts'sbuildViewRenderList; the WebGL backend takes that route, because a frame that traverses the scene once and derives per view is cheaper than one that traverses per view (R-8).