diff options
author | Marcel Admiraal <madmiraal@users.noreply.github.com> | 2021-01-20 07:02:02 +0000 |
---|---|---|
committer | Marcel Admiraal <madmiraal@users.noreply.github.com> | 2021-06-04 18:14:32 +0100 |
commit | 8acd13a456050ded00f0f264ff0aa91a304f6c54 (patch) | |
tree | 1cfac709a27ff9e08302269dfaf41ae4edd5e142 /scene | |
parent | 766c6dbb24c736eb1e24ca69eb15398eac654c2c (diff) |
Rename Quat to Quaternion
Diffstat (limited to 'scene')
-rw-r--r-- | scene/animation/animation_cache.cpp | 2 | ||||
-rw-r--r-- | scene/animation/animation_player.cpp | 4 | ||||
-rw-r--r-- | scene/animation/animation_player.h | 2 | ||||
-rw-r--r-- | scene/animation/animation_tree.cpp | 12 | ||||
-rw-r--r-- | scene/animation/animation_tree.h | 2 | ||||
-rw-r--r-- | scene/animation/tween.cpp | 14 | ||||
-rw-r--r-- | scene/resources/animation.cpp | 34 | ||||
-rw-r--r-- | scene/resources/animation.h | 14 |
8 files changed, 42 insertions, 42 deletions
diff --git a/scene/animation/animation_cache.cpp b/scene/animation/animation_cache.cpp index 9b0414c688..b8980fd56b 100644 --- a/scene/animation/animation_cache.cpp +++ b/scene/animation/animation_cache.cpp @@ -236,7 +236,7 @@ void AnimationCache::set_all(float p_time, float p_delta) { switch (animation->track_get_type(i)) { case Animation::TYPE_TRANSFORM3D: { Vector3 loc, scale; - Quat rot; + Quaternion rot; animation->transform_track_interpolate(i, p_time, &loc, &rot, &scale); Transform3D tr(Basis(rot), loc); tr.basis.scale(scale); diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 540a822486..2d565fc47a 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -377,7 +377,7 @@ void AnimationPlayer::_animation_process_animation(AnimationData *p_anim, float } Vector3 loc; - Quat rot; + Quaternion rot; Vector3 scale; Error err = a->transform_track_interpolate(i, p_time, &loc, &rot, &scale); @@ -850,7 +850,7 @@ void AnimationPlayer::_animation_update_transforms() { ERR_CONTINUE(nc->accum_pass != accum_pass); t.origin = nc->loc_accum; - t.basis.set_quat_scale(nc->rot_accum, nc->scale_accum); + t.basis.set_quaternion_scale(nc->rot_accum, nc->scale_accum); #ifndef _3D_DISABLED if (nc->skeleton && nc->bone_idx >= 0) { nc->skeleton->set_bone_pose(nc->bone_idx, t); diff --git a/scene/animation/animation_player.h b/scene/animation/animation_player.h index 8086b544f0..7922635438 100644 --- a/scene/animation/animation_player.h +++ b/scene/animation/animation_player.h @@ -102,7 +102,7 @@ private: // accumulated transforms Vector3 loc_accum; - Quat rot_accum; + Quaternion rot_accum; Vector3 scale_accum; uint64_t accum_pass = 0; diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index 728b4688f0..7369713e69 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -853,7 +853,7 @@ void AnimationTree::_process_graph(float p_delta) { if (t->process_pass != process_pass) { t->process_pass = process_pass; t->loc = Vector3(); - t->rot = Quat(); + t->rot = Quaternion(); t->rot_blend_accum = 0; t->scale = Vector3(1, 1, 1); } @@ -868,7 +868,7 @@ void AnimationTree::_process_graph(float p_delta) { } Vector3 loc[2]; - Quat rot[2]; + Quaternion rot[2]; Vector3 scale[2]; if (prev_time > time) { @@ -881,7 +881,7 @@ void AnimationTree::_process_graph(float p_delta) { t->loc += (loc[1] - loc[0]) * blend; t->scale += (scale[1] - scale[0]) * blend; - Quat q = Quat().slerp(rot[0].normalized().inverse() * rot[1].normalized(), blend).normalized(); + Quaternion q = Quaternion().slerp(rot[0].normalized().inverse() * rot[1].normalized(), blend).normalized(); t->rot = (t->rot * q).normalized(); prev_time = 0; @@ -896,14 +896,14 @@ void AnimationTree::_process_graph(float p_delta) { t->loc += (loc[1] - loc[0]) * blend; t->scale += (scale[1] - scale[0]) * blend; - Quat q = Quat().slerp(rot[0].normalized().inverse() * rot[1].normalized(), blend).normalized(); + Quaternion q = Quaternion().slerp(rot[0].normalized().inverse() * rot[1].normalized(), blend).normalized(); t->rot = (t->rot * q).normalized(); prev_time = 0; } else { Vector3 loc; - Quat rot; + Quaternion rot; Vector3 scale; Error err = a->transform_track_interpolate(i, time, &loc, &rot, &scale); @@ -1197,7 +1197,7 @@ void AnimationTree::_process_graph(float p_delta) { Transform3D xform; xform.origin = t->loc; - xform.basis.set_quat_scale(t->rot, t->scale); + xform.basis.set_quaternion_scale(t->rot, t->scale); if (t->root_motion) { root_motion_transform = xform; diff --git a/scene/animation/animation_tree.h b/scene/animation/animation_tree.h index 4f1aad3a6c..60e0c7200a 100644 --- a/scene/animation/animation_tree.h +++ b/scene/animation/animation_tree.h @@ -190,7 +190,7 @@ private: #endif // _3D_DISABLED int bone_idx = -1; Vector3 loc; - Quat rot; + Quaternion rot; float rot_blend_accum = 0.0; Vector3 scale; diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp index 3a3bae085b..b4e597f75e 100644 --- a/scene/animation/tween.cpp +++ b/scene/animation/tween.cpp @@ -519,11 +519,11 @@ Variant Tween::_run_equation(InterpolateData &p_data) { result = r; } break; - case Variant::QUAT: { + case Variant::QUATERNION: { // Get the quaternian for the initial and delta values - Quat i = initial_val; - Quat d = delta_val; - Quat r; + Quaternion i = initial_val; + Quaternion d = delta_val; + Quaternion r; // Execute the equation on the quaternian values and mutate the r quaternian // This uses the custom APPLY_EQUATION macro defined above @@ -1202,9 +1202,9 @@ bool Tween::_calc_delta_val(const Variant &p_initial_val, const Variant &p_final delta_val = d; } break; - case Variant::QUAT: + case Variant::QUATERNION: // Convert to quaternianls and find the delta - delta_val = final_val.operator Quat() - initial_val.operator Quat(); + delta_val = final_val.operator Quaternion() - initial_val.operator Quaternion(); break; case Variant::AABB: { @@ -1266,7 +1266,7 @@ bool Tween::_calc_delta_val(const Variant &p_initial_val, const Variant &p_final Variant::RECT2, Variant::VECTOR3, Variant::TRANSFORM2D, - Variant::QUAT, + Variant::QUATERNION, Variant::AABB, Variant::BASIS, Variant::TRANSFORM3D, diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp index 6e6fa7ec24..640ec50eb9 100644 --- a/scene/resources/animation.cpp +++ b/scene/resources/animation.cpp @@ -361,7 +361,7 @@ bool Animation::_get(const StringName &p_name, Variant &r_ret) const { int idx = 0; for (int i = 0; i < track_get_key_count(track); i++) { Vector3 loc; - Quat rot; + Quaternion rot; Vector3 scale; transform_track_get_key(track, i, &loc, &rot, &scale); @@ -773,7 +773,7 @@ void Animation::_clear(T &p_keys) { p_keys.clear(); } -Error Animation::transform_track_get_key(int p_track, int p_key, Vector3 *r_loc, Quat *r_rot, Vector3 *r_scale) const { +Error Animation::transform_track_get_key(int p_track, int p_key, Vector3 *r_loc, Quaternion *r_rot, Vector3 *r_scale) const { ERR_FAIL_INDEX_V(p_track, tracks.size(), ERR_INVALID_PARAMETER); Track *t = tracks[p_track]; @@ -794,7 +794,7 @@ Error Animation::transform_track_get_key(int p_track, int p_key, Vector3 *r_loc, return OK; } -int Animation::transform_track_insert_key(int p_track, float p_time, const Vector3 &p_loc, const Quat &p_rot, const Vector3 &p_scale) { +int Animation::transform_track_insert_key(int p_track, float p_time, const Vector3 &p_loc, const Quaternion &p_rot, const Vector3 &p_scale) { ERR_FAIL_INDEX_V(p_track, tracks.size(), -1); Track *t = tracks[p_track]; ERR_FAIL_COND_V(t->type != TYPE_TRANSFORM3D, -1); @@ -958,7 +958,7 @@ void Animation::track_insert_key(int p_track, float p_time, const Variant &p_key loc = d["location"]; } - Quat rot; + Quaternion rot; if (d.has("rotation")) { rot = d["rotation"]; } @@ -1462,7 +1462,7 @@ Vector3 Animation::_interpolate(const Vector3 &p_a, const Vector3 &p_b, float p_ return p_a.lerp(p_b, p_c); } -Quat Animation::_interpolate(const Quat &p_a, const Quat &p_b, float p_c) const { +Quaternion Animation::_interpolate(const Quaternion &p_a, const Quaternion &p_b, float p_c) const { return p_a.slerp(p_b, p_c); } @@ -1490,7 +1490,7 @@ Vector3 Animation::_cubic_interpolate(const Vector3 &p_pre_a, const Vector3 &p_a return p_a.cubic_interpolate(p_b, p_pre_a, p_post_b, p_c); } -Quat Animation::_cubic_interpolate(const Quat &p_pre_a, const Quat &p_a, const Quat &p_b, const Quat &p_post_b, float p_c) const { +Quaternion Animation::_cubic_interpolate(const Quaternion &p_pre_a, const Quaternion &p_a, const Quaternion &p_b, const Quaternion &p_post_b, float p_c) const { return p_a.cubic_slerp(p_b, p_pre_a, p_post_b, p_c); } @@ -1555,11 +1555,11 @@ Variant Animation::_cubic_interpolate(const Variant &p_pre_a, const Variant &p_a return a.cubic_interpolate(b, pa, pb, p_c); } - case Variant::QUAT: { - Quat a = p_a; - Quat b = p_b; - Quat pa = p_pre_a; - Quat pb = p_post_b; + case Variant::QUATERNION: { + Quaternion a = p_a; + Quaternion b = p_b; + Quaternion pa = p_pre_a; + Quaternion pb = p_post_b; return a.cubic_slerp(b, pa, pb, p_c); } @@ -1728,7 +1728,7 @@ T Animation::_interpolate(const Vector<TKey<T>> &p_keys, float p_time, Interpola // do a barrel roll } -Error Animation::transform_track_interpolate(int p_track, float p_time, Vector3 *r_loc, Quat *r_rot, Vector3 *r_scale) const { +Error Animation::transform_track_interpolate(int p_track, float p_time, Vector3 *r_loc, Quaternion *r_rot, Vector3 *r_scale) const { ERR_FAIL_INDEX_V(p_track, tracks.size(), ERR_INVALID_PARAMETER); Track *t = tracks[p_track]; ERR_FAIL_COND_V(t->type != TYPE_TRANSFORM3D, ERR_INVALID_PARAMETER); @@ -2751,9 +2751,9 @@ bool Animation::_transform_track_optimize_key(const TKey<TransformKey> &t0, cons { //rotation - const Quat &q0 = t0.value.rot; - const Quat &q1 = t1.value.rot; - const Quat &q2 = t2.value.rot; + const Quaternion &q0 = t0.value.rot; + const Quaternion &q1 = t1.value.rot; + const Quaternion &q2 = t2.value.rot; //localize both to rotation from q0 @@ -2763,8 +2763,8 @@ bool Animation::_transform_track_optimize_key(const TKey<TransformKey> &t0, cons } } else { - Quat r02 = (q0.inverse() * q2).normalized(); - Quat r01 = (q0.inverse() * q1).normalized(); + Quaternion r02 = (q0.inverse() * q2).normalized(); + Quaternion r01 = (q0.inverse() * q1).normalized(); Vector3 v02, v01; real_t a02, a01; diff --git a/scene/resources/animation.h b/scene/resources/animation.h index bfcb33af40..1484007333 100644 --- a/scene/resources/animation.h +++ b/scene/resources/animation.h @@ -88,7 +88,7 @@ private: struct TransformKey { Vector3 loc; - Quat rot; + Quaternion rot; Vector3 scale; }; @@ -186,13 +186,13 @@ private: _FORCE_INLINE_ Animation::TransformKey _interpolate(const Animation::TransformKey &p_a, const Animation::TransformKey &p_b, float p_c) const; _FORCE_INLINE_ Vector3 _interpolate(const Vector3 &p_a, const Vector3 &p_b, float p_c) const; - _FORCE_INLINE_ Quat _interpolate(const Quat &p_a, const Quat &p_b, float p_c) const; + _FORCE_INLINE_ Quaternion _interpolate(const Quaternion &p_a, const Quaternion &p_b, float p_c) const; _FORCE_INLINE_ Variant _interpolate(const Variant &p_a, const Variant &p_b, float p_c) const; _FORCE_INLINE_ float _interpolate(const float &p_a, const float &p_b, float p_c) const; _FORCE_INLINE_ Animation::TransformKey _cubic_interpolate(const Animation::TransformKey &p_pre_a, const Animation::TransformKey &p_a, const Animation::TransformKey &p_b, const Animation::TransformKey &p_post_b, float p_c) const; _FORCE_INLINE_ Vector3 _cubic_interpolate(const Vector3 &p_pre_a, const Vector3 &p_a, const Vector3 &p_b, const Vector3 &p_post_b, float p_c) const; - _FORCE_INLINE_ Quat _cubic_interpolate(const Quat &p_pre_a, const Quat &p_a, const Quat &p_b, const Quat &p_post_b, float p_c) const; + _FORCE_INLINE_ Quaternion _cubic_interpolate(const Quaternion &p_pre_a, const Quaternion &p_a, const Quaternion &p_b, const Quaternion &p_post_b, float p_c) const; _FORCE_INLINE_ Variant _cubic_interpolate(const Variant &p_pre_a, const Variant &p_a, const Variant &p_b, const Variant &p_post_b, float p_c) const; _FORCE_INLINE_ float _cubic_interpolate(const float &p_pre_a, const float &p_a, const float &p_b, const float &p_post_b, float p_c) const; @@ -213,7 +213,7 @@ private: private: Array _transform_track_interpolate(int p_track, float p_time) const { Vector3 loc; - Quat rot; + Quaternion rot; Vector3 scale; transform_track_interpolate(p_track, p_time, &loc, &rot, &scale); Array ret; @@ -291,8 +291,8 @@ public: float track_get_key_time(int p_track, int p_key_idx) const; float track_get_key_transition(int p_track, int p_key_idx) const; - int transform_track_insert_key(int p_track, float p_time, const Vector3 &p_loc, const Quat &p_rot = Quat(), const Vector3 &p_scale = Vector3()); - Error transform_track_get_key(int p_track, int p_key, Vector3 *r_loc, Quat *r_rot, Vector3 *r_scale) const; + int transform_track_insert_key(int p_track, float p_time, const Vector3 &p_loc, const Quaternion &p_rot = Quaternion(), const Vector3 &p_scale = Vector3()); + Error transform_track_get_key(int p_track, int p_key, Vector3 *r_loc, Quaternion *r_rot, Vector3 *r_scale) const; void track_set_interpolation_type(int p_track, InterpolationType p_interp); InterpolationType track_get_interpolation_type(int p_track) const; @@ -321,7 +321,7 @@ public: void track_set_interpolation_loop_wrap(int p_track, bool p_enable); bool track_get_interpolation_loop_wrap(int p_track) const; - Error transform_track_interpolate(int p_track, float p_time, Vector3 *r_loc, Quat *r_rot, Vector3 *r_scale) const; + Error transform_track_interpolate(int p_track, float p_time, Vector3 *r_loc, Quaternion *r_rot, Vector3 *r_scale) const; Variant value_track_interpolate(int p_track, float p_time) const; void value_track_get_key_indices(int p_track, float p_time, float p_delta, List<int> *p_indices) const; |