Commit graph

292 commits

Author SHA1 Message Date
FlyingRatBull
4e5210f8e9 Fix broken link to PBR example in README.md (#2064) 2021-05-01 18:51:54 +00:00
CGMossa
86ad5bf420 Adding WorldQuery for WithBundle (#2024)
In response to #2023, here is a draft for a PR. 

Fixes #2023

I've added an example to show how to use `WithBundle`, and also to test it out. 

Right now there is a bug: If a bundle and a query are "the same", then it doesn't filter out
what it needs to filter out. 

Example: 

```
Print component initated from bundle.
[examples/ecs/query_bundle.rs:57] x = Dummy( <========= This should not get printed
    111,
)
[examples/ecs/query_bundle.rs:57] x = Dummy(
    222,
)
Show all components
[examples/ecs/query_bundle.rs:50] x = Dummy(
    111,
)
[examples/ecs/query_bundle.rs:50] x = Dummy(
    222,
)
```

However, it behaves the right way, if I add one more component to the bundle,
so the query and the bundle doesn't look the same:

```
Print component initated from bundle.
[examples/ecs/query_bundle.rs:57] x = Dummy(
    222,
)
Show all components
[examples/ecs/query_bundle.rs:50] x = Dummy(
    111,
)
[examples/ecs/query_bundle.rs:50] x = Dummy(
    222,
)
```

I hope this helps. I'm definitely up for tinkering with this, and adding anything that I'm asked to add
or change. 





Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2021-04-28 21:03:10 +00:00
Grindv1k
38feddb878 Add system sets and run criteria example (#1909)
If accepted, fixes #1694 .

I wanted to explore system sets and run criteria a bit, so made an example expanding a bit on the snippets shown in the 0.5 release post.

Shows a couple of system sets, uses system labels, run criterion, and a use of the interesting `RunCriterion::pipe` functionality.
2021-04-23 19:08:16 +00:00
Mariusz Kryński
fa6d4dbd53 add render_to_texture example (#1927)
Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2021-04-19 21:07:19 +00:00
Anselmo Sampietro
9b7ed18f72 Add animate shaders example (#1765)
This PR adds an example on how to animate a shader by passing the global `time.seconds_since_startup()` to a component, and accessing that component inside the shader.

Hopefully this is the current proper solution, please let me know if it should be solved in another way.

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2021-04-15 19:49:31 +00:00
François
86f3308308 examples on how to tests systems (#1714)
well... those are examples on how to tests systems despawning entities, modifying components, accessing resources, spawning entities
2021-04-15 00:57:37 +00:00
François
dae8357057 markdown lint on CHANGELOG.md and examples/READE.md (#1906)
new lints after #1783, fixes current CI break
2021-04-13 17:18:47 +00:00
Alessandro Re
6ce57c85d6 Example on how to draw using custom mesh and shader (#1565)
I was looking into "lower level" rendering and I saw no example on how to do that. Yet, I think it's something relevant to show, so I set up a simple example on how to do that. I hope it's welcome.

I'm not confident about the code and a review is definitely nice to have, especially because there are a few things that are not great.
Specifically, I think it would be nice to see how to render with a completely custom set of attributes (position and color, in this case), but I couldn't manage to get it working without normals and uv.

It makes sense if bevy Meshes need these two attributes, but I'm not sure about it.

Co-authored-by: Alessandro Re <ale@ale-re.net>
Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2021-04-12 19:47:12 +00:00
Jonas Matser
9a78addff0 Add PBR textures (#1632)
This PR adds normal maps on top of PBR #1554. Once that PR lands, the changes should look simpler.

Edit: Turned out to be so little extra work, I added metallic/roughness texture too. And occlusion and emissive.

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2021-03-26 21:00:34 +00:00
Aaron Winter
621cba4864 Example for 2D Frustum Culling (#1503)
This adds a new project for showing off Frustum Culling.
(Master runs this at sub 1 FPS while with the frustum culling it runs at 144 FPS on my system)

Short clip of the project running:
https://streamable.com/vvzh2u
2021-03-25 01:46:22 +00:00
Jonas Matser
45b2db7070 Rebase of existing PBR work (#1554)
This is a rebase of StarArawns PBR work from #261 with IngmarBitters work from #1160 cherry-picked on top.

I had to make a few minor changes to make some intermediate commits compile and the end result is not yet 100% what I expected, so there's a bit more work to do.

Co-authored-by: John Mitchell <toasterthegamer@gmail.com>
Co-authored-by: Ingmar Bitter <ingmar.bitter@gmail.com>
2021-03-20 03:22:33 +00:00
Guim Caballero
c3a72e9dc8 Add keyboard modifier example (#1656) (#1657)
This PR adds a small example that shows how to use Keyboard modifiers, as shown in [this](https://github.com/bevyengine/bevy/issues/1654#issuecomment-798966921) snippet.

Fixes #1656.

Co-authored-by: guimcaballero <guim.caballero@gmail.com>
2021-03-14 21:00:36 +00:00
Jasen Borisov
8e3532e8f7 README/examples: better direct users to the release version (#1624)
1. The instructions in the main README used to point users to the git main version. This has likely misdirected and confused many new users. Update to direct users to the latest release instead.
2. Rewrite the notice in the examples README to make it clearer and more concise, and to show the `latest` git branch.

See also: https://github.com/bevyengine/bevy-website/pull/109 for similar changes to the website and official book.
2021-03-12 02:46:51 +00:00
MinerSebas
514723295e Add missing wireframe example to example readme (#1580)
#562 added a new Example, but forgot to also document it in the examples readme.
2021-03-09 23:25:49 +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
François
cf5f3b5008
Plugin guidelines (#1250)
* add plugin guidelines
* refactor features list
2021-01-31 20:19:10 -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
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
François
8c33da0051
3d game example (#1252)
3d game example
2021-01-21 14:10:02 -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
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
memoryruins
c097af49f3
Update examples readme (#983) 2020-12-02 14:35:27 -08:00
Nathan Stocks
7bd6cc6a55
Refresh the examples readme (#854)
Refresh the examples readme: organize, alphabetize, add missing entries, remove outdated entries.
2020-11-15 11:24:18 -08:00
memoryruins
5545585336
Fix example ToC links (#848) 2020-11-11 18:57:13 -08:00
memoryruins
d846e46998
Add entries, ToC, and releases note on examples (#844)
* Note difference between development and release examples

* Add table of contents to examples

* Add missing entries for examples
2020-11-11 17:15:19 -08:00
Robert Swain
a266578992
Add tracing spans to schedules, stages, systems (#789)
Add tracing spans to schedules, stages, systems
2020-11-10 18:49:49 -08:00
Carter Anderson
8d2d2426fe
rename example and readme titles (#781) 2020-11-03 12:00:47 -08:00
David Ackerman
7efb1b1887
Fix initial Android support (#778)
* Add force touches, fix ui focus system and touch screen system

* Fix examples README. Update rodio with Android support. Add Android build CI

* Alter android metadata in root Cargo.toml
2020-11-03 11:32:48 -08:00
Nicholas Rishel
ce1d16d90d
Add Android instructions to example README (#775)
Bonus: Fixed iOS formatted text by adding preceding newline.
2020-11-02 22:54:08 -08:00
simlay
9cc6368b28
An initial xcode setup for using xcode (#539)
An example of bevy using xcode
2020-10-31 14:36:24 -07:00
Carter Anderson
c32e637384
Asset system rework and GLTF scene loading (#693) 2020-10-18 13:48:15 -07:00
Tomasz Sterna
5e3731ddce
Create winit canvas under WebAssembly (#506) 2020-09-18 20:11:26 -07:00
Tomasz Sterna
2b0ee24a5d
Implement single threaded task scheduler for WebAssembly (#496)
* Add hello_wasm example

* Implement single threaded task scheduler for WebAssembly
2020-09-15 18:05:31 -07:00
Max Bruckner
12e0e99900
Fix cargo run command for running examples (#471) 2020-09-11 12:19:53 -07:00
memoryruins
581d85b413
Add parallel_query to the examples readme (#465) 2020-09-09 11:39:37 -07:00
VitalyR
c78187e6df
add an option about display server protocol, and create document docs/cargo_features.md (#249)
add an option about display server protocol, and create document `docs/cargo_features.md`
2020-08-24 17:06:08 -07:00
Thirds
505c79b60d
README.md link points to the correct example (#225)
The 2D Rendering example texture_atlas URL was pointing to the ./2d/sprite_sheet.rs example. This has now been fixed.
2020-08-20 17:29:10 -07:00
0x22fe
81d30dd42b
Created README for examples 2020-08-17 23:02:59 +00:00