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

    Function compute_joint_codes

    • Per-endpoint joint code (drives the shader's join geometry and cap).

      TypeScript reference for the Rust compute_joint_codes kernel — see the Rust doc comment in wasm/rust/src/lines_clipping.rs for the full rationale. This mirror is not just a WASM-missing fallback: it is the production backend for ndim > 16, which the fixed-size Rust kernels cannot serve, so the two must agree exactly.

      Agreement is trivial here in a way it was not for the scalar this replaced: the output is integer index arithmetic, so there is no f32/f64 accumulation order to reconcile between the backends.

      value meaning
      0 free polyline end — keep the soft cap
      -1 slice-clipped — suppress the cap entirely
      -2 degree->=3 hub — keep the cap
      +(slot + 1) joins visible segment slot, at that segment's START
      -(slot + 3) joins visible segment slot, at that segment's END

      slot is a storage slot in the line texture, so it survives the depth-sort worker's draw-order permutation without adjustment.

      Parameters

      • segments: Uint32Array

        Vertex index pairs [numSegments * 2]

      • visibility: Uint8Array

        Visibility mask [numSegments]

      • t1Params: Float32Array

        Start interpolation parameters [numSegments]

      • t2Params: Float32Array

        End interpolation parameters [numSegments]

      • numSegments: number

        Total number of segments

      • numVertices: number

        Total number of source vertices (bounds the touch tables)

      • outputStart: Float32Array

        Output start joint codes [visibleCount]

      • outputEnd: Float32Array

        Output end joint codes [visibleCount]

      Returns number

      Number of visible segments written