Commit graph

2208 commits

Author SHA1 Message Date
James Liu
dc8fefe27f Remove Bytes, FromBytes, Labels, EntityLabels. Document rest of bevy_core and enable warning on missing docs. (#3521)
This PR is part of the issue #3492.

# Objective

 - Clean up dead code in `bevy_core`.
 - Add and update the `bevy_core` documentation to achieve a 100% documentation coverage.
 - Add the #![warn(missing_docs)] lint to keep the documentation coverage for the future.

# Solution

 - Remove unused `Bytes`, `FromBytes`, `Labels`, and `EntityLabels` types and associated systems.
 - Made several types private that really only have use as internal types, mostly pertaining to fixed timestep execution.
 - Add and update the bevy_core documentation.
 - Add the #![warn(missing_docs)] lint.

# Open Questions

Should more of the internal states of `FixedTimestep` be public? Seems mostly to be an implementation detail unless someone really needs that fixed timestep state.
2022-01-02 20:36:40 +00:00
François
363bdf78dc Re-enable nightly checks and add new dependency duplicate (#3525)
# Objective

- Nightly checks where disabled because of a bug in Rust
- Dependency checks are failing because of a new duplicate

## Solution

- Now that https://github.com/rust-lang/rust/pull/92175 has been merged, re-enable nightly checks
- Add the new duplicate dependency to the known list
- Removed `Inflector` dependency as it's not used anymore


Co-authored-by: François <8672791+mockersf@users.noreply.github.com>
2022-01-02 20:18:53 +00:00
Jerome Humbert
e43e36696d Minor docs edit/add in bevy_render (#3447)
# Objective

Docs updates.

## Solution

- Detail what `OrthographicCameraBundle::new_2d()` creates.
- Fix a few renamed parameters in comments of `TrackedRenderPass`.
- Add missing comments for viewport and debug markers.

Co-authored-by: Jerome Humbert <djeedai@gmail.com>
2022-01-02 17:40:03 +00:00
KDecay
50b3f27a76 Updated bevy_dylib documentation and added missing_doc warning. (#3515)
This PR is part of the issue #3492.

# Objective
- Add and update the bevy_dylib documentation to achieve a 100% documentation coverage.
- Add the #![warn(missing_docs)] lint to keep the documentation coverage for the future.

# Solution
- Add and update the bevy_dylib documentation.
- Add the #![warn(missing_docs)] lint.
2022-01-02 10:51:08 +00:00
Oscar
478bf7a2b6 Remove Lutris from NixOS dependency section (#2945)
# Objective

- Using the instructions given for NixOS results in an unnecessarily long time to evaluate the shell expression due to unnecessary dependencies pulled in by `lutris`.

## Solution

- Removed `lutris` dependency.

Lutris is a GUI tool for running games on wine, I'm assuming it was pulled in by accident as it's definitely not necessary for running bevy. A hello world example, at the least, works fine without it.
2022-01-01 22:55:19 +00:00
Joel Godfrey-Smith
6b239713bf Update linux_dependencies.md (#3517)
Thanks for making Bevy. Recommend adding rust-libudev-devel as an additional dependence for Fedora.

# Objective

- Describe the objective or issue this PR addresses.
- If you're fixing a specific issue, say "Fixes #X".

## Solution

- Describe the solution used to achieve the objective above.
2022-01-01 22:28:44 +00:00
Troels Jessen
5c590b0011 Added missing docs to bevy_internal and added warn on missing docs (#3514)
# Objective
This contributes documentation that should cover the entirety of bevy_internal as requested in #3492 

## Solution
warn(missing_docs) has been activated and documentation has been added to missing parts so that no warnings appear from this setting
2022-01-01 21:22:04 +00:00
Alice Cecile
97c806585b README refresh (#3513)
# Objective

- The focus areas and roadmap are very stale.
- Some of the information about how to learn or contribute to Bevy are outdated

## Solution

- Remove links to focus areas and roadmap (roadmap still exists, and will be updated post-release).
- Link to Bevy Assets, CONTRIBUTING.md and official examples.
2022-01-01 19:41:20 +00:00
François
3ba711050f do not add plugin ExtractComponentPlugin twice for StandardMaterial (#3502)
# Objective

- After updating #2988, all the examples started crashing with
```
thread 'main' panicked at 'Plugin "bevy_render::render_component::ExtractComponentPlugin<bevy_asset::handle::Handle<bevy_pbr::pbr_material::StandardMaterial>>" was already added', crates/bevy_app/src/app.rs:831:33
```

## Solution

Plugin was added twice:
directly:
1d0d8a3397/crates/bevy_pbr/src/lib.rs (L73)
and through `MaterialPlugin`:
1d0d8a3397/crates/bevy_pbr/src/lib.rs (L72)
1d0d8a3397/crates/bevy_pbr/src/material.rs (L183)

I removed the extra plugin

Co-authored-by: François <8672791+mockersf@users.noreply.github.com>
2022-01-01 19:22:22 +00:00
Carter Anderson
1d0d8a3397 Spherical area lights example (#3498)
I was putting together the Bevy 0.6 release blog post and wanted a simple area light radius example, so here we are :)

![image](https://user-images.githubusercontent.com/2694663/147786883-63454290-b5b1-4456-9762-0b0b47e16bb5.png)
2021-12-30 21:07:26 +00:00
David Sugar
c641a905dc StorageType parameter removed from ComponentDescriptor::new_resource (#3495)
# Objective

Remove the `StorageType` parameter from `ComponentDescriptor::new_resource` as discussed in #3361.

- fixes #3361

## Solution

- Parameter removed.
- Basic docs added.

## Note

Left a [comment](https://github.com/bevyengine/bevy/issues/3361#issuecomment-996433346) about `SparseStorage` being the more reasonable choice.



Co-authored-by: r4gus <david@thesugar.de>
2021-12-30 20:08:40 +00:00
Minghao Liu
3ac55f0bcf load spirv using correct API (#3466)
# Objective

currently spirv source loading parse then desterilize it to make wgpu happy.

## Solution

Use the right API to get spirv
2021-12-30 19:55:01 +00:00
Michael Dorst
b532cc9ef6 Fix doc_markdown lints in bevy_utils (#3485)
#3457 adds the `doc_markdown` clippy lint, which checks doc comments to make sure code identifiers are escaped with backticks. This causes a lot of lint errors, so this is one of a number of PR's that will fix those lint errors one crate at a time.

This PR fixes lints in the `bevy_utils` crate.
2021-12-30 09:23:18 +00:00
Michael Dorst
593f64cfcb Fix doc_markdown lints in bevy_transform (#3483)
#3457 adds the `doc_markdown` clippy lint, which checks doc comments to make sure code identifiers are escaped with backticks. This causes a lot of lint errors, so this is one of a number of PR's that will fix those lint errors one crate at a time.

This PR fixes lints in the `bevy_transform` crate.
2021-12-30 09:23:17 +00:00
Michael Dorst
accfb33ab9 Fix doc_markdown lints in bevy_app (#3467)
#3457 adds the `doc_markdown` clippy lint, which checks doc comments to make sure code identifiers are escaped with backticks. This causes a lot of lint errors, so this is one of a number of PR's that will fix those lint errors one crate at a time.

This PR fixes lints in the `bevy_app` crate.
2021-12-30 09:08:19 +00:00
François
d8d3fdf2cf remove dead code: ShaderDefs derive (#3490)
# Objective

- remove some dead code and see if someone isn't happy about it


Co-authored-by: François <8672791+mockersf@users.noreply.github.com>
2021-12-29 21:04:29 +00:00
François
db68704231 Enable Msaa for webgl by default (#3489)
# Objective

- `Msaa` was disabled in webgl due to a bug in wgpu
- Bug has been fixed (https://github.com/gfx-rs/wgpu/pull/2307) and backported (https://github.com/gfx-rs/wgpu/pull/2327), and updates for [`wgpu-core`](https://crates.io/crates/wgpu-core/0.12.1) and [`wgpu-hal`](https://crates.io/crates/wgpu-hal/0.12.1) have been released

## Solution

- Remove custom config for `Msaa` in webgl
- I also changed two options that were using the arch instead of the `webgl` feature. it shouldn't change much for webgl, but could help if someone wants to target wasm but not webgl2


Co-authored-by: François <8672791+mockersf@users.noreply.github.com>
2021-12-29 21:04:28 +00:00
Jakob Hellermann
66b517ef81 fix shader compilation error reporting for non-wgsl shaders (#3441)
in #3289 I accidentally only logged errors for wgsl shaders, this PR expands the error reporting the the other supported shader types.
2021-12-29 21:04:27 +00:00
Jonathan Cornaz
d07c8a8fa7 Implement ReflectValue serialization for Duration (#3318)
# Objective

Resolves #3277 

Currenty if we try to serialize a scene that contains a `Duration` (which is very common, since `Timer` contains one), we get an error saying:

> Type 'core::time::Duration' does not support ReflectValue serialization


## Solution

Let `Duration` implement `SerializeValue`.



Co-authored-by: Jonathan Cornaz <jcornaz@users.noreply.github.com>
2021-12-29 21:04:26 +00:00
David Sugar
8a8293b266 Renamed Entity::new to Entity::from_raw (#3465)
# Objective

- Rename `Entity::new(id: u32)` to `Entity::from_raw(id: u32)`.
- Add further documentation.
- fixes #3108

## Solution

- Renamed `Entity::new(id: u32)` to `Entity::from_raw(id: u32)`.
- Docs extended.

I derived the examples from the discussion of issue #3108 .

The [first case](https://github.com/bevyengine/bevy/issues/3108#issuecomment-966669781) mentioned in the linked issue is quite obvious but the [second one](https://github.com/bevyengine/bevy/issues/3108#issuecomment-967093902) probably needs further explanation.


Co-authored-by: r4gus <david@thesugar.de>
2021-12-29 20:49:00 +00:00
Michael Dorst
fd743ec57f Fix doc_markdown lints in bevy_pbr (#3477)
#3457 adds the `doc_markdown` clippy lint, which checks doc comments to make sure code identifiers are escaped with backticks. This causes a lot of lint errors, so this is one of a number of PR's that will fix those lint errors one crate at a time.

This PR fixes lints in the `bevy_pbr` crate.
2021-12-29 19:04:18 +00:00
Michael Dorst
455ab65bce Fix doc_markdown lints in bevy_sprite (#3480)
#3457 adds the `doc_markdown` clippy lint, which checks doc comments to make sure code identifiers are escaped with backticks. This causes a lot of lint errors, so this is one of a number of PR's that will fix those lint errors one crate at a time.

This PR fixes lints in the `bevy_sprite` crate.
2021-12-29 18:49:43 +00:00
Michael Dorst
608e63a5bc Fix doc_markdown lints in bevy_audio (#3469)
#3457 adds the `doc_markdown` clippy lint, which checks doc comments to make sure code identifiers are escaped with backticks. This causes a lot of lint errors, so this is one of a number of PR's that will fix those lint errors one crate at a time.

This PR fixes lints in the `bevy_audio` crate.
2021-12-29 17:52:42 +00:00
Michael Dorst
32d88c7d23 Fix doc_markdown lints in bevy_asset (#3468)
#3457 adds the `doc_markdown` clippy lint, which checks doc comments to make sure code identifiers are escaped with backticks. This causes a lot of lint errors, so this is one of a number of PR's that will fix those lint errors one crate at a time.

This PR fixes lints in the `bevy_asset` crate.
2021-12-29 17:52:39 +00:00
Michael Dorst
b32770d303 Fix doc_markdown lints in bevy_tasks (#3481)
#3457 adds the `doc_markdown` clippy lint, which checks doc comments to make sure code identifiers are escaped with backticks. This causes a lot of lint errors, so this is one of a number of PR's that will fix those lint errors one crate at a time.

This PR fixes lints in the `bevy_tasks` crate.
2021-12-29 17:38:13 +00:00
Michael Dorst
b1e4984c55 Fix doc_markdown lints in bevy_reflect (#3478)
#3457 adds the `doc_markdown` clippy lint, which checks doc comments to make sure code identifiers are escaped with backticks. This causes a lot of lint errors, so this is one of a number of PR's that will fix those lint errors one crate at a time.

This PR fixes lints in the `bevy_reflect` crate.
2021-12-29 17:38:12 +00:00
Michael Dorst
a90c080659 Fix doc_markdown lints in bevy_log (#3476)
#3457 adds the `doc_markdown` clippy lint, which checks doc comments to make sure code identifiers are escaped with backticks. This causes a lot of lint errors, so this is one of a number of PR's that will fix those lint errors one crate at a time.

This PR fixes lints in the `bevy_log` crate.
2021-12-29 17:38:11 +00:00
Michael Dorst
8aff7262d6 Fix doc_markdown lints in bevy_input (#3475)
#3457 adds the `doc_markdown` clippy lint, which checks doc comments to make sure code identifiers are escaped with backticks. This causes a lot of lint errors, so this is one of a number of PR's that will fix those lint errors one crate at a time.

This PR fixes lints in the `bevy_input` crate.
2021-12-29 17:38:10 +00:00
Michael Dorst
2790b9d240 Fix doc_markdown lints in bevy_gltf (#3474)
#3457 adds the `doc_markdown` clippy lint, which checks doc comments to make sure code identifiers are escaped with backticks. This causes a lot of lint errors, so this is one of a number of PR's that will fix those lint errors one crate at a time.

This PR fixes lints in the `bevy_gltf` crate.
2021-12-29 17:38:09 +00:00
Michael Dorst
b65a1cadb7 Fix doc_markdown lints in bevy_diagnostic (#3472)
#3457 adds the `doc_markdown` clippy lint, which checks doc comments to make sure code identifiers are escaped with backticks. This causes a lot of lint errors, so this is one of a number of PR's that will fix those lint errors one crate at a time.

This PR fixes lints in the `bevy_diagnostic` crate.
2021-12-29 17:38:08 +00:00
Michael Dorst
e6bce74220 Fix doc_markdown lints in examples (#3486)
#3457 adds the `doc_markdown` clippy lint, which checks doc comments to make sure code identifiers are escaped with backticks. This causes a lot of lint errors, so this is one of a number of PR's that will fix those lint errors one crate at a time.

This PR fixes lints in the `examples` folder.
2021-12-29 17:25:34 +00:00
davier
601cc0cbe3 bevy_ui: Check clip when handling interactions (#3461)
# Objective

Fix a bug: UI nodes that are clipped could still be interacted with in the clipped area.

## Solution

Clip the position calculation in `ui_focus_system`
2021-12-28 20:47:45 +00:00
David Sugar
3a9d5a63c9 bevy::scene::Entity renamed to bevy::scene::DynamicEntity. (#3448)
Basic documentation added to bevy::scene::DynamicEntity and bevy::scene::DynamicScene.

# Objective

- Rename bevy::scene::Entity to bevy::scene::DynamicEntity
- fixes #3233

## Solution

- Renamed the struct as requested.
- Added basic documentation.

Co-authored-by: r4gus <david@thesugar.de>
2021-12-27 21:24:18 +00:00
davier
959a845704 bevy_ui: register Overflow type (#3443)
I forgot to register the new `Overflow` type in #3296.
2021-12-27 19:46:25 +00:00
François
f3b053d11f crevice derive macro: fix path to render_resource when importing from bevy (#3438)
# Objective

- Fix #3436 

## Solution

- Do not add twice `render_resource` when coming from `bevy`


Co-authored-by: François <8672791+mockersf@users.noreply.github.com>
2021-12-26 19:04:02 +00:00
davier
06d9384447 Add FromReflect trait to convert dynamic types to concrete types (#1395)
Dynamic types (`DynamicStruct`, `DynamicTupleStruct`, `DynamicTuple`, `DynamicList` and `DynamicMap`) are used when deserializing scenes, but currently they can only be applied to existing concrete types. This leads to issues when trying to spawn non trivial deserialized scene.
For components, the issue is avoided by requiring that reflected components implement ~~`FromResources`~~ `FromWorld` (or `Default`). When spawning, a new concrete type is created that way, and the dynamic type is applied to it. Unfortunately, some components don't have any valid implementation of these traits.
In addition, any `Vec` or `HashMap` inside a component will panic when a dynamic type is pushed into it (for instance, `Text` panics when adding a text section).

To solve this issue, this PR adds the `FromReflect` trait that creates a concrete type from a dynamic type that represent it, derives the trait alongside the `Reflect` trait, drops the ~~`FromResources`~~ `FromWorld` requirement on reflected components, ~~and enables reflection for UI and Text bundles~~. It also adds the requirement that fields ignored with `#[reflect(ignore)]` implement `Default`, since we need to initialize them somehow.

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2021-12-26 18:49:01 +00:00
François
585d0b8467 remove some mut in queries (#3437)
# Objective

- While reading code, found some queries that are `mut` and not used as such

## Solution

- Remove `mut` when possible


Co-authored-by: François <8672791+mockersf@users.noreply.github.com>
2021-12-26 05:39:46 +00:00
Carter Anderson
963e2f08a2 Materials and MaterialPlugin (#3428)
This adds "high level" `Material` and `SpecializedMaterial` traits, which can be used with a `MaterialPlugin<T: SpecializedMaterial>`. `MaterialPlugin` automatically registers the appropriate resources, draw functions, and queue systems. The `Material` trait is simpler, and should cover most use cases. `SpecializedMaterial` is like `Material`, but it also requires defining a "specialization key" (see #3031). `Material` has a trivial blanket impl of `SpecializedMaterial`, which allows us to use the same types + functions for both.

This makes defining custom 3d materials much simpler (see the `shader_material` example diff) and ensures consistent behavior across all 3d materials (both built in and custom). I ported the built in `StandardMaterial` to `MaterialPlugin`. There is also a new `MaterialMeshBundle<T: SpecializedMaterial>`, which `PbrBundle` aliases to.
2021-12-25 21:45:43 +00:00
François
22c665fa39 re-export BufferBinding and BufferDescriptor (#3429)
# Objective

- I want to port `bevy_egui` to Bevy main and only reuse re-exports from Bevy

## Solution

- Add exports for `BufferBinding` and `BufferDescriptor`


Co-authored-by: François <8672791+mockersf@users.noreply.github.com>
2021-12-24 16:53:49 +00:00
davier
76ec709ede Add Visibility component to UI (#3426)
# Objective

Fixes #3422 

## Solution

Adds the existing `Visibility` component to UI bundles and checks for it in the extract phase of the render app.

The `ComputedVisibility` component was not added. I don't think the UI camera needs frustum culling, but having `RenderLayers` work may be desirable. However I think we would need to change `check_visibility()` to differentiate between 2d, 3d and UI entities.
2021-12-24 07:10:12 +00:00
Jakob Hellermann
adb3ad399c make sub_app return an &App and add sub_app_mut() -> &mut App (#3309)
It's sometimes useful to have a reference to an app a sub app at the same time, which is only possible with an immutable reference.
2021-12-24 06:57:30 +00:00
François
5d5d7833f0 fix parenting of scenes (#2410)
# Objective

Fix #2406 

Scene parenting was not done completely, leaving the hierarchy maintenance to the standard system. As scene spawning happens in stage `PreUpdate` and hierarchy maintenance in stage `PostUpdate`, this left the scene in an invalid state parent wise for part of a frame

## Solution

Also add/update the `Children` component when spawning the scene.

I kept the `Children` component as a `SmallVec`, it could be moved to an `HashSet` to guarantee uniqueness


Co-authored-by: François <8672791+mockersf@users.noreply.github.com>
2021-12-24 06:57:28 +00:00
Carter Anderson
08b5234582 Disable nightly rust checks for bors (#3427)
This is a temporary measure while we wait for https://github.com/rust-lang/rust/issues/92163 to be resolved.
2021-12-24 01:11:51 +00:00
François
79d36e7c28 Prepare crevice for vendored release (#3394)
# Objective

- Our crevice is still called "crevice", which we can't use for a release
- Users would need to use our "crevice" directly to be able to use the derive macro

## Solution

- Rename crevice to bevy_crevice, and crevice-derive to bevy-crevice-derive
- Re-export it from bevy_render, and use it from bevy_render everywhere
- Fix derive macro to work either from bevy_render, from bevy_crevice, or from bevy

## Remaining

- It is currently re-exported as `bevy::render::bevy_crevice`, is it the path we want?
- After a brief suggestion to Cart, I changed the version to follow Bevy version instead of crevice, do we want that?
- Crevice README.md need to be updated
- in the `Cargo.toml`, there are a few things to change. How do we want to change them? How do we keep attributions to original Crevice?
```
authors = ["Lucien Greathouse <me@lpghatguy.com>"]
documentation = "https://docs.rs/crevice"
homepage = "https://github.com/LPGhatguy/crevice"
repository = "https://github.com/LPGhatguy/crevice"
```


Co-authored-by: François <8672791+mockersf@users.noreply.github.com>
Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2021-12-23 22:49:12 +00:00
François
aeba9faf04 use ogg by default instead of mp3 (#3421)
# Objective

- mp3 feature of rodio has dependencies that are not maintained with security issues
- mp3 feature of rodio doesn't build in wasm
- mp3 feature of rodio uses internal memory allocation that cause rejection from Apple appstore

## Solution

- Use vorbis instead of mp3 by default


Co-authored-by: François <8672791+mockersf@users.noreply.github.com>
2021-12-23 19:19:15 +00:00
Jakob Hellermann
c6d4c63f42 enable wasm-bindgen feature on gilrs (#3420)
WIthout the feature, `gilrs` uses `stdweb` instead of `wasm-bindgen` which isn't compatible with the rest of bevy.

Unfortunately, the `stdweb` dependency is still in the dependency tree, it just isn't used (https://gitlab.com/gilrs-project/gilrs/-/issues/101). This will be fixed in `gilrs 0.9` when it releases.
2021-12-23 19:19:14 +00:00
Nicola Papale
035ec7b763 Implement non-indexed mesh rendering (#3415)
# Objective

Instead of panicking when the `indices` field of a mesh is `None`, actually manage it.

This is just a question of keeping track of the vertex buffer size.

## Notes

* Relying on this change to improve performance on [bevy_debug_lines using the new renderer](https://github.com/Toqozz/bevy_debug_lines/pull/10)
* I'm still new to rendering, my only expertise with wgpu is the learn-wgpu tutorial, likely I'm overlooking something.
2021-12-23 19:19:13 +00:00
Mike
851b5939ce add tracing spans for parallel executor and system overhead (#3416)
This PR adds tracing spans for the parallel executor and system overhead.

![image](https://user-images.githubusercontent.com/2180432/147172747-b78026e3-1c30-4120-92c8-693c6f1564cd.png)
2021-12-23 19:03:44 +00:00
James Higgins
0936f4ca9d RemoveChildren command (#1925) 2021-12-23 09:04:55 +00:00
Jakob Hellermann
081350916c report shader processing errors in RenderPipelineCache (#3289)
### Problem
- shader processing errors are not displayed
- during hot reloading when encountering a shader with errors, the whole app crashes

### Solution
- log `error!`s for shader processing errors 
- when `cfg(debug_assertions)` is enabled (i.e. you're running in `debug` mode), parse shaders before passing them to wgpu. This lets us handle errors early.
2021-12-22 22:16:42 +00:00