rhodonite
    Preparing search index...

    Class Vrm0xImporter

    The VRM 0.x format importer class. This class provides functionality to import and process VRM 0.x files, including humanoid bone mapping, spring bone physics, and expression blending. It extends the GLTF2 importer with VRM-specific features.

    Index

    Methods

    • Internal method for importing VRM 0.x data into existing render passes. This method handles the complete VRM processing pipeline including material setup, outline rendering, spring bone physics, and humanoid configuration.

      Parameters

      • engine: Engine

        The engine instance

      • gltfModel: RnM2

        The loaded GLTF model data with VRM extensions

      • renderPasses: RenderPass[]

        Array of render passes to add the VRM entities to

      Returns Promise<void>

    • Creates Rhodonite sampler objects from GLTF sampler data. This method processes texture sampling configuration and creates additional dummy samplers for textures that don't specify sampling parameters.

      Parameters

      • engine: Engine
      • gltfModel: RnM2

        The GLTF model containing sampler definitions

      Returns Sampler[]

      An array of created sampler objects

    • Creates Rhodonite texture objects from GLTF texture data. This method processes all textures in the GLTF model and creates additional dummy textures (white and black) commonly used in VRM materials.

      Parameters

      • engine: Engine
      • gltfModel: RnM2

        The GLTF model containing texture definitions

      Returns Promise<Texture[]>

      A promise that resolves to an array of created textures

    • Checks if any materials in the VRM have outline rendering enabled. This method examines material properties to determine if a separate outline render pass is needed for toon-style rendering effects.

      Parameters

      • extensionsVRM: any

        The VRM extension data containing material properties

      Returns boolean

      True if outline materials are present, false otherwise

    • Initializes VRM material properties with default values for missing parameters. This method ensures all VRM materials have complete property sets, particularly for MToon shader materials commonly used in VRM models.

      Parameters

      • gltfModel: RnM2

        The GLTF model to process materials for

      • texturesLength: number

        The total number of textures for dummy texture indexing

      Returns void

    • Processes VRM blend shape groups and converts them to Rhodonite VRM expressions. This method extracts facial expressions, eye blinks, and other morph target animations from the VRM blend shape master and creates the corresponding VRM component.

      Parameters

      • gltfModel: Vrm0x

        The VRM model data containing blend shape information

      • rootEntity: ISceneGraphEntity

        The root entity to attach the VRM component to

      Returns void

    • Processes VRM spring bone physics configuration and creates the physics simulation setup. This method handles collider groups, spring bone chains, and physics parameters to enable realistic secondary motion for hair, clothing, and accessories.

      Parameters

      • engine: Engine

        The engine instance

      • gltfModel: Vrm0x

        The VRM model data containing spring bone and collider definitions

      Returns void

    • Extracts and processes VRM humanoid bone mapping information. This method creates a mapping between VRM standard bone names and the actual scene graph nodes, which is essential for animation retargeting and IK.

      Parameters

      • gltfModel: Vrm0x

        The VRM model data containing humanoid bone definitions

      • OptionalrootEntity: ISceneGraphEntity

        Optional root entity to attach the bone mapping metadata to

      Returns void

    • Imports a VRM file from the specified URL and converts it to Rhodonite scene graph entities. This method handles the complete VRM import pipeline including textures, materials, spring bone physics, humanoid mapping, and expression setup.

      Parameters

      • engine: Engine
      • url: string

        The URL of the VRM file to import

      • Optionaloptions: GltfLoadOption

        Optional loading configuration including material helpers and render states

      Returns Promise<Result<ISceneGraphEntity[], Err<RnM2, undefined>>>

      A promise that resolves to an array of scene graph entities (main + optional outline)

    • Imports only the JSON data from a VRM file without creating scene graph entities. This is useful for extracting VRM metadata, humanoid bone mappings, and other configuration data without the overhead of full scene construction.

      Parameters

      • uri: string

        The URI of the VRM file to import

      • Optionaloptions: GltfLoadOption

        Optional loading configuration

      Returns Promise<Vrm0x>

      A promise that resolves to the VRM JSON data structure