Skip to content

Commit

Permalink
extra extras
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf committed Mar 19, 2022
1 parent ee4cf30 commit 439357c
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions crates/bevy_gltf/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -580,16 +580,20 @@ fn load_node(
AssetPath::new_ref(load_context.path(), Some(&material_label));

let bounds = primitive.bounding_box();
parent
.spawn_bundle(PbrBundle {
mesh: load_context.get_handle(mesh_asset_path),
material: load_context.get_handle(material_asset_path),
..Default::default()
})
.insert(Aabb::from_min_max(
Vec3::from_slice(&bounds.min),
Vec3::from_slice(&bounds.max),
));
let mut pbr = parent.spawn_bundle(PbrBundle {
mesh: load_context.get_handle(mesh_asset_path),
material: load_context.get_handle(material_asset_path),
..Default::default()
});
pbr.insert(Aabb::from_min_max(
Vec3::from_slice(&bounds.min),
Vec3::from_slice(&bounds.max),
));
if let Some(extras) = primitive.extras() {
pbr.insert(super::GltfExtras {
value: extras.get().to_string(),
});
}
}
}

Expand All @@ -609,6 +613,11 @@ fn load_node(
if let Some(name) = light.name() {
entity.insert(Name::new(name.to_string()));
}
if let Some(extras) = light.extras() {
entity.insert(super::GltfExtras {
value: extras.get().to_string(),
});
}
}
gltf::khr_lights_punctual::Kind::Point => {
let mut entity = parent.spawn_bundle(PointLightBundle {
Expand All @@ -627,6 +636,11 @@ fn load_node(
if let Some(name) = light.name() {
entity.insert(Name::new(name.to_string()));
}
if let Some(extras) = light.extras() {
entity.insert(super::GltfExtras {
value: extras.get().to_string(),
});
}
}
gltf::khr_lights_punctual::Kind::Spot {
inner_cone_angle: _inner_cone_angle,
Expand Down

0 comments on commit 439357c

Please sign in to comment.