Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Material

The material asset, specifies in details how a model is drawn on screen.

Hierarchy

Index

Constructors

constructor

Properties

__asyncLoadAssets__

__asyncLoadAssets__: boolean = false

__depends__

__depends__: any = null

__nativeDepend__

__nativeDepend__: any = null

__onLoadedInvoked__

__onLoadedInvoked__: boolean = false

Protected _defines

_defines: MacroRecord[] = []

Protected _effectAsset

_effectAsset: EffectAsset | null = null

Protected _hash

_hash: number = 0

_native

_native: string = ""

Serializable url for native asset. For internal usage.

default

""

_nativeUrl

_nativeUrl: string = ""

Protected _passes

_passes: Pass[] = []

Protected _props

_props: Record<string, MaterialPropertyFull | MaterialPropertyFull[]>[] = []

Protected _states

_states: PassOverrides[] = []

Protected _techIdx

_techIdx: number = 0

_uuid

_uuid: string

loaded

loaded: boolean = true

Whether the asset is loaded or not

Static preventDeferredLoadDependents

preventDeferredLoadDependents: boolean = false

Indicates whether its dependent native assets can support deferred load if the owner scene (or prefab) is marked as asyncLoadAssets.

default

false

Static preventPreloadNativeObject

preventPreloadNativeObject: boolean = false

Indicates whether its native object should be preloaded from native url.

default

false

Accessors

Private nativeAsset

  • get nativeAsset(): any
  • set nativeAsset(obj: any): void
  • The underlying native asset of this asset if one is available.
    This property can be used to access additional details or functionality releated to the asset.
    This property will be initialized by the loader if _native is available.

    default

    null

    Returns any

  • The underlying native asset of this asset if one is available.
    This property can be used to access additional details or functionality releated to the asset.
    This property will be initialized by the loader if _native is available.

    default

    null

    Parameters

    • obj: any

    Returns void

nativeDep

  • get nativeDep(): undefined | { __isNative__: boolean; ext: string; uuid: string }

effectAsset

effectName

  • get effectName(): any

hash

  • get hash(): number

nativeUrl

  • get nativeUrl(): string

owner

parent

passes

  • get passes(): Pass[]

refCount

  • get refCount(): number

technique

  • get technique(): number

Methods

Protected bindTexture

Protected createPasses

  • _createPasses(): Pass[]

Protected doDestroy

  • _doDestroy(): void

Protected prepareInfo

  • prepareInfo(patch: Record<string, unknown> | Record<string, unknown>[], cur: Record<string, unknown>[]): void

Private setRawAsset

  • setRawAsset(filename: string, inLibrary?: boolean): void

Protected update

  • update(keepProps?: boolean): void

Protected uploadProperty

addRef

copy

Optional createNode

decRef

  • decRef(autoRelease?: boolean): Asset

destroy

  • destroy(): any

getProperty

initialize

onLoaded

  • onLoaded(): void

overridePipelineStates

  • overridePipelineStates(overrides: PassOverrides, passIdx?: undefined | number): void
  • Override the passes with the specified pipeline states. Allowed only on material instances.

    Parameters

    • overrides: PassOverrides

      The pipeline state override values.

    • Optional passIdx: undefined | number

      The pass to apply to. Will apply to all passes if not specified.

    Returns void

recompileShaders

  • recompileShaders(overrides: MacroRecord, passIdx?: undefined | number): void
  • Recompile the shader with the specified macro overrides. Allowed only on material instances.

    Parameters

    • overrides: MacroRecord

      The shader macro override values.

    • Optional passIdx: undefined | number

      The pass to apply to. Will apply to all passes if not specified.

    Returns void

reset

resetUniforms

  • resetUniforms(clearPasses?: boolean): void
  • Reset all the uniforms to the default value specified in EffectAsset.

    Parameters

    • Default value clearPasses: boolean = true

      Will the rendering data be cleared too?

    Returns void

Private serialize

  • serialize(): void

setProperty

toString

  • toString(): string
  • Returns the string representation of the object.
    The Asset object overrides the toString() method of the Object object.
    JavaScript calls the toString() method automatically
    when an asset is to be represented as a text value or when a texture is referred to in a string concatenation.

    For assets of the native type, it will return this.nativeUrl.
    Otherwise, an empty string is returned.
    This method may be overwritten by subclasses.

    method

    toString

    Returns string

Static deserialize

  • deserialize(data: any): any

Static getHash

Generated using TypeDoc