Interface IMaterialGenerator
Provides a mechanism to convert glTF materials into Unity Materials
Namespace: GLTFast.Materials
Assembly: glTFast.dll
Syntax
public interface IMaterialGenerator
Methods
GenerateMaterial(MaterialBase, IGltfReadable, bool)
Converts a glTF material into a Unity Material. gltfMaterial might reference textures, which can be queried from gltf.
Declaration
Material GenerateMaterial(MaterialBase gltfMaterial, IGltfReadable gltf, bool pointsSupport = false)
Parameters
| Type | Name | Description |
|---|---|---|
| MaterialBase | gltfMaterial | Source glTF material |
| IGltfReadable | gltf | Interface to a loaded glTF's resources (e.g. textures) |
| bool | pointsSupport | If true, material has to support meshes with points topology. |
Returns
| Type | Description |
|---|---|
| Material | Generated Unity Material |
GetDefaultMaterial(bool)
Get fallback material that is assigned to nodes without a material.
Declaration
Material GetDefaultMaterial(bool pointsSupport = false)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | pointsSupport | If true, material has to support meshes with points topology. |
Returns
| Type | Description |
|---|---|
| Material | fallback material |
SetLogger(ICodeLogger)
Has to be called prior to GenerateMaterial(MaterialBase, IGltfReadable, bool). The logger can be used to inform users about incidents of arbitrary severity (error,warning or info) during material generation.
Declaration
void SetLogger(ICodeLogger logger)
Parameters
| Type | Name | Description |
|---|---|---|
| ICodeLogger | logger | Logger to be used. |