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

    One run's residency accounting for sweep-registered progressive leaves, shared by all four geometry refinement phases. The map is seeded from every registered progressive loader, including completed loaders that the wrappers return from before admission, so a new view-triggered run cannot forget bytes already resident and ratchet the ceiling upward.

    Index
    perPath: Map<string, number> = ...
    declined: Set<string> = ...
    inFlight: Map<string, number> = ...

    Admitted and not yet recorded: path -> pessimistic bytes beyond its reservation.

    settleWaiters: (() => void)[] = []
    budgetBytes: number
    densityGate: RefinementDensityGate | null = null

    Optional projected-density gate. Consulted only for a rung the byte ceiling admits; its refusal shares this budget's declined set so the loop retires the loader for the run (non-sticky ACROSS runs — the gate is re-evaluated at every run start and re-kicked on zoom).

    • Build one sized from the device heap, matching the eager admission gate.

      initialResidencies is FIRST and REQUIRED, not an optional tail argument, because two separate guarantees rest on it and both fail silently when it is missing: resident bytes of already-complete loaders are forgotten (the ceiling ratchets upward, #2430), and — since the fair-share allowance divides headroom by the paths the budget currently knows — the first node admitted is handed the entire scene's headroom and can spend the whole ladder in one pass. Pass an empty iterable to opt out deliberately.

      Parameters

      Returns RefinementResidencyBudget

    • True once path has been refused this run. Callers MUST fold this into their anyHasMoreLODs / getLoaderProgress closures — see the module docstring; omitting it spins the refinement loop at frame rate.

      Parameters

      • path: string

      Returns boolean

    • Record path's current footprint and return whether it may refine plus its per-pass allowanceBytes. A refusal is sticky for the rest of the run: re-offering the same loader every pass would re-measure, re-refuse and re-log without making progress. An admission immediately reserves its estimated next rung, and record() replaces that estimate with the measured footprint when the step completes. The per-pass allowance divides remaining headroom by tracked eligible paths, including the other active workers when the sweep maps were seeded.

      CONCURRENT STEPS (B9c). Up to MAX_CONCURRENT_REFINEMENT_STEPS steps are admitted before any of them has recorded, and each can spend its whole allowance and then overshoot by one level of unknown size. The mean estimate is safe for ONE such step only: four admitted on it crossed the ceiling by four rungs. So a step admitted with nothing in flight is judged on the estimate alone, exactly as the serial loop was (and may cross by one rung, as it could); a step admitted while another is still in flight must ALSO fit a pessimistic reservation for itself and for every in-flight step: its allowance plus a next level as large as the node's whole current footprint (the stream:C doubling shape), with its allowance carved from the headroom those in-flight reservations leave. One that does not fit is in-flight: not admitted, not declined, not reported. Its caller waits on whenStepSettles and asks again. Far from the ceiling that check passes and the steps overlap; near it the loop falls back to serial admission.

      Parameters

      Returns RefinementPassAdmission

    • Whether a step reserving worstBytes fits beside the steps in flight. With none in flight it always does: the serial rule already admitted it.

      Parameters

      • worstBytes: number

      Returns boolean

    • Resolves at the next record() of an in-flight step, which is when an in-flight verdict should be asked again. Resolves at once when nothing is in flight, so a waiter never outlives the steps it waits on.

      Returns Promise<void>