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

    Mesh surface material — shaded, indexed triangles.

    Hierarchy

    • ShaderMaterial
      • MeshMaterial

    Implements

    Index
    • Update the camera-dependent uniforms.

      _resolution and _isOrtho are accepted and IGNORED: the resolution exists so a material can size a screen-space sprite, and a mesh's size is its own geometry; the near fade's ortho test reads three's isOrthographic, i.e. the camera this draw uses. Only nearCull is consumed. Named with a leading underscore so the asymmetry is visible at the signature rather than buried in the body.

      Parameters

      • _resolution: Vector2
      • _isOrtho: boolean = false
      • OptionalnearCull: number
      • Optional_pixelRatio: number

      Returns void

    • Update gamma. Toggles LUXAR_GAMMA_ONE across the 1.0 threshold so the fragment pow() fast path recompiles in/out — mirrors the sibling materials.

      Parameters

      • gamma: number

      Returns void

    • opaque-mode cutout threshold. Plain uniform write — inert in every other mode, where the coverage is applied by the framebuffer instead of compared.

      Parameters

      • cutoff: number

      Returns void

    • Switch between the stored-normal, derivative-normal and unlit variants.

      Called per commit by applyMeshShading, because the normal_dims == displayDims half of the §3.4 rule is view-dependent. Idempotent and guarded: toggling a define recompiles the program, which must not happen on a slice move that changed nothing.

      'none' is NOT view-dependent — it is authored — but it flows through the same setter so there is one place that owns the shading define set. A separate setUnlit would let a per-commit updateShading('flat') silently clear it.

      Parameters

      Returns void

    • Swap the base-colour texture, maintaining the one-colour-source invariant.

      A null texture falls back to whatever the other sources provide, which is why this routes through the shared resolver rather than just deleting its own define: dropping a texture from a node that also has a colormap LUT must re-enable USE_COLORMAP, not leave the mesh with no colour source at all.

      Parameters

      • texture: Texture<unknown, TextureEventMap> | null
      • luminance: boolean = false

      Returns void

    • Apply a Luxar blending mode in place.

      Single source of truth for creation-time wiring and runtime layers-panel transitions alike, exactly as in the sibling materials. Two mesh-specific points:

      • volumetric is mapped to opaque here as well as at load. The panel can offer it (the dropdown is shared), and a mesh must not be left in a mode whose fragment branch it does not implement.
      • the emission shape is a THREE-way choice, so BOTH mode defines are maintained: LUXAR_MESH_ALPHA_CUTOUT for opaque and LUXAR_MAX_RGB_CONTRIBUTION for max. Each must be cleared when leaving its mode — an opaque → additive switch that stranded the cutout would keep discarding fragments in a mode that has no cutout.

      Parameters

      Returns void

    • Bind a colormap LUT texture (or null to disable colormap mode).

      When texture is non-null, the USE_COLORMAP define is added and the uniforms (uColormapTex, uScalarMin, uScalarScale) are allocated with neutral defaults if they don't exist yet. When texture is null, the define is removed and the uniform values are cleared so a subsequent clone() doesn't resurrect a stale colormap.

      No-op when called on a material whose shader path doesn't include USE_COLORMAP-guarded uniforms.

      Parameters

      • texture: DataTexture | null

      Returns void

    • Update the scalar range [min, max] the colormap maps over. Encoded as uScalarMin = min and uScalarScale = 1/max(1e-10, max-min) for the shader. No-op when colormap mode is not active (uniforms are absent until setColormapTexture has been called once).

      Parameters

      • min: number
      • max: number

      Returns void