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 a SceneBindingSpec —
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: an f3d.pipeline document's body — its anchors and its nodes, each made by a PipelineNodeKind a Dart plugin registered — applied to the renderer with RendererSteps.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 ShaderBundle built at run time carries in its sdk field.

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 backend can load with GraphicsDevice.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 into host's main — see the library comment. from names 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.