bevy/crates/bevy_render/src
Jakob Hellermann 193e8c4ada scene_viewer: load cameras (#4425)
# Objective

glTF files can contain cameras. Currently the scene viewer example uses _a_ camera defined in the file if possible, otherwise it spawns a new one. It would be nice if instead it could load all the cameras and cycle through them, while also having a separate user-controller camera.

## Solution

- instead of just a camera that is already defined, always spawn a new separate user-controller camera
- maintain a list of loaded cameras and cycle through them (wrapping to the user-controller camera) when pressing `C`

This matches the behavious that https://github.khronos.org/glTF-Sample-Viewer-Release/ has.

## Implementation notes

- The gltf scene asset loader just spawns the cameras into the world, but does not return a mapping of camera index to bevy entity. So instead the scene_viewer example just collects all spawned cameras with a good old `query.iter().collect()`, so the order is unspecified and may change between runs.

## Demo

https://user-images.githubusercontent.com/22177966/161826637-40161482-5b3b-4df5-aae8-1d5e9b918393.mp4


using the virtual city glTF sample file: https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/VC

Co-authored-by: Jakob Hellermann <hellermann@sipgate.de>
2022-04-11 22:56:06 +00:00
..
camera scene_viewer: load cameras (#4425) 2022-04-11 22:56:06 +00:00
color Fixed case of R == G, following original conversion formula (#4383) 2022-04-04 18:59:00 +00:00
mesh Fix loading non-TriangleList meshes without normals in gltf loader (#4376) 2022-03-31 20:43:01 +00:00
primitives Faster view frustum culling (#4181) 2022-03-19 04:41:28 +00:00
render_graph bevy_render: Support removal of nodes, edges, subgraphs (#3048) 2022-03-21 23:58:37 +00:00
render_phase Compute Pipeline Specialization (#3979) 2022-03-23 00:27:26 +00:00
render_resource Use storage buffers for clustered forward point lights (#3989) 2022-04-07 16:16:35 +00:00
renderer bevy_app: add tracing event with tracy.frame_mark (#4320) 2022-04-08 22:50:23 +00:00
texture Do not crash if RenderDevice doesn't exist (#4427) 2022-04-05 19:37:23 +00:00
view ParamSet for conflicting SystemParam:s (#2765) 2022-03-29 23:39:38 +00:00
lib.rs unsafeify World::entities_mut (#4093) 2022-03-30 23:52:45 +00:00
render_asset.rs Introduce SystemLabel's for RenderAssetPlugin, and change Image preparation system to run before others (#3917) 2022-03-29 19:44:45 +00:00
render_component.rs Obviate the need for RunSystem, and remove it (#3817) 2022-03-15 02:16:55 +00:00
settings.rs bevy_render: Use RenderDevice to get limits/features and expose AdapterInfo (#3931) 2022-02-16 21:17:37 +00:00