2019-11-13 03:36:02 +00:00
|
|
|
[package]
|
|
|
|
name = "bevy"
|
2021-04-06 18:48:48 +00:00
|
|
|
version = "0.5.0"
|
2021-10-25 18:00:13 +00:00
|
|
|
edition = "2021"
|
2020-09-15 01:12:52 +00:00
|
|
|
authors = [
|
2020-11-10 03:26:08 +00:00
|
|
|
"Bevy Contributors <bevyengine@gmail.com>",
|
|
|
|
"Carter Anderson <mcanders1@gmail.com>",
|
2020-09-15 01:12:52 +00:00
|
|
|
]
|
2020-11-10 03:26:08 +00:00
|
|
|
categories = ["game-engines", "graphics", "gui", "rendering"]
|
2020-08-10 00:24:27 +00:00
|
|
|
description = "A refreshingly simple data-driven game engine and app framework"
|
2020-11-10 03:26:08 +00:00
|
|
|
exclude = ["assets/**/*", "tools/**/*", ".github/**/*", "crates/**/*"]
|
2020-08-10 00:24:27 +00:00
|
|
|
homepage = "https://bevyengine.org"
|
|
|
|
keywords = ["game", "engine", "gamedev", "graphics", "bevy"]
|
2021-07-23 21:11:51 +00:00
|
|
|
license = "MIT OR Apache-2.0"
|
2020-11-10 18:58:51 +00:00
|
|
|
readme = "README.md"
|
2020-11-10 03:26:08 +00:00
|
|
|
repository = "https://github.com/bevyengine/bevy"
|
|
|
|
|
|
|
|
[workspace]
|
|
|
|
exclude = ["benches"]
|
2021-04-11 20:13:07 +00:00
|
|
|
members = ["crates/*", "pipelined/*", "examples/ios", "tools/ci"]
|
2019-11-13 03:36:02 +00:00
|
|
|
|
2020-03-11 05:20:49 +00:00
|
|
|
[features]
|
2020-09-02 00:02:11 +00:00
|
|
|
default = [
|
2020-11-10 03:26:08 +00:00
|
|
|
"bevy_audio",
|
2021-07-28 21:29:32 +00:00
|
|
|
"bevy_core_pipeline",
|
2020-11-10 03:26:08 +00:00
|
|
|
"bevy_dynamic_plugin",
|
|
|
|
"bevy_gilrs",
|
2021-07-30 03:37:34 +00:00
|
|
|
"bevy_gltf2",
|
2020-11-10 03:26:08 +00:00
|
|
|
"bevy_wgpu",
|
2021-04-11 20:13:07 +00:00
|
|
|
"bevy_sprite2",
|
|
|
|
"bevy_render2",
|
2021-06-02 02:59:17 +00:00
|
|
|
"bevy_pbr2",
|
2020-11-10 03:26:08 +00:00
|
|
|
"bevy_winit",
|
|
|
|
"render",
|
|
|
|
"png",
|
|
|
|
"hdr",
|
|
|
|
"mp3",
|
|
|
|
"x11",
|
2020-09-02 00:02:11 +00:00
|
|
|
]
|
2020-11-03 00:30:30 +00:00
|
|
|
|
2020-11-10 03:26:08 +00:00
|
|
|
# Force dynamic linking, which improves iterative compile times
|
|
|
|
dynamic = ["bevy_dylib"]
|
2020-10-01 20:04:06 +00:00
|
|
|
|
2021-04-20 21:04:09 +00:00
|
|
|
# Rendering support (Also needs the bevy_wgpu feature or a third-party rendering backend)
|
2021-08-04 01:16:25 +00:00
|
|
|
render = [
|
|
|
|
"bevy_internal/bevy_pbr",
|
|
|
|
"bevy_internal/bevy_render",
|
|
|
|
"bevy_internal/bevy_sprite",
|
|
|
|
"bevy_internal/bevy_text",
|
|
|
|
"bevy_internal/bevy_ui",
|
|
|
|
]
|
2020-11-10 03:26:08 +00:00
|
|
|
|
|
|
|
# Optional bevy crates
|
|
|
|
bevy_audio = ["bevy_internal/bevy_audio"]
|
|
|
|
bevy_dynamic_plugin = ["bevy_internal/bevy_dynamic_plugin"]
|
|
|
|
bevy_gilrs = ["bevy_internal/bevy_gilrs"]
|
|
|
|
bevy_gltf = ["bevy_internal/bevy_gltf"]
|
|
|
|
bevy_wgpu = ["bevy_internal/bevy_wgpu"]
|
|
|
|
bevy_winit = ["bevy_internal/bevy_winit"]
|
|
|
|
|
2021-07-28 21:29:32 +00:00
|
|
|
bevy_core_pipeline = ["bevy_internal/bevy_core_pipeline"]
|
2021-04-11 20:13:07 +00:00
|
|
|
bevy_render2 = ["bevy_internal/bevy_render2"]
|
|
|
|
bevy_sprite2 = ["bevy_internal/bevy_sprite2"]
|
2021-06-02 02:59:17 +00:00
|
|
|
bevy_pbr2 = ["bevy_internal/bevy_pbr2"]
|
2021-07-30 03:37:34 +00:00
|
|
|
bevy_gltf2 = ["bevy_internal/bevy_gltf2"]
|
2021-04-11 20:13:07 +00:00
|
|
|
|
2020-11-13 01:23:57 +00:00
|
|
|
trace_chrome = ["bevy_internal/trace_chrome"]
|
2020-11-11 02:49:49 +00:00
|
|
|
trace = ["bevy_internal/trace"]
|
2020-11-10 03:26:08 +00:00
|
|
|
wgpu_trace = ["bevy_internal/wgpu_trace"]
|
|
|
|
|
2020-08-11 06:30:42 +00:00
|
|
|
# Image format support for texture loading (PNG and HDR are enabled by default)
|
2020-11-10 03:26:08 +00:00
|
|
|
hdr = ["bevy_internal/hdr"]
|
|
|
|
png = ["bevy_internal/png"]
|
2020-12-10 02:34:27 +00:00
|
|
|
dds = ["bevy_internal/dds"]
|
|
|
|
tga = ["bevy_internal/tga"]
|
|
|
|
jpeg = ["bevy_internal/jpeg"]
|
2020-12-23 22:53:02 +00:00
|
|
|
bmp = ["bevy_internal/bmp"]
|
2020-08-11 06:30:42 +00:00
|
|
|
|
|
|
|
# Audio format support (MP3 is enabled by default)
|
2020-11-10 03:26:08 +00:00
|
|
|
flac = ["bevy_internal/flac"]
|
|
|
|
mp3 = ["bevy_internal/mp3"]
|
|
|
|
vorbis = ["bevy_internal/vorbis"]
|
|
|
|
wav = ["bevy_internal/wav"]
|
2020-08-11 06:30:42 +00:00
|
|
|
|
2021-07-14 03:20:21 +00:00
|
|
|
# WASM support for audio (Currently only works with flac, wav and vorbis. Not with mp3)
|
|
|
|
wasm_audio = ["bevy_internal/wasm_audio"]
|
|
|
|
|
2020-11-10 03:26:08 +00:00
|
|
|
serialize = ["bevy_internal/serialize"]
|
2020-08-22 01:13:50 +00:00
|
|
|
|
2020-08-25 00:06:08 +00:00
|
|
|
# Display server protocol support (X11 is enabled by default)
|
2020-11-10 03:26:08 +00:00
|
|
|
wayland = ["bevy_internal/wayland"]
|
|
|
|
x11 = ["bevy_internal/x11"]
|
2020-05-06 01:44:32 +00:00
|
|
|
|
2021-01-03 20:39:11 +00:00
|
|
|
# enable rendering of font glyphs using subpixel accuracy
|
|
|
|
subpixel_glyph_atlas = ["bevy_internal/subpixel_glyph_atlas"]
|
|
|
|
|
2021-04-14 21:40:36 +00:00
|
|
|
# enable systems that allow for automated testing on CI
|
|
|
|
bevy_ci_testing = ["bevy_internal/bevy_ci_testing"]
|
|
|
|
|
2019-11-13 03:36:02 +00:00
|
|
|
[dependencies]
|
2021-08-04 01:16:25 +00:00
|
|
|
bevy_dylib = { path = "crates/bevy_dylib", version = "0.5.0", default-features = false, optional = true }
|
|
|
|
bevy_internal = { path = "crates/bevy_internal", version = "0.5.0", default-features = false }
|
2020-04-06 03:19:02 +00:00
|
|
|
|
|
|
|
[dev-dependencies]
|
2021-07-15 21:25:49 +00:00
|
|
|
anyhow = "1.0.4"
|
2021-01-17 21:43:03 +00:00
|
|
|
rand = "0.8.0"
|
2020-11-28 00:39:59 +00:00
|
|
|
ron = "0.6.2"
|
2021-08-04 01:16:25 +00:00
|
|
|
serde = { version = "1", features = ["derive"] }
|
2021-05-23 20:13:55 +00:00
|
|
|
# Needed to poll Task examples
|
|
|
|
futures-lite = "1.11.3"
|
Modular Rendering (#2831)
This changes how render logic is composed to make it much more modular. Previously, all extraction logic was centralized for a given "type" of rendered thing. For example, we extracted meshes into a vector of ExtractedMesh, which contained the mesh and material asset handles, the transform, etc. We looked up bindings for "drawn things" using their index in the `Vec<ExtractedMesh>`. This worked fine for built in rendering, but made it hard to reuse logic for "custom" rendering. It also prevented us from reusing things like "extracted transforms" across contexts.
To make rendering more modular, I made a number of changes:
* Entities now drive rendering:
* We extract "render components" from "app components" and store them _on_ entities. No more centralized uber lists! We now have true "ECS-driven rendering"
* To make this perform well, I implemented #2673 in upstream Bevy for fast batch insertions into specific entities. This was merged into the `pipelined-rendering` branch here: #2815
* Reworked the `Draw` abstraction:
* Generic `PhaseItems`: each draw phase can define its own type of "rendered thing", which can define its own "sort key"
* Ported the 2d, 3d, and shadow phases to the new PhaseItem impl (currently Transparent2d, Transparent3d, and Shadow PhaseItems)
* `Draw` trait and and `DrawFunctions` are now generic on PhaseItem
* Modular / Ergonomic `DrawFunctions` via `RenderCommands`
* RenderCommand is a trait that runs an ECS query and produces one or more RenderPass calls. Types implementing this trait can be composed to create a final DrawFunction. For example the DrawPbr DrawFunction is created from the following DrawCommand tuple. Const generics are used to set specific bind group locations:
```rust
pub type DrawPbr = (
SetPbrPipeline,
SetMeshViewBindGroup<0>,
SetStandardMaterialBindGroup<1>,
SetTransformBindGroup<2>,
DrawMesh,
);
```
* The new `custom_shader_pipelined` example illustrates how the commands above can be reused to create a custom draw function:
```rust
type DrawCustom = (
SetCustomMaterialPipeline,
SetMeshViewBindGroup<0>,
SetTransformBindGroup<2>,
DrawMesh,
);
```
* ExtractComponentPlugin and UniformComponentPlugin:
* Simple, standardized ways to easily extract individual components and write them to GPU buffers
* Ported PBR and Sprite rendering to the new primitives above.
* Removed staging buffer from UniformVec in favor of direct Queue usage
* Makes UniformVec much easier to use and more ergonomic. Completely removes the need for custom render graph nodes in these contexts (see the PbrNode and view Node removals and the much simpler call patterns in the relevant Prepare systems).
* Added a many_cubes_pipelined example to benchmark baseline 3d rendering performance and ensure there were no major regressions during this port. Avoiding regressions was challenging given that the old approach of extracting into centralized vectors is basically the "optimal" approach. However thanks to a various ECS optimizations and render logic rephrasing, we pretty much break even on this benchmark!
* Lifetimeless SystemParams: this will be a bit divisive, but as we continue to embrace "trait driven systems" (ex: ExtractComponentPlugin, UniformComponentPlugin, DrawCommand), the ergonomics of `(Query<'static, 'static, (&'static A, &'static B, &'static)>, Res<'static, C>)` were getting very hard to bear. As a compromise, I added "static type aliases" for the relevant SystemParams. The previous example can now be expressed like this: `(SQuery<(Read<A>, Read<B>)>, SRes<C>)`. If anyone has better ideas / conflicting opinions, please let me know!
* RunSystem trait: a way to define Systems via a trait with a SystemParam associated type. This is used to implement the various plugins mentioned above. I also added SystemParamItem and QueryItem type aliases to make "trait stye" ecs interactions nicer on the eyes (and fingers).
* RenderAsset retrying: ensures that render assets are only created when they are "ready" and allows us to create bind groups directly inside render assets (which significantly simplified the StandardMaterial code). I think ultimately we should swap this out on "asset dependency" events to wait for dependencies to load, but this will require significant asset system changes.
* Updated some built in shaders to account for missing MeshUniform fields
2021-09-23 06:16:11 +00:00
|
|
|
crevice = {path = "crates/crevice"}
|
2019-12-24 00:13:05 +00:00
|
|
|
|
2020-05-01 20:12:47 +00:00
|
|
|
[[example]]
|
|
|
|
name = "hello_world"
|
|
|
|
path = "examples/hello_world.rs"
|
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
# 2D Rendering
|
|
|
|
[[example]]
|
|
|
|
name = "contributors"
|
|
|
|
path = "examples/2d/contributors.rs"
|
|
|
|
|
2021-04-12 19:47:12 +00:00
|
|
|
[[example]]
|
|
|
|
name = "mesh"
|
|
|
|
path = "examples/2d/mesh.rs"
|
|
|
|
|
2021-03-25 01:46:22 +00:00
|
|
|
[[example]]
|
|
|
|
name = "many_sprites"
|
|
|
|
path = "examples/2d/many_sprites.rs"
|
|
|
|
|
2020-05-04 08:22:25 +00:00
|
|
|
[[example]]
|
|
|
|
name = "sprite"
|
|
|
|
path = "examples/2d/sprite.rs"
|
|
|
|
|
Add Sprite Flipping (#1407)
OK, here's my attempt at sprite flipping. There are a couple of points that I need review/help on, but I think the UX is about ideal:
```rust
.spawn(SpriteBundle {
material: materials.add(texture_handle.into()),
sprite: Sprite {
// Flip the sprite along the x axis
flip: SpriteFlip { x: true, y: false },
..Default::default()
},
..Default::default()
});
```
Now for the issues. The big issue is that for some reason, when flipping the UVs on the sprite, there is a light "bleeding" or whatever you call it where the UV tries to sample past the texture boundry and ends up clipping. This is only noticed when resizing the window, though. You can see a screenshot below.
![image](https://user-images.githubusercontent.com/25393315/107098172-397aaa00-67d4-11eb-8e02-c90c820cd70e.png)
I am quite baffled why the texture sampling is overrunning like it is and could use some guidance if anybody knows what might be wrong.
The other issue, which I just worked around, is that I had to remove the `#[render_resources(from_self)]` annotation from the Spritesheet because the `SpriteFlip` render resource wasn't being picked up properly in the shader when using it. I'm not sure what the cause of that was, but by removing the annotation and re-organizing the shader inputs accordingly the problem was fixed.
I'm not sure if this is the most efficient way to do this or if there is a better way, but I wanted to try it out if only for the learning experience. Let me know what you think!
2021-03-03 19:26:45 +00:00
|
|
|
[[example]]
|
|
|
|
name = "sprite_flipping"
|
|
|
|
path = "examples/2d/sprite_flipping.rs"
|
|
|
|
|
2020-06-02 02:23:11 +00:00
|
|
|
[[example]]
|
|
|
|
name = "sprite_sheet"
|
|
|
|
path = "examples/2d/sprite_sheet.rs"
|
|
|
|
|
2020-12-27 19:19:03 +00:00
|
|
|
[[example]]
|
|
|
|
name = "text2d"
|
|
|
|
path = "examples/2d/text2d.rs"
|
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
[[example]]
|
|
|
|
name = "texture_atlas"
|
|
|
|
path = "examples/2d/texture_atlas.rs"
|
|
|
|
|
2021-08-04 01:16:25 +00:00
|
|
|
[[example]]
|
|
|
|
name = "pipelined_texture_atlas"
|
|
|
|
path = "examples/2d/pipelined_texture_atlas.rs"
|
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
# 3D Rendering
|
2021-01-01 20:58:49 +00:00
|
|
|
[[example]]
|
|
|
|
name = "3d_scene"
|
|
|
|
path = "examples/3d/3d_scene.rs"
|
|
|
|
|
2021-06-02 02:59:17 +00:00
|
|
|
[[example]]
|
|
|
|
name = "3d_scene_pipelined"
|
|
|
|
path = "examples/3d/3d_scene_pipelined.rs"
|
|
|
|
|
Modular Rendering (#2831)
This changes how render logic is composed to make it much more modular. Previously, all extraction logic was centralized for a given "type" of rendered thing. For example, we extracted meshes into a vector of ExtractedMesh, which contained the mesh and material asset handles, the transform, etc. We looked up bindings for "drawn things" using their index in the `Vec<ExtractedMesh>`. This worked fine for built in rendering, but made it hard to reuse logic for "custom" rendering. It also prevented us from reusing things like "extracted transforms" across contexts.
To make rendering more modular, I made a number of changes:
* Entities now drive rendering:
* We extract "render components" from "app components" and store them _on_ entities. No more centralized uber lists! We now have true "ECS-driven rendering"
* To make this perform well, I implemented #2673 in upstream Bevy for fast batch insertions into specific entities. This was merged into the `pipelined-rendering` branch here: #2815
* Reworked the `Draw` abstraction:
* Generic `PhaseItems`: each draw phase can define its own type of "rendered thing", which can define its own "sort key"
* Ported the 2d, 3d, and shadow phases to the new PhaseItem impl (currently Transparent2d, Transparent3d, and Shadow PhaseItems)
* `Draw` trait and and `DrawFunctions` are now generic on PhaseItem
* Modular / Ergonomic `DrawFunctions` via `RenderCommands`
* RenderCommand is a trait that runs an ECS query and produces one or more RenderPass calls. Types implementing this trait can be composed to create a final DrawFunction. For example the DrawPbr DrawFunction is created from the following DrawCommand tuple. Const generics are used to set specific bind group locations:
```rust
pub type DrawPbr = (
SetPbrPipeline,
SetMeshViewBindGroup<0>,
SetStandardMaterialBindGroup<1>,
SetTransformBindGroup<2>,
DrawMesh,
);
```
* The new `custom_shader_pipelined` example illustrates how the commands above can be reused to create a custom draw function:
```rust
type DrawCustom = (
SetCustomMaterialPipeline,
SetMeshViewBindGroup<0>,
SetTransformBindGroup<2>,
DrawMesh,
);
```
* ExtractComponentPlugin and UniformComponentPlugin:
* Simple, standardized ways to easily extract individual components and write them to GPU buffers
* Ported PBR and Sprite rendering to the new primitives above.
* Removed staging buffer from UniformVec in favor of direct Queue usage
* Makes UniformVec much easier to use and more ergonomic. Completely removes the need for custom render graph nodes in these contexts (see the PbrNode and view Node removals and the much simpler call patterns in the relevant Prepare systems).
* Added a many_cubes_pipelined example to benchmark baseline 3d rendering performance and ensure there were no major regressions during this port. Avoiding regressions was challenging given that the old approach of extracting into centralized vectors is basically the "optimal" approach. However thanks to a various ECS optimizations and render logic rephrasing, we pretty much break even on this benchmark!
* Lifetimeless SystemParams: this will be a bit divisive, but as we continue to embrace "trait driven systems" (ex: ExtractComponentPlugin, UniformComponentPlugin, DrawCommand), the ergonomics of `(Query<'static, 'static, (&'static A, &'static B, &'static)>, Res<'static, C>)` were getting very hard to bear. As a compromise, I added "static type aliases" for the relevant SystemParams. The previous example can now be expressed like this: `(SQuery<(Read<A>, Read<B>)>, SRes<C>)`. If anyone has better ideas / conflicting opinions, please let me know!
* RunSystem trait: a way to define Systems via a trait with a SystemParam associated type. This is used to implement the various plugins mentioned above. I also added SystemParamItem and QueryItem type aliases to make "trait stye" ecs interactions nicer on the eyes (and fingers).
* RenderAsset retrying: ensures that render assets are only created when they are "ready" and allows us to create bind groups directly inside render assets (which significantly simplified the StandardMaterial code). I think ultimately we should swap this out on "asset dependency" events to wait for dependencies to load, but this will require significant asset system changes.
* Updated some built in shaders to account for missing MeshUniform fields
2021-09-23 06:16:11 +00:00
|
|
|
[[example]]
|
|
|
|
name = "many_cubes_pipelined"
|
|
|
|
path = "examples/3d/many_cubes_pipelined.rs"
|
|
|
|
|
2021-07-08 02:49:33 +00:00
|
|
|
[[example]]
|
|
|
|
name = "cornell_box_pipelined"
|
|
|
|
path = "examples/3d/cornell_box_pipelined.rs"
|
|
|
|
|
2020-05-01 20:12:47 +00:00
|
|
|
[[example]]
|
2020-10-18 20:48:15 +00:00
|
|
|
name = "load_gltf"
|
|
|
|
path = "examples/3d/load_gltf.rs"
|
2020-05-01 20:12:47 +00:00
|
|
|
|
2021-07-30 03:37:34 +00:00
|
|
|
[[example]]
|
|
|
|
name = "load_gltf_pipelined"
|
|
|
|
path = "examples/3d/load_gltf_pipelined.rs"
|
|
|
|
|
2020-07-30 01:15:15 +00:00
|
|
|
[[example]]
|
|
|
|
name = "msaa"
|
|
|
|
path = "examples/3d/msaa.rs"
|
|
|
|
|
2021-02-01 00:22:06 +00:00
|
|
|
[[example]]
|
|
|
|
name = "orthographic"
|
|
|
|
path = "examples/3d/orthographic.rs"
|
|
|
|
|
Use the infinite reverse right-handed perspective projection (#2543)
# Objective
Forward perspective projections have poor floating point precision distribution over the depth range. Reverse projections fair much better, and instead of having to have a far plane, with the reverse projection, using an infinite far plane is not a problem. The infinite reverse perspective projection has become the industry standard. The renderer rework is a great time to migrate to it.
## Solution
All perspective projections, including point lights, have been moved to using `glam::Mat4::perspective_infinite_reverse_rh()` and so have no far plane. As various depth textures are shared between orthographic and perspective projections, a quirk of this PR is that the near and far planes of the orthographic projection are swapped when the Mat4 is computed. This has no impact on 2D/3D orthographic projection usage, and provides consistency in shaders, texture clear values, etc. throughout the codebase.
## Known issues
For some reason, when looking along -Z, all geometry is black. The camera can be translated up/down / strafed left/right and geometry will still be black. Moving forward/backward or rotating the camera away from looking exactly along -Z causes everything to work as expected.
I have tried to debug this issue but both in macOS and Windows I get crashes when doing pixel debugging. If anyone could reproduce this and debug it I would be very grateful. Otherwise I will have to try to debug it further without pixel debugging, though the projections and such all looked fine to me.
2021-08-27 20:15:09 +00:00
|
|
|
[[example]]
|
|
|
|
name = "orthographic_pipelined"
|
|
|
|
path = "examples/3d/orthographic_pipelined.rs"
|
|
|
|
|
2020-05-01 20:12:47 +00:00
|
|
|
[[example]]
|
|
|
|
name = "parenting"
|
|
|
|
path = "examples/3d/parenting.rs"
|
|
|
|
|
2021-03-20 03:22:33 +00:00
|
|
|
[[example]]
|
|
|
|
name = "pbr"
|
|
|
|
path = "examples/3d/pbr.rs"
|
|
|
|
|
2021-06-27 23:10:23 +00:00
|
|
|
[[example]]
|
|
|
|
name = "pbr_pipelined"
|
|
|
|
path = "examples/3d/pbr_pipelined.rs"
|
|
|
|
|
2021-04-19 21:07:19 +00:00
|
|
|
[[example]]
|
|
|
|
name = "render_to_texture"
|
|
|
|
path = "examples/3d/render_to_texture.rs"
|
|
|
|
|
2021-07-19 19:20:59 +00:00
|
|
|
[[example]]
|
|
|
|
name = "shadow_biases_pipelined"
|
|
|
|
path = "examples/3d/shadow_biases_pipelined.rs"
|
|
|
|
|
2021-08-25 19:44:20 +00:00
|
|
|
[[example]]
|
|
|
|
name = "shadow_caster_receiver_pipelined"
|
|
|
|
path = "examples/3d/shadow_caster_receiver_pipelined.rs"
|
|
|
|
|
2020-05-01 20:12:47 +00:00
|
|
|
[[example]]
|
|
|
|
name = "spawner"
|
|
|
|
path = "examples/3d/spawner.rs"
|
|
|
|
|
|
|
|
[[example]]
|
|
|
|
name = "texture"
|
|
|
|
path = "examples/3d/texture.rs"
|
|
|
|
|
2021-06-27 23:10:23 +00:00
|
|
|
[[example]]
|
|
|
|
name = "texture_pipelined"
|
|
|
|
path = "examples/3d/texture_pipelined.rs"
|
|
|
|
|
2021-01-01 20:58:49 +00:00
|
|
|
[[example]]
|
|
|
|
name = "update_gltf_scene"
|
|
|
|
path = "examples/3d/update_gltf_scene.rs"
|
|
|
|
|
2021-03-04 01:23:24 +00:00
|
|
|
[[example]]
|
|
|
|
name = "wireframe"
|
|
|
|
path = "examples/3d/wireframe.rs"
|
|
|
|
|
2020-06-23 00:55:48 +00:00
|
|
|
[[example]]
|
|
|
|
name = "z_sort_debug"
|
|
|
|
path = "examples/3d/z_sort_debug.rs"
|
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
# Application
|
2020-11-09 21:04:27 +00:00
|
|
|
[[example]]
|
|
|
|
name = "custom_loop"
|
|
|
|
path = "examples/app/custom_loop.rs"
|
|
|
|
|
2021-01-01 21:31:22 +00:00
|
|
|
[[example]]
|
|
|
|
name = "drag_and_drop"
|
|
|
|
path = "examples/app/drag_and_drop.rs"
|
|
|
|
|
2020-05-01 20:12:47 +00:00
|
|
|
[[example]]
|
|
|
|
name = "empty"
|
|
|
|
path = "examples/app/empty.rs"
|
|
|
|
|
2020-11-13 01:23:57 +00:00
|
|
|
[[example]]
|
2021-02-22 04:50:05 +00:00
|
|
|
name = "empty_defaults"
|
|
|
|
path = "examples/app/empty_defaults.rs"
|
2020-11-13 01:23:57 +00:00
|
|
|
|
2020-05-01 20:12:47 +00:00
|
|
|
[[example]]
|
|
|
|
name = "headless"
|
|
|
|
path = "examples/app/headless.rs"
|
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
[[example]]
|
|
|
|
name = "logs"
|
|
|
|
path = "examples/app/logs.rs"
|
|
|
|
|
2020-05-03 08:30:10 +00:00
|
|
|
[[example]]
|
|
|
|
name = "plugin"
|
|
|
|
path = "examples/app/plugin.rs"
|
|
|
|
|
2020-10-29 20:04:28 +00:00
|
|
|
[[example]]
|
|
|
|
name = "plugin_group"
|
|
|
|
path = "examples/app/plugin_group.rs"
|
|
|
|
|
2020-08-21 05:37:19 +00:00
|
|
|
[[example]]
|
|
|
|
name = "return_after_run"
|
|
|
|
path = "examples/app/return_after_run.rs"
|
|
|
|
|
2020-08-14 17:15:29 +00:00
|
|
|
[[example]]
|
|
|
|
name = "thread_pool_resources"
|
|
|
|
path = "examples/app/thread_pool_resources.rs"
|
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
# Assets
|
2020-05-17 03:18:30 +00:00
|
|
|
[[example]]
|
|
|
|
name = "asset_loading"
|
|
|
|
path = "examples/asset/asset_loading.rs"
|
|
|
|
|
2020-10-01 18:31:06 +00:00
|
|
|
[[example]]
|
2020-10-18 20:48:15 +00:00
|
|
|
name = "custom_asset"
|
|
|
|
path = "examples/asset/custom_asset.rs"
|
2020-10-01 18:31:06 +00:00
|
|
|
|
2020-12-18 19:34:44 +00:00
|
|
|
[[example]]
|
|
|
|
name = "custom_asset_io"
|
|
|
|
path = "examples/asset/custom_asset_io.rs"
|
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
[[example]]
|
|
|
|
name = "hot_asset_reloading"
|
|
|
|
path = "examples/asset/hot_asset_reloading.rs"
|
|
|
|
|
2021-05-23 20:13:55 +00:00
|
|
|
# Async Tasks
|
|
|
|
[[example]]
|
|
|
|
name = "async_compute"
|
|
|
|
path = "examples/async_tasks/async_compute.rs"
|
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
# Audio
|
2020-07-16 20:46:51 +00:00
|
|
|
[[example]]
|
|
|
|
name = "audio"
|
|
|
|
path = "examples/audio/audio.rs"
|
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
# Diagnostics
|
|
|
|
[[example]]
|
|
|
|
name = "log_diagnostics"
|
|
|
|
path = "examples/diagnostics/log_diagnostics.rs"
|
|
|
|
|
2020-05-04 21:14:49 +00:00
|
|
|
[[example]]
|
|
|
|
name = "custom_diagnostic"
|
|
|
|
path = "examples/diagnostics/custom_diagnostic.rs"
|
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
# ECS (Entity Component System)
|
2020-05-04 21:14:49 +00:00
|
|
|
[[example]]
|
2021-02-22 04:50:05 +00:00
|
|
|
name = "ecs_guide"
|
|
|
|
path = "examples/ecs/ecs_guide.rs"
|
2020-05-04 21:14:49 +00:00
|
|
|
|
2020-12-31 22:29:08 +00:00
|
|
|
[[example]]
|
2021-07-12 20:09:43 +00:00
|
|
|
name = "component_change_detection"
|
|
|
|
path = "examples/ecs/component_change_detection.rs"
|
2020-12-31 22:29:08 +00:00
|
|
|
|
2020-05-01 20:12:47 +00:00
|
|
|
[[example]]
|
|
|
|
name = "event"
|
|
|
|
path = "examples/ecs/event.rs"
|
|
|
|
|
2020-12-13 02:04:42 +00:00
|
|
|
[[example]]
|
|
|
|
name = "fixed_timestep"
|
|
|
|
path = "examples/ecs/fixed_timestep.rs"
|
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
[[example]]
|
|
|
|
name = "hierarchy"
|
|
|
|
path = "examples/ecs/hierarchy.rs"
|
|
|
|
|
Add a method `iter_combinations` on query to iterate over combinations of query results (#1763)
Related to [discussion on discord](https://discord.com/channels/691052431525675048/742569353878437978/824731187724681289)
With const generics, it is now possible to write generic iterator over multiple entities at once.
This enables patterns of query iterations like
```rust
for [e1, e2, e3] in query.iter_combinations() {
// do something with relation of all three entities
}
```
The compiler is able to infer the correct iterator for given size of array, so either of those work
```rust
for [e1, e2] in query.iter_combinations() { ... }
for [e1, e2, e3] in query.iter_combinations() { ... }
```
This feature can be very useful for systems like collision detection.
When you ask for permutations of size K of N entities:
- if K == N, you get one result of all entities
- if K < N, you get all possible subsets of N with size K, without repetition
- if K > N, the result set is empty (no permutation of size K exist)
Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2021-05-17 23:33:47 +00:00
|
|
|
[[example]]
|
|
|
|
name = "iter_combinations"
|
|
|
|
path = "examples/ecs/iter_combinations.rs"
|
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
[[example]]
|
|
|
|
name = "parallel_query"
|
|
|
|
path = "examples/ecs/parallel_query.rs"
|
|
|
|
|
|
|
|
[[example]]
|
|
|
|
name = "removal_detection"
|
|
|
|
path = "examples/ecs/removal_detection.rs"
|
|
|
|
|
2020-05-01 20:12:47 +00:00
|
|
|
[[example]]
|
|
|
|
name = "startup_system"
|
|
|
|
path = "examples/ecs/startup_system.rs"
|
|
|
|
|
2020-12-13 02:04:42 +00:00
|
|
|
[[example]]
|
|
|
|
name = "state"
|
|
|
|
path = "examples/ecs/state.rs"
|
|
|
|
|
2020-11-17 02:18:00 +00:00
|
|
|
[[example]]
|
|
|
|
name = "system_chaining"
|
|
|
|
path = "examples/ecs/system_chaining.rs"
|
|
|
|
|
2021-03-03 03:11:11 +00:00
|
|
|
[[example]]
|
|
|
|
name = "system_param"
|
|
|
|
path = "examples/ecs/system_param.rs"
|
|
|
|
|
2021-04-23 19:08:16 +00:00
|
|
|
[[example]]
|
|
|
|
name = "system_sets"
|
|
|
|
path = "examples/ecs/system_sets.rs"
|
|
|
|
|
2020-11-27 19:39:33 +00:00
|
|
|
[[example]]
|
|
|
|
name = "timers"
|
|
|
|
path = "examples/ecs/timers.rs"
|
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
# Games
|
2021-01-21 22:10:02 +00:00
|
|
|
[[example]]
|
|
|
|
name = "alien_cake_addict"
|
|
|
|
path = "examples/game/alien_cake_addict.rs"
|
|
|
|
|
2020-06-27 04:40:09 +00:00
|
|
|
[[example]]
|
|
|
|
name = "breakout"
|
2020-06-28 18:11:18 +00:00
|
|
|
path = "examples/game/breakout.rs"
|
2020-06-27 04:40:09 +00:00
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
# Input
|
2020-05-01 20:12:47 +00:00
|
|
|
[[example]]
|
2021-02-22 04:50:05 +00:00
|
|
|
name = "char_input_events"
|
|
|
|
path = "examples/input/char_input_events.rs"
|
2020-05-01 20:12:47 +00:00
|
|
|
|
|
|
|
[[example]]
|
2021-02-22 04:50:05 +00:00
|
|
|
name = "gamepad_input"
|
|
|
|
path = "examples/input/gamepad_input.rs"
|
|
|
|
|
|
|
|
[[example]]
|
|
|
|
name = "gamepad_input_events"
|
|
|
|
path = "examples/input/gamepad_input_events.rs"
|
2020-06-05 06:49:36 +00:00
|
|
|
|
|
|
|
[[example]]
|
|
|
|
name = "keyboard_input"
|
|
|
|
path = "examples/input/keyboard_input.rs"
|
|
|
|
|
2021-03-14 21:00:36 +00:00
|
|
|
[[example]]
|
|
|
|
name = "keyboard_modifiers"
|
|
|
|
path = "examples/input/keyboard_modifiers.rs"
|
|
|
|
|
2020-06-05 06:49:36 +00:00
|
|
|
[[example]]
|
|
|
|
name = "keyboard_input_events"
|
|
|
|
path = "examples/input/keyboard_input_events.rs"
|
2020-05-01 20:12:47 +00:00
|
|
|
|
2020-11-07 01:15:56 +00:00
|
|
|
[[example]]
|
2021-02-22 04:50:05 +00:00
|
|
|
name = "mouse_input"
|
|
|
|
path = "examples/input/mouse_input.rs"
|
2020-09-18 21:43:47 +00:00
|
|
|
|
2020-10-21 17:27:00 +00:00
|
|
|
[[example]]
|
2021-02-22 04:50:05 +00:00
|
|
|
name = "mouse_input_events"
|
|
|
|
path = "examples/input/mouse_input_events.rs"
|
2020-10-21 17:27:00 +00:00
|
|
|
|
2020-10-18 19:24:01 +00:00
|
|
|
[[example]]
|
|
|
|
name = "touch_input"
|
|
|
|
path = "examples/input/touch_input.rs"
|
|
|
|
|
|
|
|
[[example]]
|
2020-10-18 20:20:42 +00:00
|
|
|
name = "touch_input_events"
|
|
|
|
path = "examples/input/touch_input_events.rs"
|
2020-10-18 19:24:01 +00:00
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
# Reflection
|
2020-05-01 20:12:47 +00:00
|
|
|
[[example]]
|
2020-11-28 00:39:59 +00:00
|
|
|
name = "reflection"
|
|
|
|
path = "examples/reflection/reflection.rs"
|
|
|
|
|
|
|
|
[[example]]
|
|
|
|
name = "generic_reflection"
|
|
|
|
path = "examples/reflection/generic_reflection.rs"
|
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
[[example]]
|
|
|
|
name = "reflection_types"
|
|
|
|
path = "examples/reflection/reflection_types.rs"
|
|
|
|
|
2020-11-28 00:39:59 +00:00
|
|
|
[[example]]
|
|
|
|
name = "trait_reflection"
|
|
|
|
path = "examples/reflection/trait_reflection.rs"
|
2020-05-01 20:12:47 +00:00
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
# Scene
|
2020-05-22 06:58:11 +00:00
|
|
|
[[example]]
|
2020-11-28 00:39:59 +00:00
|
|
|
name = "scene"
|
|
|
|
path = "examples/scene/scene.rs"
|
2020-05-22 06:58:11 +00:00
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
# Shaders
|
2021-04-15 19:49:31 +00:00
|
|
|
[[example]]
|
|
|
|
name = "animate_shader"
|
|
|
|
path = "examples/shader/animate_shader.rs"
|
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
[[example]]
|
|
|
|
name = "array_texture"
|
|
|
|
path = "examples/shader/array_texture.rs"
|
|
|
|
|
2020-12-07 20:32:13 +00:00
|
|
|
[[example]]
|
|
|
|
name = "hot_shader_reloading"
|
|
|
|
path = "examples/shader/hot_shader_reloading.rs"
|
|
|
|
|
2020-11-02 21:47:05 +00:00
|
|
|
[[example]]
|
|
|
|
name = "mesh_custom_attribute"
|
|
|
|
path = "examples/shader/mesh_custom_attribute.rs"
|
|
|
|
|
2020-05-01 20:12:47 +00:00
|
|
|
[[example]]
|
|
|
|
name = "shader_custom_material"
|
|
|
|
path = "examples/shader/shader_custom_material.rs"
|
|
|
|
|
|
|
|
[[example]]
|
|
|
|
name = "shader_defs"
|
|
|
|
path = "examples/shader/shader_defs.rs"
|
|
|
|
|
Modular Rendering (#2831)
This changes how render logic is composed to make it much more modular. Previously, all extraction logic was centralized for a given "type" of rendered thing. For example, we extracted meshes into a vector of ExtractedMesh, which contained the mesh and material asset handles, the transform, etc. We looked up bindings for "drawn things" using their index in the `Vec<ExtractedMesh>`. This worked fine for built in rendering, but made it hard to reuse logic for "custom" rendering. It also prevented us from reusing things like "extracted transforms" across contexts.
To make rendering more modular, I made a number of changes:
* Entities now drive rendering:
* We extract "render components" from "app components" and store them _on_ entities. No more centralized uber lists! We now have true "ECS-driven rendering"
* To make this perform well, I implemented #2673 in upstream Bevy for fast batch insertions into specific entities. This was merged into the `pipelined-rendering` branch here: #2815
* Reworked the `Draw` abstraction:
* Generic `PhaseItems`: each draw phase can define its own type of "rendered thing", which can define its own "sort key"
* Ported the 2d, 3d, and shadow phases to the new PhaseItem impl (currently Transparent2d, Transparent3d, and Shadow PhaseItems)
* `Draw` trait and and `DrawFunctions` are now generic on PhaseItem
* Modular / Ergonomic `DrawFunctions` via `RenderCommands`
* RenderCommand is a trait that runs an ECS query and produces one or more RenderPass calls. Types implementing this trait can be composed to create a final DrawFunction. For example the DrawPbr DrawFunction is created from the following DrawCommand tuple. Const generics are used to set specific bind group locations:
```rust
pub type DrawPbr = (
SetPbrPipeline,
SetMeshViewBindGroup<0>,
SetStandardMaterialBindGroup<1>,
SetTransformBindGroup<2>,
DrawMesh,
);
```
* The new `custom_shader_pipelined` example illustrates how the commands above can be reused to create a custom draw function:
```rust
type DrawCustom = (
SetCustomMaterialPipeline,
SetMeshViewBindGroup<0>,
SetTransformBindGroup<2>,
DrawMesh,
);
```
* ExtractComponentPlugin and UniformComponentPlugin:
* Simple, standardized ways to easily extract individual components and write them to GPU buffers
* Ported PBR and Sprite rendering to the new primitives above.
* Removed staging buffer from UniformVec in favor of direct Queue usage
* Makes UniformVec much easier to use and more ergonomic. Completely removes the need for custom render graph nodes in these contexts (see the PbrNode and view Node removals and the much simpler call patterns in the relevant Prepare systems).
* Added a many_cubes_pipelined example to benchmark baseline 3d rendering performance and ensure there were no major regressions during this port. Avoiding regressions was challenging given that the old approach of extracting into centralized vectors is basically the "optimal" approach. However thanks to a various ECS optimizations and render logic rephrasing, we pretty much break even on this benchmark!
* Lifetimeless SystemParams: this will be a bit divisive, but as we continue to embrace "trait driven systems" (ex: ExtractComponentPlugin, UniformComponentPlugin, DrawCommand), the ergonomics of `(Query<'static, 'static, (&'static A, &'static B, &'static)>, Res<'static, C>)` were getting very hard to bear. As a compromise, I added "static type aliases" for the relevant SystemParams. The previous example can now be expressed like this: `(SQuery<(Read<A>, Read<B>)>, SRes<C>)`. If anyone has better ideas / conflicting opinions, please let me know!
* RunSystem trait: a way to define Systems via a trait with a SystemParam associated type. This is used to implement the various plugins mentioned above. I also added SystemParamItem and QueryItem type aliases to make "trait stye" ecs interactions nicer on the eyes (and fingers).
* RenderAsset retrying: ensures that render assets are only created when they are "ready" and allows us to create bind groups directly inside render assets (which significantly simplified the StandardMaterial code). I think ultimately we should swap this out on "asset dependency" events to wait for dependencies to load, but this will require significant asset system changes.
* Updated some built in shaders to account for missing MeshUniform fields
2021-09-23 06:16:11 +00:00
|
|
|
[[example]]
|
|
|
|
name = "custom_shader_pipelined"
|
|
|
|
path = "examples/shader/custom_shader_pipelined.rs"
|
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
# Tools
|
2020-11-13 02:03:57 +00:00
|
|
|
[[example]]
|
|
|
|
name = "bevymark"
|
|
|
|
path = "examples/tools/bevymark.rs"
|
|
|
|
|
2021-04-11 20:13:07 +00:00
|
|
|
[[example]]
|
|
|
|
name = "bevymark_pipelined"
|
|
|
|
path = "examples/tools/bevymark_pipelined.rs"
|
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
# UI (User Interface)
|
2020-07-18 21:08:46 +00:00
|
|
|
[[example]]
|
|
|
|
name = "button"
|
|
|
|
path = "examples/ui/button.rs"
|
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
[[example]]
|
|
|
|
name = "font_atlas_debug"
|
|
|
|
path = "examples/ui/font_atlas_debug.rs"
|
|
|
|
|
2020-05-13 20:09:32 +00:00
|
|
|
[[example]]
|
|
|
|
name = "text"
|
|
|
|
path = "examples/ui/text.rs"
|
|
|
|
|
2020-11-13 00:21:48 +00:00
|
|
|
[[example]]
|
|
|
|
name = "text_debug"
|
|
|
|
path = "examples/ui/text_debug.rs"
|
|
|
|
|
2020-05-01 20:12:47 +00:00
|
|
|
[[example]]
|
|
|
|
name = "ui"
|
|
|
|
path = "examples/ui/ui.rs"
|
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
# Window
|
2020-06-25 22:24:27 +00:00
|
|
|
[[example]]
|
|
|
|
name = "clear_color"
|
|
|
|
path = "examples/window/clear_color.rs"
|
|
|
|
|
2021-08-19 20:34:31 +00:00
|
|
|
[[example]]
|
|
|
|
name = "clear_color_pipelined"
|
|
|
|
path = "examples/window/clear_color_pipelined.rs"
|
|
|
|
|
2020-05-01 20:12:47 +00:00
|
|
|
[[example]]
|
|
|
|
name = "multiple_windows"
|
2020-07-20 09:05:56 +00:00
|
|
|
path = "examples/window/multiple_windows.rs"
|
|
|
|
|
2020-12-28 20:26:50 +00:00
|
|
|
[[example]]
|
|
|
|
name = "scale_factor_override"
|
|
|
|
path = "examples/window/scale_factor_override.rs"
|
|
|
|
|
2020-07-20 09:05:56 +00:00
|
|
|
[[example]]
|
|
|
|
name = "window_settings"
|
2020-08-21 05:37:19 +00:00
|
|
|
path = "examples/window/window_settings.rs"
|
2020-09-16 01:05:31 +00:00
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
# WASM
|
2020-09-16 01:05:31 +00:00
|
|
|
[[example]]
|
|
|
|
name = "hello_wasm"
|
|
|
|
path = "examples/wasm/hello_wasm.rs"
|
|
|
|
required-features = []
|
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
[[example]]
|
|
|
|
name = "assets_wasm"
|
|
|
|
path = "examples/wasm/assets_wasm.rs"
|
|
|
|
required-features = ["bevy_winit"]
|
|
|
|
|
2020-09-16 01:05:31 +00:00
|
|
|
[[example]]
|
|
|
|
name = "headless_wasm"
|
|
|
|
path = "examples/wasm/headless_wasm.rs"
|
|
|
|
required-features = []
|
2020-09-16 20:40:32 +00:00
|
|
|
|
|
|
|
[[example]]
|
|
|
|
name = "winit_wasm"
|
|
|
|
path = "examples/wasm/winit_wasm.rs"
|
2020-09-19 03:11:26 +00:00
|
|
|
required-features = ["bevy_winit"]
|
2020-09-25 22:26:23 +00:00
|
|
|
|
2021-02-22 04:50:05 +00:00
|
|
|
# Android
|
2020-11-03 00:30:30 +00:00
|
|
|
[[example]]
|
2020-11-10 03:26:08 +00:00
|
|
|
crate-type = ["cdylib"]
|
2020-11-03 20:00:47 +00:00
|
|
|
name = "android"
|
|
|
|
path = "examples/android/android.rs"
|
2020-11-03 00:30:30 +00:00
|
|
|
|
|
|
|
[package.metadata.android]
|
2020-11-12 00:31:16 +00:00
|
|
|
apk_label = "Bevy Example"
|
|
|
|
assets = "assets"
|
|
|
|
res = "assets/android-res"
|
|
|
|
icon = "@mipmap/ic_launcher"
|
2020-11-22 00:38:24 +00:00
|
|
|
build_targets = ["aarch64-linux-android", "armv7-linux-androideabi"]
|
2020-11-03 19:32:48 +00:00
|
|
|
min_sdk_version = 16
|
2020-11-10 03:26:08 +00:00
|
|
|
target_sdk_version = 29
|