Skip to main content

Class: MaterialManager

Defined in: render/material.ts:72

Constructors

Constructor

new MaterialManager(): MaterialManager;

Returns

MaterialManager

Methods

Create()

Call Signature

static Create(shader): number;

Defined in: render/material.ts:78

Create a new material with the specified shader

Parameters
ParameterTypeDescription
shaderURP_LITThe name of the shader to use
Returns

number

The material handle

Call Signature

static Create(
shader,
entity,
submeshIndex?): number;

Defined in: render/material.ts:87

Create a new material and attach it to a renderable component

Parameters
ParameterTypeDescription
shaderURP_LITThe name of the shader to use
entitynumberThe entity with the renderable component
submeshIndex?numberThe submesh index to attach to (default: 0)
Returns

number

The material handle


CreateInstance()

static CreateInstance(handle): number;

Defined in: render/material.ts:132

Create a material instance

Parameters

ParameterTypeDescription
handlenumberThe material handle to create an instance from

Returns

number

The material instance handle


Destroy()

static Destroy(handle): boolean;

Defined in: render/material.ts:121

Destroy a material

Parameters

ParameterTypeDescription
handlenumberThe material handle to destroy

Returns

boolean

boolean indicating success


GetColor()

static GetColor(handle, prop): string;

Defined in: render/material.ts:252

Get a color property from the material

Parameters

ParameterTypeDescription
handlenumberThe material handle
propShaderPropertiesThe property name

Returns

string

The color as a string


GetFloat()

static GetFloat(handle, prop): number;

Defined in: render/material.ts:237

Get a float property from the material

Parameters

ParameterTypeDescription
handlenumberThe material handle
propShaderPropertiesThe property name

Returns

number

The float value


SetColor()

static SetColor(
handle,
prop,
rgba): boolean;

Defined in: render/material.ts:193

Set a color property on the material

Parameters

ParameterTypeDescription
handlenumberThe material handle
propShaderPropertiesThe property name
rgbavec4vec4 color [0.0, 1.0]

Returns

boolean

boolean indicating success


SetFloat()

static SetFloat(
handle,
prop,
value): boolean;

Defined in: render/material.ts:148

Set a float property on the material

Parameters

ParameterTypeDescription
handlenumberThe material handle
propShaderPropertiesThe property name
valuenumberThe float value

Returns

boolean

boolean indicating success


SetTexture()

static SetTexture(
handle,
prop,
tex): boolean;

Defined in: render/material.ts:217

Set a texture property on the material

Parameters

ParameterTypeDescription
handlenumberThe material handle
propShaderPropertiesThe property name
texnumberThe texture handle

Returns

boolean

boolean indicating success


SetVector()

static SetVector(
handle,
prop,
value): boolean;

Defined in: render/material.ts:169

Set a vector property on the material

Parameters

ParameterTypeDescription
handlenumberThe material handle
propShaderPropertiesThe property name
valuevec4vec4 value

Returns

boolean

boolean indicating success