Skip to content

Commit

Permalink
Go back to glam 0.27
Browse files Browse the repository at this point in the history
  • Loading branch information
FastestMolasses committed Aug 29, 2024
1 parent 6a74dce commit fb10a6d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 23,7 @@ nodejs = ["wasm", "dep:js-sys", "dep:wasm-bindgen"]
[dependencies]
bimap = { version = "0.6" }
bytecheck = { version = "0.6", optional = true, default-features = false }
glam = { version = "0.29", features = [ "core-simd", "libm" ] }
glam = { version = "0.27", features = [ "core-simd", "libm" ] }
js-sys = { version = "0.3", optional = true }
rkyv = { version = "0.7", optional = true, features = [ "validation" ] }
serde = { version= "1.0", optional = true, features = [ "serde_derive" ] }
Expand Down
6 changes: 3 additions & 3 deletions demo/src/playback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,22 113,22 @@ impl OzzExample for OzzPlayback {
let bone_rot = Quat::from_mat3(&Mat3::from_cols(bone_dir, bone_rot_y, bone_rot_z));

self.bone_trans.push(OzzTransform {
scale: scale,
scale,
rotation: bone_rot,
position: parent_pos,
});

let parent_rot = Quat::from_mat4(parent);
self.spine_trans.push(OzzTransform {
scale: scale,
scale,
rotation: parent_rot,
position: parent_pos,
});

if self.skeleton.is_leaf(i as i16) {
let current_rot = Quat::from_mat4(current);
self.spine_trans.push(OzzTransform {
scale: scale,
scale,
rotation: current_rot,
position: current_pos,
});
Expand Down
6 changes: 3 additions & 3 deletions demo/src/two_bone_ik.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,22 169,22 @@ impl OzzExample for OzzTwoBoneIK {
let bone_rot = Quat::from_mat3(&Mat3::from_cols(bone_dir, bone_rot_y, bone_rot_z));

self.bone_trans.push(OzzTransform {
scale: scale,
scale,
rotation: bone_rot,
position: parent_pos,
});

let parent_rot = Quat::from_mat4(parent);
self.spine_trans.push(OzzTransform {
scale: scale,
scale,
rotation: parent_rot,
position: parent_pos,
});

if self.skeleton.is_leaf(i as i16) {
let current_rot = Quat::from_mat4(current);
self.spine_trans.push(OzzTransform {
scale: scale,
scale,
rotation: current_rot,
position: current_pos,
});
Expand Down
17 changes: 11 additions & 6 deletions src/ik_two_bone_job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 487,7 @@ impl IKTwoBoneJob {
#[cfg(test)]
mod ik_two_bone_tests {
use core::f32::consts;
use glam::Vec3;
use glam::{Vec3, Vec4};
use wasm_bindgen_test::*;

use super::*;
Expand All @@ -504,6 504,11 @@ mod ik_two_bone_tests {
assert!(job.validate());
}

#[inline(always)]
fn vec4_to_vec3a(v: Vec4) -> Vec3A {
Vec3A::new(v[0], v[1], v[2])
}

#[test]
#[wasm_bindgen_test]
fn test_start_joint_correction() {
Expand All @@ -512,8 517,8 @@ mod ik_two_bone_tests {
Mat4::from_rotation_translation(Quat::from_axis_angle(Vec3::Z, core::f32::consts::FRAC_PI_2), Vec3::Y);
let base_end = Mat4::from_translation(Vec3::X Vec3::Y);
let mid_axis = Vec3A::cross(
Vec3A::from_vec4(base_start.col(3)) - Vec3A::from_vec4(base_mid.col(3)),
Vec3A::from_vec4(base_end.col(3)) - Vec3A::from_vec4(base_mid.col(3)),
vec4_to_vec3a(base_start.col(3)) - vec4_to_vec3a(base_mid.col(3)),
vec4_to_vec3a(base_end.col(3)) - vec4_to_vec3a(base_mid.col(3)),
);

let parents = [
Expand Down Expand Up @@ -586,8 591,8 @@ mod ik_two_bone_tests {
let mid = Mat4::from_rotation_translation(Quat::from_axis_angle(Vec3::Z, consts::FRAC_PI_2), Vec3::Y);
let end = Mat4::from_translation(Vec3::X Vec3::Y);
let mid_axis = Vec3A::cross(
Vec3A::from_vec4(start.col(3)) - Vec3A::from_vec4(mid.col(3)),
Vec3A::from_vec4(end.col(3)) - Vec3A::from_vec4(mid.col(3)),
vec4_to_vec3a(start.col(3)) - vec4_to_vec3a(mid.col(3)),
vec4_to_vec3a(end.col(3)) - vec4_to_vec3a(mid.col(3)),
);

let mut job = IKTwoBoneJob::default();
Expand Down Expand Up @@ -975,7 980,7 @@ mod ik_two_bone_tests {
let end = Mat4::from_translation(Vec3::X Vec3::Y);

let mut job = IKTwoBoneJob::default();
job.set_target(Vec3A::from_vec4(start.col(3)));
job.set_target(vec4_to_vec3a(start.col(3)));
job.set_start_joint(start);
job.set_mid_joint(mid);
job.set_end_joint(end);
Expand Down

0 comments on commit fb10a6d

Please sign in to comment.