gpu-curtains
    Preparing search index...

    This is the main class used to create and handle textures that can be used with ComputePass and/or Mesh. Also used as copy source/destination for RenderPass and RenderTarget.

    Mostly useful to handle depth and storages textures or to copy anything outputted to the screen at one point or another. It can handle basic data or image bitmap upload, but for external sources textures (like images, videos or canvases) you should use the MediaTexture class instead.

    Will create a GPUTexture and its associated TextureBinding.

    // create a texture
    // assuming 'renderer' is a valid GPURenderer
    const texture = new Texture(renderer, {
    label: 'My texture',
    name: 'myTexture',
    })

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    renderer: Renderer

    renderer used by this Texture.

    type: string

    The type of the Texture.

    uuid: string

    The universal unique id of this Texture.

    texture: GPUTexture

    The GPUTexture used.

    Size of the texture source, usually our renderer canvas size.

    options: TextureParams

    Options used to create this Texture.

    Array of bindings that will actually only hold one texture binding.

    Accessors

    Methods

    • Upload a source to the GPU and use it for our texture.

      Parameters

      • parameters: {
            source: GPUCopyExternalImageSource;
            width?: number;
            height?: number;
            depth?: number;
            origin?: GPUOrigin3D;
            colorSpace?: PredefinedColorSpace;
        }

        parameters used to upload the source.

        • source: GPUCopyExternalImageSource

          source to use for our texture.

        • Optionalwidth?: number

          source width.

        • Optionalheight?: number

          source height.

        • Optionaldepth?: number

          source depth.

        • Optionalorigin?: GPUOrigin3D
        • OptionalcolorSpace?: PredefinedColorSpace

      Returns void

    • Use data as the texture source and upload it to the GPU.

      Parameters

      • parameters: {
            width?: number;
            height?: number;
            depth?: number;
            origin?: GPUOrigin3D;
            data?: Float32Array;
        }

        parameters used to upload the source.

      Returns void

    • Update our Texture quality ratio and resize it.

      Parameters

      • qualityRatio: number = 1

        New quality ratio to use.

      Returns void