Skip to content

Commit

Permalink
load names of lights from gltf (#3553)
Browse files Browse the repository at this point in the history
# Objective

- Load names of lights from gltf

## Solution

- Load names of lights from gltf


Co-authored-by: François <[email protected]>
  • Loading branch information
mockersf and mockersf committed Jan 5, 2022
1 parent 0bae5bb commit a1e3c5c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crates/bevy_gltf/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ fn load_node(
if let Some(light) = gltf_node.light() {
match light.kind() {
gltf::khr_lights_punctual::Kind::Directional => {
parent.spawn_bundle(DirectionalLightBundle {
let mut entity = parent.spawn_bundle(DirectionalLightBundle {
directional_light: DirectionalLight {
color: Color::from(light.color()),
// NOTE: KHR_punctual_lights defines the intensity units for directional
Expand All @@ -566,9 +566,12 @@ fn load_node(
},
..Default::default()
});
if let Some(name) = light.name() {
entity.insert(Name::new(name.to_string()));
}
}
gltf::khr_lights_punctual::Kind::Point => {
parent.spawn_bundle(PointLightBundle {
let mut entity = parent.spawn_bundle(PointLightBundle {
point_light: PointLight {
color: Color::from(light.color()),
// NOTE: KHR_punctual_lights defines the intensity units for point lights in
Expand All @@ -581,6 +584,9 @@ fn load_node(
},
..Default::default()
});
if let Some(name) = light.name() {
entity.insert(Name::new(name.to_string()));
}
}
gltf::khr_lights_punctual::Kind::Spot {
inner_cone_angle: _inner_cone_angle,
Expand Down

0 comments on commit a1e3c5c

Please sign in to comment.