Constructor
new ObjMaterialFactory(webglContext, optionsopt)
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
webglContext |
WebGL2RenderingContext | WebGL2 rendering context. | |
options |
ObjMaterialFactoryOptions |
<optional> |
Factory options. |
Throws:
-
When the inputs are invalid.
- Type
- TypeError
Classes
Methods
(async) createMaterial(definition, textureUrls, textures, useVertexColorsopt) → {Promise.<(LambertMaterial|PhongMaterial|VertexColorMaterial|MtlStandardMaterial)>}
Creates a material instance, based on MTL data.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
definition |
Object | null | Parsed material definition. | ||
textureUrls |
ObjMaterialTextureUrls | null | Resolved texture URLs. | ||
textures |
Array | Output list of created textures. | ||
useVertexColors |
boolean |
<optional> |
false | Whether the vertex colors are available. |
Throws:
-
When textures output is invalid.
- Type
- TypeError
Returns:
- Promise, that resolves with the created material instance, based on the parsed MTL definition and the available inputs.
- Type
- Promise.<(LambertMaterial|PhongMaterial|VertexColorMaterial|MtlStandardMaterial)>