bevy/crates/bevy_pbr/src/entity.rs
Carter Anderson 7ab0eeece0
Break out Visible component from Draw (#1034)
Break out Visible component from Draw
2020-12-09 13:38:48 -08:00

49 lines
1.4 KiB
Rust

use crate::{light::Light, material::StandardMaterial, render_graph::FORWARD_PIPELINE_HANDLE};
use bevy_asset::Handle;
use bevy_ecs::Bundle;
use bevy_render::{
draw::Draw,
mesh::Mesh,
pipeline::{RenderPipeline, RenderPipelines},
prelude::Visible,
render_graph::base::MainPass,
};
use bevy_transform::prelude::{GlobalTransform, Transform};
/// A component bundle for "pbr mesh" entities
#[derive(Bundle)]
pub struct PbrBundle {
pub mesh: Handle<Mesh>,
pub material: Handle<StandardMaterial>,
pub main_pass: MainPass,
pub draw: Draw,
pub visible: Visible,
pub render_pipelines: RenderPipelines,
pub transform: Transform,
pub global_transform: GlobalTransform,
}
impl Default for PbrBundle {
fn default() -> Self {
Self {
render_pipelines: RenderPipelines::from_pipelines(vec![RenderPipeline::new(
FORWARD_PIPELINE_HANDLE.typed(),
)]),
mesh: Default::default(),
visible: Default::default(),
material: Default::default(),
main_pass: Default::default(),
draw: Default::default(),
transform: Default::default(),
global_transform: Default::default(),
}
}
}
/// A component bundle for "light" entities
#[derive(Debug, Bundle, Default)]
pub struct LightBundle {
pub light: Light,
pub transform: Transform,
pub global_transform: GlobalTransform,
}