Commit graph

903 commits

Author SHA1 Message Date
Zicklag
89217171b4 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
Daniel McNab
e61d7920e3 Add suffixes to diagnostics and other cleanup (#1505)
Also a few related clean ups to diagnostics
Old look (from the log_diagnostics_example):
<details>
<summary>Old look hidden to avoid clutter </summary>

![image](https://user-images.githubusercontent.com/36049421/108776774-bc349080-755a-11eb-8569-d4832abf6bc3.png)

</details>
New look: 

![image](https://user-images.githubusercontent.com/36049421/108776587-82638a00-755a-11eb-96eb-539026d59bcb.png)

In particular, notice that the width of the diagnostics has been significantly reduced - within vscode the value no longer wraps on my 1920 width monitor. The value is still 105 columns wide, so there is room for improvement however.
2021-03-03 03:43:15 +00:00
Carter Anderson
74cb13aa70 update libloading (#1543)
Alternative to #1418
2021-03-03 03:11:12 +00:00
Wouter Buckens
000dd4c1c2 Add docs & example for SystemParam (#1435)
It took me a little while to figure out how to use the `SystemParam` derive macro to easily create my own params. So I figured I'd add some docs and an example with what I learned.

- Fixed a bug in the `SystemParam` derive macro where it didn't detect the correct crate name when used in an example (no longer relevant, replaced by #1426 - see further)
- Added some doc comments and a short example code block in the docs for the `SystemParam` trait
- Added a more complete example with explanatory comments in examples
2021-03-03 03:11:11 +00:00
Archina
b8a0ab01ba add to lower case to make asset loading case insensitive (#1427)
This should fix bug #1425
2021-03-03 03:11:10 +00:00
Digital Seven
8dcba7f4a1 Add Window Resize Constraints (#1409)
You should be able to set the minimum and maximum desired resolution of a system window.
This also fixes a bug on Windows operating system: When you try to resize to 0 on the height it crashes.

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2021-03-03 02:56:50 +00:00
TheRawMeatball
87ada5b589 Get rid of ChangedRes (#1313)
This replaces `ChangedRes` with simple associated methods that return the same info, but don't block execution. Also, since ChangedRes was infectious and was the only reason `FetchSystemParam::get_params` and `System::run_unsafe` returned `Option`s, their implementation could be simplified after this PR is merged, or as part of it with a future commit.
2021-03-03 01:59:40 +00:00
Carter Anderson
e035ce1f2a remove dev-dependencies from bevy_ecs (#1542)
These are no longer used, increase build times, and currently break builds due to a broken criterion dependency on nightly.
2021-03-03 01:39:02 +00:00
Jakob Hellermann
bc4fe9b186 keep track of type name in NodeState (#1444)
Adds the original type_name to `NodeState`, enabling plugins like [this](https://github.com/jakobhellermann/bevy_mod_debugdump).
This does increase the `NodeState` type by 16 bytes, but it is already 176 so it's not that big of an increase.
2021-02-22 09:15:29 +00:00
Jakob Hellermann
a1ec684131 fix bevy_ecs macro path handling (#1426)
- It now doesn't search in the dev-dependencies anymore
- and the behaviour is consistent for derive_bundle and derive_system_param
2021-02-22 09:15:27 +00:00
Jonas Matser
72f2a7b581 Add getter for RenderGraph Node uuid (#1499)
`RenderGraph` errors only give the `Uuid` of the node. So for my graphviz dot based visualization of the `RenderGraph` I really wanted to show it to the user. I think it makes sense to have it accessible for at least debugging purposes.
2021-02-22 08:59:14 +00:00
Nathan Stocks
13b602ee3f Xtask CI (#1387)
This PR is easiest to review commit by commit.

Followup on https://github.com/bevyengine/bevy/pull/1309#issuecomment-767310084

- [x] Switch from a bash script to an xtask rust workspace member.
  - Results in ~30s longer CI due to compilation of the xtask itself
  - Enables Bevy contributors on any platform to run `cargo ci` to run linting -- if the default available Rust is the same version as on CI, then the command should give an identical result.
- [x] Use the xtask from official CI so there's only one place to update.
- [x] Bonus: Run clippy on the _entire_ workspace (existing CI setup was missing the `--workspace` flag
  - [x] Clean up newly-exposed clippy errors 

~#1388 builds on this to clean up newly discovered clippy errors -- I thought it might be nicer as a separate PR.~  Nope, merged it into this one so CI would pass.

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2021-02-22 08:42:19 +00:00
MinerSebas
c9f19d8663 Cleanup of Markdown Files and add CI Checking (#1463)
I have run the VSCode Extension [markdownlint](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint) on all Markdown Files in the Repo.
The provided Rules are documented here: https://github.com/DavidAnson/markdownlint/blob/v0.23.1/doc/Rules.md

Rules I didn't follow/fix:
* MD024/no-duplicate-heading
  * Changelog: Here Heading will always repeat.
  * Examples Readme: Platform-specific documentation should be symmetrical.
* MD025/single-title
* MD026/no-trailing-punctuation
  * Caused by the ! in "Hello, World!".
* MD033/no-inline-html
  * The plugins_guidlines file does need HTML, so the shown badges aren't downscaled too much.
* ~~MD036/no-emphasis-as-heading:~~
  * ~~This Warning only Appears in the Github Issue Templates and can be ignored.~~
* ~~MD041/first-line-heading~~
  * ~~Only appears in the Readme for the AlienCake example Assets, which is unimportant.~~

---

I also sorted the Examples in the Readme and Cargo.toml in this order/Priority:
* Topic/Folder
* Introductionary Examples
* Alphabetical Order

The explanation for each case, where it isn't Alphabetical :
* Diagnostics
  * log_diagnostics: The usage of inbuild Diagnostics is more important than creating your own.
* ECS (Entity Component System)
  * ecs_guide: The guide should be read, before diving into other Features.
* Reflection
  * reflection: Basic Explanation should be read, before more advanced Topics.
* WASM Examples
  * hello_wasm: It's "Hello, World!".
2021-02-22 04:50:05 +00:00
Jakob Hellermann
e5b0c65c86 rename bevy_ui::node module so that bevy_ui::render::node isn't shadowed (#1464)
Previously the `mod node` shadowed the `pub use render::node`, and `CAMERA_UI`, `NODE` and `UI_PASS` constants couldn't be used.
2021-02-22 04:33:33 +00:00
Alexander Krivács Schrøder
e76d6566d7 Add backend feature metadata to make bevy_winit build on docs.rs again (#1430)
The `bevy_winit` crate hasn't been able to build on docs.rs [since 0.2.1](https://docs.rs/crate/bevy_winit/0.4.0). This PR restores the ability of docs.rs to build `bevy_winit` again.

(The choice of backend is essentially arbitrary, but choosing one *is required* for the crate to build)
2021-02-22 04:15:50 +00:00
maxwellodri
ba2226a487 Added Hash and Deserialize/Serialize traits to ElementState (#1447)
This adds traits that are already implemented for KeyCodes/Mouse Button etc.
2021-02-22 03:59:37 +00:00
Jakob Hellermann
cd688d7a41 fix rustdoc warnings (#1437)
Every warning is fixed except for 
b39df9a8d2/crates/bevy_render/src/texture/texture_descriptor.rs (L61)
because I didn't know what the required feature is.
I opened https://github.com/gfx-rs/wgpu/issues/1213 for that.
2021-02-22 03:59:35 +00:00
Alec Deason
97a78c3698 Make vertex buffers optional (#1485)
For some cases, like driving a full screen fragment shader, it is sometimes convenient to not have to create and upload a mesh because the necessary vertices are simple to synthesize in the vertex shader. Bevy's existing pipeline compiler assumes that there will always be a vertex buffer. This PR changes that such that vertex buffer descriptor is only added to the pipeline layout if there are vertex attributes in the shader.
2021-02-22 03:43:27 +00:00
Niklas Eicker
2e3af84590 Add remove resource to commands (#1478)
resolves #1468 

Co-authored-by: Niklas Eicker <git@nikl.me>
2021-02-22 03:43:26 +00:00
Jakob Hellermann
f73c6d18ef better error message on failed derive (#1491)
Before, when deriving `SystemLabel` for a type without `Clone`, the error message was:
```
the trait `SystemLabel` is not implemented for `&TransformSystem`
```
Now it is
```
the trait `Clone` is not implemented for `TransformSystem`
```
which directly shows what's needed to fix the problem.
2021-02-22 03:23:57 +00:00
Renato Caldas
3319195f90 Implement Reflect for integer glam vectors. (#1455)
This is a very simple change that allows the (reflected) use of integer glam vectors (UVec2 for instance) in components.
2021-02-19 22:25:07 +00:00
Yoh Deadfall
578a5b1b88 Moved benchmarks to a single place (#1477)
Closes #1472.
2021-02-19 22:11:00 +00:00
TheRawMeatball
fa73036f9d
Extend AppBuilder api with add_system_set and similar methods (#1453)
Extend AppBuilder api with `add_system_set` and similar methods
2021-02-19 11:36:34 -08:00
Niklas Eicker
884dc46ffe
Replace right/up/forward and counter parts with local_x/local_y and local_z (#1476) 2021-02-19 10:51:26 -08:00
Alexander Sepity
c2a427f1a3
Non-string labels (#1423 continued) (#1473)
Non-string labels
2021-02-18 13:20:37 -08:00
Alexander Sepity
82d0e84a5c
Explicit execution order ambiguities API (#1469)
Explicit execution order ambiguities API.
2021-02-18 11:30:13 -08:00
François
a5d2501b75
add labels and ordering for transform and parent systems in POST_UPDATE stage (#1456) 2021-02-16 18:00:12 -08:00
Alice Cecile
a895256925
Better documentation for explicit dependencies (#1428)
* More in-depth ambiguity checker docs
* Updated ecs_guide example with explicit dependencies
2021-02-16 11:18:08 -08:00
Alexander Sepity
d021a3c374
Relaxed bounds on NonSend. (#1448) 2021-02-14 16:20:16 -08:00
Hans W. Uhlig
f8292ccf7e
Simple Implementation to address #1327 by adding a focused field to the window and related system (#1386)
* Simple Implementation to address #1327 by adding a focused field to the window and related system

* Changing Window update function from bevy_window to bevy_winit.

* Removing unused imports.
2021-02-12 21:32:32 -08:00
Wouter Buckens
b39df9a8d2
Fix missing paths in ECS SystemParam derive macro (#1434) 2021-02-11 15:59:11 -08:00
Daniel McNab
3a32a21fe9
Fix clippy stuff (#1433)
* Fix clippy stuff

* Add comments explaining inconsistency

Also explains that the code is unused
2021-02-11 14:09:01 -08:00
Alexander Sepity
d5a7330431
System sets and parallel executor v2 (#1144)
System sets and parallel executor v2
2021-02-09 12:14:10 -08:00
Carter Anderson
b71ada0346
revert default vsync mode to Fifo (#1416)
the mailbox option doesn't do framelimiting on some devices. we need to rely on vsync for framelimiting until bevy supports framelimiting internally. #1343
2021-02-08 18:13:37 -08:00
MinerSebas
3475a64a2c
More Doctest changes (#1405)
* Add system() to DocTests

* Hide use statements
2021-02-05 17:44:34 -08:00
szunami
c87d4c110f
Update example system in documentation (#1403)
The existing snippet fails to compile with:

```
no method named `system` found for fn item `fn(bevy::prelude::Commands) {example_system}` in the current scope
```
2021-02-05 12:57:47 -08:00
Rob Parrett
110ff77db9
Fix regression causing "flipped" sprites to be invisible (#1399)
Regressed in 81809c71ce
2021-02-04 20:17:11 -08:00
davier
5b115397ba
Fix Reflect serialization of tuple structs (#1366)
* Fix  DynamicTupleStruct::type_name()

* Fix type_name() for DynamicList, DynamicMap  and DynamicTuple
2021-02-02 13:57:26 -08:00
Jakob Hellermann
4796ea8d22
move texture_to_image and image_to_texture into new module (#1381)
The `Texture::convert` function previously was only compiled when
one of the image format features (`png`, `jpeg` etc.) were enabled.
The `bevy_sprite` crate needs this function though, which led
to compilation errors when using `cargo check --no-default-features
--features render`.

Now the `convert` function has no features and the `texture_to_image`
and `image_to_texture` utilites functions are in an unconditionally
compiled module.
2021-02-02 13:25:16 -08:00
dependabot[bot]
1ca8ce4a79
Update crossbeam-utils requirement from 0.7.2 to 0.8.1 (#959)
Updates the requirements on [crossbeam-utils](https://github.com/crossbeam-rs/crossbeam) to permit the latest version.
- [Release notes](https://github.com/crossbeam-rs/crossbeam/releases)
- [Changelog](https://github.com/crossbeam-rs/crossbeam/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crossbeam-rs/crossbeam/compare/crossbeam-0.7.2...crossbeam-utils-0.8.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2021-02-01 13:51:44 -08:00
dependabot[bot]
05b8b5c8c2
Update crossbeam-channel requirement from 0.4.4 to 0.5.0 (#668)
Updates the requirements on [crossbeam-channel](https://github.com/crossbeam-rs/crossbeam) to permit the latest version.
- [Release notes](https://github.com/crossbeam-rs/crossbeam/releases)
- [Changelog](https://github.com/crossbeam-rs/crossbeam/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crossbeam-rs/crossbeam/compare/crossbeam-channel-0.4.4...crossbeam-channel-0.5.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-01 13:30:38 -08:00
dependabot[bot]
89df94e690
Update ahash requirement from 0.6.1 to 0.7.0 (#1370)
Updates the requirements on [ahash](https://github.com/tkaitchuck/ahash) to permit the latest version.
- [Release notes](https://github.com/tkaitchuck/ahash/releases)
- [Commits](https://github.com/tkaitchuck/ahash/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-02-01 13:29:54 -08:00
François
6b8f8a7ed0
Texture atlas format and conversion (#1365)
* can specify texture format for a texture atlas
* add automatic conversion
2021-02-01 11:30:11 -08:00
Zhixing Zhang
81809c71ce
Update to wgpu-rs 0.7 (#542)
Update to wgpu-rs 0.7
2021-01-31 20:06:42 -08:00
Will Crichton
e6e23fdfa9
Add support for gltf::Material::unlit (#1341)
* Add support for gltf::Material::unlit
2021-01-31 17:13:16 -08:00
davier
1d3dfd3938
Fix Interaction not resetting to None sometimes (#1315)
* Fix Interaction getting stuck when pressing and releasing mouse button in one frame

* Fix Interaction not resetting in some cases with FocusPolicy::Pass
2021-01-31 17:03:25 -08:00
Nathan Stocks
0867dc76a3
Use Cow<'static, str> in Name (#1308)
* Implement Name { name } as Cow<'static, str>
* Attempt impl Reflect for Cow<'static, str.>
2021-01-31 16:35:23 -08:00
Jasen Borisov
7d065eeb71
3D OrthographicProjection improvements + new example (#1361)
* use `length_squared` for visible entities

* ortho projection 2d/3d different depth calculation

* use ScalingMode::FixedVertical for 3d ortho

* new example: 3d orthographic
2021-01-31 16:22:06 -08:00
François
83e30a841a
bind the labeled asset type to the actual loaded asset (#1363)
bind the labeled asset type to the actual loaded asset
2021-01-31 13:54:15 -08:00
Zicklag
bff44f76ec
Fix Un-Renamed add_resource Compile Error (#1357) 2021-01-30 13:32:46 -08:00