LightingModels class final
The lighting models a document may name in one engine: the engine's LightingModel.builtIn and every model a plugin registered — the open registry, one per engine (D23, D43).
How a plugin adds a way to light a surface. It describes the model —
by hand, or with MaterialBindings.lightingModel from a .f3dmat whose
light and composite hooks are the model — and registers it through the
one entrance, host.registry<LightingModels>() (a LightingModelAddon
does this), with its stages through RendererSteps.addMaterials. From
then on a material file read against this engine's table naming the
model's LightingModel.name reads as that model, and a picker
walking all offers it. Cancelling the registration takes the name back
out. The renderer's own table is Renderer.lightingModels, and a host
handed renderer.renderSteps finds it among that registry's companions.
One per engine, not one per process. Two engines in one isolate — an editor and the game it plays — install their plugins apart, and a model one of them registered is not a name in the other's documents. A document read with no engine at hand (an importer, a server, a tool) reads against shipped, the built-in models alone; one that names a plugin's model by name then warns and falls back as for any unknown name, and one that describes the model as an object reads anywhere.
A plugin's name is compared exactly; a built-in one in any case. A
name matched in any case could not tell two plugins' apart, so
acme_ink.Ink is not acme_ink.ink. The built-in models are a fixed set
with names that differ in more than case, and material files have always
named them so ("lighting": "pbr"), so pbr still reads as Pbr.
A plugin's model is in its namespace, <namespace>.<Name>, like
every other registration (LightingModel.name). A shader's entry point
cannot carry a dot, so its LightingModel.shaderName is the same word
with the dot made __ — acme_ink__Ink for acme_ink.Ink — and a model
the engine adds in a minor (which never does) cannot take its name. The
built-in names stay the built-in models: one is refused unless it is
that very constant, which is how flutter3d_post/style.dart registers
LightingModel.toon.
The words from before the dot still read. Files written then name a
plugin's model by its old stage name, <namespace>_<Name>
(acme_ink_Ink); named finds the registered model that word meant, so
.fmat and .f3d stay at their versions — the word is a value, not a
key — and are written in the new word from then on.
Constructors
- LightingModels()
- An engine's table: the built-in models, and nothing registered yet.
Properties
-
all
→ List<
LightingModel> -
Every model a document may name: LightingModel.builtIn in its order,
then the registered ones not already among them, in the order they
were first registered.
no setter
-
companions
→ Iterable<
PluginRegistry> -
The registries that come with this one, found by
PluginHost.registryas if each had been handed to the host itself.no setterinherited - hashCode → int
-
The hash code for this object.
no setterinherited
-
registered
→ List<
LightingModel> -
The models plugins registered, other than the built-in ones.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
add(
LightingModel model) → Registration -
Makes
modelone a document read against this table may name, until the result is cancelled. -
forPlugin(
PluginScope scope) → LightingModels -
This registry as
scope's plugin sees it: everything registered through the result is tracked byscope, ranked by it, and checked against its manifest. Must return the same type the registry is looked up by. -
named(
String name) → LightingModel? -
The model called
name, or null: a built-in one matched in any case, a registered one exactly — by its LightingModel.name (acme_ink.Ink), its LightingModel.shaderName (acme_ink__Ink), or the stage name a file wrote before the dot (acme_ink_Ink). -
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
Static Properties
- shipped → LightingModels
-
The built-in models alone, with nothing registerable: the table a
document read with no engine's at hand is read against.
final