Small World Engine API Reference - v0.78.00
    Preparing search index...

    Class GltfVariants

    Utility for querying and applying glTF 2.0 Material Variants (KHR_materials_variants).

    Index
    • Returns the list of variant names stored on the glTF root object, if any.

      Parameters

      • root: Object3D

        The root Object3D returned by GltfLoader.

      Returns string[]

    • Selects and applies a material variant across all meshes in the object hierarchy.

      Parameters

      • root: Object3D

        The root Object3D containing the model hierarchy.

      • variant: string | number | null | undefined

        The variant name (string), variant index (number), or null/undefined to reset to original default materials.

      Returns boolean

      true if the variant was recognized and applied (or reset to default), false if the variant name/index was not found.