Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MaterialPluginBase

Base class for material plugins.

since

5.0

Hierarchy

Index

Constructors

constructor

  • new MaterialPluginBase(material: Material, name: string, priority: number, defines?: {}, addToPluginList?: boolean, enable?: boolean): MaterialPluginBase
  • Creates a new material plugin

    Parameters

    • material: Material

      parent material of the plugin

    • name: string

      name of the plugin

    • priority: number

      priority of the plugin

    • Optional defines: {}

      list of defines used by the plugin. The value of the property is the default value for this property

      • [key: string]: any
    • Optional addToPluginList: boolean

      true to add the plugin to the list of plugins managed by the material plugin manager of the material (default: true)

    • Optional enable: boolean

      true to enable the plugin (it is handy if the plugin does not handle properties to switch its current activation)

    Returns MaterialPluginBase

Properties

Readonly markAllDefinesAsDirtySearch playground for markAllDefinesAsDirty

markAllDefinesAsDirty: () => void

Helper function to mark defines as being dirty.

Type declaration

    • (): void
    • Returns void

nameSearch playground for name

name: string

Defines the name of the plugin

prioritySearch playground for priority

priority: number

Defines the priority of the plugin. Lower numbers run first.

registerForExtraEventsSearch playground for registerForExtraEvents

registerForExtraEvents: boolean

Indicates that this plugin should be notified for the extra events (HasRenderTargetTextures / FillRenderTargetTextures / HardBindForSubMesh)

Methods

addFallbacksSearch playground for addFallbacks

  • Add fallbacks to the effect fallbacks list.

    Parameters

    • defines: MaterialDefines

      defines the Base texture to use.

    • fallbacks: EffectFallbacks

      defines the current fallback list.

    • currentRank: number

      defines the current fallback rank.

    Returns number

    the new fallback rank.

bindForSubMeshSearch playground for bindForSubMesh

  • Binds the material data.

    Parameters

    • uniformBuffer: UniformBuffer

      defines the Uniform buffer to fill in.

    • scene: Scene

      defines the scene the material belongs to.

    • engine: Engine

      the engine this scene belongs to.

    • subMesh: SubMesh

      the submesh to bind data for

    Returns void

collectDefinesSearch playground for collectDefines

  • collectDefines(defines: {}): void
  • Collects all defines.

    Parameters

    • defines: {}

      The object to append to.

      • [name: string]: { default: any; type: string }
        • default: any
        • type: string

    Returns void

copyToSearch playground for copyTo

  • Makes a duplicate of the current configuration into another one.

    Parameters

    Returns void

disposeSearch playground for dispose

  • dispose(forceDisposeTextures?: boolean): void
  • Disposes the resources of the material.

    Parameters

    • Optional forceDisposeTextures: boolean

      Forces the disposal of all textures.

    Returns void

fillRenderTargetTexturesSearch playground for fillRenderTargetTextures

  • Fills the list of render target textures.

    Parameters

    Returns void

getActiveTexturesSearch playground for getActiveTextures

  • getActiveTextures(activeTextures: BaseTexture[]): void
  • Returns an array of the actively used textures.

    Parameters

    Returns void

getAnimatablesSearch playground for getAnimatables

  • Returns the animatable textures.

    Parameters

    • animatables: IAnimatable[]

      Array of animatable textures.

    Returns void

getAttributesSearch playground for getAttributes

  • Gets the attributes used by the plugin.

    Parameters

    • attributes: string[]

      list that the attribute names should be added to.

    • scene: Scene

      the scene that the material belongs to.

    • mesh: AbstractMesh

      the mesh being rendered.

    Returns void

getClassNameSearch playground for getClassName

  • getClassName(): string
  • Gets the current class name useful for serialization or dynamic coding.

    Returns string

    The class name.

