pub struct Light {
pub light_type: LightType,
pub enabled: bool,
}Expand description
A component that adds a light source to an entity.
This component works in conjunction with the entity’s GlobalTransform
to determine the light’s world-space position and orientation.
§Examples
ⓘ
use khora_data::ecs::components::Light;
use khora_core::renderer::light::{LightType, DirectionalLight};
// Create a sun light
let sun_light = Light {
light_type: LightType::Directional(DirectionalLight::default()),
enabled: true,
};Fields§
§light_type: LightTypeThe type and properties of the light source.
enabled: boolWhether the light is currently active.
Disabled lights are not extracted for rendering and have no performance impact on the scene.
Implementations§
Trait Implementations§
impl Component for Light
Auto Trait Implementations§
impl Freeze for Light
impl RefUnwindSafe for Light
impl Send for Light
impl Sync for Light
impl Unpin for Light
impl UnwindSafe for Light
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<C1> ComponentBundle for C1where
C1: Component,
impl<C1> ComponentBundle for C1where
C1: Component,
Source§fn type_ids() -> Vec<TypeId>
fn type_ids() -> Vec<TypeId>
Returns the sorted list of
TypeIds for the components in this bundle. Read moreSource§fn create_columns() -> HashMap<TypeId, Box<dyn AnyVec>>
fn create_columns() -> HashMap<TypeId, Box<dyn AnyVec>>
Creates the set of empty, type-erased
Vec<T> columns required to store
this bundle’s components. Read moreSource§fn update_metadata(
metadata: &mut EntityMetadata,
location: PageIndex,
registry: &ComponentRegistry,
)
fn update_metadata( metadata: &mut EntityMetadata, location: PageIndex, registry: &ComponentRegistry, )
Updates the appropriate fields in an
EntityMetadata struct to point
to the location of this bundle’s data. Read moreSource§unsafe fn add_to_page(self, page: &mut ComponentPage)
unsafe fn add_to_page(self, page: &mut ComponentPage)
Adds the components from this bundle into the specified
ComponentPage. Read more