Luxar Viewer API Documentation - v2026.9.22
    Preparing search index...

    Function writeSortedIndexOrderingLive

    • Write a COMPLETE depth-sort permutation straight into the ACTIVE ordering buffer, live, with no staging and no slot flip. Returns count on success and 0 when the ordering is rejected.

      This is the one-shot counterpart of writeSortedIndexOrdering, which streams into the INACTIVE buffer and flips only when the last slice lands — necessarily a frame or more later, because the pump is driven once per rendered frame. That delay is the whole point when the ordering arrives from the SortWorker: it keeps a partially written permutation off screen.

      It is dead weight when the ordering was computed synchronously inside the commit, because there is no partial state to hide — the permutation is complete before the first write. Writing it live is then safe for exactly the reason writeSortedIndexIdentityRange gives for the same choice, and it is what removes the unsorted frame rather than merely improving it.

      The two rejections mirror writeSortedIndexOrdering: a TRUNCATED ordering is not a permutation of the drawn population, and an OVERSIZED count describes a population this geometry does not hold. Neither is clamped — a clamped prefix of a permutation is not a permutation of anything.

      Parameters

      • geometry: InstancedBufferGeometry
      • ordering: Uint32Array
      • count: number

      Returns number