MaterialParameters class final
A material's parameter values: set and read by ParameterKey from code and by name from data, checked against a schema when there is one, and held as the floats the uniform block is filled from.
The one shape of a material's parameters (since 1.0):
RenderMaterial.parameters, Material3D(parameters:) and a level's
LevelMaterial.parameters are each one of these. A MeshNode.parameters
of its own overrides the material's for that node alone, which is how a
hundred rocks share one material and one rock glows.
Constructors
- MaterialParameters({MaterialParameterSchema? schema})
-
Values of their own, starting at
schema's defaults for every parameter a draw can set. -
MaterialParameters.of(Map<
String, List< values, {MaterialParameterSchema? schema})double> > -
valuescopied, each by name as setNamed takes it:schema's defaults first, then each value checked against it. What a level'sparametersand a widget's map of numbers become.factory -
MaterialParameters.over(Map<
String, Float32List> values, {MaterialParameterSchema? schema}) -
Over
values, which every set writes into and every read reads: a map the caller keeps writing, typed. What aMap<String, Float32List>handed to a material before 1.0 becomes, so a list the caller still holds and writes in place is the one the draw binds.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
Whether nothing is set.
no setter
- isNotEmpty → bool
-
Whether anything is set.
no setter
-
names
→ Iterable<
String> -
The names that hold a value, in the order they were first set.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- schema → MaterialParameterSchema?
-
What the material declares, or null to take any name and width.
no setter
-
uniforms
→ Map<
String, Float32List> -
The values, by name, as the uniform block is filled from them.
no setter
- version → int
-
Bumped by every change through set, setNamed,
[]=and remove, for a caller that caches what it built from the values. A write into the list[]hands back is not a change it sees.no setter
Methods
-
adopt(
MaterialParameterSchema schema) → void -
Takes
schemaas what the material now declares, in place: a hot reload of its source. A value it still declares at the same width is kept, the rest are dropped, and each parameter new to it starts at its default, so whatever holds these values goes on drawing with them. -
copy(
) → MaterialParameters - An independent copy: the same schema, each value's floats copied.
-
named(
String name) → Float32List? -
The floats the parameter called
nameholds, or null when nothing is set. A copy. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
remove(
String name) → void -
Takes the parameter called
nameback to nothing set: the material's own value for a node's override, the shader's default otherwise. -
set<
T extends Object> (ParameterKey< T> key, T value) → void -
Sets
keytovalue, inkey's unit. -
setNamed(
String name, Object value) → void -
Sets the parameter called
namefrom data: a number, a list of numbers, aVector2/Vector3/Vector4, a LinearColor (as wide as the declaration, red-green-blue or with alpha), or a Quantity, converted into the declared unit. -
toString(
) → String -
A string representation of this object.
override
-
valueOf<
T extends Object> (ParameterKey< T> key) → T? -
key's value inkey's unit, or null when nothing is set.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
String name) → Float32List? -
The floats the parameter called
nameholds, or null when nothing is set: the list the draw binds, not a copy. -
operator []=(
String name, List< double> value) → void -
Sets the parameter called
nametovalue, as setNamed does.