data_plugins library
What a data plugin's materials and render steps need from the renderer:
the materials and renderSteps sections of a .f3dplugin document
(materialsSection, renderStepsSection, renderDataSections), and
RuntimeShaders, which compiles them where the backend compiles at run
time.
Here, beside the renderer, and not in flutter3d_plugin_runtime.
The runtime reads a document's sections through the plugin API's
DataSectionRegistry and depends on no subsystem a section installs
into, so a server that replays a run with data plugins in it resolves
the interpreter without the render core. An engine that draws registers
these sections with the rest:
final loader = DataPluginLoader(
sections: DataSections(<DataSection>[
...renderDataSections,
entityKindsSection, // flutter3d_sim
]),
);
Classes
- DataMaterial
- A material in the material language, as a file of the plugin's or as text written into the document.
- DataRenderStep
- A render step a data plugin adds: a full-screen stage per backend at an anchor. See RuntimeRenderStep, which it becomes.
- RuntimeBackends
- The backends a shader can be built for at run time, by the names a plugin manifest and RuntimeShaders use for them.
- RuntimeRenderStep
- A render step a plugin brought as data: a full-screen fragment stage at an anchor, switched like the engine's own steps.
- RuntimeShaders
- Materials and render steps compiled while the game runs.
Constants
- bindingsSection → const DataSection
-
A data plugin's
bindings: how its components are shown in the scene (D37), each entry aSceneBindingSpec— - materialsSection → const DataSection
-
A data plugin's
materials: the material language, compiled where the backend compiles at run time (RuntimeShaders). - pipelineSection → const DataSection
-
A data plugin's
pipeline: anf3d.pipelinedocument's body — its anchors and its nodes, each made by aPipelineNodeKinda Dart plugin registered — applied to the renderer withRendererSteps.fromDocument(D44). Its anchors and nodes are in the plugin's namespace like any it adds by hand; on an engine that draws nothing it is read and noted. -
renderDataSections
→ const List<
DataSection> - The sections this package reads from a data plugin: materialsSection and renderStepsSection, for an engine that draws.
- renderStepsSection → const DataSection
-
A data plugin's
renderSteps: a full-screen stage per backend at an anchor, switched like the engine's own steps (RuntimeRenderStep). - runtimeShaderSdk → const String
-
The text a
ShaderBundlebuilt at run time carries in itssdkfield.
Functions
-
fullscreenMaterialWgsl(
MaterialProgram program, {required int uvLocation, required String from}) → PackedStage - A full-screen stage written in the language — version 2 — as WGSL, for a plugin's render step on WebGPU while the game runs.
-
runtimeMaterialBundle(
String source, {required String? backend, required String from, Map< String, String> ? engineSources, PackedStage? webGpuHost, int? webGpuFullscreenUvLocation, MaterialCompilerRegistry? compilers}) → ShaderBundle -
One material written in the material language, as a bundle
backendcan load withGraphicsDevice.loadShaders— decision 4: shaders compiled at run time work where the backend compiles at run time. -
spliceMaterialWgsl(
MaterialProgram program, PackedStage host, {required String from}) → PackedStage -
program, already specialised, spliced intohost'smain— see the library comment.fromnames the source in every refusal.
Exceptions / Errors
- RuntimeShadersException
- A shader a plugin brought at run time that this engine cannot compile, with the sentence that says why and what to do instead.