summaryrefslogtreecommitdiff
path: root/world/src
diff options
context:
space:
mode:
Diffstat (limited to 'world/src')
-rw-r--r--world/src/main.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/world/src/main.rs b/world/src/main.rs
index a56ea74..16ed941 100644
--- a/world/src/main.rs
+++ b/world/src/main.rs
@@ -170,9 +170,18 @@ fn main() -> Result<()> {
let mut name = Vec::new();
let mut parent_pre_map = Vec::new();
let mut transform = Vec::new();
+ let mut rest = Vec::new();
for skin in gltf.skins() {
+ let mut inverse_bind_mat = skin
+ .reader(|buf| Some(&buffers[buf.index()]))
+ .read_inverse_bind_matrices();
for (j_ind, j) in skin.joints().enumerate() {
+ let ibm = if let Some(x) = &mut inverse_bind_mat {
+ Some(x.next().unwrap())
+ } else {
+ None
+ };
let a_ind = match joint_index_to_arm_index.get(&j.index()) {
Some(i) => *i,
None => {
@@ -185,6 +194,10 @@ fn main() -> Result<()> {
.find(|n| n.children().any(|c| c.index() == j.index()))
.map(|n| n.index()),
);
+ rest.push(
+ ibm.map(|a| transform_to_affine(Transform::Matrix { matrix: a }))
+ .unwrap_or(Affine3A::IDENTITY),
+ );
joint_index_to_arm_index.insert(j.index(), a_ind);
a_ind
@@ -218,6 +231,7 @@ fn main() -> Result<()> {
name: Some(name),
parent: Some(parent),
transform: Some(transform),
+ rest_transform: Some(rest),
}
};