use bevy::{
app::{App, Plugin},
core_pipeline::core_2d::graph::{Core2d, Node2d},
render::{ExtractSchedule, RenderApp, render_graph::RenderGraphExt as _},
};
use crate::{
composite::prelude::*, light::prelude::*, occluder::prelude::*, sprite_depth::prelude::*,
};
pub struct FastLightPlugin;
impl Plugin for FastLightPlugin {
fn build(&self, app: &mut App) {
app.add_plugins((
SpriteDepthPlugin,
OccluderPlugin,
MeshLightPlugin,
CompositePlugin,
));
let Some(render_app) = app.get_sub_app_mut(RenderApp) else {
return;
};
render_app.add_systems(
ExtractSchedule,
(
super::extract::extract_ambient_light,
super::extract::extract_mesh_lights,
super::extract::extract_view_entities,
),
);
render_app.add_render_graph_edges(
Core2d,
(
Node2d::MainOpaquePass,
SpriteDepthLabel,
OccluderLabel,
Node2d::MainTransparentPass,
MeshLightLabel,
CompositeLabel,
Node2d::EndMainPass,
),
);
}
}