Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gltf] Support camera and fix hierarchy #772

Merged
merged 4 commits into from
Nov 7, 2020

Conversation

FuriouZz
Copy link
Contributor

@FuriouZz FuriouZz commented Nov 2, 2020

Add support to camera import from a gltf scene

@FuriouZz FuriouZz force-pushed the feature/gltf-camera branch from da044d7 to ef79809 Compare November 3, 2020 10:58
@FuriouZz FuriouZz force-pushed the feature/gltf-camera branch from ef79809 to 24f44a2 Compare November 3, 2020 10:59
@karroffel karroffel added A-Assets Load files from disk to use for things like images, models, and sounds C-Feature A new feature, making something new possible labels Nov 3, 2020
Copy link
Member

@cart cart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! I tried testing this by exporting a blender gltf scene with a camera and was like "why isn't this working?". Turns out the blender gltf exporter doesn't export cameras by default 😄

Everything works as expected:

Blender (note that the cubes are a parent->child chain)

image

Bevy

image

projection_matrix: projection.get_projection_matrix(),
..Default::default()
},
transform: Transform::from_matrix(Mat4::from_cols_array_2d(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the transform creation is shared across both projections and the else statement. can we move this to a variable on line 217?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Job done 😁

@FuriouZz
Copy link
Contributor Author

FuriouZz commented Nov 5, 2020

I will take some time to check punctual lights import in a next PR. I think actually bevy only have a point light.

@lassade
Copy link
Contributor

lassade commented Nov 6, 2020

I give a quick look at the file, and it looks similar of what I did to fix the gltf to load the bones hierarchy.

*One note: first spawn the empty node and use the .with function to add extra components like camera and light or anything else, this way it will be easer to make future modifications

@FuriouZz
Copy link
Contributor Author

FuriouZz commented Nov 6, 2020

@lassade Thanks for the advice i didn't know how to do this. I will be glad to merge our efforts.

@FuriouZz FuriouZz requested a review from cart November 6, 2020 23:47
@cart cart merged commit 35d4fca into bevyengine:master Nov 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Assets Load files from disk to use for things like images, models, and sounds C-Feature A new feature, making something new possible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants