pixi.js
    Preparing search index...

    Interface TextureShaderAdvanced

    Shader that uses a texture. This is the default shader used by Mesh when no shader is provided. It is a simple shader that samples a texture and applies it to the geometry.

    interface TextureShader {
        compatibleRenderers: number;
        glProgram: GlProgram;
        gpuProgram: GpuProgram;
        groups: Record<number, BindGroup>;
        resources: Record<string, any>;
        texture: Texture;
        uid: number;
        addResource(name: string, groupIndex: number, bindIndex: number): void;
        destroy(destroyPrograms?: boolean): void;
    }

    Hierarchy (View Summary)

    Index

    Properties

    compatibleRenderers: number

    A number that uses two bits on whether the shader is compatible with the WebGL renderer and/or the WebGPU renderer. 0b00 - not compatible with either 0b01 - compatible with WebGL 0b10 - compatible with WebGPU This is automatically set based on if a GlProgram or GpuProgram is provided.

    glProgram: GlProgram

    An instance of the GL program used by the WebGL renderer

    gpuProgram: GpuProgram

    An instance of the GPU program used by the WebGPU renderer

    groups: Record<number, BindGroup>
    resources: Record<string, any>

    A record of the resources used by the shader.

    texture: Texture

    The texture that the shader uses.

    uid: number = ...

    A unique identifier for the shader

    Methods

    • Sometimes a resource group will be provided later (for example global uniforms) In such cases, this method can be used to let the shader know about the group.

      Parameters

      • name: string

        the name of the resource group

      • groupIndex: number

        the index of the group (should match the webGPU shader group location)

      • bindIndex: number

        the index of the bind point (should match the webGPU shader bind point)

      Returns void

    • Use to destroy the shader when its not longer needed. It will destroy the resources and remove listeners.

      Parameters

      • destroyPrograms: boolean = false

        if the programs should be destroyed as well. Make sure its not being used by other shaders!

      Returns void