Skip to content

Commit a844a67

Browse files
authored
Merge pull request #3 from amethyst/master
Update to Master
2 parents e5c1da5 + c036682 commit a844a67

File tree

225 files changed

+5294
-2028
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

225 files changed

+5294
-2028
lines changed

.github/pull_request_template.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ By placing an x in the boxes I certify that I have:
2727
If this modified or created any rs files:
2828

2929
- [ ] Ran `cargo +stable fmt --all`
30-
- [ ] Ran `cargo clippy --all`
31-
- [ ] Ran `cargo test --all --features "empty"`
30+
- [ ] Ran `cargo clippy --all --features "empty"`
31+
- [ ] Ran `cargo test --all --features "empty"`

Cargo.toml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "amethyst"
3-
version = "0.11.1"
3+
version = "0.12.0"
44
authors = ["Eyal Kalderon <[email protected]>", "Amethyst Foundation <[email protected]>"]
55
edition = "2018"
66
description = "Data-oriented game engine written in Rust"
@@ -19,7 +19,7 @@ license = "MIT/Apache-2.0"
1919
travis-ci = { repository = "amethyst/amethyst", branch = "master" }
2020

2121
[features]
22-
default = ["animation", "audio", "locale", "network", "renderer"]
22+
default = ["animation", "audio", "locale", "network", "renderer", "sentry"]
2323

2424
vulkan = ["amethyst_rendy/vulkan"]
2525
metal = ["amethyst_rendy/metal"]
@@ -104,29 +104,29 @@ members = [
104104
]
105105

106106
[dependencies]
107-
amethyst_animation = { path = "amethyst_animation", version = "0.6.0", optional = true }
108-
amethyst_assets = { path = "amethyst_assets", version = "0.7.0" }
109-
amethyst_audio = { path = "amethyst_audio", version = "0.6.0", optional = true }
110-
amethyst_config = { path = "amethyst_config", version = "0.10.0" }
111-
amethyst_core = { path = "amethyst_core", version = "0.6.0" }
112-
amethyst_error = { path = "amethyst_error", version = "0.1.0" }
113-
amethyst_controls = { path = "amethyst_controls", version = "0.5.0" }
114-
amethyst_derive = { path = "amethyst_derive", version = "0.4.0" }
115-
amethyst_gltf = { path = "amethyst_gltf", version = "0.6.0", optional = true }
116-
amethyst_network = { path = "amethyst_network", version = "0.4.0", optional = true }
117-
amethyst_locale = { path = "amethyst_locale", version = "0.5.0", optional = true }
118-
amethyst_rendy = { path = "amethyst_rendy", version = "0.1.0", features = ["window"], optional = true }
119-
amethyst_input = { path = "amethyst_input", version = "0.7.0" }
120-
amethyst_ui = { path = "amethyst_ui", version = "0.6.0" }
121-
amethyst_utils = { path = "amethyst_utils", version = "0.6.0" }
122-
amethyst_window = { path = "amethyst_window", version = "0.1.0" }
123-
crossbeam-channel = "0.3.1"
107+
amethyst_animation = { path = "amethyst_animation", version = "0.7.0", optional = true }
108+
amethyst_assets = { path = "amethyst_assets", version = "0.8.0" }
109+
amethyst_audio = { path = "amethyst_audio", version = "0.7.0", optional = true }
110+
amethyst_config = { path = "amethyst_config", version = "0.11.0" }
111+
amethyst_core = { path = "amethyst_core", version = "0.7.0" }
112+
amethyst_error = { path = "amethyst_error", version = "0.2.0" }
113+
amethyst_controls = { path = "amethyst_controls", version = "0.6.0" }
114+
amethyst_derive = { path = "amethyst_derive", version = "0.5.0" }
115+
amethyst_gltf = { path = "amethyst_gltf", version = "0.7.0", optional = true }
116+
amethyst_network = { path = "amethyst_network", version = "0.5.0", optional = true }
117+
amethyst_locale = { path = "amethyst_locale", version = "0.6.0", optional = true }
118+
amethyst_rendy = { path = "amethyst_rendy", version = "0.2.0", features = ["window"], optional = true }
119+
amethyst_input = { path = "amethyst_input", version = "0.8.0" }
120+
amethyst_ui = { path = "amethyst_ui", version = "0.7.0" }
121+
amethyst_utils = { path = "amethyst_utils", version = "0.7.0" }
122+
amethyst_window = { path = "amethyst_window", version = "0.2.0" }
123+
crossbeam-channel = "0.3.9"
124124
derivative = "1.0"
125125
fern = { version = "0.5", features = ["colored"] }
126126
log = { version = "0.4.6", features = ["serde"] }
127127
rayon = "1.1.0"
128128
rustc_version_runtime = "0.1"
129-
sentry = "0.15.4"
129+
sentry = { version = "0.15.4", optional = true }
130130
winit = { version = "0.19", features = ["serde", "icon_loading"] }
131131
serde = { version = "1.0", features = ["derive"] }
132132
palette = { version = "0.4", features = ["serde"] }

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ $ pacman -Sy grep gcc pkgconfig openssl alsa-lib cmake make python3 freetype2 aw
138138
### Fedora
139139

