Nano WebGPU API - v0.11.0
    Preparing search index...

    Class Loader

    Loader class fetches, decodes, and manages 3D assets, textures, and shader modules. Extensible through pluggable ModelParser registration.

    Index

    Constructors

    • Creates a Loader instance associated with a GPUDevice.

      Parameters

      • device: GPUDevice

        Standard WebGPU device interface.

      Returns Loader

    Methods

    • Fetches and delegates parsing of a 3D model file to the first compatible parser.

      Parameters

      • url: string

        The web address of the 3D model asset.

      Returns Promise<ModelData>

      A Promise resolving to format-agnostic ModelData.

    • Fetches and compiles a WGSL shader code file from a URL.

      Parameters

      • url: string

        Web address pointing to the WGSL shader file.

      Returns Promise<GPUShaderModule>

      A Promise resolving to a GPUShaderModule.

    • Fetches an image file, decodes it into an ImageBitmap, and uploads it to WebGPU VRAM.

      Parameters

      • url: string

        Web address pointing to the image resource.

      • options: { format?: GPUTextureFormat; usage?: number } = {}

        Custom configuration format and texture usage flags.

      Returns Promise<GPUTexture>

      A Promise resolving to an allocated GPUTexture.

    • Prepend a custom ModelParser instance to the internal parser list. Allows custom formats (e.g. FBX, Collada) to take loading precedence.

      Parameters

      Returns void