Fix glTF light orientation (#20122)

# Objective

- Extracted from https://github.com/bevyengine/bevy/pull/20099
- Turns out glTF also uses its viewport coordinate system for lights, so
let's account for that

## Solution

- Use the same branch for lights as for cameras when importing glTFs

## Testing

- Ran a dedicated Blender test scene to verify that this is the correct
behavior.
This commit is contained in:
Jan Hohenheim 2025-07-14 15:20:18 +02:00 committed by GitHub
parent 33bed5dd70
commit 9edf538643
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View File

@ -24,6 +24,7 @@ pub(crate) trait ConvertCameraCoordinates {
/// - up: Y
/// - right: X
///
/// The same convention is used for lights.
/// See <https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#view-matrix>
fn convert_camera_coordinates(self) -> Self;
}

View File

@ -45,7 +45,7 @@ pub(crate) fn node_transform(node: &Node, convert_coordinates: bool) -> Transfor
},
};
if convert_coordinates {
if node.camera().is_some() {
if node.camera().is_some() || node.light().is_some() {
transform.convert_camera_coordinates()
} else {
transform.convert_coordinates()