Documentation
    Preparing search index...

    Function viewLayerMask

    • The §46 layer mask a view actually draws (§47, §48; R-38, 2026-08-08) — view.layerMask when it has one, the camera's own layers otherwise.

      const mask = viewLayerMask(view);
      for (const item of list) {
      if ((item.layers & mask) === 0) continue; // layersMatch, inlined
      draw(item);
      }

      §48's fallback rule in exactly one place, so every backend and every consumer that draws a viewport resolves it identically. Both defaults are ALL_LAYERS — a viewport with no mask over a camera with no mask draws every layer — so this returns ALL_LAYERS for every view built before layers existed.

      The trailing ?? ALL_LAYERS is not dead: Camera.layers is non-optional in the type system, but a structurally typed camera predating the field (@fourjs/render-webgl's test double, a host's own minimal camera object) reports undefined, and that must resolve to "draws everything" rather than to a mask of zero that silently empties the view. Same defence, same reason, as material.transparent === true in collect.

      Parameters

      Returns number