Commit graph

1277 commits

Author SHA1 Message Date
TheRawMeatball
9d60563adf Query::get_unique (#1263)
Adds `get_unique` and `get_unique_mut` to extend the query api and cover a common use case. Also establishes a second impl block where non-core APIs that don't access the internal fields of queries can live.
2021-03-08 21:21:47 +00:00
Jasen Borisov
13aef05038 impl SystemParam for Option<Res<T>> / Option<ResMut<T>> (#1494)
This allows users to write systems that do not panic if a resource does not exist at runtime (such as if it has not been inserted yet).

This is a copy-paste of the impls for `Res` and `ResMut`, with an extra check to see if the resource exists.

There might be a cleaner way to do it than this check. I don't know.
2021-03-08 20:12:22 +00:00
TheRawMeatball
d9b8b3e618 Add EventWriter (#1575)
This adds a `EventWriter<T>` `SystemParam` that is just a thin wrapper around `ResMut<Events<T>>`. This is primarily to have API symmetry between the reader and writer, and has the added benefit of easily improving the API later with no breaking changes.
2021-03-07 20:42:04 +00:00
Joshua J. Bouw
2b0a48d945 feat: clone indices (#1574)
Super simple and straight forward. I need this for the tilemap because if I need to update all chunk indices, then I can calculate it once and clone it. Of course, for now I'm just returning the Vec itself then wrapping it but would be nice if I didn't have to do that.
2021-03-07 19:50:20 +00:00
François
58d687b86d fix flip of contributor bird (#1573)
Since 89217171b4, some birds in example `contributors` where not colored.

Fix is to use `flip_x` of `Sprite` instead of setting `transform.scale.x` to `-1` as described in #1407.


It may be an unintended side effect, as now we can't easily display a colored sprite while changing it's scale from `1` to `-1`, we would have to change it's scale from `1` to `0`, then flip it, then change scale from `0` to `1`.
2021-03-07 19:50:19 +00:00
Jonas Matser
a7308155ee Make TypeRegistration::get_short_name() pub (#1571)
This would allow for example `bevy_mod_debugdump` to use it, instead of custom typename shortening.
2021-03-07 19:50:18 +00:00
François
dabf419095 update archetypes if needed before running system in SingleThreadedExecutor (#1586)
fixes #1585 

I copied most of the logic from the `ParallelSystemExecutor` impl, simplifying it a little as systems can't run in parallel
2021-03-07 19:32:19 +00:00
Cameron Hart
f61e44db28 Update glam to 0.13.0. (#1550)
See https://github.com/bitshifter/glam-rs/blob/master/CHANGELOG.md for details on changes.

Co-authored-by: Cameron Hart <c_hart@wargaming.net>
2021-03-06 19:39:16 +00:00
Carter Anderson
0eba5f38b9 update hexasphere to 3.2 (#1577) 2021-03-06 19:23:04 +00:00
Alice Cecile
03e0a9f23e Docs for Bundle showing how to nest bundles (#1570)
I've also added a clearer description of what bundles are used for, and explained that you can't query for bundles (a very common beginner confusion).

Co-authored-by: MinerSebas <scherthan_sebastian@web.de>
Co-authored-by: Renato Caldas <renato@calgera.com>
2021-03-06 01:57:03 +00:00
sdfgeoff
006848311c Documented some of the Mesh properties (#1566)
I was fiddling with creating a mesh importer today, and decided to write some more docs. 

A lot of this is describing general renderer/GL stuff, so you'll probably find most of it self explanatory anyway, but perhaps it will be useful for someone.
2021-03-06 01:57:02 +00:00
sdfgeoff
64b29617d6 Added documentation on the query filters (#1553)
This documents both the non-obvious interaction with non-explicit system ordering
and adds examples for Changed and Added. This likely closes #1551
2021-03-06 01:57:01 +00:00
Renato Caldas
87399c3560 Fix staging buffer required size calculation (fixes #1056) (#1509)
Fix staging buffer required size calculation (fixes #1056)

The `required_staging_buffer_size` is currently calculated differently in two places, each will be correct in different situations:

* `prepare_staging_buffers()` based on actual `buffer_byte_len()`
* `set_required_staging_buffer_size_to_max()` based on item_size

In the case of render assets, `prepare_staging_buffers()` would only operate over changed assets. If some of the assets didn't change, their size wouldn't be taken into account for the `required_staging_buffer_size`. In some cases, this meant the buffers wouldn't be resized when they should. Now `prepare_staging_buffers()` is called over all assets, which may hit performance but at least gets the size right.

Shortly after `prepare_staging_buffers()`,  `set_required_staging_buffer_size_to_max()` would unconditionally overwrite the previously computed value, even if using `item_size` made no sense. Now it only overwrites the value if bigger.

This can be considered a short term hack, but should prevent a few hard to debug panics.
2021-03-06 01:42:57 +00:00
MinerSebas
b2d654cbf6 Use rand 0.8 again (#1567)
#1525 accidentally moved back to rand 0.7
2021-03-06 00:53:42 +00:00
Chris Janaqi
ab407aa697 ♻️ Timer refactor to duration. Add Stopwatch struct. (#1151)
This pull request is following the discussion on the issue #1127. Additionally, it integrates the change proposed by #1112.

The list of change of this pull request:

*  Add `Timer::times_finished` method that counts the number of wraps for repeating timers.
* ♻️ Refactored `Timer`
* 🐛 Fix a bug where 2 successive calls to `Timer::tick` which makes a repeating timer to finish makes `Timer::just_finished` to return `false` where it should return `true`. Minimal failing example:
```rust
use bevy::prelude::*;
let mut timer: Timer<()> = Timer::from_seconds(1.0, true);
timer.tick(1.5);
assert!(timer.finished());
assert!(timer.just_finished());
timer.tick(1.5);
assert!(timer.finished());
assert!(timer.just_finished()); // <- This fails where it should not
```
* 📚 Add extensive documentation for Timer with doc examples.
*  Add a `Stopwatch` struct similar to `Timer` with extensive doc and tests.

Even if the type specialization is not retained for bevy, the doc, bugfix and added method are worth salvaging 😅.
This is my first PR for bevy, please be kind to me ❤️ .

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2021-03-05 19:59:14 +00:00
Jakob Hellermann
4686437d7a add Or back to prelude (#1564)
The bevy ecs v2 rewrite seems to have removed the `Or` query filter from the prelude, which I assume was done on accident, since `With` and `Without` are still there.
2021-03-05 18:33:20 +00:00
Carter Anderson
3a2a68852c Bevy ECS V2 (#1525)
# Bevy ECS V2

This is a rewrite of Bevy ECS (basically everything but the new executor/schedule, which are already awesome). The overall goal was to improve the performance and versatility of Bevy ECS. Here is a quick bulleted list of changes before we dive into the details:

* Complete World rewrite
* Multiple component storage types:
    * Tables: fast cache friendly iteration, slower add/removes (previously called Archetypes)
    * Sparse Sets: fast add/remove, slower iteration
* Stateful Queries (caches query results for faster iteration. fragmented iteration is _fast_ now)
* Stateful System Params (caches expensive operations. inspired by @DJMcNab's work in #1364)
* Configurable System Params (users can set configuration when they construct their systems. once again inspired by @DJMcNab's work)
* Archetypes are now "just metadata", component storage is separate
* Archetype Graph (for faster archetype changes)
* Component Metadata
    * Configure component storage type
    * Retrieve information about component size/type/name/layout/send-ness/etc
    * Components are uniquely identified by a densely packed ComponentId
    * TypeIds are now totally optional (which should make implementing scripting easier)
* Super fast "for_each" query iterators
* Merged Resources into World. Resources are now just a special type of component
* EntityRef/EntityMut builder apis (more efficient and more ergonomic)
* Fast bitset-backed `Access<T>` replaces old hashmap-based approach everywhere
* Query conflicts are determined by component access instead of archetype component access (to avoid random failures at runtime)
    * With/Without are still taken into account for conflicts, so this should still be comfy to use
* Much simpler `IntoSystem` impl
* Significantly reduced the amount of hashing throughout the ecs in favor of Sparse Sets (indexed by densely packed ArchetypeId, ComponentId, BundleId, and TableId)
* Safety Improvements
    * Entity reservation uses a normal world reference instead of unsafe transmute
    * QuerySets no longer transmute lifetimes
    * Made traits "unsafe" where relevant
    * More thorough safety docs
* WorldCell
    * Exposes safe mutable access to multiple resources at a time in a World 
* Replaced "catch all" `System::update_archetypes(world: &World)` with `System::new_archetype(archetype: &Archetype)`
* Simpler Bundle implementation
* Replaced slow "remove_bundle_one_by_one" used as fallback for Commands::remove_bundle with fast "remove_bundle_intersection"
* Removed `Mut<T>` query impl. it is better to only support one way: `&mut T` 
* Removed with() from `Flags<T>` in favor of `Option<Flags<T>>`, which allows querying for flags to be "filtered" by default 
* Components now have is_send property (currently only resources support non-send)
* More granular module organization
* New `RemovedComponents<T>` SystemParam that replaces `query.removed::<T>()`
* `world.resource_scope()` for mutable access to resources and world at the same time
* WorldQuery and QueryFilter traits unified. FilterFetch trait added to enable "short circuit" filtering. Auto impled for cases that don't need it
* Significantly slimmed down SystemState in favor of individual SystemParam state
* System Commands changed from `commands: &mut Commands` back to `mut commands: Commands` (to allow Commands to have a World reference)

Fixes #1320

## `World` Rewrite

This is a from-scratch rewrite of `World` that fills the niche that `hecs` used to. Yes, this means Bevy ECS is no longer a "fork" of hecs. We're going out our own!

(the only shared code between the projects is the entity id allocator, which is already basically ideal)

A huge shout out to @SanderMertens (author of [flecs](https://github.com/SanderMertens/flecs)) for sharing some great ideas with me (specifically hybrid ecs storage and archetype graphs). He also helped advise on a number of implementation details.

## Component Storage (The Problem)

Two ECS storage paradigms have gained a lot of traction over the years:

* **Archetypal ECS**: 
    * Stores components in "tables" with static schemas. Each "column" stores components of a given type. Each "row" is an entity.
    * Each "archetype" has its own table. Adding/removing an entity's component changes the archetype.
    * Enables super-fast Query iteration due to its cache-friendly data layout
    * Comes at the cost of more expensive add/remove operations for an Entity's components, because all components need to be copied to the new archetype's "table"
* **Sparse Set ECS**:
    * Stores components of the same type in densely packed arrays, which are sparsely indexed by densely packed unsigned integers (Entity ids)
    * Query iteration is slower than Archetypal ECS because each entity's component could be at any position in the sparse set. This "random access" pattern isn't cache friendly. Additionally, there is an extra layer of indirection because you must first map the entity id to an index in the component array.
    * Adding/removing components is a cheap, constant time operation 

Bevy ECS V1, hecs, legion, flec, and Unity DOTS are all "archetypal ecs-es". I personally think "archetypal" storage is a good default for game engines. An entity's archetype doesn't need to change frequently in general, and it creates "fast by default" query iteration (which is a much more common operation). It is also "self optimizing". Users don't need to think about optimizing component layouts for iteration performance. It "just works" without any extra boilerplate.

Shipyard and EnTT are "sparse set ecs-es". They employ "packing" as a way to work around the "suboptimal by default" iteration performance for specific sets of components. This helps, but I didn't think this was a good choice for a general purpose engine like Bevy because:

1. "packs" conflict with each other. If bevy decides to internally pack the Transform and GlobalTransform components, users are then blocked if they want to pack some custom component with Transform.
2. users need to take manual action to optimize

Developers selecting an ECS framework are stuck with a hard choice. Select an "archetypal" framework with "fast iteration everywhere" but without the ability to cheaply add/remove components, or select a "sparse set" framework to cheaply add/remove components but with slower iteration performance.

## Hybrid Component Storage (The Solution)

In Bevy ECS V2, we get to have our cake and eat it too. It now has _both_ of the component storage types above (and more can be added later if needed):

* **Tables** (aka "archetypal" storage)
    * The default storage. If you don't configure anything, this is what you get
    * Fast iteration by default
    * Slower add/remove operations
* **Sparse Sets**
    * Opt-in
    * Slower iteration
    * Faster add/remove operations

These storage types complement each other perfectly. By default Query iteration is fast. If developers know that they want to add/remove a component at high frequencies, they can set the storage to "sparse set":

```rust
world.register_component(
    ComponentDescriptor:🆕:<MyComponent>(StorageType::SparseSet)
).unwrap();
```

## Archetypes

Archetypes are now "just metadata" ... they no longer store components directly. They do store:

* The `ComponentId`s of each of the Archetype's components (and that component's storage type)
    * Archetypes are uniquely defined by their component layouts
    * For example: entities with "table" components `[A, B, C]` _and_ "sparse set" components `[D, E]` will always be in the same archetype.
* The `TableId` associated with the archetype
    * For now each archetype has exactly one table (which can have no components),
    * There is a 1->Many relationship from Tables->Archetypes. A given table could have any number of archetype components stored in it:
        * Ex: an entity with "table storage" components `[A, B, C]` and "sparse set" components `[D, E]` will share the same `[A, B, C]` table as an entity with `[A, B, C]` table component and `[F]` sparse set components.
        * This 1->Many relationship is how we preserve fast "cache friendly" iteration performance when possible (more on this later)
* A list of entities that are in the archetype and the row id of the table they are in
* ArchetypeComponentIds
    * unique densely packed identifiers for (ArchetypeId, ComponentId) pairs
    * used by the schedule executor for cheap system access control
* "Archetype Graph Edges" (see the next section)  

## The "Archetype Graph"

Archetype changes in Bevy (and a number of other archetypal ecs-es) have historically been expensive to compute. First, you need to allocate a new vector of the entity's current component ids, add or remove components based on the operation performed, sort it (to ensure it is order-independent), then hash it to find the archetype (if it exists). And thats all before we get to the _already_ expensive full copy of all components to the new table storage.

The solution is to build a "graph" of archetypes to cache these results. @SanderMertens first exposed me to the idea (and he got it from @gjroelofs, who came up with it). They propose adding directed edges between archetypes for add/remove component operations. If `ComponentId`s are densely packed, you can use sparse sets to cheaply jump between archetypes.

Bevy takes this one step further by using add/remove `Bundle` edges instead of `Component` edges. Bevy encourages the use of `Bundles` to group add/remove operations. This is largely for "clearer game logic" reasons, but it also helps cut down on the number of archetype changes required. `Bundles` now also have densely-packed `BundleId`s. This allows us to use a _single_ edge for each bundle operation (rather than needing to traverse N edges ... one for each component). Single component operations are also bundles, so this is strictly an improvement over a "component only" graph.

As a result, an operation that used to be _heavy_ (both for allocations and compute) is now two dirt-cheap array lookups and zero allocations.

## Stateful Queries

World queries are now stateful. This allows us to:

1. Cache archetype (and table) matches
    * This resolves another issue with (naive) archetypal ECS: query performance getting worse as the number of archetypes goes up (and fragmentation occurs).
2. Cache Fetch and Filter state
    * The expensive parts of fetch/filter operations (such as hashing the TypeId to find the ComponentId) now only happen once when the Query is first constructed
3. Incrementally build up state
    * When new archetypes are added, we only process the new archetypes (no need to rebuild state for old archetypes)

As a result, the direct `World` query api now looks like this:

```rust
let mut query = world.query::<(&A, &mut B)>();
for (a, mut b) in query.iter_mut(&mut world) {
}
```

Requiring `World` to generate stateful queries (rather than letting the `QueryState` type be constructed separately) allows us to ensure that _all_ queries are properly initialized (and the relevant world state, such as ComponentIds). This enables QueryState to remove branches from its operations that check for initialization status (and also enables query.iter() to take an immutable world reference because it doesn't need to initialize anything in world).

However in systems, this is a non-breaking change. State management is done internally by the relevant SystemParam.

## Stateful SystemParams

Like Queries, `SystemParams` now also cache state. For example, `Query` system params store the "stateful query" state mentioned above. Commands store their internal `CommandQueue`. This means you can now safely use as many separate `Commands` parameters in your system as you want. `Local<T>` system params store their `T` value in their state (instead of in Resources). 

SystemParam state also enabled a significant slim-down of SystemState. It is much nicer to look at now.

Per-SystemParam state naturally insulates us from an "aliased mut" class of errors we have hit in the past (ex: using multiple `Commands` system params).

(credit goes to @DJMcNab for the initial idea and draft pr here #1364)

## Configurable SystemParams

@DJMcNab also had the great idea to make SystemParams configurable. This allows users to provide some initial configuration / values for system parameters (when possible). Most SystemParams have no config (the config type is `()`), but the `Local<T>` param now supports user-provided parameters:

```rust

fn foo(value: Local<usize>) {    
}

app.add_system(foo.system().config(|c| c.0 = Some(10)));
```

## Uber Fast "for_each" Query Iterators

Developers now have the choice to use a fast "for_each" iterator, which yields ~1.5-3x iteration speed improvements for "fragmented iteration", and minor ~1.2x iteration speed improvements for unfragmented iteration. 

```rust
fn system(query: Query<(&A, &mut B)>) {
    // you now have the option to do this for a speed boost
    query.for_each_mut(|(a, mut b)| {
    });

    // however normal iterators are still available
    for (a, mut b) in query.iter_mut() {
    }
}
```

I think in most cases we should continue to encourage "normal" iterators as they are more flexible and more "rust idiomatic". But when that extra "oomf" is needed, it makes sense to use `for_each`.

We should also consider using `for_each` for internal bevy systems to give our users a nice speed boost (but that should be a separate pr).

## Component Metadata

`World` now has a `Components` collection, which is accessible via `world.components()`. This stores mappings from `ComponentId` to `ComponentInfo`, as well as `TypeId` to `ComponentId` mappings (where relevant). `ComponentInfo` stores information about the component, such as ComponentId, TypeId, memory layout, send-ness (currently limited to resources), and storage type.

## Significantly Cheaper `Access<T>`

We used to use `TypeAccess<TypeId>` to manage read/write component/archetype-component access. This was expensive because TypeIds must be hashed and compared individually. The parallel executor got around this by "condensing" type ids into bitset-backed access types. This worked, but it had to be re-generated from the `TypeAccess<TypeId>`sources every time archetypes changed.

This pr removes TypeAccess in favor of faster bitset access everywhere. We can do this thanks to the move to densely packed `ComponentId`s and `ArchetypeComponentId`s.

## Merged Resources into World

Resources had a lot of redundant functionality with Components. They stored typed data, they had access control, they had unique ids, they were queryable via SystemParams, etc. In fact the _only_ major difference between them was that they were unique (and didn't correlate to an entity).

Separate resources also had the downside of requiring a separate set of access controls, which meant the parallel executor needed to compare more bitsets per system and manage more state.

I initially got the "separate resources" idea from `legion`. I think that design was motivated by the fact that it made the direct world query/resource lifetime interactions more manageable. It certainly made our lives easier when using Resources alongside hecs/bevy_ecs. However we already have a construct for safely and ergonomically managing in-world lifetimes: systems (which use `Access<T>` internally).

This pr merges Resources into World:

```rust
world.insert_resource(1);
world.insert_resource(2.0);
let a = world.get_resource::<i32>().unwrap();
let mut b = world.get_resource_mut::<f64>().unwrap();
*b = 3.0;
```

Resources are now just a special kind of component. They have their own ComponentIds (and their own resource TypeId->ComponentId scope, so they don't conflict wit components of the same type). They are stored in a special "resource archetype", which stores components inside the archetype using a new `unique_components` sparse set (note that this sparse set could later be used to implement Tags). This allows us to keep the code size small by reusing existing datastructures (namely Column, Archetype, ComponentFlags, and ComponentInfo). This allows us the executor to use a single `Access<ArchetypeComponentId>` per system. It should also make scripting language integration easier.

_But_ this merge did create problems for people directly interacting with `World`. What if you need mutable access to multiple resources at the same time? `world.get_resource_mut()` borrows World mutably!

## WorldCell

WorldCell applies the `Access<ArchetypeComponentId>` concept to direct world access:

```rust
let world_cell = world.cell();
let a = world_cell.get_resource_mut::<i32>().unwrap();
let b = world_cell.get_resource_mut::<f64>().unwrap();
```

This adds cheap runtime checks (a sparse set lookup of `ArchetypeComponentId` and a counter) to ensure that world accesses do not conflict with each other. Each operation returns a `WorldBorrow<'w, T>` or `WorldBorrowMut<'w, T>` wrapper type, which will release the relevant ArchetypeComponentId resources when dropped.

World caches the access sparse set (and only one cell can exist at a time), so `world.cell()` is a cheap operation. 

WorldCell does _not_ use atomic operations. It is non-send, does a mutable borrow of world to prevent other accesses, and uses a simple `Rc<RefCell<ArchetypeComponentAccess>>` wrapper in each WorldBorrow pointer. 

The api is currently limited to resource access, but it can and should be extended to queries / entity component access.

## Resource Scopes

WorldCell does not yet support component queries, and even when it does there are sometimes legitimate reasons to want a mutable world ref _and_ a mutable resource ref (ex: bevy_render and bevy_scene both need this). In these cases we could always drop down to the unsafe `world.get_resource_unchecked_mut()`, but that is not ideal!

Instead developers can use a "resource scope"

```rust
world.resource_scope(|world: &mut World, a: &mut A| {
})
```

This temporarily removes the `A` resource from `World`, provides mutable pointers to both, and re-adds A to World when finished. Thanks to the move to ComponentIds/sparse sets, this is a cheap operation.

If multiple resources are required, scopes can be nested. We could also consider adding a "resource tuple" to the api if this pattern becomes common and the boilerplate gets nasty.

## Query Conflicts Use ComponentId Instead of ArchetypeComponentId

For safety reasons, systems cannot contain queries that conflict with each other without wrapping them in a QuerySet. On bevy `main`, we use ArchetypeComponentIds to determine conflicts. This is nice because it can take into account filters:

```rust
// these queries will never conflict due to their filters
fn filter_system(a: Query<&mut A, With<B>>, b: Query<&mut B, Without<B>>) {
}
```

But it also has a significant downside:
```rust
// these queries will not conflict _until_ an entity with A, B, and C is spawned
fn maybe_conflicts_system(a: Query<(&mut A, &C)>, b: Query<(&mut A, &B)>) {
}
```

The system above will panic at runtime if an entity with A, B, and C is spawned. This makes it hard to trust that your game logic will run without crashing.

In this pr, I switched to using `ComponentId` instead. This _is_ more constraining. `maybe_conflicts_system` will now always fail, but it will do it consistently at startup. Naively, it would also _disallow_ `filter_system`, which would be a significant downgrade in usability. Bevy has a number of internal systems that rely on disjoint queries and I expect it to be a common pattern in userspace.

To resolve this, I added a new `FilteredAccess<T>` type, which wraps `Access<T>` and adds with/without filters. If two `FilteredAccess` have with/without values that prove they are disjoint, they will no longer conflict.

## EntityRef / EntityMut

World entity operations on `main` require that the user passes in an `entity` id to each operation:

```rust
let entity = world.spawn((A, )); // create a new entity with A
world.get::<A>(entity);
world.insert(entity, (B, C));
world.insert_one(entity, D);
```

This means that each operation needs to look up the entity location / verify its validity. The initial spawn operation also requires a Bundle as input. This can be awkward when no components are required (or one component is required).

These operations have been replaced by `EntityRef` and `EntityMut`, which are "builder-style" wrappers around world that provide read and read/write operations on a single, pre-validated entity:

```rust
// spawn now takes no inputs and returns an EntityMut
let entity = world.spawn()
    .insert(A) // insert a single component into the entity
    .insert_bundle((B, C)) // insert a bundle of components into the entity
    .id() // id returns the Entity id

// Returns EntityMut (or panics if the entity does not exist)
world.entity_mut(entity)
    .insert(D)
    .insert_bundle(SomeBundle::default());
{
    // returns EntityRef (or panics if the entity does not exist)
    let d = world.entity(entity)
        .get::<D>() // gets the D component
        .unwrap();
    // world.get still exists for ergonomics
    let d = world.get::<D>(entity).unwrap();
}

// These variants return Options if you want to check existence instead of panicing 
world.get_entity_mut(entity)
    .unwrap()
    .insert(E);

if let Some(entity_ref) = world.get_entity(entity) {
    let d = entity_ref.get::<D>().unwrap();
}
```

This _does not_ affect the current Commands api or terminology. I think that should be a separate conversation as that is a much larger breaking change.

## Safety Improvements

* Entity reservation in Commands uses a normal world borrow instead of an unsafe transmute
* QuerySets no longer transmutes lifetimes
* Made traits "unsafe" when implementing a trait incorrectly could cause unsafety
* More thorough safety docs

## RemovedComponents SystemParam

The old approach to querying removed components: `query.removed:<T>()` was confusing because it had no connection to the query itself. I replaced it with the following, which is both clearer and allows us to cache the ComponentId mapping in the SystemParamState:

```rust
fn system(removed: RemovedComponents<T>) {
    for entity in removed.iter() {
    }
} 
```

## Simpler Bundle implementation

Bundles are no longer responsible for sorting (or deduping) TypeInfo. They are just a simple ordered list of component types / data. This makes the implementation smaller and opens the door to an easy "nested bundle" implementation in the future (which i might even add in this pr). Duplicate detection is now done once per bundle type by World the first time a bundle is used.

## Unified WorldQuery and QueryFilter types

(don't worry they are still separate type _parameters_ in Queries .. this is a non-breaking change)

WorldQuery and QueryFilter were already basically identical apis. With the addition of `FetchState` and more storage-specific fetch methods, the overlap was even clearer (and the redundancy more painful).

QueryFilters are now just `F: WorldQuery where F::Fetch: FilterFetch`. FilterFetch requires `Fetch<Item = bool>` and adds new "short circuit" variants of fetch methods. This enables a filter tuple like `(With<A>, Without<B>, Changed<C>)` to stop evaluating the filter after the first mismatch is encountered. FilterFetch is automatically implemented for `Fetch` implementations that return bool.

This forces fetch implementations that return things like `(bool, bool, bool)` (such as the filter above) to manually implement FilterFetch and decide whether or not to short-circuit.

## More Granular Modules

World no longer globs all of the internal modules together. It now exports `core`, `system`, and `schedule` separately. I'm also considering exporting `core` submodules directly as that is still pretty "glob-ey" and unorganized (feedback welcome here).

## Remaining Draft Work (to be done in this pr)

* ~~panic on conflicting WorldQuery fetches (&A, &mut A)~~
    * ~~bevy `main` and hecs both currently allow this, but we should protect against it if possible~~
* ~~batch_iter / par_iter (currently stubbed out)~~
* ~~ChangedRes~~
    * ~~I skipped this while we sort out #1313. This pr should be adapted to account for whatever we land on there~~.
* ~~The `Archetypes` and `Tables` collections use hashes of sorted lists of component ids to uniquely identify each archetype/table. This hash is then used as the key in a HashMap to look up the relevant ArchetypeId or TableId. (which doesn't handle hash collisions properly)~~
* ~~It is currently unsafe to generate a Query from "World A", then use it on "World B" (despite the api claiming it is safe). We should probably close this gap. This could be done by adding a randomly generated WorldId to each world, then storing that id in each Query. They could then be compared to each other on each `query.do_thing(&world)` operation. This _does_ add an extra branch to each query operation, so I'm open to other suggestions if people have them.~~
* ~~Nested Bundles (if i find time)~~

## Potential Future Work

* Expand WorldCell to support queries.
* Consider not allocating in the empty archetype on `world.spawn()`
    * ex: return something like EntityMutUninit, which turns into EntityMut after an `insert` or `insert_bundle` op
    * this actually regressed performance last time i tried it, but in theory it should be faster
* Optimize SparseSet::insert (see `PERF` comment on insert)
* Replace SparseArray `Option<T>` with T::MAX to cut down on branching
    * would enable cheaper get_unchecked() operations
* upstream fixedbitset optimizations
    * fixedbitset could be allocation free for small block counts (store blocks in a SmallVec)
    * fixedbitset could have a const constructor 
* Consider implementing Tags (archetype-specific by-value data that affects archetype identity) 
    * ex: ArchetypeA could have `[A, B, C]` table components and `[D(1)]` "tag" component. ArchetypeB could have `[A, B, C]` table components and a `[D(2)]` tag component. The archetypes are different, despite both having D tags because the value inside D is different.
    * this could potentially build on top of the `archetype.unique_components` added in this pr for resource storage.
* Consider reverting `all_tuples` proc macro in favor of the old `macro_rules` implementation
    * all_tuples is more flexible and produces cleaner documentation (the macro_rules version produces weird type parameter orders due to parser constraints)
    * but unfortunately all_tuples also appears to make Rust Analyzer sad/slow when working inside of `bevy_ecs` (does not affect user code)
* Consider "resource queries" and/or "mixed resource and entity component queries" as an alternative to WorldCell
    * this is basically just "systems" so maybe it's not worth it
* Add more world ops
    * `world.clear()`
    * `world.reserve<T: Bundle>(count: usize)`
 * Try using the old archetype allocation strategy (allocate new memory on resize and copy everything over). I expect this to improve batch insertion performance at the cost of unbatched performance. But thats just a guess. I'm not an allocation perf pro :)
 * Adapt Commands apis for consistency with new World apis 

## Benchmarks

key:

* `bevy_old`: bevy `main` branch
* `bevy`: this branch
* `_foreach`: uses an optimized for_each iterator
* ` _sparse`: uses sparse set storage (if unspecified assume table storage)
* `_system`: runs inside a system (if unspecified assume test happens via direct world ops)

### Simple Insert (from ecs_bench_suite)

![image](https://user-images.githubusercontent.com/2694663/109245573-9c3ce100-7795-11eb-9003-bfd41cd5c51f.png)

### Simpler Iter (from ecs_bench_suite)

![image](https://user-images.githubusercontent.com/2694663/109245795-ffc70e80-7795-11eb-92fb-3ffad09aabf7.png)

### Fragment Iter (from ecs_bench_suite)

![image](https://user-images.githubusercontent.com/2694663/109245849-0fdeee00-7796-11eb-8d25-eb6b7a682c48.png)

### Sparse Fragmented Iter

Iterate a query that matches 5 entities from a single matching archetype, but there are 100 unmatching archetypes

![image](https://user-images.githubusercontent.com/2694663/109245916-2b49f900-7796-11eb-9a8f-ed89c203f940.png)
 
### Schedule (from ecs_bench_suite)

![image](https://user-images.githubusercontent.com/2694663/109246428-1fab0200-7797-11eb-8841-1b2161e90fa4.png)

### Add Remove Component (from ecs_bench_suite)

![image](https://user-images.githubusercontent.com/2694663/109246492-39e4e000-7797-11eb-8985-2706bd0495ab.png)


### Add Remove Component Big

Same as the test above, but each entity has 5 "large" matrix components and 1 "large" matrix component is added and removed

![image](https://user-images.githubusercontent.com/2694663/109246517-449f7500-7797-11eb-835e-28b6790daeaa.png)


### Get Component

Looks up a single component value a large number of times

![image](https://user-images.githubusercontent.com/2694663/109246129-87ad1880-7796-11eb-9fcb-c38012aa7c70.png)
2021-03-05 07:54:35 +00:00
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
Alexander Sepity
4f1a65113d Fixed commands for coerced exclusive systems (#1531)
Fixes #1530.
2021-03-03 23:36:01 +00:00
François
1fcafc4210 Glb textures should use bevy_render to load images (#1454)
Fixes #1396 

<img width="1392" alt="Screenshot 2021-02-16 at 02 24 01" src="https://user-images.githubusercontent.com/8672791/108011774-1b991a80-7008-11eb-979e-6ebfc51fba3c.png">

Issue was that, when loading an image directly from its bytes in the binary glb file, it didn't follow the same flow as when loaded as a texture file. This PR removes the dependency to `image` from `bevy_gltf`, and load the image using `bevy_render` in all cases. I also added support for more mime types while there.

<img width="1392" alt="Screenshot 2021-02-16 at 02 44 56" src="https://user-images.githubusercontent.com/8672791/108011915-674bc400-7008-11eb-83d4-ded96a38919b.png">
2021-03-03 21:36:16 +00:00
Zhixing Zhang
6e14ed23bc Enable wgpu device limits (#1544)
Follow up on #547 and #1401 

Co-authored-by: Zhixing Zhang <me@neoto.xin>
2021-03-03 21:20:46 +00:00
François
6a0968b2ea convert grayscale images to rgb (#1524)
Fixes #1518 

Issue was that images loaded as [`ImageLumaA8`](https://docs.rs/image/0.23.13/image/enum.DynamicImage.html#variant.ImageLumaA8) (grayscale with alpha channel) from `image` were considered as [`Rg8Unorm`](https://docs.rs/wgpu/0.7.0/wgpu/enum.TextureFormat.html#variant.Rg8Unorm) (red green channels) from `wgpu`.
Same for `ImageLuma8` (grayscale) that was converted to `R8Unorm` (only red channel).

As `wgpu` doesn't seem to have grayscale texture formats, I converted the grayscale textures to rgba.
2021-03-03 21:20:45 +00:00
dependabot[bot]
319e75c7aa Update tracing-wasm requirement from 0.1 to 0.2 (#1539)
Updates the requirements on [tracing-wasm](https://github.com/storyscript/tracing-wasm) to permit the latest version.
<details>
<summary>Commits</summary>
<ul>
<li><a href="09a0d75c45"><code>09a0d75</code></a> Disable default features for dependencies and release 0.2.0</li>
<li><a href="bbeca396ed"><code>bbeca39</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/storyscript/tracing-wasm/issues/12">#12</a> from storyscript/readme-clarification</li>
<li><a href="e35b182232"><code>e35b182</code></a> add clarifying note to README.</li>
<li><a href="259e118e7f"><code>259e118</code></a> rustfmt</li>
<li><a href="f2099cfe5e"><code>f2099cf</code></a> Apply clippy suggestions</li>
<li><a href="fde480fa11"><code>fde480f</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/storyscript/tracing-wasm/issues/6">#6</a> from storyscript/config-builder</li>
<li><a href="ad9d4b1903"><code>ad9d4b1</code></a> Merge pull request <a href="https://github-redirect.dependabot.com/storyscript/tracing-wasm/issues/7">#7</a> from storyscript/feat/default-level</li>
<li><a href="64fedbd267"><code>64fedbd</code></a> chore(config): change level to max_level</li>
<li><a href="7cb160a7a9"><code>7cb160a</code></a> feat(level): add default level in config from the builder</li>
<li><a href="a9e7f2a4b8"><code>a9e7f2a</code></a> WIP: Builder pattern for WASMLayerConfig</li>
<li>Additional commits viewable in <a href="https://github.com/storyscript/tracing-wasm/compare/0.1.0...v0.2.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>
2021-03-03 21:01:41 +00:00
verzuz
b8961a957e enable wgpu device features (#547)
Should wait for https://github.com/bevyengine/bevy/pull/542 and new wgpu_rs release.

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2021-03-03 20:07:26 +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
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
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
Daniel McNab
b922a3ec60
Update init_resource to not overwrite (#1349)
Update init_resource to not overwrite
2021-01-30 12:48:11 -08:00
Renato Caldas
8e0e4223e5
Improve clarity of WindowTextureNode and WindowSwapchainNode error messages (#1355)
Improve clarity of WindowTextureNode and WindowSwapchainNode error messages
2021-01-30 12:47:27 -08:00
Telzhaak
61c9a40fde
[Bugfix] add_stage now checks Stage existence (#1346)
add_stage now checks stage existence
2021-01-30 12:10:14 -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
af67231567
Fix Bug in Asset Server Error Message Formatter (#1340) 2021-01-29 13:26:21 -08:00
Zicklag
cc9ed52ea7
Update Scene Example to Use scn.ron File (#1339) 2021-01-28 14:14:50 -08:00
Jakob Hellermann
f3306e5490
implement Debug for Flags regardless of underlying type (#1323) 2021-01-26 11:58:46 -08:00
davier
528c2858e0
Expose more info in PositionedGlyph (#1319) 2021-01-26 11:53:55 -08:00
Zicklag
b6485ccf29
Process Asset File Extensions With Multiple Dots (#1277)
Process Asset File Extensions With Multiple Dots
Fixes #1276
2021-01-25 12:37:23 -08:00
davier
5edf2d2395
Prevent ImageBundles from causing constant layout recalculations (#1299)
Prevent ImageBundles from causing constant layout recalculations
2021-01-24 21:00:20 -08:00
Toniman20
32acbfb632
Added set_minimized and set_position to Window (#1292)
Added `set_minimized` and `set_position` to `Window`
2021-01-24 20:06:06 -08:00
RedlineTriad
7e368e0b78
Add more transform relative vectors (#1300)
* Add more transform relative vectors (#1298)

* Add inverse of relative directions (#1298)
2021-01-24 20:05:30 -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
Will Crichton
3d0c4e380c
Don't panic on error when loading assets (#1286)
* Don't panic on IO errors
* Better formatting for asset server errors
2021-01-23 13:23:16 -08:00
Tomasz Sterna
f2b73eaa8a
Fix documentation comment for State::overwrite_next (#1291) 2021-01-23 13:18:28 -08:00
Will Crichton
7166a28baf
Enable dynamic mutable access to component data (#1284)
* Enable dynamic mutable access to component data

* Add clippy allowance, more documentation
2021-01-22 15:15:08 -08:00
Will Crichton
ebcab3638a
Change Name to take Into<String> instead of String (#1283) 2021-01-22 14:13:26 -08:00
Daniel McNab
6bd5ec8404
Change to using add_run_criteria (#1282) 2021-01-22 14:09:14 -08:00
Renato Caldas
0a39c81be6
Add support for reading from mapped buffers (#1274)
* Add support for mapping buffers for reading.

* Add support for reading from a mapped buffer.
2021-01-21 17:53:43 -08:00
Aevyrie
18e4fa8cdf
world coords to screen space (#1258)
Add Camera::world_to_screen to convert world coordinates to screen space
2021-01-21 17:49:29 -08:00
TheRawMeatball
f15d62c0f1
More types (#1267) 2021-01-21 16:05:23 -08:00
bjorn3
7aefd727f6
Use valid keys to initialize AHasher in FixedState (#1268)
Using 0 as keys causes the hasher to get stuck
2021-01-20 14:24:57 -08:00
reidbhuntley
ac7d2de67c
Count number of times a repeating Timer wraps around in a tick (#1112)
Added just_finished_count() function
2021-01-19 14:41:37 -08:00
Alec Deason
1e8060a5a2
Add missing spawn_local method to Scope in the single threaded executor case (#1266) 2021-01-19 13:07:45 -08:00
TheRawMeatball
50ceaf3559
re-export integer vectors from glam (#1264) 2021-01-19 12:56:50 -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
Alec Deason
71c6a19ed8
Minimal change to support instanced rendering (#1262) 2021-01-18 16:52:06 -08:00
Nathan Stocks
a0475e9ad5
Change 'components' to 'bundles' where it makes sense semantically (#1257)
change 'components' to 'bundles' where it makes sense semantically
2021-01-18 16:50:36 -08:00
Alec Deason
3c5f1f8a80
Support for !Send tasks (#1216)
Support for !Send tasks
2021-01-18 13:48:28 -08:00
Cameron Hart
e7dab0c359
Update glam to 0.12.0 (#1249) 2021-01-17 13:44:55 -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
Zhixing Zhang
cf0e9f9968
Adding copy_texture_to_buffer and copy_texture_to_texture (#1236)
* Adding copy_texture_to_buffer and copy_texture_to_texture

* Adding CopyTextureToTexture and CopyTextureToBuffer in CommandQueue
2021-01-14 11:01:07 -08:00
Yoh Deadfall
6a0116e994
Removed unreferenced trait (#1230) 2021-01-12 14:06:01 -08:00
João Capucho
478f947768
Don't panic if there's no index buffer and call draw (#1229) 2021-01-12 14:05:13 -08:00
bjorn3
fbf08ac545
Faster compilation of bevy_diagnostic (#1235)
* Remove AHashExt

There is little benefit of Hash*::new() over Hash*::default(), but it
does require more code that needs to be duplicated for every Hash* in
bevy_utils. It may also slightly increase compile times.

* Add StableHash* to bevy_utils

* Use StableHashMap instead of HashMap + BTreeSet for diagnostics

This is a significant reduction in the release mode compile times of
bevy_diagnostics

```
Benchmark #1: touch crates/bevy_diagnostic/src/lib.rs && cargo build --release -p bevy_diagnostic -j1
  Time (mean ± σ):      3.645 s ±  0.009 s    [User: 3.551 s, System: 0.094 s]
  Range (min … max):    3.632 s …  3.658 s    20 runs
```

```
Benchmark #1: touch crates/bevy_diagnostic/src/lib.rs && cargo build --release -p bevy_diagnostic -j1
  Time (mean ± σ):      2.938 s ±  0.012 s    [User: 2.850 s, System: 0.090 s]
  Range (min … max):    2.919 s …  2.969 s    20 runs
```
2021-01-12 13:21:45 -08:00
François
c434f57de1
use biggest RenderResources instead of first (#1208) 2021-01-11 14:28:32 -08:00
Adamaq01
4a0837048c
Made ReflectMut::Tuple enum variant use a mutable reference (#1226) 2021-01-08 18:29:03 -08:00
Schell Carl Scivally
a6a242cb86
Render Layers (#1209)
Adds RenderLayers, which enable cameras and entities to opt in to layers that apply to them
2021-01-08 12:45:54 -08:00
Jakob Hellermann
3f2dd22cb5
bevy_render: add torus and capsule shape (#1223)
* bevy_render: add torus shape

* bevy_render: add capsule shape

* bevy_render: reorganize shape module

* bevy_render: add more docs
2021-01-08 11:39:33 -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
AngelicosPhosphoros
9bce8712b5
Use fxhash in TypeIdMap. (#1119)
Relying on TypeId being some hash internally isn't future-proof because there is no guarantee about internal layout or structure of TypeId. I benchmarked TypeId noop hasher vs fxhash and found that there is very little difference.
Also fxhash is likely to be better supported because it is widely used in rustc itself.
[Benchmarks of hashers](https://github.com/bevyengine/bevy/issues/1097)
[Engine wide benchmarks](https://github.com/bevyengine/bevy/pull/1119#issuecomment-751361215)
2021-01-07 17:42:09 -08:00
David Ackerman
0e0906d22e
Fix iOS touch location (#1224) 2021-01-07 13:37:22 -08:00
Jakob Hellermann
599f381a6a
fix repeated gamepad events (#1221)
Previously, if the actual value of LeftStickX was e.g. 0.034 and fluctuated a little
bit (less than the threshold) it would repeatedly send out events,
because it compared the value to the *filtered* old one - 0.0 - which is
more then `0.01` (the threshold) away.

The is fixed by first doing the deadzone and then comparing to the old
value.
Another possible solution would be to store both the actual old value
and the filtered one, but that would add complexity.
2021-01-07 12:35:40 -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
TheRawMeatball
c69aa98a60
Refactor Box<dyn System> to BoxedSystem (#1191)
Added BoxedSystem
2021-01-03 12:39:30 -08:00
Nathan Jeffords
60be99859a
Subpixel text positioning (#1196)
* cleanup unnecessary changes from PR #1171

* add feature to correctly render glyphs with sub-pixel positioning
2021-01-03 12:39:11 -08:00
Rob Parrett
8a330a889d
Add support for OTF fonts (#1200) 2021-01-03 12:10:23 -08:00
Restioson
820f37fccf
add convenience function (#1197) 2021-01-03 11:57:18 -08:00
MsK`
ca310b856f
New mesh attribute: color (#1194)
New mesh attribute: color
2021-01-03 11:39:15 -08:00
Adam Bates
b7e35ef744
Made gilrs crate public within bevy so we can reference the plugin outside of DefaultPlugins. (#1195) 2021-01-03 11:36:42 -08:00
Théo Degioanni
804c068cc9
bevy_reflect incorrectly looks for bevy in dev-deps (#1182)
* fix: bevy_reflect looking for bevy in dev-deps
* fix: support bevy as dev-dep only in bevy_reflect
2021-01-03 11:28:00 -08:00
François
c95d0ddfb9
remove panics when mixing UI and non UI entities in hierarchy (#1180)
* replace unwrap with logs when mixing UI and non UI entities in hierarchy
2021-01-01 16:06:40 -06:00
Nathan Jeffords
b8fb462eff
Text2d render quality (#1171)
improve quality of text2d rendering

* remove coordinate tweaking in sprite-sheet shader
* fixes glyph shimmering of animated text
* reposition glyph before passing it to ab_glyph to normalize its rendering

The result of layout of sequence of glyphs causes individuals to have fractional positions, but since glyph renderings are reused for future instances of that glyph, this produces errors. This change accepts the errors but repositions the glyph to "0, 0" in an effort to get the cleanest possible rendering.
2021-01-01 15:36:00 -06: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
228c3df751
use Name on node when loading a gltf file (#1183)
* export Name in prelude
* use Name instead of Labels in gltf scenes
2021-01-01 15:30:18 -06:00
François
c25b41a038
add scene instance entity iteration (#1058)
add scene instance entity iteration
2021-01-01 14:58:49 -06:00
Matthias Seiffert
030ccf1984
Derive Clone for SpriteSheetBundle and SpriteBundle (#1177)
* Derive Clone for TextureAtlasSprite and SpriteSheetBundle

* Derive Clone for Sprite and SpriteBundle
2021-01-01 14:52:09 -06:00
dependabot[bot]
271644a4f7
Update base64 requirement from 0.12.3 to 0.13.0 (#628)
Updates the requirements on [base64](https://github.com/marshallpierce/rust-base64) to permit the latest version.
- [Release notes](https://github.com/marshallpierce/rust-base64/releases)
- [Changelog](https://github.com/marshallpierce/rust-base64/blob/master/RELEASE-NOTES.md)
- [Commits](https://github.com/marshallpierce/rust-base64/compare/v0.12.3...v0.13.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-31 18:43:48 -06:00
Adam Bates
8f426b71c9
Minor grammar fix in code-comment for fn in state (#1173) 2020-12-31 18:37:02 -06:00
Patrik Buhring
f71dc5daeb
Fix potential bug when using multiple lights. (#1055) 2020-12-31 16:51:21 -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
Carter Anderson
38010d96ab
remove unnecessary semicolon (#1179) 2020-12-31 16:05:37 -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
Felipe Jorge
30fd302c7e
Name component with fast comparisons (#1109)
Name component with fast comparisons
2020-12-31 14:52:02 -06:00
Nathan Jeffords
6531fcdfd2
HIDPI Text (#1132)
HIDPI Text 
* add more operator overloads to `bevy::math::Size`
* render UI text at physical resolution
2020-12-30 16:40:50 -06:00
MsK`
2754a9dde8
Mutable mesh accessors: indices_mut and attribute_mut (#1164)
mutable mesh accessors: indices_mut and attribute_mut
2020-12-30 15:17:44 -06:00
François
871b47f1c3
let user disable feature png when using only other format (#1156) 2020-12-28 15:31:23 -06:00
François
adb249c394
enable change detection for labels (#1155) 2020-12-28 15:25:01 -06:00
W. Brian Gourlie
b94f266183
Implement Copy for ElementState (#1154) 2020-12-28 15:24:31 -06:00
TheRawMeatball
3cb2e22e89
Added use_dpi setting to WindowDescriptor (#1131)
Added scale_factor_override
2020-12-28 14:26:50 -06:00
Gilbert Röhrbein
4825051c6a
Test entity labels, fixed corner cases, changed interface (#1152)
* Test entity labels, fixed corner cases, changed interface

* add tests for entity_labels_system
* fixed filling label_entities map
* fixed corner cases when removing entities, Labels component
* changed EntityLabels::get to return slice or empty slice instead of
  None or Some empty or non-empty slice

Changing the interface of EntityLabels::get is beneficial, since else
you would get different results in case there was an entity before that
with this missing label or not. You would either get None or Some(&[])
and need to handle both, which is actually not necessary.

* register type Labels in CorePlugin
2020-12-27 18:28:49 -06:00
Martin Lavoie
909b396b9e
Add option to ignore events when receving unknown WindowId (#1072)
Ignore window events with unknown window id
2020-12-27 13:24:31 -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
Martin Lavoie
d3d6c35789
Add an alternative winit runner that can be started when not on the main thread (#1063) 2020-12-24 12:43:30 -06:00
Jakob Hellermann
0a51a26aba
bevy_render: load .spv assets (#1104)
bevy_render: ShaderLoader can now load spv files
2020-12-23 19:41:34 -06:00
Patrik Buhring
cbc0fe1416
Modify Derive to allow unit structs for RenderResources. (#1089) 2020-12-23 17:21:10 -06:00
Ryan Lee
acc29ec719
Add bmp as a supported texture format (#1081) 2020-12-23 16:53:02 -06:00
François
09c15ea890
do not check for focus until cursor position has been set (#1070)
do not check for focus until cursor position has been set
2020-12-23 16:10:39 -06:00
Carter Anderson
61ce3f7bcf
make wgpu options public (#1133) 2020-12-22 22:35:17 -06:00
Martin Lavoie
906b406f6a
Prevent double panic in the Drop of TaksPoolInner (#1064) 2020-12-22 14:21:21 -06:00
Alec Deason
814c413372
Fix lock order to remove the chance of deadlock (#1121) 2020-12-22 13:49:40 -06:00
Agorgianitis Loukas
dd668c1970
Expose wgpu backend in WgpuOptions and allow it to be configured from the environment (#1042) 2020-12-22 13:31:01 -06:00
Carter Anderson
3b2c6ce49b
release 0.4.0 (#1093) 2020-12-19 13:28:00 -06:00
Carter Anderson
caf3d8b3ef
add with_enter_stage (and other variants) (#1091) 2020-12-19 12:31:47 -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
Nathan Jeffords
51650f114f
run stretch's layout on physical coordinates to fix pixel alignment (#1061)
run stretch's layout on physical coordinates to fix pixel alignment of the results
2020-12-14 23:17:34 -08:00
Carter Anderson
45e2be3847
suppress wgpu warnings by default. they are generally unactionable and noisy (#1066) 2020-12-14 17:15:07 -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
Alec Deason
e511cdbda7
More informative error message on missing stage (#1048)
More informative error message on missing state
2020-12-13 12:12:09 -08:00
sapir
002e22fca0
Fix hang on missing state update handler (#1051) 2020-12-13 11:55:32 -08:00
Corey Farwell
9602b24d0f
Add support for Apple Silicon by upgrading winit. (#1043) 2020-12-13 11:27:54 -08:00
Carter Anderson
509b138e8f
Schedule v2 (#1021)
Schedule V2
2020-12-12 18:04:42 -08:00
Nathan Jeffords
9239621ffc
add ability to load .dds, .tga, and .jpeg texture formats (#1038)
add ability to load `.dds`, `.tga`, and `.jpeg` texture formats
2020-12-09 18:34:27 -08:00
James R
4a5bcccde2
Don't panic when attempting to set shader defs from an asset that hasn't loaded yet (#1035)
Don't panic when attempting to set shader defs from an asset that hasn't loaded yet
2020-12-09 16:34:22 -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
Corey Farwell
66f972c850
Use shaderc for aarch64-apple-darwin. (#1027) 2020-12-09 13:02:43 -08:00
François
f53ee54eb6
can spawn a scene from a ChildBuilder, or directly set its parent when spawning it (#1026)
can spawn a scene from a ChildBuilder, or directly set its parent when spawning one
2020-12-09 12:41:49 -08:00
François
c54179b182
only update components for entities in map (#1023) 2020-12-08 20:01:54 -08:00
rod-salazar
19c4f331ac
Ensure default material is loaded (#1016) 2020-12-08 19:36:41 -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
thebluefish
08b6aa59f8
Added WindowFocused event (#956) 2020-12-07 13:24:25 -08:00
Lukas Orsvärn
e1b995f0b0
Add documentation for bevy::ecs::Query::removed (#950)
Add documentation for bevy::ecs::Query::removed
2020-12-07 12:41:40 -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
François
a3bca7e464
Fix ci (#1024)
* fix format

* fix clippy

* used fixed nightly
2020-12-07 11:57:15 -08:00
Corey Farwell
1398d78330
Allow windows to maximized. (#1004)
Adds a new `set_maximized` method to allow users to maximize windows.
2020-12-04 14:31:17 -08:00
Patrik Buhring
fcbae57489
Update Hexasphere to improve MSRV (#994)
Assumes hexasphere will follow semver (I will try to make sure it does!)
2020-12-04 10:38:25 -08:00
Carter Anderson
d601eeb829
account for "still loading" textures in RenderResourceNodes (#1000) 2020-12-04 10:37:41 -08:00
Carter Anderson
704a116778
fix scene loading (#988) 2020-12-03 13:57:36 -08:00
François
59d98de194
naming coherence for cameras (#995)
naming coherence for cameras
2020-12-03 13:46:15 -08:00
Carter Anderson
7699f8b6db
optimize asset gpu data transfer (#987) 2020-12-03 12:39:29 -08:00
Nathan Jeffords
1aff709d27
Set cursor updates (#993)
* update `Window::set_cursor_position` to take a `Vec2` instead of `i32`s

this allows fractional coordinates to work correctly
2020-12-03 12:39:03 -08:00
Tomasz Sterna
1f2e4171cf
Store mouse cursor position in Window (#940) 2020-12-03 11:30:27 -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
Michael Tang
ff12f69233
Document part of bevy_ecs::Commands (#976)
Document part of bevy_ecs::Commands
2020-12-02 19:11:28 -08:00
Robert Swain
59010caff5
Tracing chrome span names (#979)
* Update tracing-chrome to 0.3.0

* bevy_log: Add fields to span names for tracing-chrome

* Conditionally import tracing_subscriber modules based on feature
2020-12-02 16:14:02 -08:00
Tomasz Sterna
c346d282b6
Add Archetype TypeInfo::type_name accessor (#985) 2020-12-02 14:33:17 -08:00
Carter Anderson
915024bf35
fix changed meshes (#984) 2020-12-02 14:23:49 -08:00
Carter Anderson
5a77339df0
Revert "Add Archetype TypeInfo::type_name accessor (#980)" (#982)
This reverts commit 4833c2a7f4.
2020-12-02 12:58:39 -08:00
Carter Anderson
ccb31bc949
Optimize Text rendering / SharedBuffers (#972)
optimize Text rendering / SharedBuffers
2020-12-02 12:38:20 -08:00
Tomasz Sterna
4833c2a7f4
Add Archetype TypeInfo::type_name accessor (#980) 2020-12-02 12:37:40 -08:00
Joshua J. Bouw
9f4c8b1b9a
Fix errors and panics to typical Rust conventions (#968)
Fix errors and panics to typical Rust conventions
2020-12-02 11:31:16 -08:00
Patrik Buhring
f54eb12efc
Fixed Hexasphere versioning. (#974) 2020-12-01 21:48:25 -08:00
Carter Anderson
c05c1dc119
hidpi swap chains (#973)
hidpi swap chains
2020-12-01 20:25:31 -08:00
Carter Anderson
b5ffab7135
Renderer Optimization Round 1 (#958)
* only update global transforms when they (or their ancestors) have changed

* only update render resource nodes when they have changed (quality check plz)

* only update entity mesh specialization when mesh (or mesh component) has changed

* only update sprite size when changed

* remove stale bind groups

* fix setting size of loading sprites

* store unmatched render resource binding results

* reduce state changes

* cargo fmt + clippy

* remove cached "NoMatch" results when new bindings are added to RenderResourceBindings

* inline current_entity in world_builder

* try creating bind groups even when they havent changed

* render_resources_node: update all entities when resized

* fmt
2020-12-01 13:17:48 -08:00
Nathan Stocks
3cee95e59a
Rename reflect 'hash' method to 'reflect_hash' and partial_eq to reflect_partial_eq (#954)
* Rename reflect 'hash' method to 'reflect_hash' to avoid colliding with std:#️⃣:Hash::hash to resolve #943.

* Rename partial_eq to reflect_partial_eq to avoid collisions with implementations of PartialEq on primitives.
2020-12-01 11:15:07 -08:00
Andre Kuehne
0b818d7b32
Fix collision detection by calculating positive penetration depth. (#966) 2020-12-01 00:33:52 -08:00
Amber Kowalski
ef99e59469
Test more areas of the codebase (#953)
Test more areas of the codebase
2020-11-30 22:58:49 -08:00
Carter Anderson
8675fea0f2
consolidate find-crate (#964) 2020-11-30 22:36:38 -08:00
dependabot[bot]
048e6e2561
Update glam requirement from 0.10.0 to 0.11.0 (#961)
Updates the requirements on [glam](https://github.com/bitshifter/glam-rs) to permit the latest version.
- [Release notes](https://github.com/bitshifter/glam-rs/releases)
- [Changelog](https://github.com/bitshifter/glam-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bitshifter/glam-rs/compare/0.10.0...0.11.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-30 22:25:42 -08:00
Patrik Buhring
3da653e4dd
Update Hexasphere & Usage. (#965) 2020-11-30 22:25:33 -08:00
François
6b004f7d16
switch winit size to logical to be dpi independent (#947)
* switch winit size to logical

* make scale factor available from bevy_window
2020-11-30 18:24:49 -08:00
dependabot[bot]
4cd3dd70b7
Update ahash requirement from 0.5.3 to 0.6.1 (#960)
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>
2020-11-30 18:21:02 -08:00
Toothbrush
bc2f43c1c3
Fix examples in bevy_reflect/README.md (#963) 2020-11-30 18:12:09 -08:00
Amber Kowalski
4c1bc02723
Change bevy_input::Touch API to match similar APIs (#952) 2020-11-30 17:14:08 -08:00
Joshua J. Bouw
c7b9ad5097
Fix RenderResources index slicing (#948) 2020-11-30 13:33:52 -08:00
Nick
f35f813137
additional vertex attribute value types (#946) 2020-11-30 13:05:03 -08:00
Jonathan Cornaz
52d6799544
Run parent-update and transform-propagation during the "post-startup" stage (instead of "startup") (#955)
* Propagate transforms during the POST_STARTUP start-up stage

* Update changelog
2020-11-29 14:07:47 -08:00
Mariusz Kryński
dbf226be49
store PipelineSpecialization.dynamic_bindings in HashSet (#936) 2020-11-28 13:10:18 -08:00
Amber Kowalski
097a55948c
Refactor Time API and internals (#934)
Refactor Time API and internals
2020-11-28 13:08:31 -08:00
Nick
f3b49e44c9
removed redundant v_Normal in shader (#938) 2020-11-28 12:44:25 -08:00
Carter Anderson
72b2fc9843
Bevy Reflection (#926)
Bevy Reflection
2020-11-27 16:39:59 -08:00
Philip Degarmo
ec8fd57c45
When a task scope produces <= 1 task to run, run it on the calling thread immediately. (#932)
While generally speaking the calling thread would have picked up the task first anyways, I don't think it makes much sense usually to block the calling thread until another thread wakes and does the work.
2020-11-27 12:14:44 -08:00
RiskLove
7d4cb70d92
BugFix: Archetype grow with defferent size. (#930)
Co-authored-by: heshuai <heshuai@163.com>
2020-11-27 11:55:55 -08:00
Nathan Stocks
12f29bd38c
Timer Polishing (#931)
* Pause stops ticks. Consistent getter method names. Update tests.

* Add timing example

* Format with the nightly formatter

Co-authored-by: Amber Kowalski <amberkowalski03@gmail.com>
2020-11-27 11:39:33 -08:00
Amber Kowalski
f69cc6f94c
Allow timers to be paused and encapsulate fields (#914)
Allow timers to be paused and encapsulate fields
2020-11-26 11:25:36 -08:00
dependabot[bot]
8e4eb41757
Update shaderc requirement from 0.6.3 to 0.7.0 (#823)
Updates the requirements on [shaderc](https://github.com/google/shaderc-rs) to permit the latest version.
- [Release notes](https://github.com/google/shaderc-rs/releases)
- [Commits](https://github.com/google/shaderc-rs/compare/v0.6.3...v0.7.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-25 18:46:13 -08:00
Philip Degarmo
cf75c22c9a
Fix a deadlock that can occur when using scope() on ComputeTaskPool from within a system. (#892) 2020-11-25 18:05:55 -08:00
Carter Anderson
bd5bd3bc07
temporarily suppress new clipply lint (#929) 2020-11-25 17:46:37 -08:00
SvenTS
de5ff0aa5a
Remove Changed from parent update system (#907)
System has to check for actual change of the value anyway. This way,
children inserted after postupdate get synced in the next frame and are
not lost.
2020-11-25 17:33:59 -08:00
Tomasz Sterna
fd6b787efc
Create winit windows before app.initialize() (#916)
This is required so startup systems have access
to Windows and WinitWindows resources.
2020-11-25 17:32:41 -08:00
Tomasz Sterna
b2c82955ff
Add set_cursor_position method to Window (#917) 2020-11-25 17:31:10 -08:00
Carter Anderson
86d724e04e
wgpu: use mailbox instead of fifo for vsync (#920) 2020-11-25 17:28:58 -08:00
SvenTS
69603904ab
Allow despawning of hierarchies in threadlocal systems (#908)
* Rename test components for easier understanding of failures

* Make recursive despawn public

This way, threadlocal systems can despawn hierarchies.

* Swap children before despawning
2020-11-25 17:13:11 -08:00
SvenTS
dd1b08ef8b
Improve ui depth system (#905)
* Add test for ui-z system

* Remove generic hierarchy runner and refactor ui z-system

* Remove different handling for childless nodes

Having an empty children list should be the same as having no child
component.

* Further simplify system after change
2020-11-25 16:55:55 -08:00
Nathan Stocks
2f408cf053
Improve timer ergonomics. Add tests (#923) 2020-11-25 16:43:16 -08:00
bg
01ba7c4425
avoid exclusive lock during update_asset_storage (#909)
avoid exclusive lock during `update_asset_storage`

Co-authored-by: Jay <jay@heinousjay.com>
2020-11-22 12:29:26 -08:00
Felipe Jorge
c1e499d5fe
Fix duplicated chilren in Scene spawn (#904)
Fix duplicated chilren in Scene spawn
2020-11-22 12:05:58 -08:00
Duncan
46fac78774
Extend the Texture asset type to support 3D data (#903)
Extend the Texture asset type to support 3D data

Textures are still loaded from images as 2D, but they can be reshaped
according to how the render pipeline would like to use them.

Also add an example of how this can be used with the texture2DArray uniform type.
2020-11-22 12:04:47 -08:00
marius851000
eb587b2f10
do not spend time drawing text with is_visible = false (#893)
do not draw text with is_visible = false
2020-11-22 11:57:52 -08:00
Joel Nordström
1e9a0544bd
Fix pixel format conversion in bevy_gltf (#897)
* Fix pixel format conversion in bevy_gltf

* Update renamed image::DynamicImage method calls

* Remove unused GltfError variant
2020-11-21 19:08:50 -08:00
Plecra
3a9a5b4e07
fix: update image version (#911)
into_bgra8 was added in 0.23.12
2020-11-21 19:08:02 -08:00
Mariusz Kryński
d96493a42a
use wasm-friendly instant::Instant everywhere (#895)
* use instant::Instant everywhere
* reexport instant::{Duration, Instant} from bevy_utils
2020-11-21 16:38:24 -08:00
Valentin
d458406540
Add box shape (#883)
* Add rectangular cuboid shape

Co-authored-by: Jason Lessard <jason.lessard@usherbrooke.ca>
Co-authored-by: Jason Lessard <jason.lessard@usherbrooke.ca>
Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2020-11-21 14:51:24 -08:00
bjorn3
0dbbcd98b6
Expose an EventId for events (#894)
* Expose an EventId for events

This can be helpful for correlating the place where an event is created
to the place where the event is processed.
2020-11-21 14:03:18 -08:00
rod-salazar
85ecab8bb9
Tweaks to TextureAtlasBuilder.finish() (#887)
Tweaks to TextureAtlasBuilder.finish()
2020-11-21 12:55:25 -08:00
bg
106486bd99
fix deprecation error in image_texture_loader (and CI error) (#906)
fix deprecation error in image_texture_loader (and CI error)
2020-11-21 12:26:35 -08:00
Vladyslav Batyrenko
d11be437cb
Switch to default PartialEq implementation for RenderResourceBinding (#877)
* Switch to default PartialEq implementation for RenderResourceBinding
* Move specialized RenderResourceBinding Hash implementation to BindGroupBuilder
2020-11-21 11:52:44 -08:00
Joshua J. Bouw
b4a864ba5a
Replace Bytes with Byteable for TextureAtlasSprite (#874)
Replace Bytes with Byteable for TextureAtlasSprite
2020-11-21 11:48:10 -08:00
Carter Anderson
4fecb899aa
initialize chained systems (#886) 2020-11-17 17:06:47 -08:00
Carter Anderson
457a8bd17d
ecs: replace "bool" component states with bitflags (#878) 2020-11-17 17:04:44 -08:00
bjorn3
d6eb647451
Misc cleanups (#879)
* Remove cfg!(feature = "metal-auto-capture")

This cfg! has existed since the initial commit, but the corresponding
feature has never been part of Cargo.toml

* Remove unnecessary handle_create_window_events call

* Remove EventLoopProxyPtr wrapper

* Remove unnecessary statics

* Fix unrelated deprecation warning to fix CI
2020-11-17 13:40:18 -08:00
Carter Anderson
3a6f6de277
System Inputs, Outputs, Chaining, and Registration Ergo (#876)
System Inputs, Outputs, Chaining, and Registration Ergo
2020-11-16 18:18:00 -08:00
bjorn3
50c7e229b2
Rework ResourceData to use VecResourceStorage instead of Archetype (#873) 2020-11-16 16:55:59 -08:00
dependabot[bot]
601411d201
Update find-crate requirement from 0.5 to 0.6 (#872)
Updates the requirements on [find-crate](https://github.com/taiki-e/find-crate) to permit the latest version.
- [Release notes](https://github.com/taiki-e/find-crate/releases)
- [Changelog](https://github.com/taiki-e/find-crate/blob/master/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/find-crate/compare/v0.5.0...v0.6.1)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-11-16 16:39:26 -08:00
rod-salazar
3fca8c60bb
Remove redundant texture copies in TextureCopyNode (#871)
Remove redundant texture syncs in TextureCopyNode
2020-11-16 16:38:14 -08:00
Julian Heinken
fcf9d525e1
Removed vertex fallback buffer (#870)
removed fallback buffer
2020-11-16 16:36:57 -08:00
Rob
7aac4223d0
Fixed property typos, KeyCode typo. (#857)
* Fixed property typos, KeyCode typo.

* cargo fmt
2020-11-16 16:33:19 -08:00
Carter Anderson
7628f4a64e
combine bevy_ecs and bevy_hecs crates. rename XComponents to XBundle (#863)
combine bevy_ecs and bevy_hecs crates. rename XComponents to XBundle
2020-11-15 20:32:23 -08:00
François
02f543eca3
Fall back to remove components one by one when failing to remove a bundle (#719)
Fall back to remove components one by one when failing to remove a bundle
2020-11-15 14:32:54 -08:00
milkybit
b3541a9a31
Add all basic color constants (#859)
Add all basic color constants
2020-11-15 12:44:02 -08:00
memoryruins
4bdff66b80
Check for conflicting system resource parameters (#864) 2020-11-15 12:42:43 -08:00
Joshua J. Bouw
bb4a7392c0
Remove redundant .into for mesh set_attributes with impl (#866) 2020-11-15 12:08:03 -08:00
Mariusz Kryński
515d750004
wasm32: non-spirv shader specialization (#843)
wasm32: non-spirv shader specialization
2020-11-15 12:07:17 -08:00
Jackson Lango
18195bfa91
Controllable ambient light color (#852)
Control ambient light color via resource

The AmbientLight resource now controls the ambient light color in the
pbr fragment shader.
2020-11-15 11:34:55 -08:00
MinerSebas
43aac1a784
More query filter usage (#851)
* Examples now use With<>

* More Bevy systems now use With<>

* parent_update_system now uses Changed<>
2020-11-12 18:22:46 -08:00
Marcus Buffett
1a92ec2638
Make Timer.tick return &Self (#820)
Make Timer::tick return &Self
2020-11-12 18:03:03 -08:00
Nathan Stocks
a0b16e8620
Clean up now-unused files due to changes in the transform system (#849) 2020-11-12 17:24:41 -08:00
Carter Anderson
e03f17ba7f
Log Plugin (#836)
add bevy_log plugin
2020-11-12 17:23:57 -08:00
Olivier Pinon
465c3d4f7b
Use glyph_brush_layout and add text alignment support (#765)
Use glyph_brush_layout and add text alignment support

Co-authored-by: Olivier Pinon <op@impero.com>
Co-authored-by: tigregalis <anak.harimau@gmail.com>
Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2020-11-12 16:21:48 -08:00
Carter Anderson
1eff53462a
cross-platform main function (#847) 2020-11-12 13:26:48 -08:00
Mariusz Kryński
fae628797f
bevy_render: delegate buffer aligning to render_resource_context (#842) 2020-11-11 14:08:27 -08:00
Carter Anderson
e769974d6a
query filters (#834) 2020-11-10 20:48:34 -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
Mikail Khan
b3e1048e73
added #[inline] to more window accessor functions (#830) 2020-11-10 17:20:31 -08:00
Joshua J. Bouw
c9acef04e3
Ahash constructor extensions and HashMap / HashSet (#790)
Ahash constructor extensions and HashMap / HashSet
2020-11-10 17:06:55 -08:00
rod-salazar
0c30762ab7
Update FileAssetIo NotFound error to include full path (#821) 2020-11-10 16:21:41 -08:00
memoryruins
a68c217ccf
Mark Query and QuerySet contructors as pub(crate) (#829)
Mark Query and QuerySet contructors as pub(crate)
2020-11-10 16:14:33 -08:00
Mariusz Kryński
60fa2d5f93
delegate layout reflection to RenderResourceContext (#691)
* delegate layout reflection to RenderResourceContext
Also:
 * auto-reflect DynamicBindings
 * use RenderPipeline::new, update dynamic_bindings

linting.

* add dynamic binding generation

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2020-11-10 13:20:05 -08:00
bjorn3
80a0448473
Add bevy_dylib to force dynamic linking of bevy (#808)
This easily improve compilation time by 2x
2020-11-09 19:26:08 -08:00
Carter Anderson
4ef6eb8a85
adjust to new clippy lints (#826) 2020-11-09 14:12:42 -08:00
Bram Buurlage
07f07a0736
Added RenderPass::set_scissor_rect (#815)
Added RenderPass::set_scissor_rect
2020-11-09 13:24:29 -08:00
Carter Anderson
213ba9629a
ecs: fix system name in "conflicting system" error message (#816) 2020-11-08 13:48:00 -08:00
Carter Anderson
ebcdc9fb8c
Flexible ECS System Params (#798)
system params can be in any order, faster compiles, remove foreach
2020-11-08 12:34:05 -08:00
Oscar
f54788527b
Add received character (#805)
* Add ReceivedCharacter window event

* Add ReceivedCharacter window event examples
2020-11-06 17:15:56 -08:00
Carter Anderson
9224983897
upgrade glam and hexasphere (#794) 2020-11-06 17:11:32 -08:00
Rob
06f95e9982
Fixed several typos. (#806)
* Fixed common typo in several struct names.

* Fixed minor doc typos.
2020-11-06 17:11:12 -08:00
Chrs Msln
35d4fca0d0
[gltf] Support camera and fix hierarchy (#772)
[gltf] Support camera and fix hierarchy
2020-11-06 17:08:15 -08:00
Lukas Wirth
fb7c651ab9
Port hecs derive macro improvements (#761)
* Port derive macro changes from hecs

* Emit more info on duplicate components in archetype creation
2020-11-06 13:20:53 -08:00
Carter Anderson
26be22e73c
fix unit test (#802) 2020-11-06 12:49:20 -08:00
Guillaume DALLENNE
5bd6deb974
Add mutated state when inserting an already existing component (#404)
Add mutated state when inserting an already existing component
2020-11-04 17:51:54 -08:00
Carter Anderson
1aa832be1d
fix unsafe Query function names (#785) 2020-11-03 14:10:29 -08:00
Carter Anderson
9afe196f16
release: 0.3.0 (#783) 2020-11-03 13:34:00 -08:00
memoryruins
e21705bec6
Remove two unused deps (#780) 2020-11-03 11:38:37 -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
Carter Anderson
2e2fa4fef4
make Mesh::attribute() immutable (#774) 2020-11-02 22:54:20 -08:00
Carter Anderson
66f2f76a18
rename add_plugin_group to add_plugins (#773) 2020-11-02 19:01:17 -08:00
Nathan Stocks
9871e7e24b
Remove add_default_plugins and add MinimalPlugins for simple "headless" scenarios (#767)
Remove add_default_plugins and add MinimalPlugins for simple "headless" scenarios
2020-11-02 18:38:37 -08:00
Nathan Stocks
2f87ff6618
Move ElementState to top-level of bevy_input. Resolves #687. (#769) 2020-11-02 18:16:13 -08:00
Nicholas Rishel
53c4c45eca
Use embedded glslang for runtime glsl-to-spirv and add Android example (#740)
Use embedded glslang for runtime glsl-to-spirv and add Android example
2020-11-02 16:30:30 -08:00
Carter Anderson
44b3e24e32
fix mesh allocation bug and public mesh api improvements (#768) 2020-11-02 13:15:07 -08:00
memoryruins
f81208adaa
impl ReadOnlyFetch for Or, FetchOr, and FetchMutated (#763) 2020-11-01 16:51:51 -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
Julian Heinken
4645da30c8
Mesh overhaul with custom vertex attributes #592 (#599)
Mesh overhaul with custom vertex attributes
2020-10-30 19:21:53 -07:00
Carter Anderson
ad940fbf6e
Rename query.entity() to query.get() and query.get() to query.get_component() (#752) 2020-10-30 18:04:33 -07:00
tigregalis
ff626f2f6f
fix wavy text (#725)
fix wavy text

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2020-10-30 16:29:24 -07:00
Oscar
b6004e44cf
Local resources don't create if already present (#745)
Local<T> will no longer insert the inner resource if it already exists.
2020-10-30 12:21:57 -07:00
Boxy
dea05e9af5
Remove unsound cast in thread local resources (#749)
* Remove unsound cast in thread local resources

* Make ResourceRef(Mut)::new impossible to cause unsoundness with
2020-10-30 11:43:39 -07:00
Carter Anderson
1d4a95db62
ecs: ergonomic query.iter(), remove locks, add QuerySets (#741) 2020-10-29 23:39:55 -07:00
Alex Hirsch
1b051d3353
Add SamplerDescriptor to Texture (#399) (#747)
GLTF loader now grabs (some) sampler information from the respective
GLTF sampler struct.
2020-10-29 14:22:45 -07:00
Utkarsh
fb2b19def5
Fix bug of connection event of gamepad at startup (#730)
* Removed f32==f32 comparision in gamepad.rs

* Trigger gamepad connection event at start up
2020-10-29 13:55:35 -07:00
SvenTS
7734b1ea6d
Fix PreviousParent lag by merging parent update systems (#713)
* Sync previous parent in parent_update_system

* Previous parent does not need to be an option now

* Remove previous parent after parent deletion
2020-10-29 13:54:29 -07:00
Carter Anderson
bf2a917b81
app: PluginGroups and DefaultPlugins (#744) 2020-10-29 13:04:28 -07:00
David Ackerman
0cddeed1c0
Add support for android file system (#723)
Add support for android file system
2020-10-28 17:08:33 -07:00
Freya
040b8f72b3
Optimize returns in file_asset_io.rs and entities.rs (#728)
Optimize returns in file_asset_io.rs and entities.rs
2020-10-28 16:59:45 -07:00
Boxy
8c053e7c67
Run app.initialize in the run_once runner (#736) 2020-10-28 16:43:17 -07:00
Carter Anderson
a6ac8faa8a
port upstream hecs performance improvements (#716) 2020-10-22 11:53:59 -07:00
CGMossa
58eb7e7e05
Documenting small things here and there.. (#706)
Documenting small things here and there..
2020-10-21 15:57:03 -07:00
Carter Anderson
267599e577
gamepad: expose raw and filtered gamepad events. (#711) 2020-10-21 15:56:07 -07:00
Mariusz Kryński
894cc5e40a
fix getrandom (#712) 2020-10-21 15:55:35 -07:00
Mariusz Kryński
677cb1fc67
fix wasm assets (#714)
fix wasm assets
2020-10-21 15:55:15 -07:00
Utkarsh
d01ba9e4fc
Separate gamepad state code from gamepad event code and other customizations (#700)
Separated gamepad event and gamepad state code and made gamepad input more customizable
2020-10-21 10:27:00 -07:00
James R
0f43fb066f
update glam (#707) 2020-10-20 12:31:49 -07:00
lee-orr
0dba0fe45f
add flag for low power gpu as default (#397) 2020-10-20 11:47:10 -07:00
Dashiell Elliott
0dbba3efff
Migrate to rodio 0.12 using thread local resources (#692)
Migrate to rodio 0.12 using thread local resources
2020-10-20 11:44:50 -07:00
dependabot[bot]
67f87e1d2b
Update ahash requirement from 0.4.5 to 0.5.3 (#704)
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>
2020-10-19 18:24:50 -07:00
Carter Anderson
f88cfabdde
asset: WasmAssetIo (#703)
asset: WasmAssetIo
2020-10-19 17:29:31 -07:00
tigregalis
03bc5d7fdd
two-way conversions between Color-Vec4 and Color-[f32; 4] (#688)
two-way conversions between `Color`-`Vec4` and `Color`-`[f32; 4]` - use `impl From` instead of `impl Into`
2020-10-19 12:37:15 -07:00
Carter Anderson
c32e637384
Asset system rework and GLTF scene loading (#693) 2020-10-18 13:48:15 -07:00
Carter Anderson
a602f50c2c
small input example improvements (#701) 2020-10-18 13:20:42 -07:00
Marek Legris
5acebed731
Transform and GlobalTransform are now Similarities (#596)
Transform and GlobalTransform are now Similarities.

This resolves precision errors and simplifies the api

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2020-10-18 13:03:16 -07:00
Tomasz Sterna
149c39950a
Runners explicitly call App.initialize() (#690) 2020-10-18 12:25:33 -07:00
Sergey Minakov
a80469bd13
Touch support implementation (#696)
Adds a basic touch input system
2020-10-18 12:24:01 -07:00
Alex
d004bce0c9
Added basic mouse capture API (#679)
Added basic cursor lock API
2020-10-16 14:07:01 -07:00
David Ackerman
7ba45849f3
Add default for texture format (#675) 2020-10-16 11:44:31 -07:00
Mariusz Kryński
fccfa12d3b
do not depend on spirv on wasm target (#689)
do not use spirv for wasm target
2020-10-16 11:12:55 -07:00
Mat Hostetter
871790c6e0
Adjust how ArchetypeAccess tracks mutable & immutable deps (#660)
`ArchetypeAccess` was tracking `immutable` and `mutable` separately.
This means that checking is_compatible requires three checks:
m+m, m+i, i+m.

Instead, continue tracking `mutable` accesses, but instead of
`immutable` track `immutable | mutable` as another `accessed` bit mask.
This drops the comparisons to two (m+a, a+m) and turns out to be
what the rest of the code base wants too, unifying various duplicated
checks and loops.
2020-10-15 13:39:01 -07:00
Junfeng Liu
f66a72563e
Expose a pointer of EventLoopProxy to process custom messages (#674) 2020-10-15 13:31:34 -07:00
Carter Anderson
b03d8da9bb
fix clippy (#686) 2020-10-15 12:49:56 -07:00
Utkarsh
dd91f8e116
Add support to get gamepad button/trigger values using Axis<GamepadButton> (#683) 2020-10-15 12:45:34 -07:00
François
76cc25823d
can change window settings at runtime (#644)
can change window settings at runtime
2020-10-15 11:42:19 -07:00
M
9c48e5cccb
Add a way to specify padding/ margins between sprites in a TextureAtlas. (#460)
Add a way to specify padding between sprites in a TextureAtlas
2020-10-14 20:49:07 -07:00
Catherine Gilbert
1f7fe77f32
added frame count to FrameTimeDiagnosticsPlugin (#678)
added frame count to FrameTimeDiagnosticsPlugin
2020-10-14 15:13:43 -07:00
Nathan Jeffords
7e23e132ef
add version of the ecs's write_world method that takes a pre-boxed world writer (#661)
Co-authored-by: Nathan Jeffords <njeffords@comtechefdata.com>
2020-10-14 14:01:08 -07:00
Carter Anderson
df64e1fc92
upgrade rectangle pack (#673) 2020-10-12 18:12:17 -07:00
Carter Anderson
5e7c36d1c1
Fix example colors (#672) 2020-10-12 16:54:22 -07:00
Carter Anderson
930eba4ccd
add thread local resources (#671) 2020-10-12 15:09:44 -07:00
walterpie
53d6d10506
Register IndexFormat as a property (#664) 2020-10-12 10:22:10 -07:00
Joshua J. Bouw
036b3bc0e6
add more methods to Assets for clearing and allocation reduction (#669) 2020-10-12 10:21:28 -07:00
Julian Heinken
32b122e1c5
Update color.rs (#670)
Co-authored-by: Julian Heinken <julian.heinken@gmail.com>
2020-10-12 10:19:06 -07:00
Nathan Stocks
f6fc76db1d
Upgrade to gilrs 0.8.0 to gain dpad support on macos from https://gitlab.com/gilrs-project/gilrs/-/merge_requests/50 (#653) 2020-10-10 13:30:34 -07:00
Carter Anderson
1f27d8c727
fix new clippy error (#656) 2020-10-10 12:16:52 -07:00
Nathan Stocks
333fd3f0e0
Don't Panic (#651)
Don't panic when despawning recursively
2020-10-08 18:43:41 -07:00
Nathan Stocks
bf501b77cc
Don't panic when despawning entity multiple times (#649)
Emit a debug log message instead of a panic when despawning an entity which has already been despawned.
2020-10-08 16:58:19 -07:00
memoryruins
ebce1f9c4a
Remove outdated ecs docs (#646) 2020-10-08 15:32:25 -07:00
Grayson Burton
354d71cc1f
The Great Debuggening (#632)
The Great Debuggening
2020-10-08 11:43:01 -07:00
Julian Heinken
a92790c011
sRGB awareness for Color (#616)
Color is now sRGB aware, added SrgbColorSpace trait for f32
2020-10-08 10:30:23 -07:00
François
52a4d49bbf
set asset path relative to root when loading sync (#643) 2020-10-07 11:09:17 -07:00
Downtime
125afb41ac
Exposing winit decorations (#627)
Exposing winit decorations
2020-10-05 10:51:36 -07:00
Boutillier
219527ed7d
Iter added camera to update their projection (#488) 2020-10-05 10:41:34 -07:00
Boutillier
1bdb9d3b00
Fix Added behaviour for QueryOne get. (#543)
Query unchanged as impacts performances.
Added tests in bevy_ecs/hecs
2020-10-05 10:38:12 -07:00
Andrew Hickman
9a4167ef7f
Fix FloatOrd hash being different for different NaN values (#618)
* Fix FloatOrd hash being different for different NaN values

* Fix FloatOrd hashing +0.0 and -0.0 to different values
2020-10-03 12:56:25 -07:00
Carter Anderson
22a2c88a47
winit: upgrade to 0.23.0 / move back upstream! (#617) 2020-10-02 12:24:30 -07:00
EthanYidong
4c753e2588
move dynamic plugin loading to its own optional crate (#544)
move dynamic plugin loading to its own crate
2020-10-01 13:04:06 -07:00
Will Hart
1beee4fd28
Add AppBuilder::asset_loader_from_instance (#580)
* Implement add_asset_loader_from_instance

* Add example of different data loaders
2020-10-01 11:31:06 -07:00
Gregor
056f84a2c1
Expose current_entity in ChildBuilder (#595) 2020-10-01 11:00:10 -07:00
Jonas Matser
3a4eacbdee
Adds derive for missing debug implementations (#597) 2020-10-01 10:58:21 -07:00
Nolan Darilek
d52f9e32aa
Add #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] to gamepad types. (#583)
Seems these may have been missed in the gamepad implementation, copied them from keyboard.rs.
2020-10-01 10:54:20 -07:00
Daniel McNab
cd9e502b12
Fix ScheduleRunnerPlugin (#610)
Fixes #609
2020-10-01 10:52:29 -07:00
Tomasz Sterna
408114269b
Use instant::Instant with wasm-bindgen feature (#591) 2020-09-27 12:55:06 -07:00
Raymond
74ad1c3752
Add remove bundle to bevy_ecs commands (#579)
add remove bundle to bevy_ecs commands
2020-09-26 14:27:56 -07:00
Alexander Sepity
85a7f883d1
Fix typo in #569. (#582) 2020-09-26 10:26:19 -07:00
Carter Anderson
dd07674b59
github actions: use stable clippy (#577) 2020-09-25 21:34:47 -07:00
Carter Anderson
05db806e15
fix DrawableText crash (#574) 2020-09-25 17:57:23 -07:00
Mariusz Kryński
a3012d94bb
WASM asset loading (#559)
wasm assets
2020-09-25 15:26:23 -07:00
Gray Olson
afc656701d
switch to u32 indices by default (#572) 2020-09-25 14:29:30 -07:00
Alexander Sepity
3abfcad7ab
Patch memory leak in Archetype::grow(). (#569) 2020-09-25 12:33:27 -07:00
Gray Olson
f7c8882c04
Index buffer specialization (#568)
index buffer specialization
2020-09-25 12:13:01 -07:00
Carter Anderson
a768bae33b
properly update bind group ids when setting dynamic bindings. (#560) 2020-09-23 13:20:14 -07:00
Carter Anderson
028a22b129
asset: use bevy_tasks in AssetServer (#550) 2020-09-21 20:23:09 -07:00
Tomasz Sterna
dd6f0b5e04
Option to give existing canvas element as winit window (#515) 2020-09-21 16:12:34 -07:00
Stjepan Glavina
74f881f20d
Fix compilation error on wasm (#549)
Fix compilation error on wasm
2020-09-21 15:47:38 -07:00
Logan Magee
b5f3585d2e
Merge some imports in bevy_winit/src/lib.rs (#522) 2020-09-21 13:54:47 -07:00
HyperLightKitsune
295e1f0a18
use FnOnce in Commands and ChildBuilder where possible (#535)
use FnOnce in Commands and ChildBuilder
2020-09-21 13:51:38 -07:00
Stjepan Glavina
5aa77979d1
Remove some unsafe code (#540) 2020-09-21 13:13:40 -07:00
memoryruins
fd1d6a388d
Stop looping when scheduler receives an AppExit (#536) 2020-09-20 16:32:07 -07:00
Carter Anderson
74dba5f36b
release: 0.2.1 (#533) 2020-09-20 15:58:32 -07:00
Stjepan Glavina
b05708f66a
Update async-executor to 1.3.0 (#526) 2020-09-20 11:27:24 -07:00
memoryruins
924afc3c0c
Remove UI debug print (#521) 2020-09-19 23:25:07 -07:00
Carter Anderson
ba5af4dd56
release: 0.2.0 (#520) 2020-09-19 15:29:08 -07:00
Carter Anderson
57a52e6ed7
fix font atlas text width bug (#519) 2020-09-19 14:22:01 -07:00
Carter Anderson
ff54efe3e3
transform: add "setter" builder functions, make naming clearer, and fix examples (#516) 2020-09-19 13:35:48 -07:00
Boutillier
b9f18efd86
Do not assume font handle is present in assets. (#490) 2020-09-19 12:57:52 -07:00
Tomasz Sterna
5e3731ddce
Create winit canvas under WebAssembly (#506) 2020-09-18 20:11:26 -07:00
Utkarsh
19d4694d24
Added gamepad support using Gilrs (#280)
Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2020-09-18 14:43:47 -07:00
Boiethios
d4c8436457
Add AppBuilder::add_startup_stage_[before/after] (#505)
Co-authored-by: Boiethios <felix-dev@daudre-vignier.fr>
2020-09-18 13:30:54 -07:00
Carter Anderson
70ad6671db
ecs: use generational entity ids and other optimizations (#504)
ecs: use generational entity ids and other optimizations
2020-09-17 17:16:38 -07:00
Tomasz Sterna
34c6f5f41b
Implement WASM support for bevy_winit (#503)
Also, replaced wasm_timer::Instant with instant::Instant as it is
used by winit WASM implementation.
2020-09-16 13:40:32 -07:00
Carter Anderson
ad7613c674
Fix set_scale and set_rotation in new Transform api (#500) 2020-09-16 00:19:14 -07:00
verzuz
d4ab2f4d47
fix font atlas overflow (#495)
manage font_atlas overflow
2020-09-15 18:06:10 -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