Commit graph

1489 commits

Author SHA1 Message Date
James Beilby
f584e72953 Add Transform::rotate_around method (#3107)
# Objective

- Missing obvious way to rotate a transform around a point. This is popularly used for rotation of an object in world space ("orbiting" a point), or for local rotation of an object around a pivot point on that object.
- Present in other (not to be named) game engines
- Was question from user on Discord today (thread "object rotation")

## Solution

- Added Transform::rotate_around method where point is specified in reference frame of the parent (if any) or in world space.
2022-02-04 02:09:24 +00:00
François
37a7be56db Make transform builder methods const (#3045)
# Objective

- Make transform builder methods `const`

## Solution

- I made them `const`
2022-02-04 01:46:35 +00:00
Charles
7d712406fe Simplify sending empty events (#2935)
# Objective

When using empty events, it can feel redundant to have to specify the type of the event when sending it.

## Solution

Add a new `fire()` function that sends the default value of the event. This requires that the event derives Default.


Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2022-02-04 01:24:47 +00:00
Daniel McNab
6f111136b9 Cleanup some things which shouldn't be components (#2982)
# Objective

- Using `Stopwatch` and `Timer` as raw components is a footgun.

## Solution

- Stop them from being components
2022-02-03 23:56:57 +00:00
bilsen
1f99363de9 Add &World as SystemParam (#2923)
# Objective
Make it possible to use `&World` as a system parameter

## Solution
It seems like all the pieces were already in place, very simple impl


Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2022-02-03 23:43:25 +00:00
Garett Cooper
c216738b33 Implement len and is_empty for EventReaders (#2969)
# Objective

Provide a non-consuming method of checking if there are events in an `EventReader`.

Fixes #2967

## Solution

Implements the `len` and `is_empty` functions for `EventReader` and `ManualEventReader`, giving users the ability to check for the presence of new events without consuming any.


Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2022-02-03 23:22:08 +00:00
bjorn3
af22cc1dc3 Use ManuallyDrop instead of forget in insert_resource_with_id (#2947)
# Objective

Calling forget would invalidate the data pointer before it is used.

## Solution

Use `ManuallyDrop` to prevent the value from being dropped without moving it.
2022-02-03 22:34:31 +00:00
François
19bd6b9c32 Update rodio 0.15 (#3846)
# Objective

- Update rodio to 0.15
- Replace #3828
2022-02-03 04:25:44 +00:00
Stefan Seemayer
21ac4bc0ae impl Command for <impl FnOnce(&mut World)> (#2996)
This is my first contribution to this exciting project! Thanks so much for your wonderful work. If there is anything that I can improve about this PR, please let me know :)

# Objective

- Fixes #2899
- If a simple one-off command is needed to be added within a System, this simplifies that process so that we can simply do `commands.add(|world: &mut World| { /* code here */ })` instead of defining a custom type implementing `Command`.

## Solution

- This is achieved by `impl Command for F where F: FnOnce(&mut World) + Send + Sync + 'static` as just calling the function.

I am not sure if the bounds can be further relaxed but needed the whole `Send`, `Sync`, and `'static` to get it to compile.
2022-02-03 04:11:19 +00:00
MinerSebas
69e9a47d92 SystemParam Derive fixes (#2838)
# Objective

A user on Discord couldn't derive SystemParam for this Struct:

```rs
#[derive(SystemParam)]
pub struct SpatialQuery<'w, 's, Q: WorldQuery + Send + Sync + 'static, F: WorldQuery + Send + Sync + 'static = ()>
where
    F::Fetch: FilterFetch,
{
    query: Query<'w, 's, (C, &'static Transform), F>,
}
```

## Solution

1. The `where`-clause is now also copied to the `SystemParamFetch` impl Block.
2. The `SystemParamState` impl Block no longer gets any defaults for generics


Co-authored-by: MinerSebas <66798382+MinerSebas@users.noreply.github.com>
2022-02-03 03:32:02 +00:00
dataphract
b506c30cd3 fix: only init_resource() once for AmbientLight (#3853)
# Objective

`PbrPlugin` calls `app.init_resource::<AmbientLight>()` twice. The second call won't do anything.

## Solution

Remove the second call.
2022-02-03 00:43:37 +00:00
KDecay
506642744c docs: Fix private doc links and enable CI test (#3743)
# Objective

Fixes #3566

## Solution

- [x] Fix broken links in private docs.
- [x] Add the `--document-private-items` flag to the CI.

## Note

The following was said by @killercup in #3566:

> I don't have time to confirm this but I assume that linking to private items throws an error/warning when just running cargo doc, and --document-private-item might actually hide that warning. So to test this, you'd have to run it twice.

I tested this and this is thankfully not the case. If you are linking to a private item you will get a warning no matter if you run `cargo doc` or `cargo doc --document-private-items`.

### Example

I added `struct Test;` to `bevy_core/src/name.rs` and linked to it inside of a doc comment using ``[`Test`]``. After that I ran `cargo doc -p bevy_core --document-private-items` using `RUSTDOCFLAGS="-D warnings"` and got the following output (note the last sentence):

```rust
error: public documentation for `Name` links to private item `Test`
  --> crates/bevy_core/src/name.rs:11:82
   |
11 | /// Component used to identify an entity. Stores a hash for faster comparisons [`Test`]
   |                                                                                  ^^^^ this item is private
   |
   = note: `-D rustdoc::private-intra-doc-links` implied by `-D warnings`
   = note: this link resolves only because you passed `--document-private-items`, but will break without
```
2022-02-02 21:47:29 +00:00
Andrew Jackson
6cab36165f Update ClearColor Resource docs (#3842)
# Objective
- Update the `ClearColor` resource docs as described in #3837  so new users (like me) understand it better

## Solution
- Update the docs to use what @alice-i-cecile described in #3837 


I took this one up because I got confused by it this weekend. I didn't understand why the  "background" was being set by a `ClearColor` resource.
2022-02-02 21:29:48 +00:00
TheRawMeatball
ce752d2522 Increment last event count on next instead of iter (#2382)
# Objective

Currently, simply calling `iter` on an event reader will mark all of it's events as read, even if the returned iterator is never used

## Solution

With this, the cursor will simply move to the last unread, but available event when iter is called, and incremented by one per `next` call.


Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2022-02-02 02:29:33 +00:00
dependabot[bot]
6a499b125b Update gltf requirement from 0.16.0 to 1.0.0 (#3826)
Updates the requirements on [gltf](https://github.com/gltf-rs/gltf) to permit the latest version.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/gltf-rs/gltf/blob/master/CHANGELOG.md">gltf's changelog</a>.</em></p>
<blockquote>
<h2>[1.0.0] - 2022-01-29</h2>
<h3>Added</h3>
<ul>
<li>Support for the <code>KHR_materials_specular</code> extension.</li>
<li>Support for the <code>KHR_materials_variants</code> extension.</li>
<li>Support for the <code>KHR_materials_volume</code> extension.</li>
<li><code>ExactSizeIterator</code> implementation for <code>Joints</code> iterator.</li>
</ul>
<h3>Changed</h3>
<ul>
<li>The <code>mesh.primitives</code> property is now always serialized.</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>Incorrect implementation of <code>Normalize&lt;u16&gt;</code> and <code>Normalize&lt;f32&gt;</code> for <code>u16</code>.</li>
</ul>
<h2>[0.16.0] - 2021-05-13</h2>
<h3>Added</h3>
<ul>
<li>Support for the <code>KHR_texture_transform</code> extension.</li>
<li>Support for the <code>KHR_materials_transmission_ior</code> extension.</li>
</ul>
<h3>Changed</h3>
<ul>
<li><code>Material::alpha_cutoff</code> is now optional.</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>URIs with embedded data failing to import when using <code>import_slice</code>.</li>
<li>Serialization of empty primitives object being skipped.</li>
</ul>
<h2>[0.15.2] - 2020-03-29</h2>
<h3>Changed</h3>
<ul>
<li>All features are now exposed in the <a href="http://docs.rs/gltf">online documentation</a>.</li>
<li>Primary iterators now implement <code>Iterator::nth</code> explicitly for improved performance.</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>Compiler warnings regarding deprecation of <code>std::error::Error::description</code>.</li>
</ul>
<h2>[0.15.1] - 2020-03-15</h2>
<h3>Added</h3>
<ul>
<li>New feature <code>guess_mime_type</code> which, as the name suggests, attempts to guess
the MIME type of an image if it doesn't exactly match the standard.</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a href="https://github.com/gltf-rs/gltf/commits">compare view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>
2022-02-02 00:25:39 +00:00
Horváth Bálint
c285a69f76 Add the Inside version to the Collision enum (#2489)
# Objective
I think the 'collide' function inside the 'bevy/crates/bevy_sprite/src/collide_aabb.rs' file should return 'Some' if the two rectangles are fully overlapping or one is inside the other. This can happen on low-end machines when a lot of time passes between two frames because of a stutter, so a bullet for example gets inside its target. I can also think of situations where this is a valid use case even without stutters. 

## Solution
I added an 'Inside' version to the Collision enum declared in the file. And I use it, when the two rectangles are overlapping, but we can't say from which direction it happened. I gave a 'penetration depth' of minus Infinity to these cases, so that this variant only appears, when the two rectangles overlap from each side fully. I am not sure if this is the right thing to do.

Fixes #1980

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2022-02-01 22:40:25 +00:00
Robert Swain
33ef5b5039 bevy_render: Only auto-disable mappable primary buffers for discrete GPUs (#3803)
# Objective

- While it is not safe to enable mappable primary buffers for all GPUs, it should be preferred for integrated GPUs where an integrated GPU is one that is sharing system memory.

## Solution

- Auto-disable mappable primary buffers only for discrete GPUs. If the GPU is integrated and mappable primary buffers are supported, use them.
2022-01-31 01:22:17 +00:00
sark
ca029ef0eb Naga export (#3714)
# Objective

In order to create a glsl shader, we must provide the `naga::ShaderStage` type which is not exported by bevy, meaning a user would have to manually include naga just to access this type.

`pub fn from_glsl(source: impl Into<Cow<'static, str>>, stage: naga::ShaderStage) -> Shader {`

## Solution

Re-rexport naga::ShaderStage from `render_resources`
2022-01-31 00:32:47 +00:00
François
44d09dc46d fix timer test to be less reliant on float precision (#3789)
# Objective

- Test is failing on nightly after the merge of https://github.com/rust-lang/rust/pull/90247
- It was relying on the precision of the duration of `1.0 / 3.0`

## Solution

- Fix the test to be less reliant on float precision to have the same result
2022-01-28 16:17:54 +00:00
James Liu
514754d650 Add crate level docs to bevy_log and enable #![warn(missing_docs)] (#3520)
This PR is part of the issue #3492.
# Objective

  - Add crate level docs to the bevy_log 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_log crate level docs
 - Add a note about panicking from multiple `LogPlugins` per process.
 - Add the #![warn(missing_docs)] lint.
2022-01-23 18:00:43 +00:00
Alice Cecile
f5039a476d Mark .id() methods which return an Entity as must_use (#3750)
# Objective

- Calling .id() has no purpose unless you use the Entity returned
- This is an easy source of confusion for beginners.
- This is easily missed during refactors.

## Solution

- Mark the appropriate methods as #[must_use]
2022-01-23 14:24:37 +00:00
Daniel McNab
f3de12bc5e Add a warning when watch_for_changes has no effect (#3684)
# Objective

- Users can get confused when they ask for watching to be unsupported, then find it isn't supported
- Fixes https://github.com/bevyengine/bevy/issues/3683

## Solution

- Add a warning if the `watch_for_changes` call would do nothing
2022-01-21 00:29:29 +00:00
Michael Dorst
f1f6fd349a Remove ComponentsError (#3716)
# Objective
`ComponentsError` is unused and should be removed.

Fixes #3707 

## Solution

Remove `ComponentsError`.
2022-01-21 00:12:32 +00:00
Rose Peck
e30d600dbf Update docstrings for text_system and text2d_system (#3732)
# Objective

- Fixes #3562 

## Solution

- The outdated reference to `TextGlyphs` has been removed, and replaced with a more accurate docstring.

## What was `TextGlyphs`?
This is the real question of this Issue and PR. This is particulary interesting because not only is `TextGlyphs` not a type in bevy, but it _never was_. Indeed, this type never existed on main. Where did it come from?

`TextGlyphs` was originally a tuple struct wrapping a `Vec<PositionedGlyph>`. It was first introduced back in commit ec390aec4e in #765. At the time, position information was being stored on the text entities directly. However, after design review, [it was decided](https://github.com/bevyengine/bevy/pull/765#issuecomment-725047186) to instead store the glyphs in a `HashMap` owned by the `TextPipeline`. When this was done, the original type was not only removed, but abstracted behind a few layers of the `TextPipeline` API. Obviously, the original docstring wasn't updated accordingly.

Later, as part of #1122, the incorrect docstring was swept up when copy/pasting `text_system` for `text2d`. (Although I don't blame @CleanCut for this; it took me like 3 hours to track all this down to find the original context.)
2022-01-20 19:32:16 +00:00
François
cb2ba19d97 rename Texture to Image in doc of from_buffer function (#3713)
This doc link was missed when changing the type name.

Noticed in https://github.com/bevyengine/bevy/pull/3706 which will not be merged
2022-01-18 01:28:09 +00:00
Robert Swain
55da315432 bevy_render: Provide a way to opt-out of the built-in frustum culling (#3711)
# Objective

- Allow opting-out of the built-in frustum culling for cases where its behaviour would be incorrect
- Make use of the this in the shader_instancing example that uses a custom instancing method. The built-in frustum culling breaks the custom instancing in the shader_instancing example if the camera is moved to:

```rust
    commands.spawn_bundle(PerspectiveCameraBundle {
        transform: Transform::from_xyz(12.0, 0.0, 15.0)
            .looking_at(Vec3::new(12.0, 0.0, 0.0), Vec3::Y),
        ..Default::default()
    });
```

...such that the Aabb of the cube Mesh that is at the origin goes completely out of view. This incorrectly (for the purpose of the custom instancing) culls the `Mesh` and so culls all instances even though some may be visible.


## Solution

- Add a `NoFrustumCulling` marker component
- Do not compute and add an `Aabb` to `Mesh` entities without an `Aabb` if they have a `NoFrustumCulling` marker component
- Do not apply frustum culling to entities with the `NoFrustumCulling` marker component
2022-01-17 22:55:44 +00:00
Robert Swain
a9f2817c49 bevy_pbr: Do not panic when more than 256 point lights are added the scene (#3697)
# Objective

- Do not panic when mroe than 256 point lights are added the scene
- Fixes https://github.com/bevyengine/bevy/issues/3682

## Solution

- Only iterate the first `MAX_POINT_LIGHTS` lights instead of as many as there are

## Open questions

- Should we warn that there are more than the maximum allowed number of point lights in the scene?
2022-01-17 22:22:15 +00:00
Robert Swain
ef823d369f bevy_render: Do not automatically enable MAPPABLE_PRIMARY_BUFFERS (#3698)
# Objective

- When using `WgpuOptionsPriority::Functionality`, which is the default, wgpu::Features::MAPPABLE_PRIMARY_BUFFERS would be automatically enabled. This feature can and does have a significant negative impact on performance for discrete GPUs where resizable bar is not supported, which is a common case. As such, this feature should not be automatically enabled.
- Fixes the performance regression part of https://github.com/bevyengine/bevy/issues/3686 and at least some, if not all cases of https://github.com/bevyengine/bevy/issues/3687

## Solution

- When using `WgpuOptionsPriority::Functionality`, use the adapter-supported features, enable `TEXTURE_ADAPTER_SPECIFIC_FORMAT_FEATURES` and disable `MAPPABLE_PRIMARY_BUFFERS`
2022-01-17 22:03:14 +00:00
Chris J G
8139022ecd Change bevy_core::Name to implement Deref<Target = str> (#3681)
# Objective
Fixes #3613
[Link to issue](https://github.com/bevyengine/bevy/issues/3613)

## Solution
Changed the Deref Target to `str` and changed the `deref()` function body so that a `&str` is returned by using `as_ref() `.
2022-01-17 21:30:17 +00:00
Linden Krouse
d11cd63452 Fixed doc comment with render Node input/output methods (#3642)
Fixed doc comment where render Node input/output methods refered to using `RenderContext` for interaction instead of `RenderGraphContext`

# Objective

The doc comments for `Node` refer to `RenderContext` for slots instead of `RenderGraphContext`, which is only confusing because `Node::run` is passed both `RenderContext` and `RenderGraphContext`

## Solution

Fixed the typo
2022-01-17 20:44:22 +00:00
Wybe Westra
3fcdc5a492 Expanded Msaa documentation. (#3693)
- Added default value.
- Links to the explanation of Msaa on wikipedia.
- Added a short example to show how to use the struct on an app.

Fixes #3167.
2022-01-16 21:09:15 +00:00
James Liu
e30199f7a9 Document bevy_tasks and enable #![warn(missing_docs)] (#3509)
This PR is part of the issue #3492.

# Objective

-  Add and update the bevy_tasks documentation to achieve a 100% documentation coverage (sans `prelude` module)
-  Add the #![warn(missing_docs)] lint to keep the documentation coverage for the future.

## Solution

 -  Add and update the bevy_math documentation.
 -  Add the #![warn(missing_docs)] lint.
 - Added doctest wherever there should be in the missing docs.
2022-01-16 04:53:22 +00:00
Ted Driggs
8e1f660e1d Don't panic in macro shape validation (#3647)
# Objective
Emitting compile errors produces cleaner messages than panicking in a proc-macro.

## Solution
- Replace match-with-panic code with call to new `bevy_macro_utils::get_named_struct_fields` function
- Replace one use of match-with-panic for enums with inline match

_Aside:_ I'm also the maintainer of [`darling`](https://docs.rs/darling), a crate which provides a serde-like API for parsing macro inputs. I avoided using it here because it seemed like overkill, but if there are plans to add lots more attributes/macros then that might be a good way of offloading macro error handling.
2022-01-15 22:14:43 +00:00
François
c16d0c5a39 do not set cursor grab on window creation if not asked for (#3617)
# Objective

- On Safari mobile, calling `winit_window.set_cursor_grab(true)` fails as the API is not implemented (as there is no cursor on Safari mobile, the api doesn't make sense there). I don't know about other mobile browsers
```
[Error] Unhandled Promise Rejection: TypeError: getObject(arg0).exitPointerLock is not a function. (In 'getObject(arg0).exitPointerLock()', 'getObject(arg0).exitPointerLock' is undefined)
    (anonymous function) (rect.js:1089)
    wasm-stub
    <?>.wasm-function[web_sys::features::gen_Document::Document::exit_pointer_lock::h20ffc49be163fc45]
    <?>.wasm-function[winit::platform_impl::platform::backend::canvas::Canvas::set_cursor_grab::h6a9472cf55263e98]
    <?>.wasm-function[bevy_winit::winit_windows::WinitWindows::create_window::h9db5b3cbb24347c5]
    <?>.wasm-function[<bevy_winit::WinitPlugin as bevy_app::plugin::Plugin>::build::ha4a7c046b80c4280]
    <?>.wasm-function[bevy_app::plugin_group::PluginGroupBuilder::finish::h0e5bc78f71c37b2f]
    <?>.wasm-function[rect::main::h899852fd17f2d489]
    <?>.wasm-function[std::sys_common::backtrace::__rust_begin_short_backtrace::hfe38f282e8dda96b]
    <?>.wasm-function[std::rt::lang_start::{{closure}}::hc2f3b555ffc58618]
    <?>.wasm-function[std::rt::lang_start_internal::ha901ae30d88554f2]
    <?>.wasm-function[main]
    <?>.wasm-function[]
    wasm-stub
    21261
    (anonymous function) (rect.js:1664)
    asyncFunctionResume
    (anonymous function)
    promiseReactionJobWithoutPromise
    promiseReactionJob
```

## Solution

- Do not call the api to release cursor grab on window creation, as the cursor is not grabbed anyway at this point
2022-01-15 20:29:58 +00:00
Robert Swain
2186eae89c bevy_crevice: Fix incorrect iterator usage in WriteStd430 impl for [T] (#3591)
# Objective

- Fix incorrect iterator usage in WriteStd430 impl for [T]
  - The first item was being written twice. This is correct in the WriteStd140 impl for [T].

## Solution

- See the code.
2022-01-15 20:10:33 +00:00
Federico Rinaldi
7c22f92ce4 Document sub apps (#3403)
Documentation added to:
- `App::add_sub_app` (
- `App::update` (mentions that sub apps are updated here)

### Future work
- An example for `add_sub_app` would be good, but I wasn't able to come up with a simple one.
- Since `SubApp` is private, maybe the concept of sub applications could be introduced in the `App` struct-level documentation.
2022-01-14 23:14:42 +00:00
dataphract
f073b2d7f3 document more of bevy_reflect (#3655)
This adds documentation for:

- The trait methods of `Reflect` and its subtraits
- The `partial_eq` and `apply` functions for `Map` et al.
- `DynamicList` and `DynamicMap`
- `TypeRegistry` and related types & traits
- `GetPath`, including an explanation of path string syntax

among other things.

Still to be documented are the various macros and `bevy_reflect::serde`.
2022-01-14 19:09:44 +00:00
Troels Jessen
39db8ecd03 Added docs for bevy_transform (#3516)
# Objective

bevy_transform needed documentation and warn(missing_docs) as requested by #3492 

## Solution

warn(missing_docs) was activated and documentation was added to cover the crate


Co-authored-by: Troels Jessen <kairyuka@gmail.com>
2022-01-14 18:47:48 +00:00
François
17bb812d5d Ignore clippy 1.58 (#3667)
- Work around #3666 until a proper fix is done
- Also update duplicate dependencies list
2022-01-14 18:21:22 +00:00
Nicholas French
7fd781e670 Fix documentation for QueryState::iter_manual (#3644)
# Objective

- Fixes #3616 

## Solution

- As described in the issue, documentation for `iter_manual` was copied from `iter_combinations` and did not reflect the behavior of the method. I've pulled some information from #2351 to create a more accurate description.
2022-01-13 01:50:54 +00:00
Isse
84144c9429 Remove documentation warning on EntityCommands::insert that is no longer necessary (#3653)
# Objective

- Removes warning about accidently inserting bundles with `EntityCommands::insert`, but since a component now needs to implement `Component` it is unnecessary.
2022-01-13 00:24:31 +00:00
Pascal Hertleif
bc499591c2 Use use instead of lots of full paths (#3564)
Super tiny thing. Found this while reviewing #3479.

# Objective

- Simplify code
- Fix the link in the doc comment

## Solution

- Import a single item :)


Co-authored-by: Pascal Hertleif <pascal@technocreatives.com>
2022-01-11 01:08:39 +00:00
Michael Dorst
130953c717 Enable the doc_markdown clippy lint (#3457)
# Objective

CI should check for missing backticks in doc comments.

Fixes #3435

## Solution

`clippy` has a lint for this: `doc_markdown`. This enables that lint in the CI script.

Of course, enabling this lint in CI causes a bunch of lint errors, so I've gone through and fixed all of them. This was a huge edit that touched a ton of files, so I split the PR up by crate.

When all of the following are merged, the CI should pass and this can be merged.

+ [x] #3467
+ [x] #3468
+ [x] #3470 
+ [x] #3469
+ [x] #3471 
+ [x] #3472 
+ [x] #3473 
+ [x] #3474 
+ [x] #3475 
+ [x] #3476 
+ [x] #3477 
+ [x] #3478 
+ [x] #3479 
+ [x] #3480 
+ [x] #3481 
+ [x] #3482 
+ [x] #3483 
+ [x] #3484 
+ [x] #3485 
+ [x] #3486
2022-01-09 23:20:13 +00:00
François
600ee7eee6 support all line endings in shader preprocessor (#3603)
# Objective

- Advance uses of shaders seems to often fail for Windows users
- Bevy split lines on `'\n'` which messes with windows line endings

## Solution

- Uses Rust built in https://doc.rust-lang.org/std/primitive.str.html#method.lines
2022-01-09 18:52:18 +00:00
Michael Dorst
e56685370b Fix doc_markdown lints in bevy_render (#3479)
#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_render` crate.
2022-01-09 11:09:46 +00:00
MiniaczQ
6f167aa3d6 Documented Events (#3306)
# Objective

This PR extends the `Events` documentation by:
- informing user about the possible race condition
- explicitly explaining the unusual double buffer implementation

Fixes #3305 


Co-authored-by: MiniaczQ <jakub.motyka.2000@gmail.com>
Co-authored-by: MiniaczQ <MiniaczQ@gmail.com>
2022-01-09 03:48:27 +00:00
dataphract
4b4dbb021f document Struct, TupleStruct and Tuple (#3081)
# Objective

These traits are undocumented on `main`.

## Solution

Now they have docs! Included are examples for each trait and their corresponding `GetTypeField` trait. The docs also mention that `#[derive(Reflect)]` will automatically derive the correct subtrait on structs and tuple structs.
2022-01-08 20:45:24 +00:00
Hennadii Chernyshchyk
458cb7a9e9 Add headless mode (#3439)
# Objective

In this PR I added the ability to opt-out graphical backends. Closes #3155.

## Solution

I turned backends into `Option` ~~and removed panicking sub app API to force users handle the error (was suggested by `@cart`)~~.
2022-01-08 10:39:43 +00:00
Carter Anderson
2ee38cb9e0 Release 0.6.0 (#3587) 2022-01-08 10:18:22 +00:00
davier
c2da7800e3 Add 2d meshes and materials (#3460)
# Objective

The current 2d rendering is specialized to render sprites, we need a generic way to render 2d items, using meshes and materials like we have for 3d.

## Solution

I cloned a good part of `bevy_pbr` into `bevy_sprite/src/mesh2d`, removed lighting and pbr itself, adapted it to 2d rendering, added a `ColorMaterial`, and modified the sprite rendering to break batches around 2d meshes.

~~The PR is a bit crude; I tried to change as little as I could in both the parts copied from 3d and the current sprite rendering to make reviewing easier. In the future, I expect we could make the sprite rendering a normal 2d material, cleanly integrated with the rest.~~ _edit: see <https://github.com/bevyengine/bevy/pull/3460#issuecomment-1003605194>_

## Remaining work

- ~~don't require mesh normals~~ _out of scope_
- ~~add an example~~ _done_
- support 2d meshes & materials in the UI?
- bikeshed names (I didn't think hard about naming, please check if it's fine)

## Remaining questions

- ~~should we add a depth buffer to 2d now that there are 2d meshes?~~ _let's revisit that when we have an opaque render phase_
- ~~should we add MSAA support to the sprites, or remove it from the 2d meshes?~~ _I added MSAA to sprites since it's really needed for 2d meshes_
- ~~how to customize vertex attributes?~~ _#3120_



Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2022-01-08 01:29:08 +00:00
Troels Jessen
32f7997c56 Partially document bevy_ui (#3526)
# Objective

Updated the docs for bevy_ui as requested by #3492 

## Solution

I have documented the parts I understand. anchors.rs is not in use and should be removed, thus I haven't documented that, and some of the more renderer-heavy code is beyond me and needs input from either cart or someone familiar with bevy rendering

Co-authored-by: Troels Jessen <kairyuka@gmail.com>
2022-01-07 22:20:34 +00:00
Robert Swain
d34ecd7584 bevy_pbr: Use a special first depth slice for clustered forward (#3545)
# Objective

- Using plain exponential depth slicing for perspective projection cameras results in unnecessarily many slices very close together close to the camera. If the camera is then moved close to a collection of point lights, they will likely exhaust the available uniform buffer space for the lists of which lights affect which clusters.

## Solution

- A simple solution to this is to use a different near plane value for the depth slicing and set it to where the first slice's far plane should be. The default value is 5 and works well. This results in the configured number of depth slices, maintains the exponential slicing beyond the initial slice, and no slices are too small such that they cause problems that are sensitive to the view position.
2022-01-07 21:25:59 +00:00
Dusty DeWeese
f781bfe7d8 Fix shadows for non-TriangleLists (#3581)
Fixes shadows of non TriangleList meshes:

# Without

<img width="1033" alt="Screen Shot 2022-01-07 at 13 03 02" src="https://user-images.githubusercontent.com/1069462/148607402-9bc47978-0b5b-45cd-a6e6-f488825cdf14.png">

# With

<img width="987" alt="Screen Shot 2022-01-07 at 13 04 06" src="https://user-images.githubusercontent.com/1069462/148607437-7d7c1d74-627f-4a7c-bf7b-205405586c17.png">
2022-01-07 21:10:18 +00:00
Niklas Eicker
fbab01a40d Add missing closing ticks for inline examples and some cleanup (#3573)
# Objective

- clean up documentation and inline examples

## Solution

- add missing closing "```"
- remove stray "```"
- remove whitespace in inline examples
- unify inline examples (remove some `rust` labels)
2022-01-07 09:25:12 +00:00
François
015da72250 gltf loader: do not use the taskpool for only one task (#3577)
# Objective

- Fix the case mentioned in https://github.com/bevyengine/bevy/pull/2725#issuecomment-1007014024.
- On a machine with 4 cores, so 1 thread for assets, loading a gltf with only one textures hangs all asset loading

## Solution

- Do not use the task pool when there is only one texture to load


Co-authored-by: François <8672791+mockersf@users.noreply.github.com>
2022-01-07 07:19:22 +00:00
yetanothercheer
fda0b2c911 Fix typo (#3578) 2022-01-07 06:25:38 +00:00
Daniel Bearden
b673c51e20 Bevy app docs (#3539)
# Objective

Achieve 100% documentation coverage for bevy_app crate.
See #3492 

## Solution

- Add #![warn(missing_docs)] to crate root
- Add doc comments to public items
- Add doc comment to bevy_utils::define_label macro trait
2022-01-06 23:16:47 +00:00
Michael Dorst
507441d96f Fix doc_markdown lints in bevy_ecs (#3473)
#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_ecs` crate.
2022-01-06 00:43:37 +00:00
Niklas Eicker
f9b51ca602 Complete inline documentation for bevy_audio (#3510)
# Objective
Part of #3492 

- Complete inline documentation of `bevy_audio`

## Solution

- Added inline documentation to all public parts of `bevy_audio`
- Added a few inline examples at important places
- Some renaming for clarity (e.g. `AudioLoader` and generics)
- added `#![warn(missing_docs)]` and `#![forbid(unsafe_code)]` to `bevy_audio`

I also tried adding support for the other vorbis file endings `.oga` and `.spx` to the `AudioLoader` (see `file endings` at https://tools.ietf.org/html/rfc5334#section-10.3), but the `rodio` decoder does not seem to support those.
2022-01-05 22:30:15 +00:00
Michael Dorst
251514017f Fix doc_markdown lints in bevy_ui (#3484)
#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_ui` crate.
2022-01-05 22:30:14 +00:00
Michael Dorst
0b3a1c18e9 Fix doc_markdown lints in bevy_text (#3482)
#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_text` crate.
2022-01-05 22:30:12 +00:00
Alice Cecile
073f381c9e Removal detection cleanup (#3010)
# Objective

- Fixes #1920.
- Users often want to know how to get the values of removed components (#1655).
- Stand-alone `bevy_ecs` behavior is very unintuitive, as `World::clear_trackers()` must be manually called.
- Fixes #2999 by extending the existing test (thanks @hymm for pointing me to it) to be clearer and check for component removal as well.

## Solution

- Better docs!
- Better tests!
2022-01-05 22:06:38 +00:00
TheRawMeatball
f3fba09615 Add MapMode to wgpu reexports (#3558)
This type can be needed by API s on other reexported types, so it should be included too
2022-01-05 19:19:22 +00:00
François
a1e3c5c100 load names of lights from gltf (#3553)
# Objective

- Load names of lights from gltf

## Solution

- Load names of lights from gltf


Co-authored-by: François <8672791+mockersf@users.noreply.github.com>
2022-01-05 03:27:17 +00:00
Alice Cecile
0bae5bb8f4 Remove dead anchor.rs code (#3551)
# Objective

- As noticed by @sheepyhead in #3526, `anchor.rs` is completely unused.

## Solution

- Anchors away!
2022-01-05 00:49:20 +00:00
MrGVSV
36390a80ec Documented Handles and Assets (#3348)
# Objective

Add documentation to [Handle](7356f1586d/crates/bevy_asset/src/handle.rs (L63)) and [Assets](7356f1586d/crates/bevy_asset/src/assets.rs (L48)).

## Tasks
- [x] Document `Handle`
- [x] Document `Assets`

---

Fixes #3347


Co-authored-by: MrGVSV <49806985+MrGVSV@users.noreply.github.com>
2022-01-04 23:38:39 +00:00
Rob Parrett
24b21ea35e Fix torus normals (#3549)
# Objective

Fixes #3547 

## Solution

Normal calc adapted from https://web.cs.ucdavis.edu/~amenta/s12/findnorm.pdf

## Before
<img width="1392" alt="before" src="https://user-images.githubusercontent.com/200550/148125212-fb1c083e-3c57-4330-a656-df34513c36ab.png">

## After
<img width="1392" alt="after" src="https://user-images.githubusercontent.com/200550/148125223-174dc956-37df-4ac2-8983-b18e1e2a9a7d.png">

I'm assuming that the greyness and the self-shadowing artifacts are... normal for the new renderer.
2022-01-04 21:30:46 +00:00
Robert Swain
b9c623e4f3 Configurable wgpu features/limits priority (#3452)
# Objective

- Allow the user to specify the priority when configuring wgpu features/limits and by default use the maximum capabilities of the chosen adapter.

## Solution

- Add a `WgpuOptionsPriority` enum with `Compatibility`, `Functionality` and `WebGL2` options.
- Add a `priority: WgpuOptionsPriority` member to `WgpuOptions`.
- When initialising the renderer, if `WgpuOptions::priority == WgpuOptionsPriority::Functionality`, query the adapter for the available features and limits, use them when creating a device, and update `WgpuOptions` with those values. If `Compatibility` use the behaviour as before this PR. If `WebGL2` then use the WebGL2 downlevel limits as used when when building for wasm, for convenience of testing WebGL2 limits without having to build for wasm.
- Add an environment variable `WGPU_OPTIONS_PRIO` that takes `compatibility`, `functionality`, `webgl2`.
- Default to `WgpuOptionsPriority::Functionality`.
- Insert updated `WgpuOptions` into render app world as well. This is useful for applying the limits when rendering, such as limiting the directional light shadow map texture to 2048x2048 when using WebGL2 downlevel limits but not on wasm.
- Reduced `draw_state` logs from `debug` to `trace` and added `debug` level logs for the wgpu features and limits. Use `RUST_LOG=bevy_render=debug` to see the output.
2022-01-04 20:08:12 +00:00
Michael Nett
1a2646ecc4 Use fully-qualified type names in proc macro. (#3544)
Modifies the code emitted by `derive_label` to use fully-qualified type
names (e.g. `std::boxed::Box` instead of `Box`).

# Objective

- Using unqualified types here causes errors when the proc macro is used in contexts that locally define types with conflicting names (e.g. a local definition of `Box`).

## Solution

- Fully qualify standard types emitted by the proc macro code.
2022-01-04 19:49:37 +00:00
yetanothercheer
1bae879bf3 Fix typo (#3538) 2022-01-03 08:51:44 +00:00
dependabot[bot]
97012950f9 Update nalgebra requirement from 0.29.0 to 0.30.0 (#3540)
Updates the requirements on [nalgebra](https://github.com/dimforge/nalgebra) to permit the latest version.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/dimforge/nalgebra/blob/dev/CHANGELOG.md">nalgebra's changelog</a>.</em></p>
<blockquote>
<h2>[0.30.0] (02 Jan. 2022)</h2>
<h3>Breaking changes</h3>
<ul>
<li>The <code>Dim</code> trait is now marked as unsafe.</li>
<li>The <code>Matrix::pow</code> and <code>Matrix::pow_mut</code> methods only allow positive integer exponents now. To compute negative
exponents, the user is free to invert the matrix before calling <code>pow</code> with the exponent’s absolute value.</li>
</ul>
<h3>Modified</h3>
<ul>
<li>Use more concise debug impls for matrices and geometric transformation types.</li>
<li>The singular values computed by the SVD are now sorted in increasing order by default. Use <code>SVD::new_unordered</code>
instead to reproduce the older behavior without the sorting overhead.</li>
<li>The <code>UnitDualQuaternion::sclerp</code> method will no longer panic when given two equal rotations.</li>
<li>The <code>Matrix::select_rows</code> and <code>Matrix::select_columns</code> methods no longer require the matrix components to implement
the trait <code>Zero</code>.</li>
<li>The <code>Matrix::pow</code> and <code>Matrix::pow_mut</code> methods will now also work with integer matrices.</li>
</ul>
<h3>Added</h3>
<ul>
<li>Added the conversion trait <code>From&lt;Vec&lt;T&gt;&gt;</code> and method <code>from_vec_storage</code> for <code>RowDVector</code>.</li>
<li>Added implementation of <code>From</code> and <code>Into</code> for converting between <code>nalgebra</code> types and types from
<code>glam 0.18</code>. These can be enabled by enabling the <code>convert-glam018</code> cargo features.</li>
<li>Added the methods <code>Matrix::product</code>, <code>::row_product</code>, <code>::row_product_tr</code>, and <code>::column_product</code> to compute the
product of the components, rows, or columns, of a single matrix or vector.</li>
<li>The <code>Default</code> trait is now implemented for most geometric types: <code>Point</code>, <code>Isometry</code>, <code>Rotation</code>, <code>Similarity</code>,
<code>Transform</code>, <code>UnitComplex</code>, and <code>UnitQuaternion</code>.</li>
<li>Added the <code>Scale</code> geometric type for representing non-uniform scaling.</li>
<li>Added <code>Cholesky::new_with_substitute</code> that will replace diagonal elements by a given constant whenever <code>Cholesky</code>
meets a non-definite-positiveness.</li>
<li>Re-added the conversion from a vector/matrix slice to a static array.</li>
<li>Added the <code>cuda</code> feature that enables the support of <a href="https://github.com/Rust-GPU/Rust-CUDA">rust-cuda</a> for using
<code>nalgebra</code> features with CUDA kernels written in Rust.</li>
<li>Added special-cases implementations for the 2x2 and 3x3 SVDs for better accuracy and performances.</li>
<li>Added the methods <code>Matrix::polar</code>, <code>Matrix::try_polar</code>, and <code>SVD::to_polar</code> to compute the polar decomposition of
a matrix, based on its SVD.</li>
<li><code>nalgebra-sparse</code>: provide constructors for unsorted but otherwise valid data using the CSR format.</li>
<li><code>nalgebra-sparse</code>: added reading MatrixMarked data files to a sparse <code>CooMatrix</code>.</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>Fixed a potential unsoundness with <code>matrix.get(i)</code> and <code>matrix.get_mut(i)</code> where <code>i</code>  is an <code>usize</code>, and <code>matrix</code>
is a matrix slice with non-default strides.</li>
<li>Fixed potential unsoundness with <code>vector.perp</code> where <code>vector</code> isn’t actually a 2D vector as expected.</li>
<li>Fixed linkage issue with <code>nalgebra-lapack</code>: the user of <code>nalgebra-lapack</code> no longer have to add
<code>extern crate lapack-src</code> to their <code>main.rs</code>.</li>
<li>Fixed the <code>no-std</code> build of <code>nalgebra-glm</code>.</li>
<li>Fix the <code>pow</code> and <code>pow_mut</code> functions (the result was incorrect for some exponent values).</li>
</ul>
<h2>[0.29.0]</h2>
<h3>Breaking changes</h3>
<ul>
<li>We updated to the version 0.6 of <code>simba</code>. This means that the trait bounds <code>T: na::RealField</code>, <code>na::ComplexField</code>,
<code>na::SimdRealField</code>, <code>na:SimdComplexField</code> no imply that <code>T: Copy</code> (they only imply that <code>T: Clone</code>). This may affect</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="e8b9c40123"><code>e8b9c40</code></a> Release v0.30.0</li>
<li><a href="c0f8530d5e"><code>c0f8530</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/dimforge/nalgebra/issues/1055">#1055</a> from dimforge/fix-pow</li>
<li><a href="99ac8c4032"><code>99ac8c4</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/dimforge/nalgebra/issues/1050">#1050</a> from metric-space/polar-decomposition-take-2</li>
<li><a href="498d7e3d4c"><code>498d7e3</code></a> Semi-unitary test checks for if rows or cols are orthonomal</li>
<li><a href="ae6fda7dc7"><code>ae6fda7</code></a> Change svd to svd_unordered for the method output to be equal</li>
<li><a href="d806669cc7"><code>d806669</code></a> Fix Matrix::pow and make it work only with positive exponents</li>
<li><a href="fdaf8c0fbe"><code>fdaf8c0</code></a> Add tests for Matrix::pow</li>
<li><a href="67a82c2c88"><code>67a82c2</code></a> Test: minor style fix</li>
<li><a href="8e0ca439c2"><code>8e0ca43</code></a> Use proptest for testing the polar decomposition</li>
<li><a href="cc10b67dd1"><code>cc10b67</code></a> Add Matrix::try_polar that returns Option and make Matrix::polar not return O...</li>
<li>Additional commits viewable in <a href="https://github.com/dimforge/nalgebra/compare/v0.29.0...v0.30.0">compare view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>
2022-01-03 08:33:15 +00:00
Robert Swain
85b7589388 bevy_gltf: Add support for loading lights (#3506)
# Objective

- Add support for loading lights from glTF 2.0 files

## Solution

- This adds support for the KHR_punctual_lights extension which supports point, directional, and spot lights, though we don't yet support spot lights.
- Inserting light bundles when creating scenes required registering some more light bundle component types.
2022-01-03 07:59:25 +00:00
Yilin Wei
d44c3cd150 Fix error message for the Component macro's component storage attribute. (#3534)
# Objective

Fixes the error message for the `component` attribute when users use the wrong literals.
2022-01-02 23:28:18 +00:00
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
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
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
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
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