2020-04-25 00:46:54 +00:00
|
|
|
pub mod entity;
|
|
|
|
pub mod light;
|
|
|
|
pub mod material;
|
|
|
|
pub mod nodes;
|
|
|
|
pub mod pipelines;
|
2020-07-17 02:27:19 +00:00
|
|
|
pub mod render_graph;
|
2020-04-25 00:46:54 +00:00
|
|
|
|
2020-07-17 02:27:19 +00:00
|
|
|
pub mod prelude {
|
|
|
|
pub use crate::{entity::*, light::Light, material::StandardMaterial};
|
|
|
|
}
|
2020-04-25 00:46:54 +00:00
|
|
|
|
2020-07-17 01:47:51 +00:00
|
|
|
use bevy_app::prelude::*;
|
2020-05-13 23:17:44 +00:00
|
|
|
use bevy_asset::AddAsset;
|
2020-07-10 08:37:06 +00:00
|
|
|
use bevy_ecs::IntoQuerySystem;
|
2020-04-25 00:46:54 +00:00
|
|
|
use bevy_render::{render_graph::RenderGraph, shader};
|
2020-06-04 03:08:20 +00:00
|
|
|
use bevy_type_registry::RegisterType;
|
2020-05-26 04:57:48 +00:00
|
|
|
use light::Light;
|
2020-05-01 08:50:07 +00:00
|
|
|
use material::StandardMaterial;
|
2020-07-17 02:27:19 +00:00
|
|
|
use render_graph::ForwardPbrRenderGraphBuilder;
|
2020-04-25 00:46:54 +00:00
|
|
|
|
2020-05-03 17:54:30 +00:00
|
|
|
/// NOTE: this isn't PBR yet. consider this name "aspirational" :)
|
2020-04-25 00:46:54 +00:00
|
|
|
#[derive(Default)]
|
|
|
|
pub struct PbrPlugin;
|
|
|
|
|
|
|
|
impl AppPlugin for PbrPlugin {
|
|
|
|
fn build(&self, app: &mut AppBuilder) {
|
2020-05-26 04:57:48 +00:00
|
|
|
app.add_asset::<StandardMaterial>()
|
|
|
|
.register_component::<Light>()
|
|
|
|
.add_system_to_stage(
|
|
|
|
stage::POST_UPDATE,
|
2020-06-22 00:43:36 +00:00
|
|
|
shader::asset_shader_defs_system::<StandardMaterial>.system(),
|
2020-05-26 04:57:48 +00:00
|
|
|
);
|
2020-04-25 00:46:54 +00:00
|
|
|
let resources = app.resources();
|
|
|
|
let mut render_graph = resources.get_mut::<RenderGraph>().unwrap();
|
|
|
|
render_graph.add_pbr_graph(resources);
|
|
|
|
}
|
|
|
|
}
|