Class: MaterialUtilities
Defined in: src/loader/parser/prefab/mats/MaterialUtilities.ts:15
Helper utilities used while parsing prefab materials. Resolves a shader by name into a Material, and applies decoded textures and uniform properties onto a material.
Constructors
Constructor
new MaterialUtilities():
MaterialUtilities
Returns
MaterialUtilities
Methods
GetMaterial()
staticGetMaterial(shaderName,ctx?):Material
Defined in: src/loader/parser/prefab/mats/MaterialUtilities.ts:24
Resolve a shader by its (possibly path-qualified) name and build a Material using it.
Parameters
shaderName
string
the shader name, optionally with a path/dotted prefix.
ctx?
optional rendering context passed to the shader constructor.
Returns
the constructed material.
applyMaterialTexture()
staticapplyMaterialTexture(mat,textures):void
Defined in: src/loader/parser/prefab/mats/MaterialUtilities.ts:49
Apply decoded textures onto a material, binding each to the matching material/shader property or falling back to Material.setTexture.
Parameters
mat
the target material.
textures
PrefabTextureData[]
the decoded texture entries to apply.
Returns
void
applyMaterialProperties()
staticapplyMaterialProperties(mat,properties):void
Defined in: src/loader/parser/prefab/mats/MaterialUtilities.ts:68
Apply decoded key/value uniform properties onto a material, dispatching by value type to the matching material/shader property or uniform setter.
Parameters
mat
the target material.
properties
KV[]
the decoded property entries to apply.
Returns
void

