webani - v1.0.0
    Preparing search index...

    A material that defines the properties and textures used in rendering an object. This includes the color, roughness, metallic, opacity, and textures for base color, metallic-roughness, and normal maps.

    Index

    Constructors

    Properties

    baseColorImage?: ImageBitmap

    The image used for the base color texture (optional).

    baseColorTexture: WebGLTexture

    The WebGL texture for the base color (generated from baseColorImage).

    color: Vector3

    The base color of the material.

    metallic: number

    The metallic property of the material, where 0 is non-metallic and 1 is metallic.

    metallicRoughnessImage?: ImageBitmap

    The image used for the metallic-roughness texture (optional).

    metallicRoughnessTexture: WebGLTexture

    The WebGL texture for the metallic-roughness map (generated from metallicRoughnessImage).

    normalMap: WebGLTexture

    The WebGL texture for the normal map (generated from normalMapImage).

    normalMapImage?: ImageBitmap

    The image used for the normal map (optional).

    normalScale?: number

    The scaling factor for the normal map (optional).

    opacity: number

    The opacity of the material, where 0 is fully transparent and 1 is fully opaque.

    roughness: number

    The roughness of the material, where 0 is smooth and 1 is rough.

    Accessors

    Methods

    • Binds the material to a WebGL rendering context. This method will only bind the material to a context if it hasn't been bound before.

      Parameters

      • gl: WebGL2RenderingContext

        The WebGL2 rendering context to bind the material to.

      Returns void

    • Regenerates the textures for the material based on the images provided. This will delete the existing textures and create new ones.

      Parameters

      • gl: WebGL2RenderingContext

        The WebGL2 rendering context used to regenerate the textures.

      Returns void