 5c4f3554f9
			
		
	
	
		5c4f3554f9
		
	
	
	
	
		
			
			After an inquiry on Reddit about support for Directional Lights and the unused properties on Light, I wanted to clean it up, to hopefully make it ever so slightly more clear for anyone wanting to add additional light types. Co-authored-by: Carter Anderson <mcanders1@gmail.com>
		
			
				
	
	
		
			50 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Rust
		
	
	
	
	
	
| use crate::{light::PointLight, material::StandardMaterial, render_graph::PBR_PIPELINE_HANDLE};
 | |
| use bevy_asset::Handle;
 | |
| use bevy_ecs::bundle::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(
 | |
|                 PBR_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 PointLightBundle {
 | |
|     pub point_light: PointLight,
 | |
|     pub transform: Transform,
 | |
|     pub global_transform: GlobalTransform,
 | |
| }
 |