Class: ObjMaterialFactory

ObjMaterialFactory(webglContext, optionsopt)

Factory, that creates the engine materials from the parsed MTL data.

Constructor

new ObjMaterialFactory(webglContext, optionsopt)

Parameters:
Name Type Attributes Description
webglContext WebGL2RenderingContext WebGL2 rendering context.
options ObjMaterialFactoryOptions <optional>
Factory options.
Source:
Throws:
When the inputs are invalid.
Type
TypeError

Classes

ObjMaterialFactory

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.
Source:
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)>