Skip to content

Commit c4d033d

Browse files
authored
Merge pull request #114 from SlimeYummy/change/demos
change demos
2 parents 49d302b + 2aaaf01 commit c4d033d

File tree

3 files changed

+41
-50
lines changed

3 files changed

+41
-50
lines changed

demo/src/blend.rs

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ pub struct OzzBlend {
1717
spine_trans: Vec<OzzTransform>,
1818
}
1919

20-
unsafe impl Send for OzzBlend {}
21-
unsafe impl Sync for OzzBlend {}
22-
2320
impl OzzBlend {
2421
pub async fn new() -> Box<dyn OzzExample> {
2522
let ((mut ar_skeleton, mut ar_animation1), (mut ar_animation2, mut ar_animation3)) = try_zip(
@@ -40,7 +37,7 @@ impl OzzBlend {
4037
let animation2 = Arc::new(Animation::from_archive(&mut ar_animation2).unwrap());
4138
let animation3 = Arc::new(Animation::from_archive(&mut ar_animation3).unwrap());
4239

43-
let mut ob = OzzBlend {
40+
let mut o = OzzBlend {
4441
skeleton: skeleton.clone(),
4542
sample_job1: SamplingJob::default(),
4643
sample_job2: SamplingJob::default(),
@@ -52,40 +49,40 @@ impl OzzBlend {
5249
spine_trans: Vec::new(),
5350
};
5451

55-
ob.sample_job1.set_animation(animation1.clone());
56-
ob.sample_job1
52+
o.sample_job1.set_animation(animation1.clone());
53+
o.sample_job1
5754
.set_context(SamplingContext::new(animation1.num_tracks()));
5855
let sample_out1 = Arc::new(RwLock::new(vec![SoaTransform::default(); skeleton.num_soa_joints()]));
59-
ob.sample_job1.set_output(sample_out1.clone());
56+
o.sample_job1.set_output(sample_out1.clone());
6057

61-
ob.sample_job2.set_animation(animation2.clone());
62-
ob.sample_job2
58+
o.sample_job2.set_animation(animation2.clone());
59+
o.sample_job2
6360
.set_context(SamplingContext::new(animation2.num_tracks()));
6461
let sample_out2 = Arc::new(RwLock::new(vec![SoaTransform::default(); skeleton.num_soa_joints()]));
65-
ob.sample_job2.set_output(sample_out2.clone());
62+
o.sample_job2.set_output(sample_out2.clone());
6663

67-
ob.sample_job3.set_animation(animation3.clone());
68-
ob.sample_job3
64+
o.sample_job3.set_animation(animation3.clone());
65+
o.sample_job3
6966
.set_context(SamplingContext::new(animation3.num_tracks()));
7067
let sample_out3 = Arc::new(RwLock::new(vec![SoaTransform::default(); skeleton.num_soa_joints()]));
71-
ob.sample_job3.set_output(sample_out3.clone());
68+
o.sample_job3.set_output(sample_out3.clone());
7269

73-
ob.blending_job.set_skeleton(skeleton.clone());
70+
o.blending_job.set_skeleton(skeleton.clone());
7471
let blending_out = Arc::new(RwLock::new(vec![SoaTransform::default(); skeleton.num_soa_joints()]));
75-
ob.blending_job.set_output(blending_out.clone());
76-
ob.blending_job
72+
o.blending_job.set_output(blending_out.clone());
73+
o.blending_job
7774
.layers_mut()
7875
.push(BlendingLayer::new(sample_out1.clone()));
79-
ob.blending_job
76+
o.blending_job
8077
.layers_mut()
8178
.push(BlendingLayer::new(sample_out2.clone()));
82-
ob.blending_job
79+
o.blending_job
8380
.layers_mut()
8481
.push(BlendingLayer::new(sample_out3.clone()));
8582

86-
ob.l2m_job.set_skeleton(skeleton.clone());
87-
ob.l2m_job.set_input(blending_out.clone());
88-
ob.l2m_job.set_output(ob.models.clone());
83+
o.l2m_job.set_skeleton(skeleton.clone());
84+
o.l2m_job.set_input(blending_out.clone());
85+
o.l2m_job.set_output(o.models.clone());
8986

9087
let mut bone_count = 0;
9188
let mut spine_count = 0;
@@ -101,9 +98,9 @@ impl OzzBlend {
10198
}
10299
}
103100

104-
ob.bone_trans.reserve(bone_count);
105-
ob.spine_trans.reserve(spine_count);
106-
Box::new(ob)
101+
o.bone_trans.reserve(bone_count);
102+
o.spine_trans.reserve(spine_count);
103+
Box::new(o)
107104
}
108105
}
109106

demo/src/playback.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ pub struct OzzPlayback {
1414
spine_trans: Vec<OzzTransform>,
1515
}
1616

17-
unsafe impl Send for OzzPlayback {}
18-
unsafe impl Sync for OzzPlayback {}
19-
2017
impl OzzPlayback {
2118
pub async fn new() -> Box<dyn OzzExample> {
2219
let (mut ar_skeleton, mut ar_animation) = try_zip(
@@ -29,7 +26,7 @@ impl OzzPlayback {
2926
let skeleton = Arc::new(Skeleton::from_archive(&mut ar_skeleton).unwrap());
3027
let animation = Arc::new(Animation::from_archive(&mut ar_animation).unwrap());
3128

32-
let mut oc = OzzPlayback {
29+
let mut o = OzzPlayback {
3330
skeleton: skeleton.clone(),
3431
sample_job: SamplingJob::default(),
3532
l2m_job: LocalToModelJob::default(),
@@ -38,14 +35,14 @@ impl OzzPlayback {
3835
spine_trans: Vec::new(),
3936
};
4037

41-
oc.sample_job.set_animation(animation.clone());
42-
oc.sample_job.set_context(SamplingContext::new(animation.num_tracks()));
38+
o.sample_job.set_animation(animation.clone());
39+
o.sample_job.set_context(SamplingContext::new(animation.num_tracks()));
4340
let sample_out = Arc::new(RwLock::new(vec![SoaTransform::default(); skeleton.num_soa_joints()]));
44-
oc.sample_job.set_output(sample_out.clone());
41+
o.sample_job.set_output(sample_out.clone());
4542

46-
oc.l2m_job.set_skeleton(skeleton.clone());
47-
oc.l2m_job.set_input(sample_out.clone());
48-
oc.l2m_job.set_output(oc.models.clone());
43+
o.l2m_job.set_skeleton(skeleton.clone());
44+
o.l2m_job.set_input(sample_out.clone());
45+
o.l2m_job.set_output(o.models.clone());
4946

5047
let mut bone_count = 0;
5148
let mut spine_count = 0;
@@ -61,9 +58,9 @@ impl OzzPlayback {
6158
}
6259
}
6360

64-
oc.bone_trans.reserve(bone_count);
65-
oc.spine_trans.reserve(spine_count);
66-
Box::new(oc)
61+
o.bone_trans.reserve(bone_count);
62+
o.spine_trans.reserve(spine_count);
63+
Box::new(o)
6764
}
6865
}
6966

demo/src/two_bone_ik.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,13 @@ pub struct OzzTwoBoneIK {
1919
spine_trans: Vec<OzzTransform>,
2020
}
2121

22-
unsafe impl Send for OzzTwoBoneIK {}
23-
unsafe impl Sync for OzzTwoBoneIK {}
24-
2522
impl OzzTwoBoneIK {
2623
pub async fn new() -> Box<dyn OzzExample> {
2724
let mut ar_skeleton = load_archive("/two_bone_ik/skeleton.ozz").await.unwrap();
2825

2926
let skeleton = Arc::new(Skeleton::from_archive(&mut ar_skeleton).unwrap());
3027

31-
let mut oc = OzzTwoBoneIK {
28+
let mut o = OzzTwoBoneIK {
3229
skeleton: skeleton.clone(),
3330
l2m_job1: LocalToModelJob::default(),
3431
ik_job: IKTwoBoneJob::default(),
@@ -40,13 +37,13 @@ impl OzzTwoBoneIK {
4037
spine_trans: Vec::new(),
4138
};
4239

43-
oc.l2m_job1.set_skeleton(skeleton.clone());
44-
oc.l2m_job1.set_input(oc.locals.clone());
45-
oc.l2m_job1.set_output(oc.models1.clone());
40+
o.l2m_job1.set_skeleton(skeleton.clone());
41+
o.l2m_job1.set_input(o.locals.clone());
42+
o.l2m_job1.set_output(o.models1.clone());
4643

47-
oc.l2m_job2.set_skeleton(skeleton.clone());
48-
oc.l2m_job2.set_input(oc.locals.clone());
49-
oc.l2m_job2.set_output(oc.models2.clone());
44+
o.l2m_job2.set_skeleton(skeleton.clone());
45+
o.l2m_job2.set_input(o.locals.clone());
46+
o.l2m_job2.set_output(o.models2.clone());
5047

5148
let mut bone_count = 0;
5249
let mut spine_count = 0;
@@ -62,9 +59,9 @@ impl OzzTwoBoneIK {
6259
}
6360
}
6461

65-
oc.bone_trans.reserve(bone_count);
66-
oc.spine_trans.reserve(spine_count);
67-
Box::new(oc)
62+
o.bone_trans.reserve(bone_count);
63+
o.spine_trans.reserve(spine_count);
64+
Box::new(o)
6865
}
6966
}
7067

0 commit comments

Comments
 (0)