140140
```
141-
# dnf install pkgconfig gcc openssl-devel alsa-lib-devel cmake make gcc-c++ freetype-devel expat-devel libxcb-devel
141+
# dnf install pkgconfig gcc openssl-devel alsa-lib-devel cmake make gcc-c++ freetype-devel expat-devel libxcb-devel libX11-devel
142142
```
143143

144144
### openSUSE

amethyst_animation/Cargo.toml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "amethyst_animation"
3-
version = "0.6.0"
3+
version = "0.7.0"
44
authors = ["Simon Rönnberg <[email protected]>"]
55
edition = "2018"
66
description = "Animation support for Amethyst"
@@ -14,18 +14,16 @@ readme = "README.md"
1414
license = "MIT/Apache-2.0"
1515

1616
[badges]
17-
appveyor = { repository = "amethyst/amethyst", branch = "master" }
1817
travis-ci = { repository = "amethyst/amethyst" }
1918

2019
[dependencies]
21-
amethyst_assets = { path = "../amethyst_assets/", version = "0.7.0" }
22-
amethyst_core = { path = "../amethyst_core/", version = "0.6.0" }
23-
amethyst_error = { path = "../amethyst_error/", version = "0.1.0" }
24-
amethyst_derive = { path = "../amethyst_derive", version = "0.4.0" }
25-
amethyst_rendy = { path = "../amethyst_rendy", version = "0.1.0" }
20+
amethyst_assets = { path = "../amethyst_assets/", version = "0.8.0" }
21+
amethyst_core = { path = "../amethyst_core/", version = "0.7.0" }
22+
amethyst_error = { path = "../amethyst_error/", version = "0.2.0" }
23+
amethyst_derive = { path = "../amethyst_derive", version = "0.5.0" }
24+
amethyst_rendy = { path = "../amethyst_rendy", version = "0.2.0" }
2625
derivative = "1.0"
2726
fnv = "1"
28-
hibitset = { version = "0.5.1", features = ["parallel"] }
2927
itertools = "0.7.8"
3028
log = "0.4.6"
3129
minterpolate = { version = "0.4", features = ["serde"] }
@@ -38,4 +36,4 @@ thread_profiler = { version = "0.3", optional = true }
3836
[features]
3937
profiler = [ "thread_profiler/thread_profiler" ]
4038
nightly = [ "amethyst_core/nightly" ]
41-
float64 = ["amethyst_core/float64"]
39+
float64 = ["amethyst_core/float64"]

amethyst_animation/src/bundle.rs

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
use crate::{
22
resources::AnimationSampling,
3-
skinning::VertexSkinningSystem,
3+
skinning::VertexSkinningSystemDesc,
44
systems::{
5-
AnimationControlSystem, AnimationProcessor, SamplerInterpolationSystem, SamplerProcessor,
5+
AnimationControlSystemDesc, AnimationProcessor, SamplerInterpolationSystem,
6+
SamplerProcessor,
67
},
78
};
89
use amethyst_core::{
9-
ecs::prelude::{Component, DispatcherBuilder},
10-
SystemBundle,
10+
ecs::prelude::{Component, DispatcherBuilder, World},
11+
SystemBundle, SystemDesc,
1112
};
1213
use amethyst_error::Error;
1314
use std::{hash::Hash, marker};
@@ -35,9 +36,13 @@ impl<'a> VertexSkinningBundle<'a> {
3536
}
3637

