-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unify the clone modifier and spawners, and fix races.
This large patch essentially makes particle trails and ribbons part of the spawner, which is processed during the init phase, rather than modifiers that execute during the update phase. Along the way, this made it easier to fix race conditions in spawning of trails, because spawning only happens in the init phase while despawning only happens in the update phase. This addresses #376, as well as underflow bugs that could occur in certain circumstances. In detail, this commit makes the following changes: * Every group now has an *initializer*. An initializer can either be a *spawner* or a *cloner*. This allows spawners to spawn into any group, not just the first one. * The `EffectSpawner` component is now `EffectInitializers`, a component which contains the initializers for every group. Existing code that uses `EffectSpawner` can migrate by picking the first `EffectInitializer` from that component. * The `CloneModifier` has been removed. Instead, use a `Cloner`, which manages the `age` and `lifetime` attributes automatically to avoid artifacts. The easiest way to create a cloner is to call `with_trails` or `with_ribbons` on your `EffectAsset`. * The `RibbonModifier` has been removed. Instead, at most one of the groups may be delegated the ribbon group. The easiest way to delegate a ribbon group is to call `EffectAsset::with_ribbons`. (It may seem like a loss of functionality to only support one ribbon group, but it actually isn't, because there was only one `prev` and `next` attribute pair and so multiple ribbons never actually worked before.) * The `capacity` parameter in `EffectAsset::new` is no longer a vector of capacities. Instead, you supply the capacity of each group as you create it. I figured this was cleaner. * Init modifiers can now be specific to a particle group, and they execute for cloned particles as well. There's no need to use update modifiers to set values on cloned particles. * Age and lifetime can no longer be set manually for cloned particles. (They can still be set as usual for spawned particles.) This enforces LIFO ordering for ribbons, which is necessary to avoid races. * Underflow of particle counts that could occur in certain scenarios involving multiple groups is fixed. The racy hack that "put back" particles that would otherwise underflow the alive count is no longer needed. * Particle linked lists no longer race with one another (#376). Closes #376.
- Loading branch information
Showing
40 changed files
with
1,877 additions
and
1,197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.