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

    Class MaterialAbstract

    Material represents the abstract shading template parent class. Defines standard interfaces for pipeline resolutions, binding parameter bind groups, and next-pass overlay layering (e.g. outline/highlight passes).

    Hierarchy (View Summary)

    Index

    Accessors

    • get aoIntensity(): number

      Gets the ambient occlusion shadow intensity multiplier.

      Returns number

    • set aoIntensity(val: number): void

      Sets the ambient occlusion shadow intensity multiplier and marks the material parameters as dirty.

      Parameters

      • val: number

      Returns void

    • get opacity(): number

      Gets the opacity component of the albedo color.

      Returns number

    • set opacity(value: number): void

      Sets the opacity component of the albedo color, automatically enabling transparent rendering and disabling depth writing if opacity is less than 1.0.

      Parameters

      • value: number

      Returns void

    • get transparent(): boolean

      Gets whether transparency blending is enabled.

      Returns boolean

    • set transparent(value: boolean): void

      Sets whether transparency blending is enabled. Automatically sets depthWriteEnabled to false if transparent is true.

      Parameters

      • value: boolean

      Returns void

    Constructors

    Methods

    • Abstract method performing resource cleanup (releasing GPU buffers and removing allocations tracker entries).

      Parameters

      • ctx: Context

        Target framework context.

      Returns void

    • Abstract method compiling or fetching the primary GPUBindGroup (group index 2) representing PBR parameters.

      Parameters

      • ctx: Context

        Active context.

      • Optionaltopology: GPUPrimitiveTopology

        Geometry topology.

      • OptionalindexFormat: GPUIndexFormat

        Geometry index format.

      Returns GPUBindGroup

      The resolved material GPUBindGroup.

    • Custom parameter bind group (group index 3) utilized by custom ShaderMaterials. Returns null by default for StandardMaterial.

      Parameters

      Returns GPUBindGroup | null

      The resolved custom parameters bind group or null.

    • Abstract method compiling or retrieving the cached GPURenderPipeline matching specified topologies.

      Parameters

      • ctx: Context

        Active context.

      • Optionaltopology: GPUPrimitiveTopology

        Primitive assembly topology option. Defaults to "triangle-list".

      • OptionalindexFormat: GPUIndexFormat

        Index element data format. Defaults to "uint16".

      • OptionalcullMode: GPUCullMode

        Pipeline culling override.

      • OptionaluseCSM: boolean

      Returns GPURenderPipeline

      The resolved GPURenderPipeline.

    • Hook called when any property changes. Subclasses override this to invalidate their specific GPU bind groups.

      Returns void

    Properties

    id: number

    Unique material identification key.

    isDirty: boolean = true

    Flag indicating if parameter properties are dirty, requiring a new bind group build.

    nextPass: Material | null = null

    Secondary material rendered on top of the current pass. Assign a ShaderMaterial here to layer a second render pass (e.g., outline effect) over the primary material. The next pass automatically uses the same geometry and instance matrices, drawn immediately after.

    type: string = "Material"

    Material class type string tag used for fast runtime polymorphism checks.