Class WGSLTextureLoader

A helper class for loading and creating textures for WebGPU.

Constructors

Methods

  • Creates a GPUTexture from an image.

    Parameters

    • device: GPUDevice

      The GPUDevice to use for creating the texture.

    • texture: IWGSLTexture

      The ITexture object containing the image source.

    Returns Promise<GPUTexture>

    A Promise that resolves to the created GPUTexture.

  • Creates a HTMLVideoElement for video textures.

    Parameters

    • device: GPUDevice

      The GPUDevice.

    • texture: IWGSLTexture

      The ITexture object containing the video source.

    Returns Promise<HTMLVideoElement>

    A Promise that resolves to the HTMLVideoElement.

  • Loads an array of textures and returns an array of ITextureData.

    Parameters

    • device: GPUDevice

      The GPUDevice to use for creating textures.

    • Rest...textures: IWGSLTexture[]

      An array of ITexture objects.

    Returns Promise<IWGSLTextureData[]>

    A Promise that resolves to an array of ITextureData.