getCustomCodeSearch playground for getCustomCode

  • getCustomCode(shaderType: string): Nullable<{}>
  • Returns a list of custom shader code fragments to customize the shader.

    Parameters

    • shaderType: string

      "vertex" or "fragment"

    Returns Nullable<{}>

    null if no code to be added, or a list of pointName => code. Note that pointName can also be a regular expression if it starts with a !. In that case, the string found by the regular expression (if any) will be replaced by the code provided.

getSamplersSearch playground for getSamplers

  • getSamplers(samplers: string[]): void
  • Gets the samplers used by the plugin.

    Parameters

    • samplers: string[]

      list that the sampler names should be added to.

    Returns void

getUniformBuffersNamesSearch playground for getUniformBuffersNames

  • getUniformBuffersNames(ubos: string[]): void
  • Gets the uniform buffers names added by the plugin.

    Parameters

    • ubos: string[]

      list that the ubo names should be added to.

    Returns void

getUniformsSearch playground for getUniforms

  • getUniforms(): { fragment?: string; ubo?: Array<{ name: string; size: number; type: string }>; vertex?: string }
  • Gets the description of the uniforms to add to the ubo (if engine supports ubos) or to inject directly in the vertex/fragment shaders (if engine does not support ubos)

    Returns { fragment?: string; ubo?: Array<{ name: string; size: number; type: string }>; vertex?: string }

    the description of the uniforms

    • Optional fragment?: string
    • Optional ubo?: Array<{ name: string; size: number; type: string }>
    • Optional vertex?: string

hardBindForSubMeshSearch playground for hardBindForSubMesh

  • Binds the material data (this function is called even if mustRebind() returns false)

    Parameters

    • uniformBuffer: UniformBuffer

      defines the Uniform buffer to fill in.

    • scene: Scene

      defines the scene the material belongs to.

    • engine: Engine

      defines the engine the material belongs to.

    • subMesh: SubMesh

      the submesh to bind data for

    Returns void

hasRenderTargetTexturesSearch playground for hasRenderTargetTextures

  • hasRenderTargetTextures(): boolean
  • Gets a boolean indicating that current material needs to register RTT

    Returns boolean

    true if this uses a render target otherwise false.

hasTextureSearch playground for hasTexture

  • Checks to see if a texture is used in the material.

    Parameters

    Returns boolean

    • Boolean specifying if a texture is used in the material.

isReadyForSubMeshSearch playground for isReadyForSubMesh

  • Specifies that the submesh is ready to be used.

    Parameters

    • defines: MaterialDefines

      the list of "defines" to update.

    • scene: Scene

      defines the scene the material belongs to.

    • engine: Engine

      the engine this scene belongs to.

    • subMesh: SubMesh

      the submesh to check for readiness

    Returns boolean

    • boolean indicating that the submesh is ready or not.

parseSearch playground for parse

  • parse(source: any, scene: Scene, rootUrl: string): void
  • Parses a anisotropy Configuration from a serialized object.

    Parameters

    • source: any

      Serialized object.

    • scene: Scene

      Defines the scene we are parsing for

    • rootUrl: string

      Defines the rootUrl to load from

    Returns void

prepareDefinesSearch playground for prepareDefines

  • Sets the defines for the next rendering

    Parameters

    • defines: MaterialDefines

      the list of "defines" to update.

    • scene: Scene

      defines the scene to the material belongs to.

    • mesh: AbstractMesh

      the mesh being rendered

    Returns void

prepareDefinesBeforeAttributesSearch playground for prepareDefinesBeforeAttributes

  • Sets the defines for the next rendering. Called before MaterialHelper.PrepareDefinesForAttributes is called.

    Parameters

    • defines: MaterialDefines

      the list of "defines" to update.

    • scene: Scene

      defines the scene to the material belongs to.

    • mesh: AbstractMesh

      the mesh being rendered

    Returns void

serializeSearch playground for serialize

  • serialize(): any
  • Serializes this clear coat configuration.

    Returns any

    • An object with the serialized config.

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method