Context
LightExtract is currently hardcoded into ExtractSchedule::default()
(engine-core/src/render/extract/mod.rs), which means it runs even for
pipelines with no scene concept (e.g. LoadingPipeline). See the TODO in
engine-core/src/render/gfx/light_buffer.rs:
DirectionalLightComponent/PointLightComponent, LightExtract,
DirectionalLight/GpuPointLight/ExtractedLights are a concrete lighting
implementation for a single pipeline, not a general core plumbing
abstraction (see README: "engine-core has no opinion about how you
render things"). Move it to engine-pipelines once a plugin/extension
system for ExtractSchedule exists.
This is a general problem, not just a lighting one: any future module
(physics, audio, particles, ...) will hit the same wall - engine-core
would otherwise need a growing list of App::register_x() methods, one
per subsystem.
Goal
Design and implement a plugin system for engine-core, so that modules
(engine-pipelines and future crates) register what they need
(extract systems, tick systems, asset loaders, ...) through one
consistent mechanism, instead of engine-core hardcoding them into
ExtractSchedule::default() / TickSchedule::default() / etc.
Scope
Context
LightExtractis currently hardcoded intoExtractSchedule::default()(engine-core/src/render/extract/mod.rs), which means it runs even for
pipelines with no scene concept (e.g.
LoadingPipeline). See the TODO inengine-core/src/render/gfx/light_buffer.rs:This is a general problem, not just a lighting one: any future module
(physics, audio, particles, ...) will hit the same wall - engine-core
would otherwise need a growing list of App::register_x() methods, one
per subsystem.
Goal
Design and implement a plugin system for engine-core, so that modules
(engine-pipelines and future crates) register what they need
(extract systems, tick systems, asset loaders, ...) through one
consistent mechanism, instead of engine-core hardcoding them into
ExtractSchedule::default()/TickSchedule::default()/ etc.Scope
EnginePlugintrait toengine-core(fn build(&self, app: &mut EngineContext))EngineContext:add_extract_system,add_tick_system,add_plugin,add_pluginsLightExtractfromExtractSchedule::default()LightingPlugininengine-pipelinesthat registersLightExtractengine-demo(sponza_scene_demo.rs,interpolation_demo.rs)to call
ctx.add_plugin(LightingPlugin)inon_startlight_buffer.rsTODO (remove/update the comment once done)register_loaders(currently a separateAppmethod)should be folded into the same plugin mechanism, or stay separate