API/core/Material/

Material

Material.

Hierarchy: RefObject

constructor 

new Material(engine: Engine, shader: Shader)

Create a material instance.

Parameters

  • engine

    Engine to which the material belongs

  • shader

    Shader used by the material

instanceId ReadOnly

instanceId: number = ++EngineObject._instanceIdCounter

Engine unique id.

isGCIgnored 

isGCIgnored: boolean = false

Whether to ignore the garbage collection check, if it is true, it will not be affected by ResourceManager.gc().

name 

name: string

Name.

renderQueueType 

renderQueueType: RenderQueueType = ...

Render queue type.

renderState ReadOnly

renderState: RenderState = ...

Render state.

shader 

shader: Shader

Shader used by the material.

shaderData ReadOnly

shaderData: ShaderData = ...

Shader data.

destroyed 

get destroyed(): boolean

Whether it has been destroyed.

engine 

get engine(): Engine

Get the engine which the object belongs.

refCount 

get refCount(): number

Counted by valid references.

clone 

clone(): Material

Clone and return the instance.

cloneTo 

cloneTo(target: Material): void

Clone to the target material.

Parameters

  • target

    target material

destroy 

destroy(force: boolean): boolean

Destroy self.

Parameters

  • force

    Whether to force the destruction, if it is fasle, refCount = 0 can be released successfully.

Returns

Whether the release was successful.