Commit graph

560 commits

Author SHA1 Message Date
Zhixing Zhang
d9fb61d474 Wireframe Rendering Pipeline (#562)
This PR implements wireframe rendering.

Usage:

This is now ready as soon as #1401 gets merged.


Usage:

```rust
    app
        .insert_resource(WgpuOptions {
            name: Some("3d_scene"),
            features: WgpuFeatures::NON_FILL_POLYGON_MODE,
            ..Default::default()
        }) // To enable the NON_FILL_POLYGON_MODE feature
        .add_plugin(WireframePlugin)
        .run();

```

Now we just need to add the Wireframe component on an entity, and it'll draw. its wireframe.


We can also enable wireframe drawing globally by setting the global property in the `WireframeConfig` resource to `true`.



Co-authored-by: Zhixing Zhang <me@neoto.xin>
2021-03-04 01:23:24 +00:00
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
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
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
Aevyrie
d85b89b430 Update example with new stage terminology (#1496)
Updates old comments from the old `stage::UPDATE` terminology to the new `CoreStage` enum.
2021-02-22 03:43:28 +00:00
Alexander Sepity
c2a427f1a3
Non-string labels (#1423 continued) (#1473)
Non-string labels
2021-02-18 13:20:37 -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
Daniel McNab
7be096a254
Fix the z_sort_debug example from #1361 (#1419)
Fixes #1411
2021-02-09 12:37:49 -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
François
cf5f3b5008
Plugin guidelines (#1250)
* add plugin guidelines
* refactor features list
2021-01-31 20:19:10 -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
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
Jeremiah Senkpiel
4904080382
examples: add rng coloring to bevymark birds (#1192)
This is something done by a lot of the "bunnymark" tests, and it makes it easier to really see how many you've added.
2021-01-31 13:41:13 -08:00
Alice Cecile
6f5a4d9deb
Rename add_resource to insert_resource (#1356)
* Renamed add_resource to insert_resource

* Changed usage of add_resource to insert_resource

* Renamed add_thread_local_resource
2021-01-30 12:55:13 -08:00
Jasen Borisov
57f9ac18d7
OrthographicProjection scaling mode + camera bundle refactoring (#400)
* add normalized orthographic projection

* custom scale for ScaledOrthographicProjection

* allow choosing base axis for ScaledOrthographicProjection

* cargo fmt

* add general (scaled) orthographic camera bundle

FIXME: does the same "far" trick from Camera2DBundle make any sense here?

* fixes

* camera bundles: rename and new ortho constructors

* unify orthographic projections

* give PerspectiveCameraBundle constructors like those of OrthographicCameraBundle

* update examples with new camera bundle syntax

* rename CameraUiBundle to UiCameraBundle

* update examples

* ScalingMode::None

* remove extra blank lines

* sane default bounds for orthographic projection

* fix alien_cake_addict example

* reorder ScalingMode enum variants

* ios example fix
2021-01-30 02:31:03 -08:00
Zicklag
cc9ed52ea7
Update Scene Example to Use scn.ron File (#1339) 2021-01-28 14:14:50 -08:00
Mark
4a6b2c5f8e
Update README.md (#1338)
- added some missing examples
- changed the order of a few examples (app/empty came after app/empty_default for example)
- added a table with the examples for Android and iOS, like it was done for wasm

see [`issue 1326`](https://github.com/bevyengine/bevy/issues/1326)
2021-01-28 13:58:20 -08:00
tigregalis
40b5bbd028
Rich text (#1245)
Rich text support (different fonts / styles within the same text section)
2021-01-24 17:07:43 -08:00
François
8c33da0051
3d game example (#1252)
3d game example
2021-01-21 14:10:02 -08:00
TheRawMeatball
a880b54508
Make EventReader a SystemParam (#1244)
* Add generic support for `#[derive(SystemParam)]`
* Make EventReader a SystemParam
2021-01-18 22:23:30 -08:00
Christopher Durham
4d5ba7918b
Update rand requirement from 0.7 to 0.8 (#1114)
* Update rand requirement from 0.7 to 0.8

* Update examples' usage of Rng::gen_range
2021-01-17 13:43:03 -08:00
TehPers
5e7456115a
Implement Reflect for tuples up to length 12 (#1218)
Add Reflect impls for tuples up to length 12
2021-01-07 19:50:09 -08:00
Daniel McNab
9f2410a4ac
Add from_xyz to Transform (#1212)
* Add the from_xyz helper method to Transform

* Use `from_xyz` where possible
2021-01-06 17:17:06 -08:00
François
12d4184d7c
fix label to load gltf scene (#1204) 2021-01-06 16:15:59 -08:00
Dimitri Belopopsky
a01f22e0c5
Add basic file drag and drop support (#1096)
Add basic file drag and drop support
2021-01-01 15:31:22 -06:00
François
c25b41a038
add scene instance entity iteration (#1058)
add scene instance entity iteration
2021-01-01 14:58:49 -06:00
François
d91117d6e7
add Flags<T> as a query to get flags of component (#1172)
add `Flags` as a query to get flags of component
2020-12-31 16:29:08 -06:00
MinerSebas
bbae58a1f3
Remove outdated Documentation (#1178) 2020-12-31 16:06:12 -06:00
François
21794fe6df
make more information available from loaded GLTF model (#1020)
make more information available from loaded GLTF model 
* make gltf nodes available as assets
* add list of primitive per mesh, and their associated material
* complete gltf structure
* get names of gltf assets
* only load materials once
* add labels with node names
2020-12-31 14:57:15 -06:00
TheRawMeatball
3cb2e22e89
Added use_dpi setting to WindowDescriptor (#1131)
Added scale_factor_override
2020-12-28 14:26:50 -06:00
Nathan Stocks
f574c2c547
Render text in 2D scenes (#1122)
Render text in 2D scenes
2020-12-27 13:19:03 -06:00
François
b28365f966
updates on diagnostics (log + new diagnostics) (#1085)
* move print diagnostics to log

* entity count diagnostic

* asset count diagnostic

* remove useless `pub`s

* use `BTreeMap` instead of `HashMap`

* get entity count from world

* keep ordered list of diagnostics
2020-12-24 13:28:31 -06:00
Patrik Buhring
cbc0fe1416
Modify Derive to allow unit structs for RenderResources. (#1089) 2020-12-23 17:21:10 -06:00
Carter Anderson
9db38b7b97
fix multiple windows example (#1088) 2020-12-18 18:01:00 -06:00
François
18e5411d7d
set is_transparent to true by default for UI bundles (#1071)
set is_transparent to true by default for UI bundles
2020-12-18 15:21:37 -06:00
François
d0840bd721
Fix example return_after_run (#1082)
* ignore error when setting global tracing subscriber

* ignore unfocus event on window closed previously

* update example to show how to disable LogPlugin
2020-12-18 15:08:26 -06:00
Nathan Jeffords
596bed8ce2
add ability to provide custom a AssetIo implementation (#1037)
make it easier to override the default asset IO instance
2020-12-18 13:34:44 -06:00
Carter Anderson
841755aaf2
Adopt a Fetch pattern for SystemParams (#1074) 2020-12-15 21:57:16 -08:00
Carter Anderson
b12e3bf3bb
Improve usability of StateStage and cut down on "magic" (#1059)
Improve usability of StateStage and cut down on "magic"
2020-12-14 17:13:22 -08:00
Nathan Jeffords
d2e4327b14
update Window's width & height methods to return f32 (#1033)
update `Window`'s `width` & `height` methods to return `f32`
2020-12-13 15:05:56 -08:00
Mariusz Kryński
9a4327b3e2
fix contributors example (#1050) 2020-12-13 11:31:50 -08:00
Carter Anderson
509b138e8f
Schedule v2 (#1021)
Schedule V2
2020-12-12 18:04:42 -08:00
Nathan Stocks
fd3706b8de
Just spawn one CameraUiBundle (not 4) (#1047) 2020-12-12 16:55:20 -08:00
Carter Anderson
7ab0eeece0
Break out Visible component from Draw (#1034)
Break out Visible component from Draw
2020-12-09 13:38:48 -08:00
Nathan Jeffords
3d386a77b4
attempt to deal with rounding issue when creating the swap chain (#997)
attempt to deal with rounding issue when creating the swap chain on high DPI displays
2020-12-07 13:32:57 -08:00
Al M
2c9b7956d1
Live reloading of shaders (#937)
* Add ShaderLoader, rebuild pipelines for modified shader assets
* New example
* Add shader_update_system, ShaderError, remove specialization assets
* Don't panic on shader compilation failure
2020-12-07 12:32:13 -08:00
Carter Anderson
44b5cfeda1
fix example bindings (#1001) 2020-12-04 10:37:27 -08:00
François
59d98de194
naming coherence for cameras (#995)
naming coherence for cameras
2020-12-03 13:46:15 -08:00
Joshua J. Bouw
b8f8d468db
ChangeTextureAtlasBuilder into expected Builder conventions (#969)
* Change`TextureAtlasBuilder` into expected Builder conventions
2020-12-02 20:54:13 -08:00