1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/// The per-vertex deltas of one blend shape target (expression morph).
///
/// Position deltas are mandatory; normal and tangent deltas are optional
/// (the runtime falls back to the base attributes when absent).
#[derive(Debug, Clone)]
pub struct MorphTarget {
position_deltas: Vec<[f32; 3]>,
normal_deltas: Option<Vec<[f32; 3]>>,
tangent_deltas: Option<Vec<[f32; 3]>>,
}
impl MorphTarget {
pub(crate) fn new(
position_deltas: Vec<[f32; 3]>,
normal_deltas: Option<Vec<[f32; 3]>>,
tangent_deltas: Option<Vec<[f32; 3]>>,
) -> Self {
Self {
position_deltas,
normal_deltas,
tangent_deltas,
}
}
/// Returns the position delta for every base vertex.
pub fn position_deltas(&self) -> &[[f32; 3]] {
&self.position_deltas
}
/// Returns optional normal deltas aligned with the base vertices.
pub fn normal_deltas(&self) -> Option<&[[f32; 3]]> {
self.normal_deltas.as_deref()
}
/// Returns optional tangent deltas aligned with the base vertices.
pub fn tangent_deltas(&self) -> Option<&[[f32; 3]]> {
self.tangent_deltas.as_deref()
}
}