mirror of
https://github.com/bevyengine/bevy
synced 2024-12-20 10:03:07 +00:00
b724a0f586
# Objective - Remove all the `.system()` possible. - Check for remaining missing cases. ## Solution - Remove all `.system()`, fix compile errors - 32 calls to `.system()` remains, mostly internals, the few others should be removed after #2446
55 lines
1.4 KiB
Rust
55 lines
1.4 KiB
Rust
pub mod render_graph;
|
|
|
|
mod entity;
|
|
mod light;
|
|
mod material;
|
|
|
|
pub use entity::*;
|
|
pub use light::*;
|
|
pub use material::*;
|
|
|
|
pub mod prelude {
|
|
#[doc(hidden)]
|
|
pub use crate::{
|
|
entity::*,
|
|
light::{DirectionalLight, PointLight},
|
|
material::StandardMaterial,
|
|
};
|
|
}
|
|
|
|
use bevy_app::prelude::*;
|
|
use bevy_asset::{AddAsset, Assets, Handle};
|
|
use bevy_render::{prelude::Color, shader};
|
|
use material::StandardMaterial;
|
|
use render_graph::add_pbr_graph;
|
|
|
|
/// NOTE: this isn't PBR yet. consider this name "aspirational" :)
|
|
#[derive(Default)]
|
|
pub struct PbrPlugin;
|
|
|
|
impl Plugin for PbrPlugin {
|
|
fn build(&self, app: &mut App) {
|
|
app.add_asset::<StandardMaterial>()
|
|
.register_type::<PointLight>()
|
|
.add_system_to_stage(
|
|
CoreStage::PostUpdate,
|
|
shader::asset_shader_defs_system::<StandardMaterial>,
|
|
)
|
|
.init_resource::<AmbientLight>();
|
|
add_pbr_graph(&mut app.world);
|
|
|
|
// add default StandardMaterial
|
|
let mut materials = app
|
|
.world
|
|
.get_resource_mut::<Assets<StandardMaterial>>()
|
|
.unwrap();
|
|
materials.set_untracked(
|
|
Handle::<StandardMaterial>::default(),
|
|
StandardMaterial {
|
|
base_color: Color::PINK,
|
|
unlit: true,
|
|
..Default::default()
|
|
},
|
|
);
|
|
}
|
|
}
|