diff options
author | reduz <reduzio@gmail.com> | 2021-10-21 13:38:20 -0300 |
---|---|---|
committer | reduz <reduzio@gmail.com> | 2021-10-25 14:34:00 -0300 |
commit | d03b7fbe090dca1f9ea4190116ac0efbee37e929 (patch) | |
tree | 5d7db71d15925908cf87483526e6716cba0bef65 /tests | |
parent | 5ff0624a073fe580b7f26b94f6e242462b67bc2a (diff) |
Refactored Node3D rotation modes
* Made the Basis euler orders indexed via enum.
* Node3D has a new rotation_order property to choose Euler rotation order.
* Node3D has also a rotation_mode property to choose between Euler, Quaternion and Basis
Exposing these modes as well as the order makes Godot a lot friendlier for animators, which can choose the best way to interpolate rotations.
The new *Basis* mode makes the (exposed) transform property obsolete, so it was removed (can still be accessed by code of course).
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_basis.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/test_basis.h b/tests/test_basis.h index 11c68f9eb7..b254d9fb7f 100644 --- a/tests/test_basis.h +++ b/tests/test_basis.h @@ -60,27 +60,27 @@ Basis EulerToBasis(RotOrder mode, const Vector3 &p_rotation) { Basis ret; switch (mode) { case EulerXYZ: - ret.set_euler_xyz(p_rotation); + ret.set_euler(p_rotation, Basis::EULER_ORDER_XYZ); break; case EulerXZY: - ret.set_euler_xzy(p_rotation); + ret.set_euler(p_rotation, Basis::EULER_ORDER_XZY); break; case EulerYZX: - ret.set_euler_yzx(p_rotation); + ret.set_euler(p_rotation, Basis::EULER_ORDER_YZX); break; case EulerYXZ: - ret.set_euler_yxz(p_rotation); + ret.set_euler(p_rotation, Basis::EULER_ORDER_YXZ); break; case EulerZXY: - ret.set_euler_zxy(p_rotation); + ret.set_euler(p_rotation, Basis::EULER_ORDER_ZXY); break; case EulerZYX: - ret.set_euler_zyx(p_rotation); + ret.set_euler(p_rotation, Basis::EULER_ORDER_ZYX); break; default: @@ -94,22 +94,22 @@ Basis EulerToBasis(RotOrder mode, const Vector3 &p_rotation) { Vector3 BasisToEuler(RotOrder mode, const Basis &p_rotation) { switch (mode) { case EulerXYZ: - return p_rotation.get_euler_xyz(); + return p_rotation.get_euler(Basis::EULER_ORDER_XYZ); case EulerXZY: - return p_rotation.get_euler_xzy(); + return p_rotation.get_euler(Basis::EULER_ORDER_XZY); case EulerYZX: - return p_rotation.get_euler_yzx(); + return p_rotation.get_euler(Basis::EULER_ORDER_YZX); case EulerYXZ: - return p_rotation.get_euler_yxz(); + return p_rotation.get_euler(Basis::EULER_ORDER_YXZ); case EulerZXY: - return p_rotation.get_euler_zxy(); + return p_rotation.get_euler(Basis::EULER_ORDER_ZXY); case EulerZYX: - return p_rotation.get_euler_zyx(); + return p_rotation.get_euler(Basis::EULER_ORDER_ZYX); default: // If you land here, Please integrate all rotation orders. @@ -170,9 +170,9 @@ void test_rotation(Vector3 deg_original_euler, RotOrder rot_order) { CHECK_MESSAGE((res.get_axis(2) - Vector3(0.0, 0.0, 1.0)).length() <= 0.1, vformat("Fail due to Z %s\n", String(res.get_axis(2))).utf8().ptr()); // Double check `to_rotation` decomposing with XYZ rotation order. - const Vector3 euler_xyz_from_rotation = to_rotation.get_euler_xyz(); + const Vector3 euler_xyz_from_rotation = to_rotation.get_euler(Basis::EULER_ORDER_XYZ); Basis rotation_from_xyz_computed_euler; - rotation_from_xyz_computed_euler.set_euler_xyz(euler_xyz_from_rotation); + rotation_from_xyz_computed_euler.set_euler(euler_xyz_from_rotation, Basis::EULER_ORDER_XYZ); res = to_rotation.inverse() * rotation_from_xyz_computed_euler; |