3738
impl<'a, 'b, 'c> SystemBundle<'a, 'b> for VertexSkinningBundle<'c> {
38-
fn build(self, builder: &mut DispatcherBuilder<'a, 'b>) -> Result<(), Error> {
39+
fn build(
40+
self,
41+
world: &mut World,
42+
builder: &mut DispatcherBuilder<'a, 'b>,
43+
) -> Result<(), Error> {
3944
builder.add(
40-
VertexSkinningSystem::new(),
45+
VertexSkinningSystemDesc::default().build(world),
4146
"vertex_skinning_system",
4247
self.dep,
4348
);
@@ -85,7 +90,11 @@ impl<'a, 'b, 'c, T> SystemBundle<'a, 'b> for SamplingBundle<'c, T>
8590
where
8691
T: AnimationSampling + Component,
8792
{
88-
fn build(self, builder: &mut DispatcherBuilder<'a, 'b>) -> Result<(), Error> {
93+
fn build(
94+
self,
95+
_world: &mut World,
96+
builder: &mut DispatcherBuilder<'a, 'b>,
97+
) -> Result<(), Error> {
8998
builder.add(SamplerProcessor::<T::Primitive>::new(), "", &[]);
9099
builder.add(SamplerInterpolationSystem::<T>::new(), self.name, self.dep);
91100
Ok(())
@@ -140,15 +149,19 @@ where
140149
I: PartialEq + Eq + Hash + Copy + Send + Sync + 'static,
141150
T: AnimationSampling + Component + Clone,
142151
{
143-
fn build(self, builder: &mut DispatcherBuilder<'a, 'b>) -> Result<(), Error> {
152+
fn build(
153+
self,
154+
world: &mut World,
155+
builder: &mut DispatcherBuilder<'a, 'b>,
156+
) -> Result<(), Error> {
144157
builder.add(AnimationProcessor::<T>::new(), "", &[]);
145158
builder.add(
146-
AnimationControlSystem::<I, T>::new(),
159+
AnimationControlSystemDesc::<I, T>::default().build(world),
147160
self.animation_name,
148161
self.dep,
149162
);
150163
SamplingBundle::<T>::new(self.sampling_name)
151164
.with_dep(&[self.animation_name])
152-
.build(builder)
165+
.build(world, builder)
153166
}
154167
}

amethyst_animation/src/skinning/resources.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
use derivative::Derivative;
2-
use hibitset::BitSet;
32
use serde::{Deserialize, Serialize};
43

54
use amethyst_assets::{PrefabData, ProgressCounter};
65
use amethyst_core::{
7-
ecs::prelude::{Component, DenseVecStorage, Entity, WriteStorage},
6+
ecs::{
7+
hibitset::BitSet,
8+
prelude::{Component, DenseVecStorage, Entity, WriteStorage},
9+
},
810
math::Matrix4,
911
};
1012
use amethyst_derive::PrefabData;

amethyst_animation/src/skinning/systems.rs

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
use amethyst_core::{
22
ecs::prelude::{
3-
BitSet, ComponentEvent, Join, ReadStorage, ReaderId, Resources, System, WriteStorage,
3+
BitSet, ComponentEvent, Join, ReadStorage, ReaderId, System, SystemData, World,
4+
WriteStorage,
45
},
56
math::{convert, Matrix4},
6-
Transform,
7+
SystemDesc, Transform,
78
};
89
use amethyst_rendy::skinning::JointTransforms;
910

@@ -14,22 +15,40 @@ use thread_profiler::profile_scope;
1415

1516
use super::resources::*;
1617

18+
/// Builds a `VertexSkinningSystem`.
19+
#[derive(Default, Debug)]
20+
pub struct VertexSkinningSystemDesc;
21+
22+
impl<'a, 'b> SystemDesc<'a, 'b, VertexSkinningSystem> for VertexSkinningSystemDesc {
23+
fn build(self, world: &mut World) -> VertexSkinningSystem {
24+
<VertexSkinningSystem as System<'_>>::SystemData::setup(world);
25+
let mut transform = WriteStorage::<Transform>::fetch(&world);
26+
let updated_id = transform.register_reader();
27+
28+
VertexSkinningSystem::new(updated_id)
29+
}
30+
}
31+
1732
/// System for performing vertex skinning.
1833
///
1934
/// Needs to run after global transforms have been updated for the current frame.
20-
#[derive(Default, Debug)]
35+
#[derive(Debug)]
2136
pub struct VertexSkinningSystem {
2237
/// Also scratch space, used while determining which skins need to be updated.
2338
updated: BitSet,
2439
updated_skins: BitSet,
2540
/// Used for tracking modifications to global transforms
26-
updated_id: Option<ReaderId<ComponentEvent>>,
41+
updated_id: ReaderId<ComponentEvent>,
2742
}
2843

2944
impl VertexSkinningSystem {
3045
/// Creates a new `VertexSkinningSystem`
31-
pub fn new() -> Self {
32-
Self::default()
46+
pub fn new(updated_id: ReaderId<ComponentEvent>) -> Self {
47+
Self {
48+
updated: BitSet::default(),
49+
updated_skins: BitSet::default(),
50+
updated_id,
51+
}
3352
}
3453
}
3554

@@ -49,9 +68,7 @@ impl<'a> System<'a> for VertexSkinningSystem {
4968

5069
global_transforms
5170
.channel()
52-
.read(self.updated_id.as_mut().expect(
53-
"`VertexSkinningSystem::setup` was not called before `VertexSkinningSystem::run`",
54-
))
71+
.read(&mut self.updated_id)
5572
.for_each(|event| match event {
5673
ComponentEvent::Inserted(id) | ComponentEvent::Modified(id) => {
5774
self.updated.add(*id);
@@ -126,11 +143,4 @@ impl<'a> System<'a> for VertexSkinningSystem {
126143
}
127144
}
128145
}
129-
130-
fn setup(&mut self, res: &mut Resources) {
131-
use amethyst_core::ecs::prelude::SystemData;
132-
Self::SystemData::setup(res);
133-
let mut transform = WriteStorage::<Transform>::fetch(res);
134-
self.updated_id = Some(transform.register_reader());
135-
}
136146
}

amethyst_animation/src/systems/control.rs

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
use std::{hash::Hash, marker, time::Duration};
1+
use std::{
2+
hash::Hash,
3+
marker::{self, PhantomData},
4+
time::Duration,
5+
};
26

7+
use derivative::Derivative;
38
use fnv::FnvHashMap;
49
use log::error;
510
use minterpolate::InterpolationPrimitive;
611

712
use amethyst_assets::{AssetStorage, Handle};
813
use amethyst_core::{
914
ecs::prelude::{
10-
Component, Entities, Entity, Join, Read, ReadStorage, Resources, System, SystemData,
15+
Component, Entities, Entity, Join, Read, ReadStorage, System, SystemData, World,
1116
WriteStorage,
1217
},
1318
timing::secs_to_duration,
19+
SystemDesc,
1420
};
1521

1622
use crate::resources::{
@@ -22,6 +28,27 @@ use crate::resources::{
2228
#[cfg(feature = "profiler")]
2329
use thread_profiler::profile_scope;
2430

31+
/// Builds an `AnimationControlSystem`.
32+
#[derive(Derivative, Debug)]
33+
#[derivative(Default(bound = ""))]
34+
pub struct AnimationControlSystemDesc<I, T> {
35+
marker: PhantomData<(I, T)>,
36+
}
37+
38+
impl<'a, 'b, I, T> SystemDesc<'a, 'b, AnimationControlSystem<I, T>>
39+
for AnimationControlSystemDesc<I, T>
40+
where
41+
I: Copy + Eq + Hash + Send + Sync + 'static,
42+
T: AnimationSampling + Component + Clone,
43+
{
44+
fn build(self, world: &mut World) -> AnimationControlSystem<I, T> {
45+
<AnimationControlSystem<I, T> as System<'_>>::SystemData::setup(world);
46+
ReadStorage::<AnimationSet<I, T>>::setup(world);
47+
48+
AnimationControlSystem::new()
49+
}
50+
}
51+
2552
/// System for setting up animations, should run before `SamplerInterpolationSystem`.
2653
///
2754
/// Will process all active `AnimationControl` + `AnimationHierarchy`, and do processing of the
@@ -47,7 +74,8 @@ where
4774

4875
impl<I, T> AnimationControlSystem<I, T>
4976
where
50-
I: Eq + Hash,
77+
I: PartialEq + Eq + Hash + Copy + Send + Sync + 'static,
78+
T: AnimationSampling + Component + Clone,
5179
{
5280
/// Creates a new `AnimationControlSystem`
5381
pub fn new() -> Self {
@@ -212,11 +240,6 @@ where
212240
controls.remove(entity);
213241
}
214242
}
215-
216-
fn setup(&mut self, res: &mut Resources) {
217-
Self::SystemData::setup(res);
218-
ReadStorage::<AnimationSet<I, T>>::setup(res);
219-
}
220243
}
221244

222245
fn get_running_duration<T>(

amethyst_animation/src/systems/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ use amethyst_assets::Processor;
22

33
use crate::resources::{Animation, Sampler};
44

5-
pub use self::{control::AnimationControlSystem, sampling::SamplerInterpolationSystem};
5+
pub use self::{
6+
control::{AnimationControlSystem, AnimationControlSystemDesc},
7+
sampling::SamplerInterpolationSystem,
8+
};
69

710
mod control;
811
mod sampling;

0 commit comments

Comments
 (0)