MaterialDocument class final

A material as a file of its own, rather than as part of a model.

Why a material wants to be a file. A look — the studio's brushed steel, the water in level three — is authored once and worn by many meshes, and a model format cannot say that: glTF writes the material into every file that uses it, so changing the steel means re-exporting every model made of it. A standalone material is the artist's unit of work and the thing they iterate on between two runs of the game.

surface rather than a second set of colour fields. SurfaceMaterial is already what every decoder produces and what the renderer converts, so a separate but equal description would be a second thing to keep correct and the first place a new field would be forgotten. What a standalone file adds is the three things a model's material cannot have: images named by path instead of by index into a container, a shader of the application's own, and the parameters that shader reads.

Constructors

MaterialDocument({required SurfaceMaterial surface, List<String> images = const <String>[], LightingModel? lighting, String parameterBlock = 'MaterialParams', Map<String, Float32List> parameters = const <String, Float32List>{}, Map<String, MaterialHint> hints = const <String, MaterialHint>{}, Map<String, TextureBinding> extraTextures = const <String, TextureBinding>{}, List<String> warnings = const <String>[], Map<String, Object?> unknown = const <String, Object?>{}})
A material of surface; by default it names no images, takes the scene's lighting model, and binds no parameters.
const

Properties

extraTextures → Map<String, TextureBinding>
Texture slots beyond the standard five, by sampler name.
final
hashCode → int
The hash code for this object.
no setterinherited
hints → Map<String, MaterialHint>
How a UI should show a parameters entry, by the same uniform name.
final
images → List<String>
Image paths, indexed by TextureBinding.imageIndex.
final
lighting → LightingModel?
The shader this material asks for, or null to take the scene's.
final
parameterBlock → String
The uniform block an application's own shader reads parameters from.
final
parameters → Map<String, Float32List>
Numbers the shader reads, by uniform name.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
surface → SurfaceMaterial
Colours, factors, texture slots and alpha — the vocabulary shared with every model decoder.
final
unknown → Map<String, Object?>
The top-level keys of the file this build does not read, as they were, written back by writeFmat after its own: a material a later build wrote keeps what it added when an earlier one opens and saves it.
final
warnings → List<String>
Non-fatal findings from reading: unknown keys, a slot that names an image the file does not list. Surfaced rather than logged, like a model's.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited