summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/core_constants.cpp2
-rw-r--r--core/io/marshalls.cpp8
-rw-r--r--core/io/packed_data_container.cpp2
-rw-r--r--core/io/resource_format_binary.cpp12
-rw-r--r--core/math/basis.cpp38
-rw-r--r--core/math/basis.h20
-rw-r--r--core/math/math_fieldwise.cpp4
-rw-r--r--core/math/quaternion.cpp (renamed from core/math/quat.cpp)68
-rw-r--r--core/math/quaternion.h (renamed from core/math/quat.h)106
-rw-r--r--core/math/transform_3d.cpp6
-rw-r--r--core/variant/method_ptrcall.h2
-rw-r--r--core/variant/type_info.h2
-rw-r--r--core/variant/typed_array.h4
-rw-r--r--core/variant/variant.cpp81
-rw-r--r--core/variant/variant.h10
-rw-r--r--core/variant/variant_call.cpp30
-rw-r--r--core/variant/variant_construct.cpp18
-rw-r--r--core/variant/variant_internal.h32
-rw-r--r--core/variant/variant_op.cpp42
-rw-r--r--core/variant/variant_parser.cpp10
-rw-r--r--core/variant/variant_setget.cpp32
-rw-r--r--doc/classes/@GlobalScope.xml4
-rw-r--r--doc/classes/Animation.xml4
-rw-r--r--doc/classes/Basis.xml10
-rw-r--r--doc/classes/Quaternion.xml (renamed from doc/classes/Quat.xml)90
-rw-r--r--doc/classes/Vector3.xml2
-rw-r--r--doc/classes/float.xml6
-rw-r--r--doc/classes/int.xml4
-rw-r--r--editor/animation_track_editor.cpp18
-rw-r--r--editor/connections_dialog.cpp6
-rw-r--r--editor/editor_properties.cpp24
-rw-r--r--editor/editor_properties.h6
-rw-r--r--editor/editor_properties_array_dict.cpp4
-rw-r--r--editor/import/editor_import_collada.cpp4
-rw-r--r--editor/import/resource_importer_scene.cpp8
-rw-r--r--editor/property_editor.cpp12
-rw-r--r--modules/fbx/data/pivot_transform.cpp24
-rw-r--r--modules/fbx/data/pivot_transform.h12
-rw-r--r--modules/fbx/editor_scene_importer_fbx.cpp50
-rw-r--r--modules/fbx/tools/import_utils.cpp4
-rw-r--r--modules/fbx/tools/import_utils.h4
-rw-r--r--modules/gdnative/gdnative/quaternion.cpp (renamed from modules/gdnative/gdnative/quat.cpp)24
-rw-r--r--modules/gdnative/gdnative/variant.cpp12
-rw-r--r--modules/gdnative/gdnative_api.json28
-rw-r--r--modules/gdnative/include/gdnative/gdnative.h4
-rw-r--r--modules/gdnative/include/gdnative/quaternion.h (renamed from modules/gdnative/include/gdnative/quat.h)26
-rw-r--r--modules/gdnative/include/gdnative/variant.h8
-rw-r--r--modules/gdscript/gdscript_analyzer.cpp4
-rw-r--r--modules/gdscript/gdscript_byte_codegen.cpp8
-rw-r--r--modules/gdscript/gdscript_disassembler.cpp4
-rw-r--r--modules/gdscript/gdscript_function.h4
-rw-r--r--modules/gdscript/gdscript_parser.cpp2
-rw-r--r--modules/gdscript/gdscript_vm.cpp12
-rw-r--r--modules/gltf/doc_classes/GLTFNode.xml2
-rw-r--r--modules/gltf/gltf_animation.h2
-rw-r--r--modules/gltf/gltf_document.cpp100
-rw-r--r--modules/gltf/gltf_document.h6
-rw-r--r--modules/gltf/gltf_node.cpp6
-rw-r--r--modules/gltf/gltf_node.h6
-rw-r--r--modules/mobile_vr/mobile_vr_interface.cpp4
-rw-r--r--modules/mono/csharp_script.cpp2
-rw-r--r--modules/mono/editor/bindings_generator.cpp14
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs66
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs (renamed from modules/mono/glue/GodotSharp/GodotSharp/Core/Quat.cs)100
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs12
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj2
-rw-r--r--modules/mono/mono_gd/gd_mono_cache.cpp4
-rw-r--r--modules/mono/mono_gd/gd_mono_cache.h2
-rw-r--r--modules/mono/mono_gd/gd_mono_field.cpp8
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.cpp20
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.h24
-rw-r--r--modules/visual_script/visual_script_editor.cpp4
-rw-r--r--modules/visual_script/visual_script_nodes.cpp2
-rw-r--r--platform/windows/godot.natvis8
-rw-r--r--scene/animation/animation_cache.cpp2
-rw-r--r--scene/animation/animation_player.cpp4
-rw-r--r--scene/animation/animation_player.h2
-rw-r--r--scene/animation/animation_tree.cpp12
-rw-r--r--scene/animation/animation_tree.h2
-rw-r--r--scene/animation/tween.cpp14
-rw-r--r--scene/resources/animation.cpp34
-rw-r--r--scene/resources/animation.h14
-rw-r--r--servers/physics_3d/joints/cone_twist_joint_3d_sw.cpp2
-rw-r--r--servers/physics_3d/joints/hinge_joint_3d_sw.cpp2
-rw-r--r--servers/rendering/renderer_rd/renderer_storage_rd.cpp4
-rw-r--r--tests/test_class_db.h2
-rw-r--r--tests/test_macros.h2
-rw-r--r--tests/test_math.cpp8
-rw-r--r--tests/test_validate_testing.h2
89 files changed, 730 insertions, 731 deletions
diff --git a/core/core_constants.cpp b/core/core_constants.cpp
index 30c2ed80ac..7fc09fc3a6 100644
--- a/core/core_constants.cpp
+++ b/core/core_constants.cpp
@@ -580,7 +580,7 @@ void register_global_constants() {
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR3I", Variant::VECTOR3I);
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_TRANSFORM2D", Variant::TRANSFORM2D);
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_PLANE", Variant::PLANE);
- BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_QUAT", Variant::QUAT);
+ BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_QUATERNION", Variant::QUATERNION);
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_AABB", Variant::AABB);
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_BASIS", Variant::BASIS);
BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_TRANSFORM3D", Variant::TRANSFORM3D);
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index de32ffbcdc..b1988d6f2a 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -279,9 +279,9 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
}
} break;
- case Variant::QUAT: {
+ case Variant::QUATERNION: {
ERR_FAIL_COND_V(len < 4 * 4, ERR_INVALID_DATA);
- Quat val;
+ Quaternion val;
val.x = decode_float(&buf[0]);
val.y = decode_float(&buf[4]);
val.z = decode_float(&buf[8]);
@@ -1099,9 +1099,9 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
r_len += 4 * 4;
} break;
- case Variant::QUAT: {
+ case Variant::QUATERNION: {
if (buf) {
- Quat q = p_variant;
+ Quaternion q = p_variant;
encode_float(q.x, &buf[0]);
encode_float(q.y, &buf[4]);
encode_float(q.z, &buf[8]);
diff --git a/core/io/packed_data_container.cpp b/core/io/packed_data_container.cpp
index 7565e8e01a..cf6a0b6027 100644
--- a/core/io/packed_data_container.cpp
+++ b/core/io/packed_data_container.cpp
@@ -227,7 +227,7 @@ uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &tmpd
case Variant::VECTOR3:
case Variant::TRANSFORM2D:
case Variant::PLANE:
- case Variant::QUAT:
+ case Variant::QUATERNION:
case Variant::AABB:
case Variant::BASIS:
case Variant::TRANSFORM3D:
diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp
index 59474a5bc5..385f15c0cf 100644
--- a/core/io/resource_format_binary.cpp
+++ b/core/io/resource_format_binary.cpp
@@ -51,7 +51,7 @@ enum {
VARIANT_RECT2 = 11,
VARIANT_VECTOR3 = 12,
VARIANT_PLANE = 13,
- VARIANT_QUAT = 14,
+ VARIANT_QUATERNION = 14,
VARIANT_AABB = 15,
VARIANT_MATRIX3 = 16,
VARIANT_TRANSFORM = 17,
@@ -199,8 +199,8 @@ Error ResourceLoaderBinary::parse_variant(Variant &r_v) {
v.d = f->get_real();
r_v = v;
} break;
- case VARIANT_QUAT: {
- Quat v;
+ case VARIANT_QUATERNION: {
+ Quaternion v;
v.x = f->get_real();
v.y = f->get_real();
v.z = f->get_real();
@@ -1371,9 +1371,9 @@ void ResourceFormatSaverBinaryInstance::write_variant(FileAccess *f, const Varia
f->store_real(val.d);
} break;
- case Variant::QUAT: {
- f->store_32(VARIANT_QUAT);
- Quat val = p_property;
+ case Variant::QUATERNION: {
+ f->store_32(VARIANT_QUATERNION);
+ Quaternion val = p_property;
f->store_real(val.x);
f->store_real(val.y);
f->store_real(val.z);
diff --git a/core/math/basis.cpp b/core/math/basis.cpp
index 037378b9d7..7489da34d9 100644
--- a/core/math/basis.cpp
+++ b/core/math/basis.cpp
@@ -345,12 +345,12 @@ void Basis::rotate(const Vector3 &p_euler) {
*this = rotated(p_euler);
}
-Basis Basis::rotated(const Quat &p_quat) const {
- return Basis(p_quat) * (*this);
+Basis Basis::rotated(const Quaternion &p_quaternion) const {
+ return Basis(p_quaternion) * (*this);
}
-void Basis::rotate(const Quat &p_quat) {
- *this = rotated(p_quat);
+void Basis::rotate(const Quaternion &p_quaternion) {
+ *this = rotated(p_quaternion);
}
Vector3 Basis::get_rotation_euler() const {
@@ -367,7 +367,7 @@ Vector3 Basis::get_rotation_euler() const {
return m.get_euler();
}
-Quat Basis::get_rotation_quat() const {
+Quaternion Basis::get_rotation_quaternion() const {
// Assumes that the matrix can be decomposed into a proper rotation and scaling matrix as M = R.S,
// and returns the Euler angles corresponding to the rotation part, complementing get_scale().
// See the comment in get_scale() for further information.
@@ -378,7 +378,7 @@ Quat Basis::get_rotation_quat() const {
m.scale(Vector3(-1, -1, -1));
}
- return m.get_quat();
+ return m.get_quaternion();
}
void Basis::get_rotation_axis_angle(Vector3 &p_axis, real_t &p_angle) const {
@@ -770,9 +770,9 @@ Basis::operator String() const {
return mtx;
}
-Quat Basis::get_quat() const {
+Quaternion Basis::get_quaternion() const {
#ifdef MATH_CHECKS
- ERR_FAIL_COND_V_MSG(!is_rotation(), Quat(), "Basis must be normalized in order to be casted to a Quaternion. Use get_rotation_quat() or call orthonormalized() instead.");
+ ERR_FAIL_COND_V_MSG(!is_rotation(), Quaternion(), "Basis must be normalized in order to be casted to a Quaternion. Use get_rotation_quaternion() or call orthonormalized() instead.");
#endif
/* Allow getting a quaternion from an unnormalized transform */
Basis m = *this;
@@ -803,7 +803,7 @@ Quat Basis::get_quat() const {
temp[k] = (m.elements[k][i] + m.elements[i][k]) * s;
}
- return Quat(temp[0], temp[1], temp[2], temp[3]);
+ return Quaternion(temp[0], temp[1], temp[2], temp[3]);
}
static const Basis _ortho_bases[24] = {
@@ -945,13 +945,13 @@ void Basis::get_axis_angle(Vector3 &r_axis, real_t &r_angle) const {
r_angle = angle;
}
-void Basis::set_quat(const Quat &p_quat) {
- real_t d = p_quat.length_squared();
+void Basis::set_quaternion(const Quaternion &p_quaternion) {
+ real_t d = p_quaternion.length_squared();
real_t s = 2.0 / d;
- real_t xs = p_quat.x * s, ys = p_quat.y * s, zs = p_quat.z * s;
- real_t wx = p_quat.w * xs, wy = p_quat.w * ys, wz = p_quat.w * zs;
- real_t xx = p_quat.x * xs, xy = p_quat.x * ys, xz = p_quat.x * zs;
- real_t yy = p_quat.y * ys, yz = p_quat.y * zs, zz = p_quat.z * zs;
+ real_t xs = p_quaternion.x * s, ys = p_quaternion.y * s, zs = p_quaternion.z * s;
+ real_t wx = p_quaternion.w * xs, wy = p_quaternion.w * ys, wz = p_quaternion.w * zs;
+ real_t xx = p_quaternion.x * xs, xy = p_quaternion.x * ys, xz = p_quaternion.x * zs;
+ real_t yy = p_quaternion.y * ys, yz = p_quaternion.y * zs, zz = p_quaternion.z * zs;
set(1.0 - (yy + zz), xy - wz, xz + wy,
xy + wz, 1.0 - (xx + zz), yz - wx,
xz - wy, yz + wx, 1.0 - (xx + yy));
@@ -997,9 +997,9 @@ void Basis::set_euler_scale(const Vector3 &p_euler, const Vector3 &p_scale) {
rotate(p_euler);
}
-void Basis::set_quat_scale(const Quat &p_quat, const Vector3 &p_scale) {
+void Basis::set_quaternion_scale(const Quaternion &p_quaternion, const Vector3 &p_scale) {
set_diagonal(p_scale);
- rotate(p_quat);
+ rotate(p_quaternion);
}
void Basis::set_diagonal(const Vector3 &p_diag) {
@@ -1018,8 +1018,8 @@ void Basis::set_diagonal(const Vector3 &p_diag) {
Basis Basis::slerp(const Basis &p_to, const real_t &p_weight) const {
//consider scale
- Quat from(*this);
- Quat to(p_to);
+ Quaternion from(*this);
+ Quaternion to(p_to);
Basis b(from.slerp(to, p_weight));
b.elements[0] *= Math::lerp(elements[0].length(), p_to.elements[0].length(), p_weight);
diff --git a/core/math/basis.h b/core/math/basis.h
index 56f6227313..3736047dd3 100644
--- a/core/math/basis.h
+++ b/core/math/basis.h
@@ -31,7 +31,7 @@
#ifndef BASIS_H
#define BASIS_H
-#include "core/math/quat.h"
+#include "core/math/quaternion.h"
#include "core/math/vector3.h"
class Basis {
@@ -79,13 +79,13 @@ public:
void rotate(const Vector3 &p_euler);
Basis rotated(const Vector3 &p_euler) const;
- void rotate(const Quat &p_quat);
- Basis rotated(const Quat &p_quat) const;
+ void rotate(const Quaternion &p_quaternion);
+ Basis rotated(const Quaternion &p_quaternion) const;
Vector3 get_rotation_euler() const;
void get_rotation_axis_angle(Vector3 &p_axis, real_t &p_angle) const;
void get_rotation_axis_angle_local(Vector3 &p_axis, real_t &p_angle) const;
- Quat get_rotation_quat() const;
+ Quaternion get_rotation_quaternion() const;
Vector3 get_rotation() const { return get_rotation_euler(); };
Vector3 rotref_posscale_decomposition(Basis &rotref) const;
@@ -108,8 +108,8 @@ public:
Vector3 get_euler_zyx() const;
void set_euler_zyx(const Vector3 &p_euler);
- Quat get_quat() const;
- void set_quat(const Quat &p_quat);
+ Quaternion get_quaternion() const;
+ void set_quaternion(const Quaternion &p_quaternion);
Vector3 get_euler() const { return get_euler_yxz(); }
void set_euler(const Vector3 &p_euler) { set_euler_yxz(p_euler); }
@@ -132,7 +132,7 @@ public:
void set_axis_angle_scale(const Vector3 &p_axis, real_t p_phi, const Vector3 &p_scale);
void set_euler_scale(const Vector3 &p_euler, const Vector3 &p_scale);
- void set_quat_scale(const Quat &p_quat, const Vector3 &p_scale);
+ void set_quaternion_scale(const Quaternion &p_quaternion, const Vector3 &p_scale);
// transposed dot products
_FORCE_INLINE_ real_t tdotx(const Vector3 &v) const {
@@ -240,10 +240,10 @@ public:
#endif
Basis diagonalize();
- operator Quat() const { return get_quat(); }
+ operator Quaternion() const { return get_quaternion(); }
- Basis(const Quat &p_quat) { set_quat(p_quat); };
- Basis(const Quat &p_quat, const Vector3 &p_scale) { set_quat_scale(p_quat, p_scale); }
+ Basis(const Quaternion &p_quaternion) { set_quaternion(p_quaternion); };
+ Basis(const Quaternion &p_quaternion, const Vector3 &p_scale) { set_quaternion_scale(p_quaternion, p_scale); }
Basis(const Vector3 &p_euler) { set_euler(p_euler); }
Basis(const Vector3 &p_euler, const Vector3 &p_scale) { set_euler_scale(p_euler, p_scale); }
diff --git a/core/math/math_fieldwise.cpp b/core/math/math_fieldwise.cpp
index f2baef1a59..570c57e254 100644
--- a/core/math/math_fieldwise.cpp
+++ b/core/math/math_fieldwise.cpp
@@ -88,8 +88,8 @@ Variant fieldwise_assign(const Variant &p_target, const Variant &p_source, const
return target;
}
- case Variant::QUAT: {
- SETUP_TYPE(Quat)
+ case Variant::QUATERNION: {
+ SETUP_TYPE(Quaternion)
/**/ TRY_TRANSFER_FIELD("x", x)
else TRY_TRANSFER_FIELD("y", y)
diff --git a/core/math/quat.cpp b/core/math/quaternion.cpp
index 3982a0b993..8de3d0cc2a 100644
--- a/core/math/quat.cpp
+++ b/core/math/quaternion.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* quat.cpp */
+/* quaternion.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "quat.h"
+#include "quaternion.h"
#include "core/math/basis.h"
#include "core/string/print_string.h"
@@ -37,7 +37,7 @@
// (ax,ay,az), where ax is the angle of rotation around x axis,
// and similar for other axes.
// This implementation uses XYZ convention (Z is the first rotation).
-Vector3 Quat::get_euler_xyz() const {
+Vector3 Quaternion::get_euler_xyz() const {
Basis m(*this);
return m.get_euler_xyz();
}
@@ -46,7 +46,7 @@ Vector3 Quat::get_euler_xyz() const {
// (ax,ay,az), where ax is the angle of rotation around x axis,
// and similar for other axes.
// This implementation uses YXZ convention (Z is the first rotation).
-Vector3 Quat::get_euler_yxz() const {
+Vector3 Quaternion::get_euler_yxz() const {
#ifdef MATH_CHECKS
ERR_FAIL_COND_V_MSG(!is_normalized(), Vector3(0, 0, 0), "The quaternion must be normalized.");
#endif
@@ -54,7 +54,7 @@ Vector3 Quat::get_euler_yxz() const {
return m.get_euler_yxz();
}
-void Quat::operator*=(const Quat &p_q) {
+void Quaternion::operator*=(const Quaternion &p_q) {
real_t xx = w * p_q.x + x * p_q.w + y * p_q.z - z * p_q.y;
real_t yy = w * p_q.y + y * p_q.w + z * p_q.x - x * p_q.z;
real_t zz = w * p_q.z + z * p_q.w + x * p_q.y - y * p_q.x;
@@ -64,45 +64,45 @@ void Quat::operator*=(const Quat &p_q) {
z = zz;
}
-Quat Quat::operator*(const Quat &p_q) const {
- Quat r = *this;
+Quaternion Quaternion::operator*(const Quaternion &p_q) const {
+ Quaternion r = *this;
r *= p_q;
return r;
}
-bool Quat::is_equal_approx(const Quat &p_quat) const {
- return Math::is_equal_approx(x, p_quat.x) && Math::is_equal_approx(y, p_quat.y) && Math::is_equal_approx(z, p_quat.z) && Math::is_equal_approx(w, p_quat.w);
+bool Quaternion::is_equal_approx(const Quaternion &p_quaternion) const {
+ return Math::is_equal_approx(x, p_quaternion.x) && Math::is_equal_approx(y, p_quaternion.y) && Math::is_equal_approx(z, p_quaternion.z) && Math::is_equal_approx(w, p_quaternion.w);
}
-real_t Quat::length() const {
+real_t Quaternion::length() const {
return Math::sqrt(length_squared());
}
-void Quat::normalize() {
+void Quaternion::normalize() {
*this /= length();
}
-Quat Quat::normalized() const {
+Quaternion Quaternion::normalized() const {
return *this / length();
}
-bool Quat::is_normalized() const {
+bool Quaternion::is_normalized() const {
return Math::is_equal_approx(length_squared(), 1, (real_t)UNIT_EPSILON); //use less epsilon
}
-Quat Quat::inverse() const {
+Quaternion Quaternion::inverse() const {
#ifdef MATH_CHECKS
- ERR_FAIL_COND_V_MSG(!is_normalized(), Quat(), "The quaternion must be normalized.");
+ ERR_FAIL_COND_V_MSG(!is_normalized(), Quaternion(), "The quaternion must be normalized.");
#endif
- return Quat(-x, -y, -z, w);
+ return Quaternion(-x, -y, -z, w);
}
-Quat Quat::slerp(const Quat &p_to, const real_t &p_weight) const {
+Quaternion Quaternion::slerp(const Quaternion &p_to, const real_t &p_weight) const {
#ifdef MATH_CHECKS
- ERR_FAIL_COND_V_MSG(!is_normalized(), Quat(), "The start quaternion must be normalized.");
- ERR_FAIL_COND_V_MSG(!p_to.is_normalized(), Quat(), "The end quaternion must be normalized.");
+ ERR_FAIL_COND_V_MSG(!is_normalized(), Quaternion(), "The start quaternion must be normalized.");
+ ERR_FAIL_COND_V_MSG(!p_to.is_normalized(), Quaternion(), "The end quaternion must be normalized.");
#endif
- Quat to1;
+ Quaternion to1;
real_t omega, cosom, sinom, scale0, scale1;
// calc cosine
@@ -137,19 +137,19 @@ Quat Quat::slerp(const Quat &p_to, const real_t &p_weight) const {
scale1 = p_weight;
}
// calculate final values
- return Quat(
+ return Quaternion(
scale0 * x + scale1 * to1.x,
scale0 * y + scale1 * to1.y,
scale0 * z + scale1 * to1.z,
scale0 * w + scale1 * to1.w);
}
-Quat Quat::slerpni(const Quat &p_to, const real_t &p_weight) const {
+Quaternion Quaternion::slerpni(const Quaternion &p_to, const real_t &p_weight) const {
#ifdef MATH_CHECKS
- ERR_FAIL_COND_V_MSG(!is_normalized(), Quat(), "The start quaternion must be normalized.");
- ERR_FAIL_COND_V_MSG(!p_to.is_normalized(), Quat(), "The end quaternion must be normalized.");
+ ERR_FAIL_COND_V_MSG(!is_normalized(), Quaternion(), "The start quaternion must be normalized.");
+ ERR_FAIL_COND_V_MSG(!p_to.is_normalized(), Quaternion(), "The end quaternion must be normalized.");
#endif
- const Quat &from = *this;
+ const Quaternion &from = *this;
real_t dot = from.dot(p_to);
@@ -162,29 +162,29 @@ Quat Quat::slerpni(const Quat &p_to, const real_t &p_weight) const {
newFactor = Math::sin(p_weight * theta) * sinT,
invFactor = Math::sin((1.0 - p_weight) * theta) * sinT;
- return Quat(invFactor * from.x + newFactor * p_to.x,
+ return Quaternion(invFactor * from.x + newFactor * p_to.x,
invFactor * from.y + newFactor * p_to.y,
invFactor * from.z + newFactor * p_to.z,
invFactor * from.w + newFactor * p_to.w);
}
-Quat Quat::cubic_slerp(const Quat &p_b, const Quat &p_pre_a, const Quat &p_post_b, const real_t &p_weight) const {
+Quaternion Quaternion::cubic_slerp(const Quaternion &p_b, const Quaternion &p_pre_a, const Quaternion &p_post_b, const real_t &p_weight) const {
#ifdef MATH_CHECKS
- ERR_FAIL_COND_V_MSG(!is_normalized(), Quat(), "The start quaternion must be normalized.");
- ERR_FAIL_COND_V_MSG(!p_b.is_normalized(), Quat(), "The end quaternion must be normalized.");
+ ERR_FAIL_COND_V_MSG(!is_normalized(), Quaternion(), "The start quaternion must be normalized.");
+ ERR_FAIL_COND_V_MSG(!p_b.is_normalized(), Quaternion(), "The end quaternion must be normalized.");
#endif
//the only way to do slerp :|
real_t t2 = (1.0 - p_weight) * p_weight * 2;
- Quat sp = this->slerp(p_b, p_weight);
- Quat sq = p_pre_a.slerpni(p_post_b, p_weight);
+ Quaternion sp = this->slerp(p_b, p_weight);
+ Quaternion sq = p_pre_a.slerpni(p_post_b, p_weight);
return sp.slerpni(sq, t2);
}
-Quat::operator String() const {
+Quaternion::operator String() const {
return String::num(x) + ", " + String::num(y) + ", " + String::num(z) + ", " + String::num(w);
}
-Quat::Quat(const Vector3 &p_axis, real_t p_angle) {
+Quaternion::Quaternion(const Vector3 &p_axis, real_t p_angle) {
#ifdef MATH_CHECKS
ERR_FAIL_COND_MSG(!p_axis.is_normalized(), "The axis Vector3 must be normalized.");
#endif
@@ -209,7 +209,7 @@ Quat::Quat(const Vector3 &p_axis, real_t p_angle) {
// (ax, ay, az), where ax is the angle of rotation around x axis,
// and similar for other axes.
// This implementation uses YXZ convention (Z is the first rotation).
-Quat::Quat(const Vector3 &p_euler) {
+Quaternion::Quaternion(const Vector3 &p_euler) {
real_t half_a1 = p_euler.y * 0.5;
real_t half_a2 = p_euler.x * 0.5;
real_t half_a3 = p_euler.z * 0.5;
diff --git a/core/math/quat.h b/core/math/quaternion.h
index d9b130c050..796214b79e 100644
--- a/core/math/quat.h
+++ b/core/math/quaternion.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* quat.h */
+/* quaternion.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -36,7 +36,7 @@
#include "core/math/vector3.h"
#include "core/string/ustring.h"
-class Quat {
+class Quaternion {
public:
union {
struct {
@@ -55,21 +55,21 @@ public:
return components[idx];
}
_FORCE_INLINE_ real_t length_squared() const;
- bool is_equal_approx(const Quat &p_quat) const;
+ bool is_equal_approx(const Quaternion &p_quaternion) const;
real_t length() const;
void normalize();
- Quat normalized() const;
+ Quaternion normalized() const;
bool is_normalized() const;
- Quat inverse() const;
- _FORCE_INLINE_ real_t dot(const Quat &p_q) const;
+ Quaternion inverse() const;
+ _FORCE_INLINE_ real_t dot(const Quaternion &p_q) const;
Vector3 get_euler_xyz() const;
Vector3 get_euler_yxz() const;
Vector3 get_euler() const { return get_euler_yxz(); };
- Quat slerp(const Quat &p_to, const real_t &p_weight) const;
- Quat slerpni(const Quat &p_to, const real_t &p_weight) const;
- Quat cubic_slerp(const Quat &p_b, const Quat &p_pre_a, const Quat &p_post_b, const real_t &p_weight) const;
+ Quaternion slerp(const Quaternion &p_to, const real_t &p_weight) const;
+ Quaternion slerpni(const Quaternion &p_to, const real_t &p_weight) const;
+ Quaternion cubic_slerp(const Quaternion &p_b, const Quaternion &p_pre_a, const Quaternion &p_post_b, const real_t &p_weight) const;
_FORCE_INLINE_ void get_axis_angle(Vector3 &r_axis, real_t &r_angle) const {
r_angle = 2 * Math::acos(w);
@@ -79,11 +79,11 @@ public:
r_axis.z = z * r;
}
- void operator*=(const Quat &p_q);
- Quat operator*(const Quat &p_q) const;
+ void operator*=(const Quaternion &p_q);
+ Quaternion operator*(const Quaternion &p_q) const;
- Quat operator*(const Vector3 &v) const {
- return Quat(w * v.x + y * v.z - z * v.y,
+ Quaternion operator*(const Vector3 &v) const {
+ return Quaternion(w * v.x + y * v.z - z * v.y,
w * v.y + z * v.x - x * v.z,
w * v.z + x * v.y - y * v.x,
-x * v.x - y * v.y - z * v.z);
@@ -102,42 +102,42 @@ public:
return inverse().xform(v);
}
- _FORCE_INLINE_ void operator+=(const Quat &p_q);
- _FORCE_INLINE_ void operator-=(const Quat &p_q);
+ _FORCE_INLINE_ void operator+=(const Quaternion &p_q);
+ _FORCE_INLINE_ void operator-=(const Quaternion &p_q);
_FORCE_INLINE_ void operator*=(const real_t &s);
_FORCE_INLINE_ void operator/=(const real_t &s);
- _FORCE_INLINE_ Quat operator+(const Quat &q2) const;
- _FORCE_INLINE_ Quat operator-(const Quat &q2) const;
- _FORCE_INLINE_ Quat operator-() const;
- _FORCE_INLINE_ Quat operator*(const real_t &s) const;
- _FORCE_INLINE_ Quat operator/(const real_t &s) const;
+ _FORCE_INLINE_ Quaternion operator+(const Quaternion &q2) const;
+ _FORCE_INLINE_ Quaternion operator-(const Quaternion &q2) const;
+ _FORCE_INLINE_ Quaternion operator-() const;
+ _FORCE_INLINE_ Quaternion operator*(const real_t &s) const;
+ _FORCE_INLINE_ Quaternion operator/(const real_t &s) const;
- _FORCE_INLINE_ bool operator==(const Quat &p_quat) const;
- _FORCE_INLINE_ bool operator!=(const Quat &p_quat) const;
+ _FORCE_INLINE_ bool operator==(const Quaternion &p_quaternion) const;
+ _FORCE_INLINE_ bool operator!=(const Quaternion &p_quaternion) const;
operator String() const;
- _FORCE_INLINE_ Quat() {}
+ _FORCE_INLINE_ Quaternion() {}
- _FORCE_INLINE_ Quat(real_t p_x, real_t p_y, real_t p_z, real_t p_w) :
+ _FORCE_INLINE_ Quaternion(real_t p_x, real_t p_y, real_t p_z, real_t p_w) :
x(p_x),
y(p_y),
z(p_z),
w(p_w) {
}
- Quat(const Vector3 &p_axis, real_t p_angle);
+ Quaternion(const Vector3 &p_axis, real_t p_angle);
- Quat(const Vector3 &p_euler);
+ Quaternion(const Vector3 &p_euler);
- Quat(const Quat &p_q) :
+ Quaternion(const Quaternion &p_q) :
x(p_q.x),
y(p_q.y),
z(p_q.z),
w(p_q.w) {
}
- Quat &operator=(const Quat &p_q) {
+ Quaternion &operator=(const Quaternion &p_q) {
x = p_q.x;
y = p_q.y;
z = p_q.z;
@@ -145,7 +145,7 @@ public:
return *this;
}
- Quat(const Vector3 &v0, const Vector3 &v1) // shortest arc
+ Quaternion(const Vector3 &v0, const Vector3 &v1) // shortest arc
{
Vector3 c = v0.cross(v1);
real_t d = v0.dot(v1);
@@ -167,72 +167,72 @@ public:
}
};
-real_t Quat::dot(const Quat &p_q) const {
+real_t Quaternion::dot(const Quaternion &p_q) const {
return x * p_q.x + y * p_q.y + z * p_q.z + w * p_q.w;
}
-real_t Quat::length_squared() const {
+real_t Quaternion::length_squared() const {
return dot(*this);
}
-void Quat::operator+=(const Quat &p_q) {
+void Quaternion::operator+=(const Quaternion &p_q) {
x += p_q.x;
y += p_q.y;
z += p_q.z;
w += p_q.w;
}
-void Quat::operator-=(const Quat &p_q) {
+void Quaternion::operator-=(const Quaternion &p_q) {
x -= p_q.x;
y -= p_q.y;
z -= p_q.z;
w -= p_q.w;
}
-void Quat::operator*=(const real_t &s) {
+void Quaternion::operator*=(const real_t &s) {
x *= s;
y *= s;
z *= s;
w *= s;
}
-void Quat::operator/=(const real_t &s) {
+void Quaternion::operator/=(const real_t &s) {
*this *= 1.0 / s;
}
-Quat Quat::operator+(const Quat &q2) const {
- const Quat &q1 = *this;
- return Quat(q1.x + q2.x, q1.y + q2.y, q1.z + q2.z, q1.w + q2.w);
+Quaternion Quaternion::operator+(const Quaternion &q2) const {
+ const Quaternion &q1 = *this;
+ return Quaternion(q1.x + q2.x, q1.y + q2.y, q1.z + q2.z, q1.w + q2.w);
}
-Quat Quat::operator-(const Quat &q2) const {
- const Quat &q1 = *this;
- return Quat(q1.x - q2.x, q1.y - q2.y, q1.z - q2.z, q1.w - q2.w);
+Quaternion Quaternion::operator-(const Quaternion &q2) const {
+ const Quaternion &q1 = *this;
+ return Quaternion(q1.x - q2.x, q1.y - q2.y, q1.z - q2.z, q1.w - q2.w);
}
-Quat Quat::operator-() const {
- const Quat &q2 = *this;
- return Quat(-q2.x, -q2.y, -q2.z, -q2.w);
+Quaternion Quaternion::operator-() const {
+ const Quaternion &q2 = *this;
+ return Quaternion(-q2.x, -q2.y, -q2.z, -q2.w);
}
-Quat Quat::operator*(const real_t &s) const {
- return Quat(x * s, y * s, z * s, w * s);
+Quaternion Quaternion::operator*(const real_t &s) const {
+ return Quaternion(x * s, y * s, z * s, w * s);
}
-Quat Quat::operator/(const real_t &s) const {
+Quaternion Quaternion::operator/(const real_t &s) const {
return *this * (1.0 / s);
}
-bool Quat::operator==(const Quat &p_quat) const {
- return x == p_quat.x && y == p_quat.y && z == p_quat.z && w == p_quat.w;
+bool Quaternion::operator==(const Quaternion &p_quaternion) const {
+ return x == p_quaternion.x && y == p_quaternion.y && z == p_quaternion.z && w == p_quaternion.w;
}
-bool Quat::operator!=(const Quat &p_quat) const {
- return x != p_quat.x || y != p_quat.y || z != p_quat.z || w != p_quat.w;
+bool Quaternion::operator!=(const Quaternion &p_quaternion) const {
+ return x != p_quaternion.x || y != p_quaternion.y || z != p_quaternion.z || w != p_quaternion.w;
}
-_FORCE_INLINE_ Quat operator*(const real_t &p_real, const Quat &p_quat) {
- return p_quat * p_real;
+_FORCE_INLINE_ Quaternion operator*(const real_t &p_real, const Quaternion &p_quaternion) {
+ return p_quaternion * p_real;
}
#endif // QUAT_H
diff --git a/core/math/transform_3d.cpp b/core/math/transform_3d.cpp
index 2611d6accf..210f0b81bb 100644
--- a/core/math/transform_3d.cpp
+++ b/core/math/transform_3d.cpp
@@ -112,15 +112,15 @@ Transform3D Transform3D::interpolate_with(const Transform3D &p_transform, real_t
/* not sure if very "efficient" but good enough? */
Vector3 src_scale = basis.get_scale();
- Quat src_rot = basis.get_rotation_quat();
+ Quaternion src_rot = basis.get_rotation_quaternion();
Vector3 src_loc = origin;
Vector3 dst_scale = p_transform.basis.get_scale();
- Quat dst_rot = p_transform.basis.get_rotation_quat();
+ Quaternion dst_rot = p_transform.basis.get_rotation_quaternion();
Vector3 dst_loc = p_transform.origin;
Transform3D interp;
- interp.basis.set_quat_scale(src_rot.slerp(dst_rot, p_c).normalized(), src_scale.lerp(dst_scale, p_c));
+ interp.basis.set_quaternion_scale(src_rot.slerp(dst_rot, p_c).normalized(), src_scale.lerp(dst_scale, p_c));
interp.origin = src_loc.lerp(dst_loc, p_c);
return interp;
diff --git a/core/variant/method_ptrcall.h b/core/variant/method_ptrcall.h
index f863962111..d4ec5e570c 100644
--- a/core/variant/method_ptrcall.h
+++ b/core/variant/method_ptrcall.h
@@ -122,7 +122,7 @@ MAKE_PTRARG_BY_REFERENCE(Vector3);
MAKE_PTRARG_BY_REFERENCE(Vector3i);
MAKE_PTRARG(Transform2D);
MAKE_PTRARG_BY_REFERENCE(Plane);
-MAKE_PTRARG(Quat);
+MAKE_PTRARG(Quaternion);
MAKE_PTRARG_BY_REFERENCE(AABB);
MAKE_PTRARG_BY_REFERENCE(Basis);
MAKE_PTRARG_BY_REFERENCE(Transform3D);
diff --git a/core/variant/type_info.h b/core/variant/type_info.h
index 5712c90f4c..76cb065d10 100644
--- a/core/variant/type_info.h
+++ b/core/variant/type_info.h
@@ -146,7 +146,7 @@ MAKE_TYPE_INFO(Rect2i, Variant::RECT2I)
MAKE_TYPE_INFO(Vector3i, Variant::VECTOR3I)
MAKE_TYPE_INFO(Transform2D, Variant::TRANSFORM2D)
MAKE_TYPE_INFO(Plane, Variant::PLANE)
-MAKE_TYPE_INFO(Quat, Variant::QUAT)
+MAKE_TYPE_INFO(Quaternion, Variant::QUATERNION)
MAKE_TYPE_INFO(AABB, Variant::AABB)
MAKE_TYPE_INFO(Basis, Variant::BASIS)
MAKE_TYPE_INFO(Transform3D, Variant::TRANSFORM3D)
diff --git a/core/variant/typed_array.h b/core/variant/typed_array.h
index 95c0578543..900dcf7689 100644
--- a/core/variant/typed_array.h
+++ b/core/variant/typed_array.h
@@ -98,7 +98,7 @@ MAKE_TYPED_ARRAY(Vector3, Variant::VECTOR3)
MAKE_TYPED_ARRAY(Vector3i, Variant::VECTOR3I)
MAKE_TYPED_ARRAY(Transform2D, Variant::TRANSFORM2D)
MAKE_TYPED_ARRAY(Plane, Variant::PLANE)
-MAKE_TYPED_ARRAY(Quat, Variant::QUAT)
+MAKE_TYPED_ARRAY(Quaternion, Variant::QUATERNION)
MAKE_TYPED_ARRAY(AABB, Variant::AABB)
MAKE_TYPED_ARRAY(Basis, Variant::BASIS)
MAKE_TYPED_ARRAY(Transform3D, Variant::TRANSFORM3D)
@@ -196,7 +196,7 @@ MAKE_TYPED_ARRAY_INFO(Vector3, Variant::VECTOR3)
MAKE_TYPED_ARRAY_INFO(Vector3i, Variant::VECTOR3I)
MAKE_TYPED_ARRAY_INFO(Transform2D, Variant::TRANSFORM2D)
MAKE_TYPED_ARRAY_INFO(Plane, Variant::PLANE)
-MAKE_TYPED_ARRAY_INFO(Quat, Variant::QUAT)
+MAKE_TYPED_ARRAY_INFO(Quaternion, Variant::QUATERNION)
MAKE_TYPED_ARRAY_INFO(AABB, Variant::AABB)
MAKE_TYPED_ARRAY_INFO(Basis, Variant::BASIS)
MAKE_TYPED_ARRAY_INFO(Transform3D, Variant::TRANSFORM3D)
diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp
index d77b7ef140..2bde08742c 100644
--- a/core/variant/variant.cpp
+++ b/core/variant/variant.cpp
@@ -91,8 +91,8 @@ String Variant::get_type_name(Variant::Type p_type) {
case AABB: {
return "AABB";
} break;
- case QUAT: {
- return "Quat";
+ case QUATERNION: {
+ return "Quaternion";
} break;
case BASIS: {
@@ -300,7 +300,7 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) {
} break;
- case QUAT: {
+ case QUATERNION: {
static const Type valid[] = {
BASIS,
NIL
@@ -311,7 +311,7 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) {
} break;
case BASIS: {
static const Type valid[] = {
- QUAT,
+ QUATERNION,
VECTOR3,
NIL
};
@@ -322,7 +322,7 @@ bool Variant::can_convert(Variant::Type p_type_from, Variant::Type p_type_to) {
case TRANSFORM3D: {
static const Type valid[] = {
TRANSFORM2D,
- QUAT,
+ QUATERNION,
BASIS,
NIL
};
@@ -607,7 +607,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type
} break;
- case QUAT: {
+ case QUATERNION: {
static const Type valid[] = {
BASIS,
NIL
@@ -618,7 +618,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type
} break;
case BASIS: {
static const Type valid[] = {
- QUAT,
+ QUATERNION,
VECTOR3,
NIL
};
@@ -629,7 +629,7 @@ bool Variant::can_convert_strict(Variant::Type p_type_from, Variant::Type p_type
case TRANSFORM3D: {
static const Type valid[] = {
TRANSFORM2D,
- QUAT,
+ QUATERNION,
BASIS,
NIL
};
@@ -873,8 +873,8 @@ bool Variant::is_zero() const {
case AABB: {
return *_data._aabb == ::AABB();
} break;
- case QUAT: {
- return *reinterpret_cast<const Quat *>(_data._mem) == Quat();
+ case QUATERNION: {
+ return *reinterpret_cast<const Quaternion *>(_data._mem) == Quaternion();
} break;
case BASIS: {
@@ -1092,8 +1092,8 @@ void Variant::reference(const Variant &p_variant) {
case AABB: {
_data._aabb = memnew(::AABB(*p_variant._data._aabb));
} break;
- case QUAT: {
- memnew_placement(_data._mem, Quat(*reinterpret_cast<const Quat *>(p_variant._data._mem)));
+ case QUATERNION: {
+ memnew_placement(_data._mem, Quaternion(*reinterpret_cast<const Quaternion *>(p_variant._data._mem)));
} break;
case BASIS: {
@@ -1254,8 +1254,8 @@ void Variant::zero() {
case PLANE:
*reinterpret_cast<Plane *>(this->_data._mem) = Plane();
break;
- case QUAT:
- *reinterpret_cast<Quat *>(this->_data._mem) = Quat();
+ case QUATERNION:
+ *reinterpret_cast<Quaternion *>(this->_data._mem) = Quaternion();
break;
case COLOR:
*reinterpret_cast<Color *>(this->_data._mem) = Color();
@@ -1275,7 +1275,7 @@ void Variant::_clear_internal() {
// no point, they don't allocate memory
VECTOR3,
PLANE,
- QUAT,
+ QUATERNION,
COLOR,
VECTOR2,
RECT2
@@ -1653,11 +1653,10 @@ String Variant::stringify(List<const void *> &stack) const {
return "(" + operator Vector3i() + ")";
case PLANE:
return operator Plane();
- //case QUAT:
case AABB:
return operator ::AABB();
- case QUAT:
- return "(" + operator Quat() + ")";
+ case QUATERNION:
+ return "(" + operator Quaternion() + ")";
case BASIS: {
Basis mat3 = operator Basis();
@@ -1956,8 +1955,8 @@ Variant::operator ::AABB() const {
Variant::operator Basis() const {
if (type == BASIS) {
return *_data._basis;
- } else if (type == QUAT) {
- return *reinterpret_cast<const Quat *>(_data._mem);
+ } else if (type == QUATERNION) {
+ return *reinterpret_cast<const Quaternion *>(_data._mem);
} else if (type == VECTOR3) {
return Basis(*reinterpret_cast<const Vector3 *>(_data._mem));
} else if (type == TRANSFORM3D) { // unexposed in Variant::can_convert?
@@ -1967,15 +1966,15 @@ Variant::operator Basis() const {
}
}
-Variant::operator Quat() const {
- if (type == QUAT) {
- return *reinterpret_cast<const Quat *>(_data._mem);
+Variant::operator Quaternion() const {
+ if (type == QUATERNION) {
+ return *reinterpret_cast<const Quaternion *>(_data._mem);
} else if (type == BASIS) {
return *_data._basis;
} else if (type == TRANSFORM3D) {
return _data._transform3d->basis;
} else {
- return Quat();
+ return Quaternion();
}
}
@@ -1984,8 +1983,8 @@ Variant::operator Transform3D() const {
return *_data._transform3d;
} else if (type == BASIS) {
return Transform3D(*_data._basis, Vector3());
- } else if (type == QUAT) {
- return Transform3D(Basis(*reinterpret_cast<const Quat *>(_data._mem)), Vector3());
+ } else if (type == QUATERNION) {
+ return Transform3D(Basis(*reinterpret_cast<const Quaternion *>(_data._mem)), Vector3());
} else if (type == TRANSFORM2D) {
const Transform2D &t = *_data._transform2d;
Transform3D m;
@@ -2495,9 +2494,9 @@ Variant::Variant(const Basis &p_matrix) {
_data._basis = memnew(Basis(p_matrix));
}
-Variant::Variant(const Quat &p_quat) {
- type = QUAT;
- memnew_placement(_data._mem, Quat(p_quat));
+Variant::Variant(const Quaternion &p_quaternion) {
+ type = QUATERNION;
+ memnew_placement(_data._mem, Quaternion(p_quaternion));
}
Variant::Variant(const Transform3D &p_transform) {
@@ -2739,8 +2738,8 @@ void Variant::operator=(const Variant &p_variant) {
case AABB: {
*_data._aabb = *(p_variant._data._aabb);
} break;
- case QUAT: {
- *reinterpret_cast<Quat *>(_data._mem) = *reinterpret_cast<const Quat *>(p_variant._data._mem);
+ case QUATERNION: {
+ *reinterpret_cast<Quaternion *>(_data._mem) = *reinterpret_cast<const Quaternion *>(p_variant._data._mem);
} break;
case BASIS: {
*_data._basis = *(p_variant._data._basis);
@@ -2916,11 +2915,11 @@ uint32_t Variant::hash() const {
return hash;
} break;
- case QUAT: {
- uint32_t hash = hash_djb2_one_float(reinterpret_cast<const Quat *>(_data._mem)->x);
- hash = hash_djb2_one_float(reinterpret_cast<const Quat *>(_data._mem)->y, hash);
- hash = hash_djb2_one_float(reinterpret_cast<const Quat *>(_data._mem)->z, hash);
- return hash_djb2_one_float(reinterpret_cast<const Quat *>(_data._mem)->w, hash);
+ case QUATERNION: {
+ uint32_t hash = hash_djb2_one_float(reinterpret_cast<const Quaternion *>(_data._mem)->x);
+ hash = hash_djb2_one_float(reinterpret_cast<const Quaternion *>(_data._mem)->y, hash);
+ hash = hash_djb2_one_float(reinterpret_cast<const Quaternion *>(_data._mem)->z, hash);
+ return hash_djb2_one_float(reinterpret_cast<const Quaternion *>(_data._mem)->w, hash);
} break;
case BASIS: {
@@ -3127,7 +3126,7 @@ uint32_t Variant::hash() const {
(hash_compare_scalar((p_lhs).y, (p_rhs).y)) && \
(hash_compare_scalar((p_lhs).z, (p_rhs).z))
-#define hash_compare_quat(p_lhs, p_rhs) \
+#define hash_compare_quaternion(p_lhs, p_rhs) \
(hash_compare_scalar((p_lhs).x, (p_rhs).x)) && \
(hash_compare_scalar((p_lhs).y, (p_rhs).y)) && \
(hash_compare_scalar((p_lhs).z, (p_rhs).z)) && \
@@ -3235,11 +3234,11 @@ bool Variant::hash_compare(const Variant &p_variant) const {
} break;
- case QUAT: {
- const Quat *l = reinterpret_cast<const Quat *>(_data._mem);
- const Quat *r = reinterpret_cast<const Quat *>(p_variant._data._mem);
+ case QUATERNION: {
+ const Quaternion *l = reinterpret_cast<const Quaternion *>(_data._mem);
+ const Quaternion *r = reinterpret_cast<const Quaternion *>(p_variant._data._mem);
- return hash_compare_quat(*l, *r);
+ return hash_compare_quaternion(*l, *r);
} break;
case BASIS: {
diff --git a/core/variant/variant.h b/core/variant/variant.h
index 4945e967eb..75316da63f 100644
--- a/core/variant/variant.h
+++ b/core/variant/variant.h
@@ -37,7 +37,7 @@
#include "core/math/color.h"
#include "core/math/face3.h"
#include "core/math/plane.h"
-#include "core/math/quat.h"
+#include "core/math/quaternion.h"
#include "core/math/transform_2d.h"
#include "core/math/transform_3d.h"
#include "core/math/vector3.h"
@@ -88,7 +88,7 @@ public:
VECTOR3I,
TRANSFORM2D,
PLANE,
- QUAT,
+ QUATERNION,
AABB,
BASIS,
TRANSFORM3D,
@@ -225,7 +225,7 @@ private:
false, //VECTOR3I,
true, //TRANSFORM2D,
false, //PLANE,
- false, //QUAT,
+ false, //QUATERNION,
true, //AABB,
true, //BASIS,
true, //TRANSFORM,
@@ -320,7 +320,7 @@ public:
operator Vector3i() const;
operator Plane() const;
operator ::AABB() const;
- operator Quat() const;
+ operator Quaternion() const;
operator Basis() const;
operator Transform2D() const;
operator Transform3D() const;
@@ -392,7 +392,7 @@ public:
Variant(const Vector3i &p_vector3i);
Variant(const Plane &p_plane);
Variant(const ::AABB &p_aabb);
- Variant(const Quat &p_quat);
+ Variant(const Quaternion &p_quat);
Variant(const Basis &p_matrix);
Variant(const Transform2D &p_transform);
Variant(const Transform3D &p_transform);
diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp
index a93a166d33..72dd888dff 100644
--- a/core/variant/variant_call.cpp
+++ b/core/variant/variant_call.cpp
@@ -1544,19 +1544,19 @@ static void _register_variant_builtin_methods() {
bind_methodv(Plane, intersects_ray, &Plane::intersects_ray_bind, sarray("from", "dir"), varray());
bind_methodv(Plane, intersects_segment, &Plane::intersects_segment_bind, sarray("from", "to"), varray());
- /* Quat */
-
- bind_method(Quat, length, sarray(), varray());
- bind_method(Quat, length_squared, sarray(), varray());
- bind_method(Quat, normalized, sarray(), varray());
- bind_method(Quat, is_normalized, sarray(), varray());
- bind_method(Quat, is_equal_approx, sarray("to"), varray());
- bind_method(Quat, inverse, sarray(), varray());
- bind_method(Quat, dot, sarray("with"), varray());
- bind_method(Quat, slerp, sarray("to", "weight"), varray());
- bind_method(Quat, slerpni, sarray("to", "weight"), varray());
- bind_method(Quat, cubic_slerp, sarray("b", "pre_a", "post_b", "weight"), varray());
- bind_method(Quat, get_euler, sarray(), varray());
+ /* Quaternion */
+
+ bind_method(Quaternion, length, sarray(), varray());
+ bind_method(Quaternion, length_squared, sarray(), varray());
+ bind_method(Quaternion, normalized, sarray(), varray());
+ bind_method(Quaternion, is_normalized, sarray(), varray());
+ bind_method(Quaternion, is_equal_approx, sarray("to"), varray());
+ bind_method(Quaternion, inverse, sarray(), varray());
+ bind_method(Quaternion, dot, sarray("with"), varray());
+ bind_method(Quaternion, slerp, sarray("to", "weight"), varray());
+ bind_method(Quaternion, slerpni, sarray("to", "weight"), varray());
+ bind_method(Quaternion, cubic_slerp, sarray("b", "pre_a", "post_b", "weight"), varray());
+ bind_method(Quaternion, get_euler, sarray(), varray());
/* Color */
@@ -1668,7 +1668,7 @@ static void _register_variant_builtin_methods() {
bind_method(Basis, get_orthogonal_index, sarray(), varray());
bind_method(Basis, slerp, sarray("to", "weight"), varray());
bind_method(Basis, is_equal_approx, sarray("b"), varray());
- bind_method(Basis, get_rotation_quat, sarray(), varray());
+ bind_method(Basis, get_rotation_quaternion, sarray(), varray());
/* AABB */
@@ -2047,7 +2047,7 @@ static void _register_variant_builtin_methods() {
_VariantCall::add_variant_constant(Variant::PLANE, "PLANE_XZ", Plane(Vector3(0, 1, 0), 0));
_VariantCall::add_variant_constant(Variant::PLANE, "PLANE_XY", Plane(Vector3(0, 0, 1), 0));
- _VariantCall::add_variant_constant(Variant::QUAT, "IDENTITY", Quat(0, 0, 0, 1));
+ _VariantCall::add_variant_constant(Variant::QUATERNION, "IDENTITY", Quaternion(0, 0, 0, 1));
}
void Variant::_register_variant_methods() {
diff --git a/core/variant/variant_construct.cpp b/core/variant/variant_construct.cpp
index 699496ce19..f66f33ef93 100644
--- a/core/variant/variant_construct.cpp
+++ b/core/variant/variant_construct.cpp
@@ -62,7 +62,7 @@ MAKE_PTRCONSTRUCT(Vector3);
MAKE_PTRCONSTRUCT(Vector3i);
MAKE_PTRCONSTRUCT(Transform2D);
MAKE_PTRCONSTRUCT(Plane);
-MAKE_PTRCONSTRUCT(Quat);
+MAKE_PTRCONSTRUCT(Quaternion);
MAKE_PTRCONSTRUCT(AABB);
MAKE_PTRCONSTRUCT(Basis);
MAKE_PTRCONSTRUCT(Transform3D);
@@ -659,13 +659,13 @@ void Variant::_register_variant_constructors() {
add_constructor<VariantConstructor<Plane, Vector3, Vector3, Vector3>>(sarray("point1", "point2", "point3"));
add_constructor<VariantConstructor<Plane, double, double, double, double>>(sarray("a", "b", "c", "d"));
- add_constructor<VariantConstructNoArgs<Quat>>(sarray());
- add_constructor<VariantConstructor<Quat, Quat>>(sarray("from"));
- add_constructor<VariantConstructor<Quat, Basis>>(sarray("from"));
- add_constructor<VariantConstructor<Quat, Vector3>>(sarray("euler"));
- add_constructor<VariantConstructor<Quat, Vector3, double>>(sarray("axis", "angle"));
- add_constructor<VariantConstructor<Quat, Vector3, Vector3>>(sarray("arc_from", "arc_to"));
- add_constructor<VariantConstructor<Quat, double, double, double, double>>(sarray("x", "y", "z", "w"));
+ add_constructor<VariantConstructNoArgs<Quaternion>>(sarray());
+ add_constructor<VariantConstructor<Quaternion, Quaternion>>(sarray("from"));
+ add_constructor<VariantConstructor<Quaternion, Basis>>(sarray("from"));
+ add_constructor<VariantConstructor<Quaternion, Vector3>>(sarray("euler"));
+ add_constructor<VariantConstructor<Quaternion, Vector3, double>>(sarray("axis", "angle"));
+ add_constructor<VariantConstructor<Quaternion, Vector3, Vector3>>(sarray("arc_from", "arc_to"));
+ add_constructor<VariantConstructor<Quaternion, double, double, double, double>>(sarray("x", "y", "z", "w"));
add_constructor<VariantConstructNoArgs<::AABB>>(sarray());
add_constructor<VariantConstructor<::AABB, ::AABB>>(sarray("from"));
@@ -673,7 +673,7 @@ void Variant::_register_variant_constructors() {
add_constructor<VariantConstructNoArgs<Basis>>(sarray());
add_constructor<VariantConstructor<Basis, Basis>>(sarray("from"));
- add_constructor<VariantConstructor<Basis, Quat>>(sarray("from"));
+ add_constructor<VariantConstructor<Basis, Quaternion>>(sarray("from"));
add_constructor<VariantConstructor<Basis, Vector3>>(sarray("euler"));
add_constructor<VariantConstructor<Basis, Vector3, double>>(sarray("axis", "phi"));
add_constructor<VariantConstructor<Basis, Vector3, Vector3, Vector3>>(sarray("x_axis", "y_axis", "z_axis"));
diff --git a/core/variant/variant_internal.h b/core/variant/variant_internal.h
index 1eaa211b37..9e5811a082 100644
--- a/core/variant/variant_internal.h
+++ b/core/variant/variant_internal.h
@@ -138,8 +138,8 @@ public:
_FORCE_INLINE_ static const Transform2D *get_transform2d(const Variant *v) { return v->_data._transform2d; }
_FORCE_INLINE_ static Plane *get_plane(Variant *v) { return reinterpret_cast<Plane *>(v->_data._mem); }
_FORCE_INLINE_ static const Plane *get_plane(const Variant *v) { return reinterpret_cast<const Plane *>(v->_data._mem); }
- _FORCE_INLINE_ static Quat *get_quat(Variant *v) { return reinterpret_cast<Quat *>(v->_data._mem); }
- _FORCE_INLINE_ static const Quat *get_quat(const Variant *v) { return reinterpret_cast<const Quat *>(v->_data._mem); }
+ _FORCE_INLINE_ static Quaternion *get_quaternion(Variant *v) { return reinterpret_cast<Quaternion *>(v->_data._mem); }
+ _FORCE_INLINE_ static const Quaternion *get_quaternion(const Variant *v) { return reinterpret_cast<const Quaternion *>(v->_data._mem); }
_FORCE_INLINE_ static ::AABB *get_aabb(Variant *v) { return v->_data._aabb; }
_FORCE_INLINE_ static const ::AABB *get_aabb(const Variant *v) { return v->_data._aabb; }
_FORCE_INLINE_ static Basis *get_basis(Variant *v) { return v->_data._basis; }
@@ -324,8 +324,8 @@ public:
return get_transform(v);
case Variant::TRANSFORM2D:
return get_transform2d(v);
- case Variant::QUAT:
- return get_quat(v);
+ case Variant::QUATERNION:
+ return get_quaternion(v);
case Variant::PLANE:
return get_plane(v);
case Variant::BASIS:
@@ -402,8 +402,8 @@ public:
return get_transform(v);
case Variant::TRANSFORM2D:
return get_transform2d(v);
- case Variant::QUAT:
- return get_quat(v);
+ case Variant::QUATERNION:
+ return get_quaternion(v);
case Variant::PLANE:
return get_plane(v);
case Variant::BASIS:
@@ -602,9 +602,9 @@ struct VariantGetInternalPtr<Plane> {
};
template <>
-struct VariantGetInternalPtr<Quat> {
- static Quat *get_ptr(Variant *v) { return VariantInternal::get_quat(v); }
- static const Quat *get_ptr(const Variant *v) { return VariantInternal::get_quat(v); }
+struct VariantGetInternalPtr<Quaternion> {
+ static Quaternion *get_ptr(Variant *v) { return VariantInternal::get_quaternion(v); }
+ static const Quaternion *get_ptr(const Variant *v) { return VariantInternal::get_quaternion(v); }
};
template <>
@@ -831,9 +831,9 @@ struct VariantInternalAccessor<Plane> {
};
template <>
-struct VariantInternalAccessor<Quat> {
- static _FORCE_INLINE_ const Quat &get(const Variant *v) { return *VariantInternal::get_quat(v); }
- static _FORCE_INLINE_ void set(Variant *v, const Quat &p_value) { *VariantInternal::get_quat(v) = p_value; }
+struct VariantInternalAccessor<Quaternion> {
+ static _FORCE_INLINE_ const Quaternion &get(const Variant *v) { return *VariantInternal::get_quaternion(v); }
+ static _FORCE_INLINE_ void set(Variant *v, const Quaternion &p_value) { *VariantInternal::get_quaternion(v) = p_value; }
};
template <>
@@ -1067,8 +1067,8 @@ struct VariantInitializer<Plane> {
};
template <>
-struct VariantInitializer<Quat> {
- static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_generic<Quat>(v); }
+struct VariantInitializer<Quaternion> {
+ static _FORCE_INLINE_ void init(Variant *v) { VariantInternal::init_generic<Quaternion>(v); }
};
template <>
@@ -1241,8 +1241,8 @@ struct VariantZeroAssigner<Plane> {
};
template <>
-struct VariantZeroAssigner<Quat> {
- static _FORCE_INLINE_ void zero(Variant *v) { *VariantInternal::get_quat(v) = Quat(); }
+struct VariantZeroAssigner<Quaternion> {
+ static _FORCE_INLINE_ void zero(Variant *v) { *VariantInternal::get_quaternion(v) = Quaternion(); }
};
template <>
diff --git a/core/variant/variant_op.cpp b/core/variant/variant_op.cpp
index cce0177e20..10d0a83014 100644
--- a/core/variant/variant_op.cpp
+++ b/core/variant/variant_op.cpp
@@ -1395,7 +1395,7 @@ void Variant::_register_variant_operators() {
register_op<OperatorEvaluatorAdd<Vector2i, Vector2i, Vector2i>>(Variant::OP_ADD, Variant::VECTOR2I, Variant::VECTOR2I);
register_op<OperatorEvaluatorAdd<Vector3, Vector3, Vector3>>(Variant::OP_ADD, Variant::VECTOR3, Variant::VECTOR3);
register_op<OperatorEvaluatorAdd<Vector3i, Vector3i, Vector3i>>(Variant::OP_ADD, Variant::VECTOR3I, Variant::VECTOR3I);
- register_op<OperatorEvaluatorAdd<Quat, Quat, Quat>>(Variant::OP_ADD, Variant::QUAT, Variant::QUAT);
+ register_op<OperatorEvaluatorAdd<Quaternion, Quaternion, Quaternion>>(Variant::OP_ADD, Variant::QUATERNION, Variant::QUATERNION);
register_op<OperatorEvaluatorAdd<Color, Color, Color>>(Variant::OP_ADD, Variant::COLOR, Variant::COLOR);
register_op<OperatorEvaluatorAddArray>(Variant::OP_ADD, Variant::ARRAY, Variant::ARRAY);
register_op<OperatorEvaluatorAppendArray<uint8_t>>(Variant::OP_ADD, Variant::PACKED_BYTE_ARRAY, Variant::PACKED_BYTE_ARRAY);
@@ -1416,7 +1416,7 @@ void Variant::_register_variant_operators() {
register_op<OperatorEvaluatorSub<Vector2i, Vector2i, Vector2i>>(Variant::OP_SUBTRACT, Variant::VECTOR2I, Variant::VECTOR2I);
register_op<OperatorEvaluatorSub<Vector3, Vector3, Vector3>>(Variant::OP_SUBTRACT, Variant::VECTOR3, Variant::VECTOR3);
register_op<OperatorEvaluatorSub<Vector3i, Vector3i, Vector3i>>(Variant::OP_SUBTRACT, Variant::VECTOR3I, Variant::VECTOR3I);
- register_op<OperatorEvaluatorSub<Quat, Quat, Quat>>(Variant::OP_SUBTRACT, Variant::QUAT, Variant::QUAT);
+ register_op<OperatorEvaluatorSub<Quaternion, Quaternion, Quaternion>>(Variant::OP_SUBTRACT, Variant::QUATERNION, Variant::QUATERNION);
register_op<OperatorEvaluatorSub<Color, Color, Color>>(Variant::OP_SUBTRACT, Variant::COLOR, Variant::COLOR);
register_op<OperatorEvaluatorMul<int64_t, int64_t, int64_t>>(Variant::OP_MULTIPLY, Variant::INT, Variant::INT);
@@ -1449,9 +1449,9 @@ void Variant::_register_variant_operators() {
register_op<OperatorEvaluatorMul<Vector3i, Vector3i, int64_t>>(Variant::OP_MULTIPLY, Variant::VECTOR3I, Variant::INT);
register_op<OperatorEvaluatorMul<Vector3i, Vector3i, double>>(Variant::OP_MULTIPLY, Variant::VECTOR3I, Variant::FLOAT);
- register_op<OperatorEvaluatorMul<Quat, Quat, Quat>>(Variant::OP_MULTIPLY, Variant::QUAT, Variant::QUAT);
- register_op<OperatorEvaluatorMul<Quat, Quat, int64_t>>(Variant::OP_MULTIPLY, Variant::QUAT, Variant::INT);
- register_op<OperatorEvaluatorMul<Quat, Quat, double>>(Variant::OP_MULTIPLY, Variant::QUAT, Variant::FLOAT);
+ register_op<OperatorEvaluatorMul<Quaternion, Quaternion, Quaternion>>(Variant::OP_MULTIPLY, Variant::QUATERNION, Variant::QUATERNION);
+ register_op<OperatorEvaluatorMul<Quaternion, Quaternion, int64_t>>(Variant::OP_MULTIPLY, Variant::QUATERNION, Variant::INT);
+ register_op<OperatorEvaluatorMul<Quaternion, Quaternion, double>>(Variant::OP_MULTIPLY, Variant::QUATERNION, Variant::FLOAT);
register_op<OperatorEvaluatorMul<Color, Color, Color>>(Variant::OP_MULTIPLY, Variant::COLOR, Variant::COLOR);
register_op<OperatorEvaluatorMul<Color, Color, int64_t>>(Variant::OP_MULTIPLY, Variant::COLOR, Variant::INT);
@@ -1477,13 +1477,13 @@ void Variant::_register_variant_operators() {
register_op<OperatorEvaluatorXForm<Vector3, Basis, Vector3>>(Variant::OP_MULTIPLY, Variant::BASIS, Variant::VECTOR3);
register_op<OperatorEvaluatorXFormInv<Vector3, Vector3, Basis>>(Variant::OP_MULTIPLY, Variant::VECTOR3, Variant::BASIS);
- register_op<OperatorEvaluatorMul<Quat, Quat, Quat>>(Variant::OP_MULTIPLY, Variant::QUAT, Variant::QUAT);
- register_op<OperatorEvaluatorMul<Quat, Quat, int64_t>>(Variant::OP_MULTIPLY, Variant::QUAT, Variant::INT);
- register_op<OperatorEvaluatorMul<Quat, int64_t, Quat>>(Variant::OP_MULTIPLY, Variant::INT, Variant::QUAT);
- register_op<OperatorEvaluatorMul<Quat, Quat, double>>(Variant::OP_MULTIPLY, Variant::QUAT, Variant::FLOAT);
- register_op<OperatorEvaluatorMul<Quat, double, Quat>>(Variant::OP_MULTIPLY, Variant::FLOAT, Variant::QUAT);
- register_op<OperatorEvaluatorXForm<Vector3, Quat, Vector3>>(Variant::OP_MULTIPLY, Variant::QUAT, Variant::VECTOR3);
- register_op<OperatorEvaluatorXFormInv<Vector3, Vector3, Quat>>(Variant::OP_MULTIPLY, Variant::VECTOR3, Variant::QUAT);
+ register_op<OperatorEvaluatorMul<Quaternion, Quaternion, Quaternion>>(Variant::OP_MULTIPLY, Variant::QUATERNION, Variant::QUATERNION);
+ register_op<OperatorEvaluatorMul<Quaternion, Quaternion, int64_t>>(Variant::OP_MULTIPLY, Variant::QUATERNION, Variant::INT);
+ register_op<OperatorEvaluatorMul<Quaternion, int64_t, Quaternion>>(Variant::OP_MULTIPLY, Variant::INT, Variant::QUATERNION);
+ register_op<OperatorEvaluatorMul<Quaternion, Quaternion, double>>(Variant::OP_MULTIPLY, Variant::QUATERNION, Variant::FLOAT);
+ register_op<OperatorEvaluatorMul<Quaternion, double, Quaternion>>(Variant::OP_MULTIPLY, Variant::FLOAT, Variant::QUATERNION);
+ register_op<OperatorEvaluatorXForm<Vector3, Quaternion, Vector3>>(Variant::OP_MULTIPLY, Variant::QUATERNION, Variant::VECTOR3);
+ register_op<OperatorEvaluatorXFormInv<Vector3, Vector3, Quaternion>>(Variant::OP_MULTIPLY, Variant::VECTOR3, Variant::QUATERNION);
register_op<OperatorEvaluatorMul<Color, Color, Color>>(Variant::OP_MULTIPLY, Variant::COLOR, Variant::COLOR);
register_op<OperatorEvaluatorMul<Color, Color, int64_t>>(Variant::OP_MULTIPLY, Variant::COLOR, Variant::INT);
@@ -1516,8 +1516,8 @@ void Variant::_register_variant_operators() {
register_op<OperatorEvaluatorDivNZ<Vector3i, Vector3i, double>>(Variant::OP_DIVIDE, Variant::VECTOR3I, Variant::FLOAT);
register_op<OperatorEvaluatorDivNZ<Vector3i, Vector3i, int64_t>>(Variant::OP_DIVIDE, Variant::VECTOR3I, Variant::INT);
- register_op<OperatorEvaluatorDiv<Quat, Quat, double>>(Variant::OP_DIVIDE, Variant::QUAT, Variant::FLOAT);
- register_op<OperatorEvaluatorDiv<Quat, Quat, int64_t>>(Variant::OP_DIVIDE, Variant::QUAT, Variant::INT);
+ register_op<OperatorEvaluatorDiv<Quaternion, Quaternion, double>>(Variant::OP_DIVIDE, Variant::QUATERNION, Variant::FLOAT);
+ register_op<OperatorEvaluatorDiv<Quaternion, Quaternion, int64_t>>(Variant::OP_DIVIDE, Variant::QUATERNION, Variant::INT);
register_op<OperatorEvaluatorDiv<Color, Color, Color>>(Variant::OP_DIVIDE, Variant::COLOR, Variant::COLOR);
register_op<OperatorEvaluatorDiv<Color, Color, double>>(Variant::OP_DIVIDE, Variant::COLOR, Variant::FLOAT);
@@ -1544,7 +1544,7 @@ void Variant::_register_variant_operators() {
register_op<OperatorEvaluatorStringModT<Vector3i>>(Variant::OP_MODULE, Variant::STRING, Variant::VECTOR3I);
register_op<OperatorEvaluatorStringModT<Transform2D>>(Variant::OP_MODULE, Variant::STRING, Variant::TRANSFORM2D);
register_op<OperatorEvaluatorStringModT<Plane>>(Variant::OP_MODULE, Variant::STRING, Variant::PLANE);
- register_op<OperatorEvaluatorStringModT<Quat>>(Variant::OP_MODULE, Variant::STRING, Variant::QUAT);
+ register_op<OperatorEvaluatorStringModT<Quaternion>>(Variant::OP_MODULE, Variant::STRING, Variant::QUATERNION);
register_op<OperatorEvaluatorStringModT<::AABB>>(Variant::OP_MODULE, Variant::STRING, Variant::AABB);
register_op<OperatorEvaluatorStringModT<Basis>>(Variant::OP_MODULE, Variant::STRING, Variant::BASIS);
register_op<OperatorEvaluatorStringModT<Transform3D>>(Variant::OP_MODULE, Variant::STRING, Variant::TRANSFORM3D);
@@ -1574,7 +1574,7 @@ void Variant::_register_variant_operators() {
register_op<OperatorEvaluatorNeg<Vector2i, Vector2i>>(Variant::OP_NEGATE, Variant::VECTOR2I, Variant::NIL);
register_op<OperatorEvaluatorNeg<Vector3, Vector3>>(Variant::OP_NEGATE, Variant::VECTOR3, Variant::NIL);
register_op<OperatorEvaluatorNeg<Vector3i, Vector3i>>(Variant::OP_NEGATE, Variant::VECTOR3I, Variant::NIL);
- register_op<OperatorEvaluatorNeg<Quat, Quat>>(Variant::OP_NEGATE, Variant::QUAT, Variant::NIL);
+ register_op<OperatorEvaluatorNeg<Quaternion, Quaternion>>(Variant::OP_NEGATE, Variant::QUATERNION, Variant::NIL);
register_op<OperatorEvaluatorNeg<Plane, Plane>>(Variant::OP_NEGATE, Variant::PLANE, Variant::NIL);
register_op<OperatorEvaluatorNeg<Color, Color>>(Variant::OP_NEGATE, Variant::COLOR, Variant::NIL);
@@ -1584,7 +1584,7 @@ void Variant::_register_variant_operators() {
register_op<OperatorEvaluatorPos<Vector2i, Vector2i>>(Variant::OP_POSITIVE, Variant::VECTOR2I, Variant::NIL);
register_op<OperatorEvaluatorPos<Vector3, Vector3>>(Variant::OP_POSITIVE, Variant::VECTOR3, Variant::NIL);
register_op<OperatorEvaluatorPos<Vector3i, Vector3i>>(Variant::OP_POSITIVE, Variant::VECTOR3I, Variant::NIL);
- register_op<OperatorEvaluatorPos<Quat, Quat>>(Variant::OP_POSITIVE, Variant::QUAT, Variant::NIL);
+ register_op<OperatorEvaluatorPos<Quaternion, Quaternion>>(Variant::OP_POSITIVE, Variant::QUATERNION, Variant::NIL);
register_op<OperatorEvaluatorPos<Plane, Plane>>(Variant::OP_POSITIVE, Variant::PLANE, Variant::NIL);
register_op<OperatorEvaluatorPos<Color, Color>>(Variant::OP_POSITIVE, Variant::COLOR, Variant::NIL);
@@ -1612,7 +1612,7 @@ void Variant::_register_variant_operators() {
register_op<OperatorEvaluatorEqual<Vector3i, Vector3i>>(Variant::OP_EQUAL, Variant::VECTOR3I, Variant::VECTOR3I);
register_op<OperatorEvaluatorEqual<Transform2D, Transform2D>>(Variant::OP_EQUAL, Variant::TRANSFORM2D, Variant::TRANSFORM2D);
register_op<OperatorEvaluatorEqual<Plane, Plane>>(Variant::OP_EQUAL, Variant::PLANE, Variant::PLANE);
- register_op<OperatorEvaluatorEqual<Quat, Quat>>(Variant::OP_EQUAL, Variant::QUAT, Variant::QUAT);
+ register_op<OperatorEvaluatorEqual<Quaternion, Quaternion>>(Variant::OP_EQUAL, Variant::QUATERNION, Variant::QUATERNION);
register_op<OperatorEvaluatorEqual<::AABB, ::AABB>>(Variant::OP_EQUAL, Variant::AABB, Variant::AABB);
register_op<OperatorEvaluatorEqual<Basis, Basis>>(Variant::OP_EQUAL, Variant::BASIS, Variant::BASIS);
register_op<OperatorEvaluatorEqual<Transform3D, Transform3D>>(Variant::OP_EQUAL, Variant::TRANSFORM3D, Variant::TRANSFORM3D);
@@ -1658,7 +1658,7 @@ void Variant::_register_variant_operators() {
register_op<OperatorEvaluatorNotEqual<Vector3i, Vector3i>>(Variant::OP_NOT_EQUAL, Variant::VECTOR3I, Variant::VECTOR3I);
register_op<OperatorEvaluatorNotEqual<Transform2D, Transform2D>>(Variant::OP_NOT_EQUAL, Variant::TRANSFORM2D, Variant::TRANSFORM2D);
register_op<OperatorEvaluatorNotEqual<Plane, Plane>>(Variant::OP_NOT_EQUAL, Variant::PLANE, Variant::PLANE);
- register_op<OperatorEvaluatorNotEqual<Quat, Quat>>(Variant::OP_NOT_EQUAL, Variant::QUAT, Variant::QUAT);
+ register_op<OperatorEvaluatorNotEqual<Quaternion, Quaternion>>(Variant::OP_NOT_EQUAL, Variant::QUATERNION, Variant::QUATERNION);
register_op<OperatorEvaluatorNotEqual<::AABB, ::AABB>>(Variant::OP_NOT_EQUAL, Variant::AABB, Variant::AABB);
register_op<OperatorEvaluatorNotEqual<Basis, Basis>>(Variant::OP_NOT_EQUAL, Variant::BASIS, Variant::BASIS);
register_op<OperatorEvaluatorNotEqual<Transform3D, Transform3D>>(Variant::OP_NOT_EQUAL, Variant::TRANSFORM3D, Variant::TRANSFORM3D);
@@ -1849,7 +1849,7 @@ void Variant::_register_variant_operators() {
register_op<OperatorEvaluatorInDictionaryHas<Vector3i>>(Variant::OP_IN, Variant::VECTOR3I, Variant::DICTIONARY);
register_op<OperatorEvaluatorInDictionaryHas<Transform2D>>(Variant::OP_IN, Variant::TRANSFORM2D, Variant::DICTIONARY);
register_op<OperatorEvaluatorInDictionaryHas<Plane>>(Variant::OP_IN, Variant::PLANE, Variant::DICTIONARY);
- register_op<OperatorEvaluatorInDictionaryHas<Quat>>(Variant::OP_IN, Variant::QUAT, Variant::DICTIONARY);
+ register_op<OperatorEvaluatorInDictionaryHas<Quaternion>>(Variant::OP_IN, Variant::QUATERNION, Variant::DICTIONARY);
register_op<OperatorEvaluatorInDictionaryHas<::AABB>>(Variant::OP_IN, Variant::AABB, Variant::DICTIONARY);
register_op<OperatorEvaluatorInDictionaryHas<Basis>>(Variant::OP_IN, Variant::BASIS, Variant::DICTIONARY);
register_op<OperatorEvaluatorInDictionaryHas<Transform3D>>(Variant::OP_IN, Variant::TRANSFORM3D, Variant::DICTIONARY);
@@ -1886,7 +1886,7 @@ void Variant::_register_variant_operators() {
register_op<OperatorEvaluatorInArrayFind<Vector3i, Array>>(Variant::OP_IN, Variant::VECTOR3I, Variant::ARRAY);
register_op<OperatorEvaluatorInArrayFind<Transform2D, Array>>(Variant::OP_IN, Variant::TRANSFORM2D, Variant::ARRAY);
register_op<OperatorEvaluatorInArrayFind<Plane, Array>>(Variant::OP_IN, Variant::PLANE, Variant::ARRAY);
- register_op<OperatorEvaluatorInArrayFind<Quat, Array>>(Variant::OP_IN, Variant::QUAT, Variant::ARRAY);
+ register_op<OperatorEvaluatorInArrayFind<Quaternion, Array>>(Variant::OP_IN, Variant::QUATERNION, Variant::ARRAY);
register_op<OperatorEvaluatorInArrayFind<::AABB, Array>>(Variant::OP_IN, Variant::AABB, Variant::ARRAY);
register_op<OperatorEvaluatorInArrayFind<Basis, Array>>(Variant::OP_IN, Variant::BASIS, Variant::ARRAY);
register_op<OperatorEvaluatorInArrayFind<Transform3D, Array>>(Variant::OP_IN, Variant::TRANSFORM3D, Variant::ARRAY);
diff --git a/core/variant/variant_parser.cpp b/core/variant/variant_parser.cpp
index 62643e1d31..b58f60c149 100644
--- a/core/variant/variant_parser.cpp
+++ b/core/variant/variant_parser.cpp
@@ -614,7 +614,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
}
value = Plane(args[0], args[1], args[2], args[3]);
- } else if (id == "Quat") {
+ } else if (id == "Quaternion" || id == "Quat") { // "Quat" kept for compatibility
Vector<real_t> args;
Error err = _parse_construct<real_t>(p_stream, args, line, r_err_str);
if (err) {
@@ -626,7 +626,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
return ERR_PARSE_ERROR;
}
- value = Quat(args[0], args[1], args[2], args[3]);
+ value = Quaternion(args[0], args[1], args[2], args[3]);
} else if (id == "AABB" || id == "Rect3") {
Vector<real_t> args;
Error err = _parse_construct<real_t>(p_stream, args, line, r_err_str);
@@ -1454,9 +1454,9 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str
p_store_string_func(p_store_string_ud, "AABB( " + rtosfix(aabb.position.x) + ", " + rtosfix(aabb.position.y) + ", " + rtosfix(aabb.position.z) + ", " + rtosfix(aabb.size.x) + ", " + rtosfix(aabb.size.y) + ", " + rtosfix(aabb.size.z) + " )");
} break;
- case Variant::QUAT: {
- Quat quat = p_variant;
- p_store_string_func(p_store_string_ud, "Quat( " + rtosfix(quat.x) + ", " + rtosfix(quat.y) + ", " + rtosfix(quat.z) + ", " + rtosfix(quat.w) + " )");
+ case Variant::QUATERNION: {
+ Quaternion quaternion = p_variant;
+ p_store_string_func(p_store_string_ud, "Quaternion( " + rtosfix(quaternion.x) + ", " + rtosfix(quaternion.y) + ", " + rtosfix(quaternion.z) + ", " + rtosfix(quaternion.w) + " )");
} break;
case Variant::TRANSFORM2D: {
diff --git a/core/variant/variant_setget.cpp b/core/variant/variant_setget.cpp
index c3f667d9a7..4f4a80e807 100644
--- a/core/variant/variant_setget.cpp
+++ b/core/variant/variant_setget.cpp
@@ -279,10 +279,10 @@ SETGET_NUMBER_STRUCT_CUSTOM(Plane, double, z, normal.z)
SETGET_STRUCT(Plane, Vector3, normal)
SETGET_NUMBER_STRUCT(Plane, double, d)
-SETGET_NUMBER_STRUCT(Quat, double, x)
-SETGET_NUMBER_STRUCT(Quat, double, y)
-SETGET_NUMBER_STRUCT(Quat, double, z)
-SETGET_NUMBER_STRUCT(Quat, double, w)
+SETGET_NUMBER_STRUCT(Quaternion, double, x)
+SETGET_NUMBER_STRUCT(Quaternion, double, y)
+SETGET_NUMBER_STRUCT(Quaternion, double, z)
+SETGET_NUMBER_STRUCT(Quaternion, double, w)
SETGET_STRUCT_FUNC_INDEX(Basis, Vector3, x, set_axis, get_axis, 0)
SETGET_STRUCT_FUNC_INDEX(Basis, Vector3, y, set_axis, get_axis, 1)
@@ -374,10 +374,10 @@ void register_named_setters_getters() {
REGISTER_MEMBER(Plane, d);
REGISTER_MEMBER(Plane, normal);
- REGISTER_MEMBER(Quat, x);
- REGISTER_MEMBER(Quat, y);
- REGISTER_MEMBER(Quat, z);
- REGISTER_MEMBER(Quat, w);
+ REGISTER_MEMBER(Quaternion, x);
+ REGISTER_MEMBER(Quaternion, y);
+ REGISTER_MEMBER(Quaternion, z);
+ REGISTER_MEMBER(Quaternion, w);
REGISTER_MEMBER(Basis, x);
REGISTER_MEMBER(Basis, y);
@@ -975,7 +975,7 @@ INDEXED_SETGET_STRUCT_BULTIN_NUMERIC(Vector2, double, real_t, 2)
INDEXED_SETGET_STRUCT_BULTIN_NUMERIC(Vector2i, int64_t, int32_t, 2)
INDEXED_SETGET_STRUCT_BULTIN_NUMERIC(Vector3, double, real_t, 3)
INDEXED_SETGET_STRUCT_BULTIN_NUMERIC(Vector3i, int64_t, int32_t, 3)
-INDEXED_SETGET_STRUCT_BULTIN_NUMERIC(Quat, double, real_t, 4)
+INDEXED_SETGET_STRUCT_BULTIN_NUMERIC(Quaternion, double, real_t, 4)
INDEXED_SETGET_STRUCT_BULTIN_NUMERIC(Color, double, float, 4)
INDEXED_SETGET_STRUCT_BULTIN_ACCESSOR(Transform2D, Vector2, .elements, 3)
@@ -1037,7 +1037,7 @@ void register_indexed_setters_getters() {
REGISTER_INDEXED_MEMBER(Vector2i);
REGISTER_INDEXED_MEMBER(Vector3);
REGISTER_INDEXED_MEMBER(Vector3i);
- REGISTER_INDEXED_MEMBER(Quat);
+ REGISTER_INDEXED_MEMBER(Quaternion);
REGISTER_INDEXED_MEMBER(Color);
REGISTER_INDEXED_MEMBER(Transform2D);
REGISTER_INDEXED_MEMBER(Basis);
@@ -2135,10 +2135,10 @@ void Variant::blend(const Variant &a, const Variant &b, float c, Variant &r_dst)
r_dst = ::AABB(ra->position + rb->position * c, ra->size + rb->size * c);
}
return;
- case QUAT: {
- Quat empty_rot;
- const Quat *qa = reinterpret_cast<const Quat *>(a._data._mem);
- const Quat *qb = reinterpret_cast<const Quat *>(b._data._mem);
+ case QUATERNION: {
+ Quaternion empty_rot;
+ const Quaternion *qa = reinterpret_cast<const Quaternion *>(a._data._mem);
+ const Quaternion *qb = reinterpret_cast<const Quaternion *>(b._data._mem);
r_dst = *qa * empty_rot.slerp(*qb, c);
}
return;
@@ -2295,8 +2295,8 @@ void Variant::interpolate(const Variant &a, const Variant &b, float c, Variant &
r_dst = a;
}
return;
- case QUAT: {
- r_dst = reinterpret_cast<const Quat *>(a._data._mem)->slerp(*reinterpret_cast<const Quat *>(b._data._mem), c);
+ case QUATERNION: {
+ r_dst = reinterpret_cast<const Quaternion *>(a._data._mem)->slerp(*reinterpret_cast<const Quaternion *>(b._data._mem), c);
}
return;
case AABB: {
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index 00bfb3dbb9..ed0cf5bd5d 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -2596,8 +2596,8 @@
<constant name="TYPE_PLANE" value="12" enum="Variant.Type">
Variable is of type [Plane].
</constant>
- <constant name="TYPE_QUAT" value="13" enum="Variant.Type">
- Variable is of type [Quat].
+ <constant name="TYPE_QUATERNION" value="13" enum="Variant.Type">
+ Variable is of type [Quaternion].
</constant>
<constant name="TYPE_AABB" value="14" enum="Variant.Type">
Variable is of type [AABB].
diff --git a/doc/classes/Animation.xml b/doc/classes/Animation.xml
index 7f99d06357..02203a3725 100644
--- a/doc/classes/Animation.xml
+++ b/doc/classes/Animation.xml
@@ -640,7 +640,7 @@
</argument>
<argument index="2" name="location" type="Vector3">
</argument>
- <argument index="3" name="rotation" type="Quat">
+ <argument index="3" name="rotation" type="Quaternion">
</argument>
<argument index="4" name="scale" type="Vector3">
</argument>
@@ -656,7 +656,7 @@
<argument index="1" name="time_sec" type="float">
</argument>
<description>
- Returns the interpolated value of a transform track at a given time (in seconds). An array consisting of 3 elements: position ([Vector3]), rotation ([Quat]) and scale ([Vector3]).
+ Returns the interpolated value of a transform track at a given time (in seconds). An array consisting of 3 elements: position ([Vector3]), rotation ([Quaternion]) and scale ([Vector3]).
</description>
</method>
<method name="value_track_get_key_indices" qualifiers="const">
diff --git a/doc/classes/Basis.xml b/doc/classes/Basis.xml
index f01a11e399..14fca04672 100644
--- a/doc/classes/Basis.xml
+++ b/doc/classes/Basis.xml
@@ -53,13 +53,13 @@
</argument>
<description>
Constructs a pure rotation basis matrix from the given Euler angles (in the YXZ convention: when *composing*, first Y, then X, and Z last), given in the vector format as (X angle, Y angle, Z angle).
- Consider using the [Quat] constructor instead, which uses a quaternion instead of Euler angles.
+ Consider using the [Quaternion] constructor instead, which uses a quaternion instead of Euler angles.
</description>
</method>
<method name="Basis" qualifiers="constructor">
<return type="Basis">
</return>
- <argument index="0" name="from" type="Quat">
+ <argument index="0" name="from" type="Quaternion">
</argument>
<description>
Constructs a pure rotation basis matrix from the given quaternion.
@@ -91,7 +91,7 @@
</return>
<description>
Returns the basis's rotation in the form of Euler angles (in the YXZ convention: when decomposing, first Z, then X, and Y last). The returned vector contains the rotation angles in the format (X angle, Y angle, Z angle).
- Consider using the [method get_rotation_quat] method instead, which returns a [Quat] quaternion instead of Euler angles.
+ Consider using the [method get_rotation_quaternion] method instead, which returns a [Quaternion] quaternion instead of Euler angles.
</description>
</method>
<method name="get_orthogonal_index" qualifiers="const">
@@ -101,8 +101,8 @@
This function considers a discretization of rotations into 24 points on unit sphere, lying along the vectors (x,y,z) with each component being either -1, 0, or 1, and returns the index of the point best representing the orientation of the object. It is mainly used by the [GridMap] editor. For further details, refer to the Godot source code.
</description>
</method>
- <method name="get_rotation_quat" qualifiers="const">
- <return type="Quat">
+ <method name="get_rotation_quaternion" qualifiers="const">
+ <return type="Quaternion">
</return>
<description>
Returns the basis's rotation in the form of a quaternion. See [method get_euler] if you need Euler angles, but keep in mind quaternions should generally be preferred to Euler angles.
diff --git a/doc/classes/Quat.xml b/doc/classes/Quaternion.xml
index 1c0a3e37c0..678fb0d44d 100644
--- a/doc/classes/Quat.xml
+++ b/doc/classes/Quaternion.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="Quat" version="4.0">
+<class name="Quaternion" version="4.0">
<brief_description>
Quaternion.
</brief_description>
<description>
A unit quaternion used for representing 3D rotations. Quaternions need to be normalized to be used for rotation.
- It is similar to Basis, which implements matrix representation of rotations, and can be parametrized using both an axis-angle pair or Euler angles. Basis stores rotation, scale, and shearing, while Quat only stores rotation.
+ It is similar to Basis, which implements matrix representation of rotations, and can be parametrized using both an axis-angle pair or Euler angles. Basis stores rotation, scale, and shearing, while Quaternion only stores rotation.
Due to its compactness and the way it is stored in memory, certain operations (obtaining axis-angle and performing SLERP, in particular) are more efficient and robust against floating-point errors.
</description>
<tutorials>
@@ -13,24 +13,24 @@
<link title="Third Person Shooter Demo">https://godotengine.org/asset-library/asset/678</link>
</tutorials>
<methods>
- <method name="Quat" qualifiers="constructor">
- <return type="Quat">
+ <method name="Quaternion" qualifiers="constructor">
+ <return type="Quaternion">
</return>
<description>
Constructs a default-initialized quaternion with all components set to [code]0[/code].
</description>
</method>
- <method name="Quat" qualifiers="constructor">
- <return type="Quat">
+ <method name="Quaternion" qualifiers="constructor">
+ <return type="Quaternion">
</return>
- <argument index="0" name="from" type="Quat">
+ <argument index="0" name="from" type="Quaternion">
</argument>
<description>
- Constructs a [Quat] as a copy of the given [Quat].
+ Constructs a [Quaternion] as a copy of the given [Quaternion].
</description>
</method>
- <method name="Quat" qualifiers="constructor">
- <return type="Quat">
+ <method name="Quaternion" qualifiers="constructor">
+ <return type="Quaternion">
</return>
<argument index="0" name="arc_from" type="Vector3">
</argument>
@@ -39,8 +39,8 @@
<description>
</description>
</method>
- <method name="Quat" qualifiers="constructor">
- <return type="Quat">
+ <method name="Quaternion" qualifiers="constructor">
+ <return type="Quaternion">
</return>
<argument index="0" name="axis" type="Vector3">
</argument>
@@ -50,8 +50,8 @@
Constructs a quaternion that will rotate around the given axis by the specified angle. The axis must be a normalized vector.
</description>
</method>
- <method name="Quat" qualifiers="constructor">
- <return type="Quat">
+ <method name="Quaternion" qualifiers="constructor">
+ <return type="Quaternion">
</return>
<argument index="0" name="euler" type="Vector3">
</argument>
@@ -59,8 +59,8 @@
Constructs a quaternion that will perform a rotation specified by Euler angles (in the YXZ convention: when decomposing, first Z, then X, and Y last), given in the vector format as (X angle, Y angle, Z angle).
</description>
</method>
- <method name="Quat" qualifiers="constructor">
- <return type="Quat">
+ <method name="Quaternion" qualifiers="constructor">
+ <return type="Quaternion">
</return>
<argument index="0" name="from" type="Basis">
</argument>
@@ -68,8 +68,8 @@
Constructs a quaternion from the given [Basis].
</description>
</method>
- <method name="Quat" qualifiers="constructor">
- <return type="Quat">
+ <method name="Quaternion" qualifiers="constructor">
+ <return type="Quaternion">
</return>
<argument index="0" name="x" type="float">
</argument>
@@ -84,13 +84,13 @@
</description>
</method>
<method name="cubic_slerp" qualifiers="const">
- <return type="Quat">
+ <return type="Quaternion">
</return>
- <argument index="0" name="b" type="Quat">
+ <argument index="0" name="b" type="Quaternion">
</argument>
- <argument index="1" name="pre_a" type="Quat">
+ <argument index="1" name="pre_a" type="Quaternion">
</argument>
- <argument index="2" name="post_b" type="Quat">
+ <argument index="2" name="post_b" type="Quaternion">
</argument>
<argument index="3" name="weight" type="float">
</argument>
@@ -101,7 +101,7 @@
<method name="dot" qualifiers="const">
<return type="float">
</return>
- <argument index="0" name="with" type="Quat">
+ <argument index="0" name="with" type="Quaternion">
</argument>
<description>
Returns the dot product of two quaternions.
@@ -115,7 +115,7 @@
</description>
</method>
<method name="inverse" qualifiers="const">
- <return type="Quat">
+ <return type="Quaternion">
</return>
<description>
Returns the inverse of the quaternion.
@@ -124,7 +124,7 @@
<method name="is_equal_approx" qualifiers="const">
<return type="bool">
</return>
- <argument index="0" name="to" type="Quat">
+ <argument index="0" name="to" type="Quaternion">
</argument>
<description>
Returns [code]true[/code] if this quaternion and [code]quat[/code] are approximately equal, by running [method @GlobalScope.is_equal_approx] on each component.
@@ -152,7 +152,7 @@
</description>
</method>
<method name="normalized" qualifiers="const">
- <return type="Quat">
+ <return type="Quaternion">
</return>
<description>
Returns a copy of the quaternion, normalized to unit length.
@@ -161,15 +161,15 @@
<method name="operator !=" qualifiers="operator">
<return type="bool">
</return>
- <argument index="0" name="right" type="Quat">
+ <argument index="0" name="right" type="Quaternion">
</argument>
<description>
</description>
</method>
<method name="operator *" qualifiers="operator">
- <return type="Quat">
+ <return type="Quaternion">
</return>
- <argument index="0" name="right" type="Quat">
+ <argument index="0" name="right" type="Quaternion">
</argument>
<description>
</description>
@@ -183,7 +183,7 @@
</description>
</method>
<method name="operator *" qualifiers="operator">
- <return type="Quat">
+ <return type="Quaternion">
</return>
<argument index="0" name="right" type="float">
</argument>
@@ -191,7 +191,7 @@
</description>
</method>
<method name="operator *" qualifiers="operator">
- <return type="Quat">
+ <return type="Quaternion">
</return>
<argument index="0" name="right" type="int">
</argument>
@@ -199,35 +199,35 @@
</description>
</method>
<method name="operator +" qualifiers="operator">
- <return type="Quat">
+ <return type="Quaternion">
</return>
<description>
</description>
</method>
<method name="operator +" qualifiers="operator">
- <return type="Quat">
+ <return type="Quaternion">
</return>
- <argument index="0" name="right" type="Quat">
+ <argument index="0" name="right" type="Quaternion">
</argument>
<description>
</description>
</method>
<method name="operator -" qualifiers="operator">
- <return type="Quat">
+ <return type="Quaternion">
</return>
<description>
</description>
</method>
<method name="operator -" qualifiers="operator">
- <return type="Quat">
+ <return type="Quaternion">
</return>
- <argument index="0" name="right" type="Quat">
+ <argument index="0" name="right" type="Quaternion">
</argument>
<description>
</description>
</method>
<method name="operator /" qualifiers="operator">
- <return type="Quat">
+ <return type="Quaternion">
</return>
<argument index="0" name="right" type="float">
</argument>
@@ -235,7 +235,7 @@
</description>
</method>
<method name="operator /" qualifiers="operator">
- <return type="Quat">
+ <return type="Quaternion">
</return>
<argument index="0" name="right" type="int">
</argument>
@@ -245,7 +245,7 @@
<method name="operator ==" qualifiers="operator">
<return type="bool">
</return>
- <argument index="0" name="right" type="Quat">
+ <argument index="0" name="right" type="Quaternion">
</argument>
<description>
</description>
@@ -259,9 +259,9 @@
</description>
</method>
<method name="slerp" qualifiers="const">
- <return type="Quat">
+ <return type="Quaternion">
</return>
- <argument index="0" name="to" type="Quat">
+ <argument index="0" name="to" type="Quaternion">
</argument>
<argument index="1" name="weight" type="float">
</argument>
@@ -271,9 +271,9 @@
</description>
</method>
<method name="slerpni" qualifiers="const">
- <return type="Quat">
+ <return type="Quaternion">
</return>
- <argument index="0" name="to" type="Quat">
+ <argument index="0" name="to" type="Quaternion">
</argument>
<argument index="1" name="weight" type="float">
</argument>
@@ -301,7 +301,7 @@
</member>
</members>
<constants>
- <constant name="IDENTITY" value="Quat( 0, 0, 0, 1 )">
+ <constant name="IDENTITY" value="Quaternion( 0, 0, 0, 1 )">
The identity quaternion, representing no rotation. Equivalent to an identity [Basis] matrix. If a vector is transformed by an identity quaternion, it will not change.
</constant>
</constants>
diff --git a/doc/classes/Vector3.xml b/doc/classes/Vector3.xml
index fdddddee28..b6effd441b 100644
--- a/doc/classes/Vector3.xml
+++ b/doc/classes/Vector3.xml
@@ -286,7 +286,7 @@
<method name="operator *" qualifiers="operator">
<return type="Vector3">
</return>
- <argument index="0" name="right" type="Quat">
+ <argument index="0" name="right" type="Quaternion">
</argument>
<description>
</description>
diff --git a/doc/classes/float.xml b/doc/classes/float.xml
index 11f6d91b05..f75c130039 100644
--- a/doc/classes/float.xml
+++ b/doc/classes/float.xml
@@ -113,12 +113,12 @@
</description>
</method>
<method name="operator *" qualifiers="operator">
- <return type="Quat">
+ <return type="Quaternion">
</return>
- <argument index="0" name="right" type="Quat">
+ <argument index="0" name="right" type="Quaternion">
</argument>
<description>
- Multiplies each component of the [Quat] by the given [float].
+ Multiplies each component of the [Quaternion] by the given [float].
</description>
</method>
<method name="operator *" qualifiers="operator">
diff --git a/doc/classes/int.xml b/doc/classes/int.xml
index 119cdf8eeb..b0ad963998 100644
--- a/doc/classes/int.xml
+++ b/doc/classes/int.xml
@@ -183,9 +183,9 @@
</description>
</method>
<method name="operator *" qualifiers="operator">
- <return type="Quat">
+ <return type="Quaternion">
</return>
- <argument index="0" name="right" type="Quat">
+ <argument index="0" name="right" type="Quaternion">
</argument>
<description>
Multiplies each component of the quaternion by the given integer.
diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp
index bd29eb973d..fde75e0f0c 100644
--- a/editor/animation_track_editor.cpp
+++ b/editor/animation_track_editor.cpp
@@ -525,7 +525,7 @@ public:
switch (animation->track_get_type(track)) {
case Animation::TYPE_TRANSFORM3D: {
p_list->push_back(PropertyInfo(Variant::VECTOR3, "location"));
- p_list->push_back(PropertyInfo(Variant::QUAT, "rotation"));
+ p_list->push_back(PropertyInfo(Variant::QUATERNION, "rotation"));
p_list->push_back(PropertyInfo(Variant::VECTOR3, "scale"));
} break;
@@ -1164,7 +1164,7 @@ public:
switch (animation->track_get_type(first_track)) {
case Animation::TYPE_TRANSFORM3D: {
p_list->push_back(PropertyInfo(Variant::VECTOR3, "location"));
- p_list->push_back(PropertyInfo(Variant::QUAT, "rotation"));
+ p_list->push_back(PropertyInfo(Variant::QUATERNION, "rotation"));
p_list->push_back(PropertyInfo(Variant::VECTOR3, "scale"));
} break;
case Animation::TYPE_VALUE: {
@@ -3376,7 +3376,7 @@ void AnimationTrackEditor::_query_insert(const InsertData &p_id) {
case Variant::FLOAT:
case Variant::VECTOR2:
case Variant::VECTOR3:
- case Variant::QUAT:
+ case Variant::QUATERNION:
case Variant::PLANE:
case Variant::COLOR: {
// Valid.
@@ -3845,7 +3845,7 @@ static Vector<String> _get_bezier_subindices_for_type(Variant::Type p_type, bool
subindices.push_back(":y");
subindices.push_back(":z");
} break;
- case Variant::QUAT: {
+ case Variant::QUATERNION: {
subindices.push_back(":x");
subindices.push_back(":y");
subindices.push_back(":z");
@@ -3911,7 +3911,7 @@ AnimationTrackEditor::TrackIndices AnimationTrackEditor::_confirm_insert(InsertD
h.type == Variant::RECT2 ||
h.type == Variant::VECTOR3 ||
h.type == Variant::AABB ||
- h.type == Variant::QUAT ||
+ h.type == Variant::QUATERNION ||
h.type == Variant::COLOR ||
h.type == Variant::PLANE ||
h.type == Variant::TRANSFORM2D ||
@@ -3950,7 +3950,7 @@ AnimationTrackEditor::TrackIndices AnimationTrackEditor::_confirm_insert(InsertD
Dictionary d;
d["location"] = tr.origin;
d["scale"] = tr.basis.get_scale();
- d["rotation"] = Quat(tr.basis);
+ d["rotation"] = Quaternion(tr.basis);
value = d;
} break;
case Animation::TYPE_BEZIER: {
@@ -4394,7 +4394,7 @@ void AnimationTrackEditor::_new_track_node_selected(NodePath p_path) {
filter.push_back(Variant::FLOAT);
filter.push_back(Variant::VECTOR2);
filter.push_back(Variant::VECTOR3);
- filter.push_back(Variant::QUAT);
+ filter.push_back(Variant::QUATERNION);
filter.push_back(Variant::PLANE);
filter.push_back(Variant::COLOR);
@@ -4464,7 +4464,7 @@ void AnimationTrackEditor::_new_track_property_selected(String p_name) {
h.type == Variant::RECT2 ||
h.type == Variant::VECTOR3 ||
h.type == Variant::AABB ||
- h.type == Variant::QUAT ||
+ h.type == Variant::QUATERNION ||
h.type == Variant::COLOR ||
h.type == Variant::PLANE ||
h.type == Variant::TRANSFORM2D ||
@@ -4564,7 +4564,7 @@ void AnimationTrackEditor::_insert_key_from_track(float p_ofs, int p_track) {
Vector3 loc = xf.get_origin();
Vector3 scale = xf.basis.get_scale_local();
- Quat rot = xf.basis;
+ Quaternion rot = xf.basis;
undo_redo->create_action(TTR("Add Transform Track Key"));
undo_redo->add_do_method(animation.ptr(), "transform_track_insert_key", p_track, p_ofs, loc, rot, scale);
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp
index 5fcee1851d..3c0651f019 100644
--- a/editor/connections_dialog.cpp
+++ b/editor/connections_dialog.cpp
@@ -203,8 +203,8 @@ void ConnectDialog::_add_bind() {
case Variant::PLANE:
value = Plane();
break;
- case Variant::QUAT:
- value = Quat();
+ case Variant::QUATERNION:
+ value = Quaternion();
break;
case Variant::AABB:
value = AABB();
@@ -443,7 +443,7 @@ ConnectDialog::ConnectDialog() {
type_list->add_item("Rect2", Variant::RECT2);
type_list->add_item("Vector3", Variant::VECTOR3);
type_list->add_item("Plane", Variant::PLANE);
- type_list->add_item("Quat", Variant::QUAT);
+ type_list->add_item("Quaternion", Variant::QUATERNION);
type_list->add_item("AABB", Variant::AABB);
type_list->add_item("Basis", Variant::BASIS);
type_list->add_item("Transform", Variant::TRANSFORM3D);
diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp
index 2088ea7ca6..ece7094767 100644
--- a/editor/editor_properties.cpp
+++ b/editor/editor_properties.cpp
@@ -1761,14 +1761,14 @@ EditorPropertyPlane::EditorPropertyPlane(bool p_force_wide) {
setting = false;
}
-///////////////////// QUAT /////////////////////////
+///////////////////// QUATERNION /////////////////////////
-void EditorPropertyQuat::_value_changed(double val, const String &p_name) {
+void EditorPropertyQuaternion::_value_changed(double val, const String &p_name) {
if (setting) {
return;
}
- Quat p;
+ Quaternion p;
p.x = spin[0]->get_value();
p.y = spin[1]->get_value();
p.z = spin[2]->get_value();
@@ -1776,8 +1776,8 @@ void EditorPropertyQuat::_value_changed(double val, const String &p_name) {
emit_changed(get_edited_property(), p, p_name);
}
-void EditorPropertyQuat::update_property() {
- Quat val = get_edited_object()->get(get_edited_property());
+void EditorPropertyQuaternion::update_property() {
+ Quaternion val = get_edited_object()->get(get_edited_property());
setting = true;
spin[0]->set_value(val.x);
spin[1]->set_value(val.y);
@@ -1786,7 +1786,7 @@ void EditorPropertyQuat::update_property() {
setting = false;
}
-void EditorPropertyQuat::_notification(int p_what) {
+void EditorPropertyQuaternion::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
Color base = get_theme_color("accent_color", "Editor");
for (int i = 0; i < 3; i++) {
@@ -1797,10 +1797,10 @@ void EditorPropertyQuat::_notification(int p_what) {
}
}
-void EditorPropertyQuat::_bind_methods() {
+void EditorPropertyQuaternion::_bind_methods() {
}
-void EditorPropertyQuat::setup(double p_min, double p_max, double p_step, bool p_no_slider) {
+void EditorPropertyQuaternion::setup(double p_min, double p_max, double p_step, bool p_no_slider) {
for (int i = 0; i < 4; i++) {
spin[i]->set_min(p_min);
spin[i]->set_max(p_max);
@@ -1811,7 +1811,7 @@ void EditorPropertyQuat::setup(double p_min, double p_max, double p_step, bool p
}
}
-EditorPropertyQuat::EditorPropertyQuat() {
+EditorPropertyQuaternion::EditorPropertyQuaternion() {
bool horizontal = EDITOR_GET("interface/inspector/horizontal_vector_types_editing");
BoxContainer *bc;
@@ -1832,7 +1832,7 @@ EditorPropertyQuat::EditorPropertyQuat() {
spin[i]->set_label(desc[i]);
bc->add_child(spin[i]);
add_focusable(spin[i]);
- spin[i]->connect("value_changed", callable_mp(this, &EditorPropertyQuat::_value_changed), varray(desc[i]));
+ spin[i]->connect("value_changed", callable_mp(this, &EditorPropertyQuaternion::_value_changed), varray(desc[i]));
if (horizontal) {
spin[i]->set_h_size_flags(SIZE_EXPAND_FILL);
}
@@ -3056,8 +3056,8 @@ bool EditorInspectorDefaultPlugin::parse_property(Object *p_object, Variant::Typ
editor->setup(min, max, step, hide_slider);
add_property_editor(p_path, editor);
} break;
- case Variant::QUAT: {
- EditorPropertyQuat *editor = memnew(EditorPropertyQuat);
+ case Variant::QUATERNION: {
+ EditorPropertyQuaternion *editor = memnew(EditorPropertyQuaternion);
double min = -65535, max = 65535, step = default_float_step;
bool hide_slider = true;
diff --git a/editor/editor_properties.h b/editor/editor_properties.h
index 2638a6666a..121848d936 100644
--- a/editor/editor_properties.h
+++ b/editor/editor_properties.h
@@ -465,8 +465,8 @@ public:
EditorPropertyPlane(bool p_force_wide = false);
};
-class EditorPropertyQuat : public EditorProperty {
- GDCLASS(EditorPropertyQuat, EditorProperty);
+class EditorPropertyQuaternion : public EditorProperty {
+ GDCLASS(EditorPropertyQuaternion, EditorProperty);
EditorSpinSlider *spin[4];
bool setting;
void _value_changed(double p_val, const String &p_name);
@@ -478,7 +478,7 @@ protected:
public:
virtual void update_property() override;
void setup(double p_min, double p_max, double p_step, bool p_no_slider);
- EditorPropertyQuat();
+ EditorPropertyQuaternion();
};
class EditorPropertyAABB : public EditorProperty {
diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp
index 93a5246660..bfa85f4aab 100644
--- a/editor/editor_properties_array_dict.cpp
+++ b/editor/editor_properties_array_dict.cpp
@@ -850,8 +850,8 @@ void EditorPropertyDictionary::update_property() {
prop = editor;
} break;
- case Variant::QUAT: {
- EditorPropertyQuat *editor = memnew(EditorPropertyQuat);
+ case Variant::QUATERNION: {
+ EditorPropertyQuaternion *editor = memnew(EditorPropertyQuaternion);
editor->setup(-100000, 100000, 0.001, true);
prop = editor;
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp
index e080586faa..dc1bd38a99 100644
--- a/editor/import/editor_import_collada.cpp
+++ b/editor/import/editor_import_collada.cpp
@@ -1545,7 +1545,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
Vector3 s = xform.basis.get_scale();
bool singular_matrix = Math::is_equal_approx(s.x, 0.0f) || Math::is_equal_approx(s.y, 0.0f) || Math::is_equal_approx(s.z, 0.0f);
- Quat q = singular_matrix ? Quat() : xform.basis.get_rotation_quat();
+ Quaternion q = singular_matrix ? Quaternion() : xform.basis.get_rotation_quaternion();
Vector3 l = xform.origin;
animation->transform_track_insert_key(track, snapshots[i], l, q, s);
@@ -1596,7 +1596,7 @@ void ColladaImport::create_animation(int p_clip, bool p_make_tracks_in_all_bones
Vector3 s = xform.basis.get_scale();
bool singular_matrix = Math::is_equal_approx(s.x, 0.0f) || Math::is_equal_approx(s.y, 0.0f) || Math::is_equal_approx(s.z, 0.0f);
- Quat q = singular_matrix ? Quat() : xform.basis.get_rotation_quat();
+ Quaternion q = singular_matrix ? Quaternion() : xform.basis.get_rotation_quaternion();
Vector3 l = xform.origin;
animation->transform_track_insert_key(track, 0, l, q, s);
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index f7a7fdebda..b589a6aaa0 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -857,7 +857,7 @@ void ResourceImporterScene::_create_clips(AnimationPlayer *anim, const Array &p_
if (kt > (from + 0.01) && k > 0) {
if (default_anim->track_get_type(j) == Animation::TYPE_TRANSFORM3D) {
- Quat q;
+ Quaternion q;
Vector3 p;
Vector3 s;
default_anim->transform_track_interpolate(j, from, &p, &q, &s);
@@ -871,7 +871,7 @@ void ResourceImporterScene::_create_clips(AnimationPlayer *anim, const Array &p_
}
if (default_anim->track_get_type(j) == Animation::TYPE_TRANSFORM3D) {
- Quat q;
+ Quaternion q;
Vector3 p;
Vector3 s;
default_anim->transform_track_get_key(j, k, &p, &q, &s);
@@ -885,7 +885,7 @@ void ResourceImporterScene::_create_clips(AnimationPlayer *anim, const Array &p_
if (dtrack != -1 && kt >= to) {
if (default_anim->track_get_type(j) == Animation::TYPE_TRANSFORM3D) {
- Quat q;
+ Quaternion q;
Vector3 p;
Vector3 s;
default_anim->transform_track_interpolate(j, to, &p, &q, &s);
@@ -903,7 +903,7 @@ void ResourceImporterScene::_create_clips(AnimationPlayer *anim, const Array &p_
dtrack = new_anim->get_track_count() - 1;
new_anim->track_set_path(dtrack, default_anim->track_get_path(j));
if (default_anim->track_get_type(j) == Animation::TYPE_TRANSFORM3D) {
- Quat q;
+ Quaternion q;
Vector3 p;
Vector3 s;
default_anim->transform_track_interpolate(j, from, &p, &q, &s);
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index ea2a800a10..7a4b0964fa 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -727,13 +727,13 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant::
value_editor[3]->set_text(String::num(plane.d));
} break;
- case Variant::QUAT: {
+ case Variant::QUATERNION: {
field_names.push_back("x");
field_names.push_back("y");
field_names.push_back("z");
field_names.push_back("w");
config_value_editors(4, 4, 10, field_names);
- Quat q = v;
+ Quaternion q = v;
value_editor[0]->set_text(String::num(q.x));
value_editor[1]->set_text(String::num(q.y));
value_editor[2]->set_text(String::num(q.z));
@@ -1513,8 +1513,8 @@ void CustomPropertyEditor::_modified(String p_string) {
_emit_changed_whole_or_field();
} break;
- case Variant::QUAT: {
- Quat q;
+ case Variant::QUATERNION: {
+ Quaternion q;
q.x = _parse_real_expression(value_editor[0]->get_text());
q.y = _parse_real_expression(value_editor[1]->get_text());
q.z = _parse_real_expression(value_editor[2]->get_text());
@@ -1635,7 +1635,7 @@ void CustomPropertyEditor::_focus_enter() {
case Variant::RECT2:
case Variant::VECTOR3:
case Variant::PLANE:
- case Variant::QUAT:
+ case Variant::QUATERNION:
case Variant::AABB:
case Variant::TRANSFORM2D:
case Variant::BASIS:
@@ -1661,7 +1661,7 @@ void CustomPropertyEditor::_focus_exit() {
case Variant::RECT2:
case Variant::VECTOR3:
case Variant::PLANE:
- case Variant::QUAT:
+ case Variant::QUATERNION:
case Variant::AABB:
case Variant::TRANSFORM2D:
case Variant::BASIS:
diff --git a/modules/fbx/data/pivot_transform.cpp b/modules/fbx/data/pivot_transform.cpp
index 3e4e197fbf..4cf42257a4 100644
--- a/modules/fbx/data/pivot_transform.cpp
+++ b/modules/fbx/data/pivot_transform.cpp
@@ -90,7 +90,7 @@ void PivotTransform::ReadTransformChain() {
if (ok) {
geometric_rotation = ImportUtils::EulerToQuaternion(rot, ImportUtils::deg2rad(GeometricRotation));
} else {
- geometric_rotation = Quat();
+ geometric_rotation = Quaternion();
}
const Vector3 &GeometricTranslation = ImportUtils::safe_import_vector3(FBXDocParser::PropertyGet<Vector3>(props, "GeometricTranslation", ok));
@@ -100,7 +100,7 @@ void PivotTransform::ReadTransformChain() {
geometric_translation = Vector3(0, 0, 0);
}
- if (geometric_rotation != Quat()) {
+ if (geometric_rotation != Quaternion()) {
print_error("geometric rotation is unsupported!");
//CRASH_COND(true);
}
@@ -116,7 +116,7 @@ void PivotTransform::ReadTransformChain() {
}
}
-Transform3D PivotTransform::ComputeLocalTransform(Vector3 p_translation, Quat p_rotation, Vector3 p_scaling) const {
+Transform3D PivotTransform::ComputeLocalTransform(Vector3 p_translation, Quaternion p_rotation, Vector3 p_scaling) const {
Transform3D T, Roff, Rp, Soff, Sp, S;
// Here I assume this is the operation which needs done.
@@ -142,18 +142,18 @@ Transform3D PivotTransform::ComputeLocalTransform(Vector3 p_translation, Quat p_
Transform3D PivotTransform::ComputeGlobalTransform(Transform3D t) const {
Vector3 pos = t.origin;
Vector3 scale = t.basis.get_scale();
- Quat rot = t.basis.get_rotation_quat();
+ Quaternion rot = t.basis.get_rotation_quaternion();
return ComputeGlobalTransform(pos, rot, scale);
}
Transform3D PivotTransform::ComputeLocalTransform(Transform3D t) const {
Vector3 pos = t.origin;
Vector3 scale = t.basis.get_scale();
- Quat rot = t.basis.get_rotation_quat();
+ Quaternion rot = t.basis.get_rotation_quaternion();
return ComputeLocalTransform(pos, rot, scale);
}
-Transform3D PivotTransform::ComputeGlobalTransform(Vector3 p_translation, Quat p_rotation, Vector3 p_scaling) const {
+Transform3D PivotTransform::ComputeGlobalTransform(Vector3 p_translation, Quaternion p_rotation, Vector3 p_scaling) const {
Transform3D T, Roff, Rp, Soff, Sp, S;
// Here I assume this is the operation which needs done.
@@ -183,11 +183,11 @@ Transform3D PivotTransform::ComputeGlobalTransform(Vector3 p_translation, Quat p
}
Transform3D local_rotation_m, parent_global_rotation_m;
- Quat parent_global_rotation = parent_global_xform.basis.get_rotation_quat();
- parent_global_rotation_m.basis.set_quat(parent_global_rotation);
+ Quaternion parent_global_rotation = parent_global_xform.basis.get_rotation_quaternion();
+ parent_global_rotation_m.basis.set_quaternion(parent_global_rotation);
local_rotation_m = Rpre * R * Rpost;
- //Basis parent_global_rotation = Basis(parent_global_xform.get_basis().get_rotation_quat().normalized());
+ //Basis parent_global_rotation = Basis(parent_global_xform.get_basis().get_rotation_quaternion().normalized());
Transform3D local_shear_scaling, parent_shear_scaling, parent_shear_rotation, parent_shear_translation;
Vector3 parent_translation = parent_global_xform.get_origin();
@@ -250,11 +250,11 @@ void PivotTransform::ComputePivotTransform() {
}
Transform3D local_rotation_m, parent_global_rotation_m;
- Quat parent_global_rotation = parent_global_xform.basis.get_rotation_quat();
- parent_global_rotation_m.basis.set_quat(parent_global_rotation);
+ Quaternion parent_global_rotation = parent_global_xform.basis.get_rotation_quaternion();
+ parent_global_rotation_m.basis.set_quaternion(parent_global_rotation);
local_rotation_m = Rpre * R * Rpost;
- //Basis parent_global_rotation = Basis(parent_global_xform.get_basis().get_rotation_quat().normalized());
+ //Basis parent_global_rotation = Basis(parent_global_xform.get_basis().get_rotation_quaternion().normalized());
Transform3D local_shear_scaling, parent_shear_scaling, parent_shear_rotation, parent_shear_translation;
Vector3 parent_translation = parent_global_xform.get_origin();
diff --git a/modules/fbx/data/pivot_transform.h b/modules/fbx/data/pivot_transform.h
index 8ed8358b70..29cf7a3d0e 100644
--- a/modules/fbx/data/pivot_transform.h
+++ b/modules/fbx/data/pivot_transform.h
@@ -58,10 +58,10 @@ enum TransformationComp {
struct PivotTransform : Reference, ModelAbstraction {
// at the end we want to keep geometric_ everything, post and pre rotation
// these are used during animation data processing / keyframe ingestion the rest can be simplified down / out.
- Quat pre_rotation = Quat();
- Quat post_rotation = Quat();
- Quat rotation = Quat();
- Quat geometric_rotation = Quat();
+ Quaternion pre_rotation = Quaternion();
+ Quaternion post_rotation = Quaternion();
+ Quaternion rotation = Quaternion();
+ Quaternion geometric_rotation = Quaternion();
Vector3 rotation_pivot = Vector3();
Vector3 rotation_offset = Vector3();
Vector3 scaling_offset = Vector3(1.0, 1.0, 1.0);
@@ -87,8 +87,8 @@ struct PivotTransform : Reference, ModelAbstraction {
Transform3D ComputeGlobalTransform(Transform3D t) const;
Transform3D ComputeLocalTransform(Transform3D t) const;
- Transform3D ComputeGlobalTransform(Vector3 p_translation, Quat p_rotation, Vector3 p_scaling) const;
- Transform3D ComputeLocalTransform(Vector3 p_translation, Quat p_rotation, Vector3 p_scaling) const;
+ Transform3D ComputeGlobalTransform(Vector3 p_translation, Quaternion p_rotation, Vector3 p_scaling) const;
+ Transform3D ComputeLocalTransform(Vector3 p_translation, Quaternion p_rotation, Vector3 p_scaling) const;
/* Extract into xforms and calculate once */
void ComputePivotTransform();
diff --git a/modules/fbx/editor_scene_importer_fbx.cpp b/modules/fbx/editor_scene_importer_fbx.cpp
index 4da0b55f42..40deaae74d 100644
--- a/modules/fbx/editor_scene_importer_fbx.cpp
+++ b/modules/fbx/editor_scene_importer_fbx.cpp
@@ -258,24 +258,24 @@ struct EditorSceneImporterAssetImportInterpolate {
//thank you for existing, partial specialization
template <>
-struct EditorSceneImporterAssetImportInterpolate<Quat> {
- Quat lerp(const Quat &a, const Quat &b, float c) const {
- ERR_FAIL_COND_V(!a.is_normalized(), Quat());
- ERR_FAIL_COND_V(!b.is_normalized(), Quat());
+struct EditorSceneImporterAssetImportInterpolate<Quaternion> {
+ Quaternion lerp(const Quaternion &a, const Quaternion &b, float c) const {
+ ERR_FAIL_COND_V(!a.is_normalized(), Quaternion());
+ ERR_FAIL_COND_V(!b.is_normalized(), Quaternion());
return a.slerp(b, c).normalized();
}
- Quat catmull_rom(const Quat &p0, const Quat &p1, const Quat &p2, const Quat &p3, float c) {
- ERR_FAIL_COND_V(!p1.is_normalized(), Quat());
- ERR_FAIL_COND_V(!p2.is_normalized(), Quat());
+ Quaternion catmull_rom(const Quaternion &p0, const Quaternion &p1, const Quaternion &p2, const Quaternion &p3, float c) {
+ ERR_FAIL_COND_V(!p1.is_normalized(), Quaternion());
+ ERR_FAIL_COND_V(!p2.is_normalized(), Quaternion());
return p1.slerp(p2, c).normalized();
}
- Quat bezier(Quat start, Quat control_1, Quat control_2, Quat end, float t) {
- ERR_FAIL_COND_V(!start.is_normalized(), Quat());
- ERR_FAIL_COND_V(!end.is_normalized(), Quat());
+ Quaternion bezier(Quaternion start, Quaternion control_1, Quaternion control_2, Quaternion end, float t) {
+ ERR_FAIL_COND_V(!start.is_normalized(), Quaternion());
+ ERR_FAIL_COND_V(!end.is_normalized(), Quaternion());
return start.slerp(end, t).normalized();
}
@@ -888,7 +888,7 @@ Node3D *EditorSceneImporterFBX::_generate_scene(
// we need to know what object the curves are for.
// we need the target ID and the target name for the track reduction.
- FBXDocParser::Model::RotOrder quat_rotation_order = FBXDocParser::Model::RotOrder_EulerXYZ;
+ FBXDocParser::Model::RotOrder quaternion_rotation_order = FBXDocParser::Model::RotOrder_EulerXYZ;
// T:: R:: S:: Visible:: Custom::
for (const FBXDocParser::AnimationCurveNode *curve_node : node_list) {
@@ -910,7 +910,7 @@ Node3D *EditorSceneImporterFBX::_generate_scene(
continue;
} else {
//print_verbose("[doc] applied rotation order: " + itos(target->RotationOrder()));
- quat_rotation_order = target->RotationOrder();
+ quaternion_rotation_order = target->RotationOrder();
}
uint64_t target_id = target->ID();
@@ -1086,7 +1086,7 @@ Node3D *EditorSceneImporterFBX::_generate_scene(
Vector<float> pos_times;
Vector<Vector3> scale_values;
Vector<float> scale_times;
- Vector<Quat> rot_values;
+ Vector<Quaternion> rot_values;
Vector<float> rot_times;
double max_duration = 0;
@@ -1122,8 +1122,8 @@ Node3D *EditorSceneImporterFBX::_generate_scene(
bool got_pre = false;
bool got_post = false;
- Quat post_rotation;
- Quat pre_rotation;
+ Quaternion post_rotation;
+ Quaternion pre_rotation;
// Rotation matrix
const Vector3 &PreRotation = FBXDocParser::PropertyGet<Vector3>(props, "PreRotation", got_pre);
@@ -1137,24 +1137,24 @@ Node3D *EditorSceneImporterFBX::_generate_scene(
post_rotation = ImportUtils::EulerToQuaternion(rot_order, ImportUtils::deg2rad(PostRotation));
}
- Quat lastQuat = Quat();
+ Quaternion lastQuaternion = Quaternion();
for (std::pair<int64_t, Vector3> rotation_key : rotation_keys.keyframes) {
double animation_track_time = CONVERT_FBX_TIME(rotation_key.first);
//print_verbose("euler rotation key: " + rotation_key.second);
- Quat rot_key_value = ImportUtils::EulerToQuaternion(quat_rotation_order, ImportUtils::deg2rad(rotation_key.second));
+ Quaternion rot_key_value = ImportUtils::EulerToQuaternion(quaternion_rotation_order, ImportUtils::deg2rad(rotation_key.second));
- if (lastQuat != Quat() && rot_key_value.dot(lastQuat) < 0) {
+ if (lastQuaternion != Quaternion() && rot_key_value.dot(lastQuaternion) < 0) {
rot_key_value.x = -rot_key_value.x;
rot_key_value.y = -rot_key_value.y;
rot_key_value.z = -rot_key_value.z;
rot_key_value.w = -rot_key_value.w;
}
// pre_post rotation possibly could fix orientation
- Quat final_rotation = pre_rotation * rot_key_value * post_rotation;
+ Quaternion final_rotation = pre_rotation * rot_key_value * post_rotation;
- lastQuat = final_rotation;
+ lastQuaternion = final_rotation;
if (animation_track_time > max_duration) {
max_duration = animation_track_time;
@@ -1182,13 +1182,13 @@ Node3D *EditorSceneImporterFBX::_generate_scene(
}
const Vector3 def_pos = translation_keys.has_default ? (translation_keys.default_value * state.scale) : bone_rest.origin;
- const Quat def_rot = rotation_keys.has_default ? ImportUtils::EulerToQuaternion(quat_rotation_order, ImportUtils::deg2rad(rotation_keys.default_value)) : bone_rest.basis.get_rotation_quat();
+ const Quaternion def_rot = rotation_keys.has_default ? ImportUtils::EulerToQuaternion(quaternion_rotation_order, ImportUtils::deg2rad(rotation_keys.default_value)) : bone_rest.basis.get_rotation_quaternion();
const Vector3 def_scale = scale_keys.has_default ? scale_keys.default_value : bone_rest.basis.get_scale();
print_verbose("track defaults: p(" + def_pos + ") s(" + def_scale + ") r(" + def_rot + ")");
while (true) {
Vector3 pos = def_pos;
- Quat rot = def_rot;
+ Quaternion rot = def_rot;
Vector3 scale = def_scale;
if (pos_values.size()) {
@@ -1197,7 +1197,7 @@ Node3D *EditorSceneImporterFBX::_generate_scene(
}
if (rot_values.size()) {
- rot = _interpolate_track<Quat>(rot_times, rot_values, time,
+ rot = _interpolate_track<Quaternion>(rot_times, rot_values, time,
AssetImportAnimation::INTERP_LINEAR);
}
@@ -1209,12 +1209,12 @@ Node3D *EditorSceneImporterFBX::_generate_scene(
// node animations must also include pivots
if (skeleton_bone >= 0) {
Transform3D xform = Transform3D();
- xform.basis.set_quat_scale(rot, scale);
+ xform.basis.set_quaternion_scale(rot, scale);
xform.origin = pos;
const Transform3D t = bone_rest.affine_inverse() * xform;
// populate this again
- rot = t.basis.get_rotation_quat();
+ rot = t.basis.get_rotation_quaternion();
rot.normalize();
scale = t.basis.get_scale();
pos = t.origin;
diff --git a/modules/fbx/tools/import_utils.cpp b/modules/fbx/tools/import_utils.cpp
index 259000d2a4..66b0153308 100644
--- a/modules/fbx/tools/import_utils.cpp
+++ b/modules/fbx/tools/import_utils.cpp
@@ -80,7 +80,7 @@ Basis ImportUtils::EulerToBasis(FBXDocParser::Model::RotOrder mode, const Vector
return ret;
}
-Quat ImportUtils::EulerToQuaternion(FBXDocParser::Model::RotOrder mode, const Vector3 &p_rotation) {
+Quaternion ImportUtils::EulerToQuaternion(FBXDocParser::Model::RotOrder mode, const Vector3 &p_rotation) {
return ImportUtils::EulerToBasis(mode, p_rotation);
}
@@ -117,7 +117,7 @@ Vector3 ImportUtils::BasisToEuler(FBXDocParser::Model::RotOrder mode, const Basi
}
}
-Vector3 ImportUtils::QuaternionToEuler(FBXDocParser::Model::RotOrder mode, const Quat &p_rotation) {
+Vector3 ImportUtils::QuaternionToEuler(FBXDocParser::Model::RotOrder mode, const Quaternion &p_rotation) {
return BasisToEuler(mode, p_rotation);
}
diff --git a/modules/fbx/tools/import_utils.h b/modules/fbx/tools/import_utils.h
index 3972f7520e..7625f67256 100644
--- a/modules/fbx/tools/import_utils.h
+++ b/modules/fbx/tools/import_utils.h
@@ -56,13 +56,13 @@ public:
static Basis EulerToBasis(FBXDocParser::Model::RotOrder mode, const Vector3 &p_rotation);
/// Converts rotation order vector (in rad) to quaternion.
- static Quat EulerToQuaternion(FBXDocParser::Model::RotOrder mode, const Vector3 &p_rotation);
+ static Quaternion EulerToQuaternion(FBXDocParser::Model::RotOrder mode, const Vector3 &p_rotation);
/// Converts basis into rotation order vector (in rad).
static Vector3 BasisToEuler(FBXDocParser::Model::RotOrder mode, const Basis &p_rotation);
/// Converts quaternion into rotation order vector (in rad).
- static Vector3 QuaternionToEuler(FBXDocParser::Model::RotOrder mode, const Quat &p_rotation);
+ static Vector3 QuaternionToEuler(FBXDocParser::Model::RotOrder mode, const Quaternion &p_rotation);
static void debug_xform(String name, const Transform3D &t) {
print_verbose(name + " " + t.origin + " rotation: " + (t.basis.get_euler() * (180 / Math_PI)));
diff --git a/modules/gdnative/gdnative/quat.cpp b/modules/gdnative/gdnative/quaternion.cpp
index 8ebcf7c91f..62bcbbd382 100644
--- a/modules/gdnative/gdnative/quat.cpp
+++ b/modules/gdnative/gdnative/quaternion.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* quat.cpp */
+/* quaternion.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,31 +28,31 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "gdnative/quat.h"
+#include "gdnative/quaternion.h"
-#include "core/math/quat.h"
+#include "core/math/quaternion.h"
-static_assert(sizeof(godot_quat) == sizeof(Quat), "Quat size mismatch");
+static_assert(sizeof(godot_quaternion) == sizeof(Quaternion), "Quaternion size mismatch");
#ifdef __cplusplus
extern "C" {
#endif
-void GDAPI godot_quat_new(godot_quat *p_self) {
- memnew_placement(p_self, Quat);
+void GDAPI godot_quaternion_new(godot_quaternion *p_self) {
+ memnew_placement(p_self, Quaternion);
}
-void GDAPI godot_quat_new_copy(godot_quat *r_dest, const godot_quat *p_src) {
- memnew_placement(r_dest, Quat(*(Quat *)p_src));
+void GDAPI godot_quaternion_new_copy(godot_quaternion *r_dest, const godot_quaternion *p_src) {
+ memnew_placement(r_dest, Quaternion(*(Quaternion *)p_src));
}
-godot_real_t GDAPI *godot_quat_operator_index(godot_quat *p_self, godot_int p_index) {
- Quat *self = (Quat *)p_self;
+godot_real_t GDAPI *godot_quaternion_operator_index(godot_quaternion *p_self, godot_int p_index) {
+ Quaternion *self = (Quaternion *)p_self;
return (godot_real_t *)&self->operator[](p_index);
}
-const godot_real_t GDAPI *godot_quat_operator_index_const(const godot_quat *p_self, godot_int p_index) {
- const Quat *self = (const Quat *)p_self;
+const godot_real_t GDAPI *godot_quaternion_operator_index_const(const godot_quaternion *p_self, godot_int p_index) {
+ const Quaternion *self = (const Quaternion *)p_self;
return (const godot_real_t *)&self->operator[](p_index);
}
diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp
index c588704627..24f50a94f5 100644
--- a/modules/gdnative/gdnative/variant.cpp
+++ b/modules/gdnative/gdnative/variant.cpp
@@ -143,10 +143,10 @@ void GDAPI godot_variant_new_plane(godot_variant *r_dest, const godot_plane *p_p
memnew_placement_custom(dest, Variant, Variant(*plane));
}
-void GDAPI godot_variant_new_quat(godot_variant *r_dest, const godot_quat *p_quat) {
+void GDAPI godot_variant_new_quaternion(godot_variant *r_dest, const godot_quaternion *p_quaternion) {
Variant *dest = (Variant *)r_dest;
- const Quat *quat = (const Quat *)p_quat;
- memnew_placement_custom(dest, Variant, Variant(*quat));
+ const Quaternion *quaternion = (const Quaternion *)p_quaternion;
+ memnew_placement_custom(dest, Variant, Variant(*quaternion));
}
void GDAPI godot_variant_new_aabb(godot_variant *r_dest, const godot_aabb *p_aabb) {
@@ -378,10 +378,10 @@ godot_plane GDAPI godot_variant_as_plane(const godot_variant *p_self) {
return raw_dest;
}
-godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_self) {
- godot_quat raw_dest;
+godot_quaternion GDAPI godot_variant_as_quaternion(const godot_variant *p_self) {
+ godot_quaternion raw_dest;
const Variant *self = (const Variant *)p_self;
- Quat *dest = (Quat *)&raw_dest;
+ Quaternion *dest = (Quaternion *)&raw_dest;
*dest = *self;
return raw_dest;
}
diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json
index ec825229ac..175a6a3c91 100644
--- a/modules/gdnative/gdnative_api.json
+++ b/modules/gdnative/gdnative_api.json
@@ -469,7 +469,7 @@
]
},
{
- "name": "godot_variant_new_quat",
+ "name": "godot_variant_new_quaternion",
"return_type": "void",
"arguments": [
[
@@ -477,8 +477,8 @@
"r_dest"
],
[
- "const godot_quat *",
- "p_quat"
+ "const godot_quaternion *",
+ "p_quaternion"
]
]
},
@@ -893,8 +893,8 @@
]
},
{
- "name": "godot_variant_as_quat",
- "return_type": "godot_quat",
+ "name": "godot_variant_as_quaternion",
+ "return_type": "godot_quaternion",
"arguments": [
[
"const godot_variant *",
@@ -3866,35 +3866,35 @@
]
},
{
- "name": "godot_quat_new",
+ "name": "godot_quaternion_new",
"return_type": "void",
"arguments": [
[
- "godot_quat *",
+ "godot_quaternion *",
"p_self"
]
]
},
{
- "name": "godot_quat_new_copy",
+ "name": "godot_quaternion_new_copy",
"return_type": "void",
"arguments": [
[
- "godot_quat *",
+ "godot_quaternion *",
"r_dest"
],
[
- "const godot_quat *",
+ "const godot_quaternion *",
"p_src"
]
]
},
{
- "name": "godot_quat_operator_index",
+ "name": "godot_quaternion_operator_index",
"return_type": "godot_real_t *",
"arguments": [
[
- "godot_quat *",
+ "godot_quaternion *",
"p_self"
],
[
@@ -3904,11 +3904,11 @@
]
},
{
- "name": "godot_quat_operator_index_const",
+ "name": "godot_quaternion_operator_index_const",
"return_type": "const godot_real_t *",
"arguments": [
[
- "const godot_quat *",
+ "const godot_quaternion *",
"p_self"
],
[
diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h
index 1937748bd4..d8c290f6bd 100644
--- a/modules/gdnative/include/gdnative/gdnative.h
+++ b/modules/gdnative/include/gdnative/gdnative.h
@@ -149,9 +149,9 @@ typedef void godot_object;
#include <gdnative/plane.h>
-/////// Quat
+/////// Quaternion
-#include <gdnative/quat.h>
+#include <gdnative/quaternion.h>
/////// AABB
diff --git a/modules/gdnative/include/gdnative/quat.h b/modules/gdnative/include/gdnative/quaternion.h
index 00abdb4404..75754e6ab5 100644
--- a/modules/gdnative/include/gdnative/quat.h
+++ b/modules/gdnative/include/gdnative/quaternion.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* quat.h */
+/* quaternion.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef GODOT_QUAT_H
-#define GODOT_QUAT_H
+#ifndef GODOT_QUATERNION_H
+#define GODOT_QUATERNION_H
#ifdef __cplusplus
extern "C" {
@@ -37,24 +37,24 @@ extern "C" {
#include <gdnative/math_defs.h>
-#define GODOT_QUAT_SIZE (sizeof(godot_real_t) * 4)
+#define GODOT_QUATERNION_SIZE (sizeof(godot_real_t) * 4)
-#ifndef GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED
-#define GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED
+#ifndef GODOT_CORE_API_GODOT_QUATERNION_TYPE_DEFINED
+#define GODOT_CORE_API_GODOT_QUATERNION_TYPE_DEFINED
typedef struct {
- uint8_t _dont_touch_that[GODOT_QUAT_SIZE];
-} godot_quat;
+ uint8_t _dont_touch_that[GODOT_QUATERNION_SIZE];
+} godot_quaternion;
#endif
#include <gdnative/gdnative.h>
-void GDAPI godot_quat_new(godot_quat *p_self);
-void GDAPI godot_quat_new_copy(godot_quat *r_dest, const godot_quat *p_src);
-godot_real_t GDAPI *godot_quat_operator_index(godot_quat *p_self, godot_int p_index);
-const godot_real_t GDAPI *godot_quat_operator_index_const(const godot_quat *p_self, godot_int p_index);
+void GDAPI godot_quaternion_new(godot_quaternion *p_self);
+void GDAPI godot_quaternion_new_copy(godot_quaternion *r_dest, const godot_quaternion *p_src);
+godot_real_t GDAPI *godot_quaternion_operator_index(godot_quaternion *p_self, godot_int p_index);
+const godot_real_t GDAPI *godot_quaternion_operator_index_const(const godot_quaternion *p_self, godot_int p_index);
#ifdef __cplusplus
}
#endif
-#endif // GODOT_QUAT_H
+#endif // GODOT_QUATERNION_H
diff --git a/modules/gdnative/include/gdnative/variant.h b/modules/gdnative/include/gdnative/variant.h
index 6bc6435114..dd4f76cf57 100644
--- a/modules/gdnative/include/gdnative/variant.h
+++ b/modules/gdnative/include/gdnative/variant.h
@@ -56,7 +56,7 @@ typedef enum godot_variant_type {
GODOT_VARIANT_TYPE_VECTOR3I,
GODOT_VARIANT_TYPE_TRANSFORM2D,
GODOT_VARIANT_TYPE_PLANE,
- GODOT_VARIANT_TYPE_QUAT,
+ GODOT_VARIANT_TYPE_QUATERNION,
GODOT_VARIANT_TYPE_AABB,
GODOT_VARIANT_TYPE_BASIS,
GODOT_VARIANT_TYPE_TRANSFORM3D,
@@ -177,7 +177,7 @@ typedef void (*godot_ptr_utility_function)(void *r_return, const void **p_argume
#include <gdnative/node_path.h>
#include <gdnative/packed_arrays.h>
#include <gdnative/plane.h>
-#include <gdnative/quat.h>
+#include <gdnative/quaternion.h>
#include <gdnative/rect2.h>
#include <gdnative/rid.h>
#include <gdnative/signal.h>
@@ -208,7 +208,7 @@ void GDAPI godot_variant_new_vector3(godot_variant *r_dest, const godot_vector3
void GDAPI godot_variant_new_vector3i(godot_variant *r_dest, const godot_vector3i *p_v3);
void GDAPI godot_variant_new_transform2d(godot_variant *r_dest, const godot_transform2d *p_t2d);
void GDAPI godot_variant_new_plane(godot_variant *r_dest, const godot_plane *p_plane);
-void GDAPI godot_variant_new_quat(godot_variant *r_dest, const godot_quat *p_quat);
+void GDAPI godot_variant_new_quaternion(godot_variant *r_dest, const godot_quaternion *p_quaternion);
void GDAPI godot_variant_new_aabb(godot_variant *r_dest, const godot_aabb *p_aabb);
void GDAPI godot_variant_new_basis(godot_variant *r_dest, const godot_basis *p_basis);
void GDAPI godot_variant_new_transform3d(godot_variant *r_dest, const godot_transform3d *p_trans);
@@ -243,7 +243,7 @@ godot_vector3 GDAPI godot_variant_as_vector3(const godot_variant *p_self);
godot_vector3i GDAPI godot_variant_as_vector3i(const godot_variant *p_self);
godot_transform2d GDAPI godot_variant_as_transform2d(const godot_variant *p_self);
godot_plane GDAPI godot_variant_as_plane(const godot_variant *p_self);
-godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_self);
+godot_quaternion GDAPI godot_variant_as_quaternion(const godot_variant *p_self);
godot_aabb GDAPI godot_variant_as_aabb(const godot_variant *p_self);
godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_self);
godot_transform3d GDAPI godot_variant_as_transform3d(const godot_variant *p_self);
diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp
index a4786c5396..e92adee8e8 100644
--- a/modules/gdscript/gdscript_analyzer.cpp
+++ b/modules/gdscript/gdscript_analyzer.cpp
@@ -2825,7 +2825,7 @@ void GDScriptAnalyzer::reduce_subscript(GDScriptParser::SubscriptNode *p_subscri
case Variant::RECT2:
case Variant::RECT2I:
case Variant::PLANE:
- case Variant::QUAT:
+ case Variant::QUATERNION:
case Variant::AABB:
case Variant::OBJECT:
error = index_type.builtin_type != Variant::STRING;
@@ -2904,7 +2904,7 @@ void GDScriptAnalyzer::reduce_subscript(GDScriptParser::SubscriptNode *p_subscri
case Variant::PACKED_FLOAT64_ARRAY:
case Variant::VECTOR2:
case Variant::VECTOR3:
- case Variant::QUAT:
+ case Variant::QUATERNION:
result_type.builtin_type = Variant::FLOAT;
break;
// Return Color.
diff --git a/modules/gdscript/gdscript_byte_codegen.cpp b/modules/gdscript/gdscript_byte_codegen.cpp
index 6d7d0951b0..6998cc5bb7 100644
--- a/modules/gdscript/gdscript_byte_codegen.cpp
+++ b/modules/gdscript/gdscript_byte_codegen.cpp
@@ -85,7 +85,7 @@ uint32_t GDScriptByteCodeGenerator::add_temporary(const GDScriptDataType &p_type
case Variant::VECTOR3I:
case Variant::TRANSFORM2D:
case Variant::PLANE:
- case Variant::QUAT:
+ case Variant::QUATERNION:
case Variant::AABB:
case Variant::BASIS:
case Variant::TRANSFORM3D:
@@ -458,8 +458,8 @@ void GDScriptByteCodeGenerator::write_type_adjust(const Address &p_target, Varia
case Variant::PLANE:
append(GDScriptFunction::OPCODE_TYPE_ADJUST_PLANE, 1);
break;
- case Variant::QUAT:
- append(GDScriptFunction::OPCODE_TYPE_ADJUST_QUAT, 1);
+ case Variant::QUATERNION:
+ append(GDScriptFunction::OPCODE_TYPE_ADJUST_QUATERNION, 1);
break;
case Variant::AABB:
append(GDScriptFunction::OPCODE_TYPE_ADJUST_AABB, 1);
@@ -1105,7 +1105,7 @@ void GDScriptByteCodeGenerator::write_call_ptrcall(const Address &p_target, cons
CASE_TYPE(STRING_NAME);
CASE_TYPE(NODE_PATH);
CASE_TYPE(RID);
- CASE_TYPE(QUAT);
+ CASE_TYPE(QUATERNION);
CASE_TYPE(OBJECT);
CASE_TYPE(CALLABLE);
CASE_TYPE(SIGNAL);
diff --git a/modules/gdscript/gdscript_disassembler.cpp b/modules/gdscript/gdscript_disassembler.cpp
index 8aa64d7dcc..1acb9ceddc 100644
--- a/modules/gdscript/gdscript_disassembler.cpp
+++ b/modules/gdscript/gdscript_disassembler.cpp
@@ -625,7 +625,7 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
DISASSEMBLE_PTRCALL(STRING_NAME);
DISASSEMBLE_PTRCALL(NODE_PATH);
DISASSEMBLE_PTRCALL(RID);
- DISASSEMBLE_PTRCALL(QUAT);
+ DISASSEMBLE_PTRCALL(QUATERNION);
DISASSEMBLE_PTRCALL(OBJECT);
DISASSEMBLE_PTRCALL(CALLABLE);
DISASSEMBLE_PTRCALL(SIGNAL);
@@ -957,7 +957,7 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const {
DISASSEMBLE_TYPE_ADJUST(VECTOR3I);
DISASSEMBLE_TYPE_ADJUST(TRANSFORM2D);
DISASSEMBLE_TYPE_ADJUST(PLANE);
- DISASSEMBLE_TYPE_ADJUST(QUAT);
+ DISASSEMBLE_TYPE_ADJUST(QUATERNION);
DISASSEMBLE_TYPE_ADJUST(AABB);
DISASSEMBLE_TYPE_ADJUST(BASIS);
DISASSEMBLE_TYPE_ADJUST(TRANSFORM);
diff --git a/modules/gdscript/gdscript_function.h b/modules/gdscript/gdscript_function.h
index 658be9f364..cd1704cb03 100644
--- a/modules/gdscript/gdscript_function.h
+++ b/modules/gdscript/gdscript_function.h
@@ -278,7 +278,7 @@ public:
OPCODE_CALL_PTRCALL_VECTOR3I,
OPCODE_CALL_PTRCALL_TRANSFORM2D,
OPCODE_CALL_PTRCALL_PLANE,
- OPCODE_CALL_PTRCALL_QUAT,
+ OPCODE_CALL_PTRCALL_QUATERNION,
OPCODE_CALL_PTRCALL_AABB,
OPCODE_CALL_PTRCALL_BASIS,
OPCODE_CALL_PTRCALL_TRANSFORM3D,
@@ -365,7 +365,7 @@ public:
OPCODE_TYPE_ADJUST_VECTOR3I,
OPCODE_TYPE_ADJUST_TRANSFORM2D,
OPCODE_TYPE_ADJUST_PLANE,
- OPCODE_TYPE_ADJUST_QUAT,
+ OPCODE_TYPE_ADJUST_QUATERNION,
OPCODE_TYPE_ADJUST_AABB,
OPCODE_TYPE_ADJUST_BASIS,
OPCODE_TYPE_ADJUST_TRANSFORM,
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 152b1ba23c..1af54ea8df 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -61,7 +61,7 @@ Variant::Type GDScriptParser::get_builtin_type(const StringName &p_type) {
builtin_types["Vector3i"] = Variant::VECTOR3I;
builtin_types["AABB"] = Variant::AABB;
builtin_types["Plane"] = Variant::PLANE;
- builtin_types["Quat"] = Variant::QUAT;
+ builtin_types["Quaternion"] = Variant::QUATERNION;
builtin_types["Basis"] = Variant::BASIS;
builtin_types["Transform"] = Variant::TRANSFORM3D;
builtin_types["Color"] = Variant::COLOR;
diff --git a/modules/gdscript/gdscript_vm.cpp b/modules/gdscript/gdscript_vm.cpp
index d45d50287e..318ec966ae 100644
--- a/modules/gdscript/gdscript_vm.cpp
+++ b/modules/gdscript/gdscript_vm.cpp
@@ -166,7 +166,7 @@ void (*type_init_function_table[])(Variant *) = {
&VariantInitializer<Vector3i>::init, // VECTOR3I.
&VariantInitializer<Transform2D>::init, // TRANSFORM2D.
&VariantInitializer<Plane>::init, // PLANE.
- &VariantInitializer<Quat>::init, // QUAT.
+ &VariantInitializer<Quaternion>::init, // QUATERNION.
&VariantInitializer<AABB>::init, // AABB.
&VariantInitializer<Basis>::init, // BASIS.
&VariantInitializer<Transform3D>::init, // TRANSFORM3D.
@@ -248,7 +248,7 @@ void (*type_init_function_table[])(Variant *) = {
&&OPCODE_CALL_PTRCALL_VECTOR3I, \
&&OPCODE_CALL_PTRCALL_TRANSFORM2D, \
&&OPCODE_CALL_PTRCALL_PLANE, \
- &&OPCODE_CALL_PTRCALL_QUAT, \
+ &&OPCODE_CALL_PTRCALL_QUATERNION, \
&&OPCODE_CALL_PTRCALL_AABB, \
&&OPCODE_CALL_PTRCALL_BASIS, \
&&OPCODE_CALL_PTRCALL_TRANSFORM3D, \
@@ -335,7 +335,7 @@ void (*type_init_function_table[])(Variant *) = {
&&OPCODE_TYPE_ADJUST_VECTOR3I, \
&&OPCODE_TYPE_ADJUST_TRANSFORM2D, \
&&OPCODE_TYPE_ADJUST_PLANE, \
- &&OPCODE_TYPE_ADJUST_QUAT, \
+ &&OPCODE_TYPE_ADJUST_QUATERNION, \
&&OPCODE_TYPE_ADJUST_AABB, \
&&OPCODE_TYPE_ADJUST_BASIS, \
&&OPCODE_TYPE_ADJUST_TRANSFORM, \
@@ -398,7 +398,7 @@ void (*type_init_function_table[])(Variant *) = {
#define OP_GET_VECTOR3I get_vector3i
#define OP_GET_RECT2 get_rect2
#define OP_GET_RECT2I get_rect2i
-#define OP_GET_QUAT get_quat
+#define OP_GET_QUATERNION get_quaternion
#define OP_GET_COLOR get_color
#define OP_GET_STRING get_string
#define OP_GET_STRING_NAME get_string_name
@@ -1733,7 +1733,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
OPCODE_CALL_PTR(VECTOR3I);
OPCODE_CALL_PTR(TRANSFORM2D);
OPCODE_CALL_PTR(PLANE);
- OPCODE_CALL_PTR(QUAT);
+ OPCODE_CALL_PTR(QUATERNION);
OPCODE_CALL_PTR(AABB);
OPCODE_CALL_PTR(BASIS);
OPCODE_CALL_PTR(TRANSFORM3D);
@@ -3150,7 +3150,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
OPCODE_TYPE_ADJUST(VECTOR3I, Vector3i);
OPCODE_TYPE_ADJUST(TRANSFORM2D, Transform2D);
OPCODE_TYPE_ADJUST(PLANE, Plane);
- OPCODE_TYPE_ADJUST(QUAT, Quat);
+ OPCODE_TYPE_ADJUST(QUATERNION, Quaternion);
OPCODE_TYPE_ADJUST(AABB, AABB);
OPCODE_TYPE_ADJUST(BASIS, Basis);
OPCODE_TYPE_ADJUST(TRANSFORM, Transform3D);
diff --git a/modules/gltf/doc_classes/GLTFNode.xml b/modules/gltf/doc_classes/GLTFNode.xml
index 33aad0028e..5d84d7088b 100644
--- a/modules/gltf/doc_classes/GLTFNode.xml
+++ b/modules/gltf/doc_classes/GLTFNode.xml
@@ -23,7 +23,7 @@
</member>
<member name="parent" type="int" setter="set_parent" getter="get_parent" default="-1">
</member>
- <member name="rotation" type="Quat" setter="set_rotation" getter="get_rotation" default="Quat( 0, 0, 0, 1 )">
+ <member name="rotation" type="Quaternion" setter="set_rotation" getter="get_rotation" default="Quaternion( 0, 0, 0, 1 )">
</member>
<member name="scale" type="Vector3" setter="set_scale" getter="get_scale" default="Vector3( 1, 1, 1 )">
</member>
diff --git a/modules/gltf/gltf_animation.h b/modules/gltf/gltf_animation.h
index a494e6bd67..216d2161c4 100644
--- a/modules/gltf/gltf_animation.h
+++ b/modules/gltf/gltf_animation.h
@@ -56,7 +56,7 @@ public:
struct Track {
Channel<Vector3> translation_track;
- Channel<Quat> rotation_track;
+ Channel<Quaternion> rotation_track;
Channel<Vector3> scale_track;
Vector<Channel<float>> weight_tracks;
};
diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp
index c32f7619d8..fa93704fd9 100644
--- a/modules/gltf/gltf_document.cpp
+++ b/modules/gltf/gltf_document.cpp
@@ -342,19 +342,19 @@ static Vector3 _arr_to_vec3(const Array &p_array) {
return Vector3(p_array[0], p_array[1], p_array[2]);
}
-static Array _quat_to_array(const Quat &p_quat) {
+static Array _quaternion_to_array(const Quaternion &p_quaternion) {
Array array;
array.resize(4);
- array[0] = p_quat.x;
- array[1] = p_quat.y;
- array[2] = p_quat.z;
- array[3] = p_quat.w;
+ array[0] = p_quaternion.x;
+ array[1] = p_quaternion.y;
+ array[2] = p_quaternion.z;
+ array[3] = p_quaternion.w;
return array;
}
-static Quat _arr_to_quat(const Array &p_array) {
- ERR_FAIL_COND_V(p_array.size() != 4, Quat());
- return Quat(p_array[0], p_array[1], p_array[2], p_array[3]);
+static Quaternion _arr_to_quaternion(const Array &p_array) {
+ ERR_FAIL_COND_V(p_array.size() != 4, Quaternion());
+ return Quaternion(p_array[0], p_array[1], p_array[2], p_array[3]);
}
static Transform3D _arr_to_xform(const Array &p_array) {
@@ -425,8 +425,8 @@ Error GLTFDocument::_serialize_nodes(Ref<GLTFState> state) {
node["matrix"] = _xform_to_array(n->xform);
}
- if (!n->rotation.is_equal_approx(Quat())) {
- node["rotation"] = _quat_to_array(n->rotation);
+ if (!n->rotation.is_equal_approx(Quaternion())) {
+ node["rotation"] = _quaternion_to_array(n->rotation);
}
if (!n->scale.is_equal_approx(Vector3(1.0f, 1.0f, 1.0f))) {
@@ -591,13 +591,13 @@ Error GLTFDocument::_parse_nodes(Ref<GLTFState> state) {
node->translation = _arr_to_vec3(n["translation"]);
}
if (n.has("rotation")) {
- node->rotation = _arr_to_quat(n["rotation"]);
+ node->rotation = _arr_to_quaternion(n["rotation"]);
}
if (n.has("scale")) {
node->scale = _arr_to_vec3(n["scale"]);
}
- node->xform.basis.set_quat_scale(node->rotation, node->scale);
+ node->xform.basis.set_quaternion_scale(node->rotation, node->scale);
node->xform.origin = node->translation;
}
@@ -1779,7 +1779,7 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_joints(Ref<GLTFState> state,
return state->accessors.size() - 1;
}
-GLTFAccessorIndex GLTFDocument::_encode_accessor_as_quats(Ref<GLTFState> state, const Vector<Quat> p_attribs, const bool p_for_vertex) {
+GLTFAccessorIndex GLTFDocument::_encode_accessor_as_quaternions(Ref<GLTFState> state, const Vector<Quaternion> p_attribs, const bool p_for_vertex) {
if (p_attribs.size() == 0) {
return -1;
}
@@ -1794,11 +1794,11 @@ GLTFAccessorIndex GLTFDocument::_encode_accessor_as_quats(Ref<GLTFState> state,
Vector<double> type_min;
type_min.resize(element_count);
for (int i = 0; i < p_attribs.size(); i++) {
- Quat quat = p_attribs[i];
- attribs.write[(i * element_count) + 0] = Math::snapped(quat.x, CMP_NORMALIZE_TOLERANCE);
- attribs.write[(i * element_count) + 1] = Math::snapped(quat.y, CMP_NORMALIZE_TOLERANCE);
- attribs.write[(i * element_count) + 2] = Math::snapped(quat.z, CMP_NORMALIZE_TOLERANCE);
- attribs.write[(i * element_count) + 3] = Math::snapped(quat.w, CMP_NORMALIZE_TOLERANCE);
+ Quaternion quaternion = p_attribs[i];
+ attribs.write[(i * element_count) + 0] = Math::snapped(quaternion.x, CMP_NORMALIZE_TOLERANCE);
+ attribs.write[(i * element_count) + 1] = Math::snapped(quaternion.y, CMP_NORMALIZE_TOLERANCE);
+ attribs.write[(i * element_count) + 2] = Math::snapped(quaternion.z, CMP_NORMALIZE_TOLERANCE);
+ attribs.write[(i * element_count) + 3] = Math::snapped(quaternion.w, CMP_NORMALIZE_TOLERANCE);
_calc_accessor_min_max(i, element_count, type_max, attribs, type_min);
}
@@ -2053,9 +2053,9 @@ Vector<Color> GLTFDocument::_decode_accessor_as_color(Ref<GLTFState> state, cons
}
return ret;
}
-Vector<Quat> GLTFDocument::_decode_accessor_as_quat(Ref<GLTFState> state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex) {
+Vector<Quaternion> GLTFDocument::_decode_accessor_as_quaternion(Ref<GLTFState> state, const GLTFAccessorIndex p_accessor, const bool p_for_vertex) {
const Vector<double> attribs = _decode_accessor(state, p_accessor, p_for_vertex);
- Vector<Quat> ret;
+ Vector<Quaternion> ret;
if (attribs.size() == 0) {
return ret;
@@ -2067,7 +2067,7 @@ Vector<Quat> GLTFDocument::_decode_accessor_as_quat(Ref<GLTFState> state, const
ret.resize(ret_size);
{
for (int i = 0; i < ret_size; i++) {
- ret.write[i] = Quat(attribs_ptr[i * 4 + 0], attribs_ptr[i * 4 + 1], attribs_ptr[i * 4 + 2], attribs_ptr[i * 4 + 3]).normalized();
+ ret.write[i] = Quaternion(attribs_ptr[i * 4 + 0], attribs_ptr[i * 4 + 1], attribs_ptr[i * 4 + 2], attribs_ptr[i * 4 + 3]).normalized();
}
}
return ret;
@@ -4607,8 +4607,8 @@ Error GLTFDocument::_serialize_animations(Ref<GLTFState> state) {
s["interpolation"] = interpolation_to_string(track.rotation_track.interpolation);
Vector<real_t> times = Variant(track.rotation_track.times);
s["input"] = _encode_accessor_as_floats(state, times, false);
- Vector<Quat> values = track.rotation_track.values;
- s["output"] = _encode_accessor_as_quats(state, values, false);
+ Vector<Quaternion> values = track.rotation_track.values;
+ s["output"] = _encode_accessor_as_quaternions(state, values, false);
samplers.push_back(s);
@@ -4777,7 +4777,7 @@ Error GLTFDocument::_parse_animations(Ref<GLTFState> state) {
track->translation_track.times = Variant(times); //convert via variant
track->translation_track.values = Variant(translations); //convert via variant
} else if (path == "rotation") {
- const Vector<Quat> rotations = _decode_accessor_as_quat(state, output, false);
+ const Vector<Quaternion> rotations = _decode_accessor_as_quaternion(state, output, false);
track->rotation_track.interpolation = interp;
track->rotation_track.times = Variant(times); //convert via variant
track->rotation_track.values = rotations;
@@ -5077,7 +5077,7 @@ GLTFSkeletonIndex GLTFDocument::_convert_skeleton(Ref<GLTFState> state, Skeleton
void GLTFDocument::_convert_spatial(Ref<GLTFState> state, Node3D *p_spatial, Ref<GLTFNode> p_node) {
Transform3D xform = p_spatial->get_transform();
p_node->scale = xform.basis.get_scale();
- p_node->rotation = xform.basis.get_rotation_quat();
+ p_node->rotation = xform.basis.get_rotation_quaternion();
p_node->translation = xform.origin;
}
@@ -5274,9 +5274,9 @@ void GLTFDocument::_convert_mult_mesh_instance_to_gltf(Node *p_scene_parent, con
transform.origin =
Vector3(xform_2d.get_origin().x, 0, xform_2d.get_origin().y);
real_t rotation = xform_2d.get_rotation();
- Quat quat(Vector3(0, 1, 0), rotation);
+ Quaternion quaternion(Vector3(0, 1, 0), rotation);
Size2 scale = xform_2d.get_scale();
- transform.basis.set_quat_scale(quat,
+ transform.basis.set_quaternion_scale(quaternion,
Vector3(scale.x, 0, scale.y));
transform =
multi_mesh_instance->get_transform() * transform;
@@ -5516,24 +5516,24 @@ struct EditorSceneImporterGLTFInterpolate {
// thank you for existing, partial specialization
template <>
-struct EditorSceneImporterGLTFInterpolate<Quat> {
- Quat lerp(const Quat &a, const Quat &b, const float c) const {
- ERR_FAIL_COND_V_MSG(!a.is_normalized(), Quat(), "The quaternion \"a\" must be normalized.");
- ERR_FAIL_COND_V_MSG(!b.is_normalized(), Quat(), "The quaternion \"b\" must be normalized.");
+struct EditorSceneImporterGLTFInterpolate<Quaternion> {
+ Quaternion lerp(const Quaternion &a, const Quaternion &b, const float c) const {
+ ERR_FAIL_COND_V_MSG(!a.is_normalized(), Quaternion(), "The quaternion \"a\" must be normalized.");
+ ERR_FAIL_COND_V_MSG(!b.is_normalized(), Quaternion(), "The quaternion \"b\" must be normalized.");
return a.slerp(b, c).normalized();
}
- Quat catmull_rom(const Quat &p0, const Quat &p1, const Quat &p2, const Quat &p3, const float c) {
- ERR_FAIL_COND_V_MSG(!p1.is_normalized(), Quat(), "The quaternion \"p1\" must be normalized.");
- ERR_FAIL_COND_V_MSG(!p2.is_normalized(), Quat(), "The quaternion \"p2\" must be normalized.");
+ Quaternion catmull_rom(const Quaternion &p0, const Quaternion &p1, const Quaternion &p2, const Quaternion &p3, const float c) {
+ ERR_FAIL_COND_V_MSG(!p1.is_normalized(), Quaternion(), "The quaternion \"p1\" must be normalized.");
+ ERR_FAIL_COND_V_MSG(!p2.is_normalized(), Quaternion(), "The quaternion \"p2\" must be normalized.");
return p1.slerp(p2, c).normalized();
}
- Quat bezier(const Quat start, const Quat control_1, const Quat control_2, const Quat end, const float t) {
- ERR_FAIL_COND_V_MSG(!start.is_normalized(), Quat(), "The start quaternion must be normalized.");
- ERR_FAIL_COND_V_MSG(!end.is_normalized(), Quat(), "The end quaternion must be normalized.");
+ Quaternion bezier(const Quaternion start, const Quaternion control_1, const Quaternion control_2, const Quaternion end, const float t) {
+ ERR_FAIL_COND_V_MSG(!start.is_normalized(), Quaternion(), "The start quaternion must be normalized.");
+ ERR_FAIL_COND_V_MSG(!end.is_normalized(), Quaternion(), "The end quaternion must be normalized.");
return start.slerp(end, t).normalized();
}
@@ -5681,7 +5681,7 @@ void GLTFDocument::_import_animation(Ref<GLTFState> state, AnimationPlayer *ap,
double time = 0.0;
Vector3 base_pos;
- Quat base_rot;
+ Quaternion base_rot;
Vector3 base_scale = Vector3(1, 1, 1);
if (!track.rotation_track.values.size()) {
@@ -5699,7 +5699,7 @@ void GLTFDocument::_import_animation(Ref<GLTFState> state, AnimationPlayer *ap,
bool last = false;
while (true) {
Vector3 pos = base_pos;
- Quat rot = base_rot;
+ Quaternion rot = base_rot;
Vector3 scale = base_scale;
if (track.translation_track.times.size()) {
@@ -5707,7 +5707,7 @@ void GLTFDocument::_import_animation(Ref<GLTFState> state, AnimationPlayer *ap,
}
if (track.rotation_track.times.size()) {
- rot = _interpolate_track<Quat>(track.rotation_track.times, track.rotation_track.values, time, track.rotation_track.interpolation);
+ rot = _interpolate_track<Quaternion>(track.rotation_track.times, track.rotation_track.values, time, track.rotation_track.interpolation);
}
if (track.scale_track.times.size()) {
@@ -5716,14 +5716,14 @@ void GLTFDocument::_import_animation(Ref<GLTFState> state, AnimationPlayer *ap,
if (gltf_node->skeleton >= 0) {
Transform3D xform;
- xform.basis.set_quat_scale(rot, scale);
+ xform.basis.set_quaternion_scale(rot, scale);
xform.origin = pos;
const Skeleton3D *skeleton = state->skeletons[gltf_node->skeleton]->godot_skeleton;
const int bone_idx = skeleton->find_bone(gltf_node->get_name());
xform = skeleton->get_bone_rest(bone_idx).affine_inverse() * xform;
- rot = xform.basis.get_rotation_quat();
+ rot = xform.basis.get_rotation_quaternion();
rot.normalize();
scale = xform.basis.get_scale();
pos = xform.origin;
@@ -5810,7 +5810,7 @@ void GLTFDocument::_convert_mesh_instances(Ref<GLTFState> state) {
ERR_CONTINUE(!mi);
Transform3D mi_xform = mi->get_transform();
node->scale = mi_xform.basis.get_scale();
- node->rotation = mi_xform.basis.get_rotation_quat();
+ node->rotation = mi_xform.basis.get_rotation_quaternion();
node->translation = mi_xform.origin;
Dictionary json_skin;
@@ -5874,7 +5874,7 @@ void GLTFDocument::_convert_mesh_instances(Ref<GLTFState> state) {
Transform3D bone_rest_xform = skeleton->get_bone_rest(bone_index);
joint_node->scale = bone_rest_xform.basis.get_scale();
- joint_node->rotation = bone_rest_xform.basis.get_rotation_quat();
+ joint_node->rotation = bone_rest_xform.basis.get_rotation_quaternion();
joint_node->translation = bone_rest_xform.origin;
joint_node->joint = true;
@@ -6036,16 +6036,16 @@ GLTFAnimation::Track GLTFDocument::_convert_animation_track(Ref<GLTFState> state
p_track.rotation_track.interpolation = gltf_interpolation;
for (int32_t key_i = 0; key_i < key_count; key_i++) {
Vector3 translation;
- Quat rotation;
+ Quaternion rotation;
Vector3 scale;
Error err = p_animation->transform_track_get_key(p_track_i, key_i, &translation, &rotation, &scale);
ERR_CONTINUE(err != OK);
Transform3D xform;
- xform.basis.set_quat_scale(rotation, scale);
+ xform.basis.set_quaternion_scale(rotation, scale);
xform.origin = translation;
xform = p_bone_rest * xform;
p_track.translation_track.values.write[key_i] = xform.get_origin();
- p_track.rotation_track.values.write[key_i] = xform.basis.get_rotation_quat();
+ p_track.rotation_track.values.write[key_i] = xform.basis.get_rotation_quaternion();
p_track.scale_track.values.write[key_i] = xform.basis.get_scale();
}
} else if (path.find(":transform") != -1) {
@@ -6065,7 +6065,7 @@ GLTFAnimation::Track GLTFDocument::_convert_animation_track(Ref<GLTFState> state
for (int32_t key_i = 0; key_i < key_count; key_i++) {
Transform3D xform = p_animation->track_get_key_value(p_track_i, key_i);
p_track.translation_track.values.write[key_i] = xform.get_origin();
- p_track.rotation_track.values.write[key_i] = xform.basis.get_rotation_quat();
+ p_track.rotation_track.values.write[key_i] = xform.basis.get_rotation_quaternion();
p_track.scale_track.values.write[key_i] = xform.basis.get_scale();
}
} else if (track_type == Animation::TYPE_VALUE) {
@@ -6077,7 +6077,7 @@ GLTFAnimation::Track GLTFDocument::_convert_animation_track(Ref<GLTFState> state
p_track.rotation_track.interpolation = gltf_interpolation;
for (int32_t key_i = 0; key_i < key_count; key_i++) {
- Quat rotation_track = p_animation->track_get_key_value(p_track_i, key_i);
+ Quaternion rotation_track = p_animation->track_get_key_value(p_track_i, key_i);
p_track.rotation_track.values.write[key_i] = rotation_track;
}
} else if (path.find(":translation") != -1) {
@@ -6104,7 +6104,7 @@ GLTFAnimation::Track GLTFDocument::_convert_animation_track(Ref<GLTFState> state
rotation_radian.x = Math::deg2rad(rotation_degrees.x);
rotation_radian.y = Math::deg2rad(rotation_degrees.y);
rotation_radian.z = Math::deg2rad(rotation_degrees.z);
- p_track.rotation_track.values.write[key_i] = Quat(rotation_radian);
+ p_track.rotation_track.values.write[key_i] = Quaternion(rotation_radian);
}
} else if (path.find(":scale") != -1) {
p_track.scale_track.times = times;
diff --git a/modules/gltf/gltf_document.h b/modules/gltf/gltf_document.h
index 3076ddb8ad..514373c4f0 100644
--- a/modules/gltf/gltf_document.h
+++ b/modules/gltf/gltf_document.h
@@ -205,7 +205,7 @@ private:
Vector<Color> _decode_accessor_as_color(Ref<GLTFState> state,
const GLTFAccessorIndex p_accessor,
const bool p_for_vertex);
- Vector<Quat> _decode_accessor_as_quat(Ref<GLTFState> state,
+ Vector<Quaternion> _decode_accessor_as_quaternion(Ref<GLTFState> state,
const GLTFAccessorIndex p_accessor,
const bool p_for_vertex);
Vector<Transform2D> _decode_accessor_as_xform2d(Ref<GLTFState> state,
@@ -273,8 +273,8 @@ private:
T _interpolate_track(const Vector<float> &p_times, const Vector<T> &p_values,
const float p_time,
const GLTFAnimation::Interpolation p_interp);
- GLTFAccessorIndex _encode_accessor_as_quats(Ref<GLTFState> state,
- const Vector<Quat> p_attribs,
+ GLTFAccessorIndex _encode_accessor_as_quaternions(Ref<GLTFState> state,
+ const Vector<Quaternion> p_attribs,
const bool p_for_vertex);
GLTFAccessorIndex _encode_accessor_as_weights(Ref<GLTFState> state,
const Vector<Color> p_attribs,
diff --git a/modules/gltf/gltf_node.cpp b/modules/gltf/gltf_node.cpp
index 759b52619d..5db7ad66c3 100644
--- a/modules/gltf/gltf_node.cpp
+++ b/modules/gltf/gltf_node.cpp
@@ -67,7 +67,7 @@ void GLTFNode::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::INT, "skeleton"), "set_skeleton", "get_skeleton"); // GLTFSkeletonIndex
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "joint"), "set_joint", "get_joint"); // bool
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "translation"), "set_translation", "get_translation"); // Vector3
- ADD_PROPERTY(PropertyInfo(Variant::QUAT, "rotation"), "set_rotation", "get_rotation"); // Quat
+ ADD_PROPERTY(PropertyInfo(Variant::QUATERNION, "rotation"), "set_rotation", "get_rotation"); // Quaternion
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "scale"), "set_scale", "get_scale"); // Vector3
ADD_PROPERTY(PropertyInfo(Variant::PACKED_INT32_ARRAY, "children"), "set_children", "get_children"); // Vector<int>
ADD_PROPERTY(PropertyInfo(Variant::INT, "light"), "set_light", "get_light"); // GLTFLightIndex
@@ -145,11 +145,11 @@ void GLTFNode::set_translation(Vector3 p_translation) {
translation = p_translation;
}
-Quat GLTFNode::get_rotation() {
+Quaternion GLTFNode::get_rotation() {
return rotation;
}
-void GLTFNode::set_rotation(Quat p_rotation) {
+void GLTFNode::set_rotation(Quaternion p_rotation) {
rotation = p_rotation;
}
diff --git a/modules/gltf/gltf_node.h b/modules/gltf/gltf_node.h
index 6e6d9d5248..378b6da8bf 100644
--- a/modules/gltf/gltf_node.h
+++ b/modules/gltf/gltf_node.h
@@ -50,7 +50,7 @@ private:
GLTFSkeletonIndex skeleton = -1;
bool joint = false;
Vector3 translation;
- Quat rotation;
+ Quaternion rotation;
Vector3 scale = Vector3(1, 1, 1);
Vector<int> children;
GLTFLightIndex light = -1;
@@ -86,8 +86,8 @@ public:
Vector3 get_translation();
void set_translation(Vector3 p_translation);
- Quat get_rotation();
- void set_rotation(Quat p_rotation);
+ Quaternion get_rotation();
+ void set_rotation(Quaternion p_rotation);
Vector3 get_scale();
void set_scale(Vector3 p_scale);
diff --git a/modules/mobile_vr/mobile_vr_interface.cpp b/modules/mobile_vr/mobile_vr_interface.cpp
index a0731f90f3..40b1745c35 100644
--- a/modules/mobile_vr/mobile_vr_interface.cpp
+++ b/modules/mobile_vr/mobile_vr_interface.cpp
@@ -185,8 +185,8 @@ void MobileVRInterface::set_position_from_sensors() {
// if you have a gyro + accelerometer that combo tends to be better than combining all three but without a gyro you need the magnetometer..
if (has_magneto && has_grav && !has_gyro) {
// convert to quaternions, easier to smooth those out
- Quat transform_quat(orientation);
- Quat acc_mag_quat(combine_acc_mag(grav, magneto));
+ Quaternion transform_quat(orientation);
+ Quaternion acc_mag_quat(combine_acc_mag(grav, magneto));
transform_quat = transform_quat.slerp(acc_mag_quat, 0.1);
orientation = Basis(transform_quat);
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 1f07f58ecc..5406e17054 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -496,7 +496,7 @@ static String variant_type_to_managed_name(const String &p_var_type_name) {
Variant::VECTOR3I,
Variant::TRANSFORM2D,
Variant::PLANE,
- Variant::QUAT,
+ Variant::QUATERNION,
Variant::AABB,
Variant::BASIS,
Variant::TRANSFORM3D,
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index c2707e46d9..94c5195b83 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -2523,7 +2523,7 @@ bool BindingsGenerator::_arg_default_value_is_assignable_to_type(const Variant &
case Variant::TRANSFORM2D:
case Variant::TRANSFORM3D:
case Variant::BASIS:
- case Variant::QUAT:
+ case Variant::QUATERNION:
case Variant::PLANE:
case Variant::AABB:
case Variant::COLOR:
@@ -3142,12 +3142,12 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar
}
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
} break;
- case Variant::QUAT: {
- Quat quat = p_val.operator Quat();
- if (quat == Quat()) {
- r_iarg.default_argument = "Quat.Identity";
+ case Variant::QUATERNION: {
+ Quaternion quaternion = p_val.operator Quaternion();
+ if (quaternion == Quaternion()) {
+ r_iarg.default_argument = "Quaternion.Identity";
} else {
- r_iarg.default_argument = "new Quat" + quat.operator String();
+ r_iarg.default_argument = "new Quaternion" + quaternion.operator String();
}
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
} break;
@@ -3196,7 +3196,7 @@ void BindingsGenerator::_populate_builtin_type_interfaces() {
INSERT_STRUCT_TYPE(Vector3)
INSERT_STRUCT_TYPE(Vector3i)
INSERT_STRUCT_TYPE(Basis)
- INSERT_STRUCT_TYPE(Quat)
+ INSERT_STRUCT_TYPE(Quaternion)
INSERT_STRUCT_TYPE(Transform3D)
INSERT_STRUCT_TYPE(AABB)
INSERT_STRUCT_TYPE(Color)
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
index 3f1120575f..01525e593f 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
@@ -207,7 +207,7 @@ namespace Godot
}
}
- public Quat RotationQuat()
+ public Quaternion RotationQuaternion()
{
Basis orthonormalizedBasis = Orthonormalized();
real_t det = orthonormalizedBasis.Determinant();
@@ -218,18 +218,18 @@ namespace Godot
orthonormalizedBasis = orthonormalizedBasis.Scaled(-Vector3.One);
}
- return orthonormalizedBasis.Quat();
+ return orthonormalizedBasis.Quaternion();
}
- internal void SetQuatScale(Quat quat, Vector3 scale)
+ internal void SetQuaternionScale(Quaternion quaternion, Vector3 scale)
{
SetDiagonal(scale);
- Rotate(quat);
+ Rotate(quaternion);
}
- private void Rotate(Quat quat)
+ private void Rotate(Quaternion quaternion)
{
- this *= new Basis(quat);
+ this *= new Basis(quaternion);
}
private void SetDiagonal(Vector3 diagonal)
@@ -263,8 +263,8 @@ namespace Godot
/// The returned vector contains the rotation angles in
/// the format (X angle, Y angle, Z angle).
///
- /// Consider using the <see cref="Basis.Quat()"/> method instead, which
- /// returns a <see cref="Godot.Quat"/> quaternion instead of Euler angles.
+ /// Consider using the <see cref="Basis.Quaternion()"/> method instead, which
+ /// returns a <see cref="Godot.Quaternion"/> quaternion instead of Euler angles.
/// </summary>
/// <returns>A Vector3 representing the basis rotation in Euler angles.</returns>
public Vector3 GetEuler()
@@ -486,8 +486,8 @@ namespace Godot
/// <returns>The resulting basis matrix of the interpolation.</returns>
public Basis Slerp(Basis target, real_t weight)
{
- Quat from = new Quat(this);
- Quat to = new Quat(target);
+ Quaternion from = new Quaternion(this);
+ Quaternion to = new Quaternion(target);
Basis b = new Basis(from.Slerp(to, weight));
b.Row0 *= Mathf.Lerp(Row0.Length(), target.Row0.Length(), weight);
@@ -588,8 +588,8 @@ namespace Godot
/// See <see cref="GetEuler()"/> if you need Euler angles, but keep in
/// mind that quaternions should generally be preferred to Euler angles.
/// </summary>
- /// <returns>A <see cref="Godot.Quat"/> representing the basis's rotation.</returns>
- public Quat Quat()
+ /// <returns>A <see cref="Godot.Quaternion"/> representing the basis's rotation.</returns>
+ public Quaternion Quaternion()
{
real_t trace = Row0[0] + Row1[1] + Row2[2];
@@ -597,7 +597,7 @@ namespace Godot
{
real_t s = Mathf.Sqrt(trace + 1.0f) * 2f;
real_t inv_s = 1f / s;
- return new Quat(
+ return new Quaternion(
(Row2[1] - Row1[2]) * inv_s,
(Row0[2] - Row2[0]) * inv_s,
(Row1[0] - Row0[1]) * inv_s,
@@ -609,7 +609,7 @@ namespace Godot
{
real_t s = Mathf.Sqrt(Row0[0] - Row1[1] - Row2[2] + 1.0f) * 2f;
real_t inv_s = 1f / s;
- return new Quat(
+ return new Quaternion(
s * 0.25f,
(Row0[1] + Row1[0]) * inv_s,
(Row0[2] + Row2[0]) * inv_s,
@@ -621,7 +621,7 @@ namespace Godot
{
real_t s = Mathf.Sqrt(-Row0[0] + Row1[1] - Row2[2] + 1.0f) * 2f;
real_t inv_s = 1f / s;
- return new Quat(
+ return new Quaternion(
(Row0[1] + Row1[0]) * inv_s,
s * 0.25f,
(Row1[2] + Row2[1]) * inv_s,
@@ -632,7 +632,7 @@ namespace Godot
{
real_t s = Mathf.Sqrt(-Row0[0] - Row1[1] + Row2[2] + 1.0f) * 2f;
real_t inv_s = 1f / s;
- return new Quat(
+ return new Quaternion(
(Row0[2] + Row2[0]) * inv_s,
(Row1[2] + Row2[1]) * inv_s,
s * 0.25f,
@@ -699,23 +699,23 @@ namespace Godot
/// <summary>
/// Constructs a pure rotation basis matrix from the given quaternion.
/// </summary>
- /// <param name="quat">The quaternion to create the basis from.</param>
- public Basis(Quat quat)
+ /// <param name="quaternion">The quaternion to create the basis from.</param>
+ public Basis(Quaternion quaternion)
{
- real_t s = 2.0f / quat.LengthSquared;
+ real_t s = 2.0f / quaternion.LengthSquared;
- real_t xs = quat.x * s;
- real_t ys = quat.y * s;
- real_t zs = quat.z * s;
- real_t wx = quat.w * xs;
- real_t wy = quat.w * ys;
- real_t wz = quat.w * zs;
- real_t xx = quat.x * xs;
- real_t xy = quat.x * ys;
- real_t xz = quat.x * zs;
- real_t yy = quat.y * ys;
- real_t yz = quat.y * zs;
- real_t zz = quat.z * zs;
+ real_t xs = quaternion.x * s;
+ real_t ys = quaternion.y * s;
+ real_t zs = quaternion.z * s;
+ real_t wx = quaternion.w * xs;
+ real_t wy = quaternion.w * ys;
+ real_t wz = quaternion.w * zs;
+ real_t xx = quaternion.x * xs;
+ real_t xy = quaternion.x * ys;
+ real_t xz = quaternion.x * zs;
+ real_t yy = quaternion.y * ys;
+ real_t yz = quaternion.y * zs;
+ real_t zz = quaternion.z * zs;
Row0 = new Vector3(1.0f - (yy + zz), xy - wz, xz + wy);
Row1 = new Vector3(xy + wz, 1.0f - (xx + zz), yz - wx);
@@ -727,8 +727,8 @@ namespace Godot
/// (in the YXZ convention: when *composing*, first Y, then X, and Z last),
/// given in the vector format as (X angle, Y angle, Z angle).
///
- /// Consider using the <see cref="Basis(Quat)"/> constructor instead, which
- /// uses a <see cref="Godot.Quat"/> quaternion instead of Euler angles.
+ /// Consider using the <see cref="Basis(Quaternion)"/> constructor instead, which
+ /// uses a <see cref="Godot.Quaternion"/> quaternion instead of Euler angles.
/// </summary>
/// <param name="eulerYXZ">The Euler angles to create the basis from.</param>
public Basis(Vector3 eulerYXZ)
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Quat.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs
index bd3bcb0c58..b087b4c200 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Quat.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs
@@ -15,7 +15,7 @@ namespace Godot
/// It is similar to Basis, which implements matrix representation of
/// rotations, and can be parametrized using both an axis-angle pair
/// or Euler angles. Basis stores rotation, scale, and shearing,
- /// while Quat only stores rotation.
+ /// while Quaternion only stores rotation.
///
/// Due to its compactness and the way it is stored in memory, certain
/// operations (obtaining axis-angle and performing SLERP, in particular)
@@ -23,7 +23,7 @@ namespace Godot
/// </summary>
[Serializable]
[StructLayout(LayoutKind.Sequential)]
- public struct Quat : IEquatable<Quat>
+ public struct Quaternion : IEquatable<Quaternion>
{
/// <summary>
/// X component of the quaternion (imaginary `i` axis part).
@@ -122,11 +122,11 @@ namespace Godot
/// <param name="postB">A quaternion after `b`.</param>
/// <param name="weight">A value on the range of 0.0 to 1.0, representing the amount of interpolation.</param>
/// <returns>The interpolated quaternion.</returns>
- public Quat CubicSlerp(Quat b, Quat preA, Quat postB, real_t weight)
+ public Quaternion CubicSlerp(Quaternion b, Quaternion preA, Quaternion postB, real_t weight)
{
real_t t2 = (1.0f - weight) * weight * 2f;
- Quat sp = Slerp(b, weight);
- Quat sq = preA.Slerpni(postB, weight);
+ Quaternion sp = Slerp(b, weight);
+ Quaternion sq = preA.Slerpni(postB, weight);
return sp.Slerpni(sq, t2);
}
@@ -135,7 +135,7 @@ namespace Godot
/// </summary>
/// <param name="b">The other quaternion.</param>
/// <returns>The dot product.</returns>
- public real_t Dot(Quat b)
+ public real_t Dot(Quaternion b)
{
return x * b.x + y * b.y + z * b.z + w * b.w;
}
@@ -152,7 +152,7 @@ namespace Godot
#if DEBUG
if (!IsNormalized())
{
- throw new InvalidOperationException("Quat is not normalized");
+ throw new InvalidOperationException("Quaternion is not normalized");
}
#endif
var basis = new Basis(this);
@@ -163,15 +163,15 @@ namespace Godot
/// Returns the inverse of the quaternion.
/// </summary>
/// <returns>The inverse quaternion.</returns>
- public Quat Inverse()
+ public Quaternion Inverse()
{
#if DEBUG
if (!IsNormalized())
{
- throw new InvalidOperationException("Quat is not normalized");
+ throw new InvalidOperationException("Quaternion is not normalized");
}
#endif
- return new Quat(-x, -y, -z, w);
+ return new Quaternion(-x, -y, -z, w);
}
/// <summary>
@@ -187,7 +187,7 @@ namespace Godot
/// Returns a copy of the quaternion, normalized to unit length.
/// </summary>
/// <returns>The normalized quaternion.</returns>
- public Quat Normalized()
+ public Quaternion Normalized()
{
return this / Length;
}
@@ -201,12 +201,12 @@ namespace Godot
/// <param name="to">The destination quaternion for interpolation. Must be normalized.</param>
/// <param name="weight">A value on the range of 0.0 to 1.0, representing the amount of interpolation.</param>
/// <returns>The resulting quaternion of the interpolation.</returns>
- public Quat Slerp(Quat to, real_t weight)
+ public Quaternion Slerp(Quaternion to, real_t weight)
{
#if DEBUG
if (!IsNormalized())
{
- throw new InvalidOperationException("Quat is not normalized");
+ throw new InvalidOperationException("Quaternion is not normalized");
}
if (!to.IsNormalized())
{
@@ -217,7 +217,7 @@ namespace Godot
// Calculate cosine.
real_t cosom = x * to.x + y * to.y + z * to.z + w * to.w;
- var to1 = new Quat();
+ var to1 = new Quaternion();
// Adjust signs if necessary.
if (cosom < 0.0)
@@ -255,7 +255,7 @@ namespace Godot
}
// Calculate final values.
- return new Quat
+ return new Quaternion
(
scale0 * x + scale1 * to1.x,
scale0 * y + scale1 * to1.y,
@@ -272,7 +272,7 @@ namespace Godot
/// <param name="to">The destination quaternion for interpolation. Must be normalized.</param>
/// <param name="weight">A value on the range of 0.0 to 1.0, representing the amount of interpolation.</param>
/// <returns>The resulting quaternion of the interpolation.</returns>
- public Quat Slerpni(Quat to, real_t weight)
+ public Quaternion Slerpni(Quaternion to, real_t weight)
{
real_t dot = Dot(to);
@@ -286,7 +286,7 @@ namespace Godot
real_t newFactor = Mathf.Sin(weight * theta) * sinT;
real_t invFactor = Mathf.Sin((1.0f - weight) * theta) * sinT;
- return new Quat
+ return new Quaternion
(
invFactor * x + newFactor * to.x,
invFactor * y + newFactor * to.y,
@@ -305,7 +305,7 @@ namespace Godot
#if DEBUG
if (!IsNormalized())
{
- throw new InvalidOperationException("Quat is not normalized");
+ throw new InvalidOperationException("Quaternion is not normalized");
}
#endif
var u = new Vector3(x, y, z);
@@ -314,15 +314,15 @@ namespace Godot
}
// Constants
- private static readonly Quat _identity = new Quat(0, 0, 0, 1);
+ private static readonly Quaternion _identity = new Quaternion(0, 0, 0, 1);
/// <summary>
/// The identity quaternion, representing no rotation.
/// Equivalent to an identity <see cref="Basis"/> matrix. If a vector is transformed by
/// an identity quaternion, it will not change.
/// </summary>
- /// <value>Equivalent to `new Quat(0, 0, 0, 1)`.</value>
- public static Quat Identity { get { return _identity; } }
+ /// <value>Equivalent to `new Quaternion(0, 0, 0, 1)`.</value>
+ public static Quaternion Identity { get { return _identity; } }
/// <summary>
/// Constructs a quaternion defined by the given values.
@@ -331,7 +331,7 @@ namespace Godot
/// <param name="y">Y component of the quaternion (imaginary `j` axis part).</param>
/// <param name="z">Z component of the quaternion (imaginary `k` axis part).</param>
/// <param name="w">W component of the quaternion (real part).</param>
- public Quat(real_t x, real_t y, real_t z, real_t w)
+ public Quaternion(real_t x, real_t y, real_t z, real_t w)
{
this.x = x;
this.y = y;
@@ -343,7 +343,7 @@ namespace Godot
/// Constructs a quaternion from the given quaternion.
/// </summary>
/// <param name="q">The existing quaternion.</param>
- public Quat(Quat q)
+ public Quaternion(Quaternion q)
{
this = q;
}
@@ -352,9 +352,9 @@ namespace Godot
/// Constructs a quaternion from the given <see cref="Basis"/>.
/// </summary>
/// <param name="basis">The basis to construct from.</param>
- public Quat(Basis basis)
+ public Quaternion(Basis basis)
{
- this = basis.Quat();
+ this = basis.Quaternion();
}
/// <summary>
@@ -364,7 +364,7 @@ namespace Godot
/// given in the vector format as (X angle, Y angle, Z angle).
/// </summary>
/// <param name="eulerYXZ"></param>
- public Quat(Vector3 eulerYXZ)
+ public Quaternion(Vector3 eulerYXZ)
{
real_t half_a1 = eulerYXZ.y * 0.5f;
real_t half_a2 = eulerYXZ.x * 0.5f;
@@ -393,7 +393,7 @@ namespace Godot
/// </summary>
/// <param name="axis">The axis to rotate around. Must be normalized.</param>
/// <param name="angle">The angle to rotate, in radians.</param>
- public Quat(Vector3 axis, real_t angle)
+ public Quaternion(Vector3 axis, real_t angle)
{
#if DEBUG
if (!axis.IsNormalized())
@@ -424,9 +424,9 @@ namespace Godot
}
}
- public static Quat operator *(Quat left, Quat right)
+ public static Quaternion operator *(Quaternion left, Quaternion right)
{
- return new Quat
+ return new Quaternion
(
left.w * right.x + left.x * right.w + left.y * right.z - left.z * right.y,
left.w * right.y + left.y * right.w + left.z * right.x - left.x * right.z,
@@ -435,24 +435,24 @@ namespace Godot
);
}
- public static Quat operator +(Quat left, Quat right)
+ public static Quaternion operator +(Quaternion left, Quaternion right)
{
- return new Quat(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w);
+ return new Quaternion(left.x + right.x, left.y + right.y, left.z + right.z, left.w + right.w);
}
- public static Quat operator -(Quat left, Quat right)
+ public static Quaternion operator -(Quaternion left, Quaternion right)
{
- return new Quat(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w);
+ return new Quaternion(left.x - right.x, left.y - right.y, left.z - right.z, left.w - right.w);
}
- public static Quat operator -(Quat left)
+ public static Quaternion operator -(Quaternion left)
{
- return new Quat(-left.x, -left.y, -left.z, -left.w);
+ return new Quaternion(-left.x, -left.y, -left.z, -left.w);
}
- public static Quat operator *(Quat left, Vector3 right)
+ public static Quaternion operator *(Quaternion left, Vector3 right)
{
- return new Quat
+ return new Quaternion
(
left.w * right.x + left.y * right.z - left.z * right.y,
left.w * right.y + left.z * right.x - left.x * right.z,
@@ -461,9 +461,9 @@ namespace Godot
);
}
- public static Quat operator *(Vector3 left, Quat right)
+ public static Quaternion operator *(Vector3 left, Quaternion right)
{
- return new Quat
+ return new Quaternion
(
right.w * left.x + right.y * left.z - right.z * left.y,
right.w * left.y + right.z * left.x - right.x * left.z,
@@ -472,42 +472,42 @@ namespace Godot
);
}
- public static Quat operator *(Quat left, real_t right)
+ public static Quaternion operator *(Quaternion left, real_t right)
{
- return new Quat(left.x * right, left.y * right, left.z * right, left.w * right);
+ return new Quaternion(left.x * right, left.y * right, left.z * right, left.w * right);
}
- public static Quat operator *(real_t left, Quat right)
+ public static Quaternion operator *(real_t left, Quaternion right)
{
- return new Quat(right.x * left, right.y * left, right.z * left, right.w * left);
+ return new Quaternion(right.x * left, right.y * left, right.z * left, right.w * left);
}
- public static Quat operator /(Quat left, real_t right)
+ public static Quaternion operator /(Quaternion left, real_t right)
{
return left * (1.0f / right);
}
- public static bool operator ==(Quat left, Quat right)
+ public static bool operator ==(Quaternion left, Quaternion right)
{
return left.Equals(right);
}
- public static bool operator !=(Quat left, Quat right)
+ public static bool operator !=(Quaternion left, Quaternion right)
{
return !left.Equals(right);
}
public override bool Equals(object obj)
{
- if (obj is Quat)
+ if (obj is Quaternion)
{
- return Equals((Quat)obj);
+ return Equals((Quaternion)obj);
}
return false;
}
- public bool Equals(Quat other)
+ public bool Equals(Quaternion other)
{
return x == other.x && y == other.y && z == other.z && w == other.w;
}
@@ -518,7 +518,7 @@ namespace Godot
/// </summary>
/// <param name="other">The other quaternion to compare.</param>
/// <returns>Whether or not the quaternions are approximately equal.</returns>
- public bool IsEqualApprox(Quat other)
+ public bool IsEqualApprox(Quaternion other)
{
return Mathf.IsEqualApprox(x, other.x) && Mathf.IsEqualApprox(y, other.y) && Mathf.IsEqualApprox(z, other.z) && Mathf.IsEqualApprox(w, other.w);
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs
index 9e5ff2b315..50cc95fb95 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs
@@ -124,15 +124,15 @@ namespace Godot
/* not sure if very "efficient" but good enough? */
Vector3 sourceScale = basis.Scale;
- Quat sourceRotation = basis.RotationQuat();
+ Quaternion sourceRotation = basis.RotationQuaternion();
Vector3 sourceLocation = origin;
Vector3 destinationScale = transform.basis.Scale;
- Quat destinationRotation = transform.basis.RotationQuat();
+ Quaternion destinationRotation = transform.basis.RotationQuaternion();
Vector3 destinationLocation = transform.origin;
var interpolated = new Transform3D();
- interpolated.basis.SetQuatScale(sourceRotation.Slerp(destinationRotation, weight).Normalized(), sourceScale.Lerp(destinationScale, weight));
+ interpolated.basis.SetQuaternionScale(sourceRotation.Slerp(destinationRotation, weight).Normalized(), sourceScale.Lerp(destinationScale, weight));
interpolated.origin = sourceLocation.Lerp(destinationLocation, weight);
return interpolated;
@@ -324,11 +324,11 @@ namespace Godot
/// <summary>
/// Constructs a transformation matrix from the given quaternion and origin vector.
/// </summary>
- /// <param name="quat">The <see cref="Godot.Quat"/> to create the basis from.</param>
+ /// <param name="quaternion">The <see cref="Godot.Quaternion"/> to create the basis from.</param>
/// <param name="origin">The origin vector, or column index 3.</param>
- public Transform3D(Quat quat, Vector3 origin)
+ public Transform3D(Quaternion quaternion, Vector3 origin)
{
- basis = new Basis(quat);
+ basis = new Basis(quaternion);
this.origin = origin;
}
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj b/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj
index c3dd13d84b..1fcfe74c86 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj
+++ b/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj
@@ -50,7 +50,7 @@
<Compile Include="Core\NodePath.cs" />
<Compile Include="Core\Object.base.cs" />
<Compile Include="Core\Plane.cs" />
- <Compile Include="Core\Quat.cs" />
+ <Compile Include="Core\Quaternion.cs" />
<Compile Include="Core\Rect2.cs" />
<Compile Include="Core\Rect2i.cs" />
<Compile Include="Core\RID.cs" />
diff --git a/modules/mono/mono_gd/gd_mono_cache.cpp b/modules/mono/mono_gd/gd_mono_cache.cpp
index adb0518cd6..341ca88728 100644
--- a/modules/mono/mono_gd/gd_mono_cache.cpp
+++ b/modules/mono/mono_gd/gd_mono_cache.cpp
@@ -109,7 +109,7 @@ void CachedData::clear_godot_api_cache() {
class_Vector3 = nullptr;
class_Vector3i = nullptr;
class_Basis = nullptr;
- class_Quat = nullptr;
+ class_Quaternion = nullptr;
class_Transform3D = nullptr;
class_AABB = nullptr;
class_Color = nullptr;
@@ -238,7 +238,7 @@ void update_godot_api_cache() {
CACHE_CLASS_AND_CHECK(Vector3, GODOT_API_CLASS(Vector3));
CACHE_CLASS_AND_CHECK(Vector3i, GODOT_API_CLASS(Vector3i));
CACHE_CLASS_AND_CHECK(Basis, GODOT_API_CLASS(Basis));
- CACHE_CLASS_AND_CHECK(Quat, GODOT_API_CLASS(Quat));
+ CACHE_CLASS_AND_CHECK(Quaternion, GODOT_API_CLASS(Quaternion));
CACHE_CLASS_AND_CHECK(Transform3D, GODOT_API_CLASS(Transform3D));
CACHE_CLASS_AND_CHECK(AABB, GODOT_API_CLASS(AABB));
CACHE_CLASS_AND_CHECK(Color, GODOT_API_CLASS(Color));
diff --git a/modules/mono/mono_gd/gd_mono_cache.h b/modules/mono/mono_gd/gd_mono_cache.h
index a332d492b9..3d867060f5 100644
--- a/modules/mono/mono_gd/gd_mono_cache.h
+++ b/modules/mono/mono_gd/gd_mono_cache.h
@@ -80,7 +80,7 @@ struct CachedData {
GDMonoClass *class_Vector3;
GDMonoClass *class_Vector3i;
GDMonoClass *class_Basis;
- GDMonoClass *class_Quat;
+ GDMonoClass *class_Quaternion;
GDMonoClass *class_Transform3D;
GDMonoClass *class_AABB;
GDMonoClass *class_Color;
diff --git a/modules/mono/mono_gd/gd_mono_field.cpp b/modules/mono/mono_gd/gd_mono_field.cpp
index 97e3fe1677..111eaa0bbf 100644
--- a/modules/mono/mono_gd/gd_mono_field.cpp
+++ b/modules/mono/mono_gd/gd_mono_field.cpp
@@ -146,8 +146,8 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_
break;
}
- if (tclass == CACHED_CLASS(Quat)) {
- GDMonoMarshal::M_Quat from = MARSHALLED_OUT(Quat, p_value.operator ::Quat());
+ if (tclass == CACHED_CLASS(Quaternion)) {
+ GDMonoMarshal::M_Quaternion from = MARSHALLED_OUT(Quaternion, p_value.operator ::Quaternion());
mono_field_set_value(p_object, mono_field, &from);
break;
}
@@ -336,8 +336,8 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_
GDMonoMarshal::M_Plane from = MARSHALLED_OUT(Plane, p_value.operator ::Plane());
mono_field_set_value(p_object, mono_field, &from);
} break;
- case Variant::QUAT: {
- GDMonoMarshal::M_Quat from = MARSHALLED_OUT(Quat, p_value.operator ::Quat());
+ case Variant::QUATERNION: {
+ GDMonoMarshal::M_Quaternion from = MARSHALLED_OUT(Quaternion, p_value.operator ::Quaternion());
mono_field_set_value(p_object, mono_field, &from);
} break;
case Variant::AABB: {
diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp
index 0623755263..c8f80e7777 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.cpp
+++ b/modules/mono/mono_gd/gd_mono_marshal.cpp
@@ -104,8 +104,8 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type, bool *r_nil_is_
return Variant::BASIS;
}
- if (vtclass == CACHED_CLASS(Quat)) {
- return Variant::QUAT;
+ if (vtclass == CACHED_CLASS(Quaternion)) {
+ return Variant::QUATERNION;
}
if (vtclass == CACHED_CLASS(Transform3D)) {
@@ -508,9 +508,9 @@ MonoObject *variant_to_mono_object(const Variant &p_var) {
GDMonoMarshal::M_Plane from = MARSHALLED_OUT(Plane, p_var.operator ::Plane());
return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Plane), &from);
}
- case Variant::QUAT: {
- GDMonoMarshal::M_Quat from = MARSHALLED_OUT(Quat, p_var.operator ::Quat());
- return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Quat), &from);
+ case Variant::QUATERNION: {
+ GDMonoMarshal::M_Quaternion from = MARSHALLED_OUT(Quaternion, p_var.operator ::Quaternion());
+ return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(Quaternion), &from);
}
case Variant::AABB: {
GDMonoMarshal::M_AABB from = MARSHALLED_OUT(AABB, p_var.operator ::AABB());
@@ -619,7 +619,7 @@ size_t variant_get_managed_unboxed_size(const ManagedType &p_type) {
RETURN_CHECK_FOR_STRUCT(Vector3);
RETURN_CHECK_FOR_STRUCT(Vector3i);
RETURN_CHECK_FOR_STRUCT(Basis);
- RETURN_CHECK_FOR_STRUCT(Quat);
+ RETURN_CHECK_FOR_STRUCT(Quaternion);
RETURN_CHECK_FOR_STRUCT(Transform3D);
RETURN_CHECK_FOR_STRUCT(AABB);
RETURN_CHECK_FOR_STRUCT(Color);
@@ -724,7 +724,7 @@ void *variant_to_managed_unboxed(const Variant &p_var, const ManagedType &p_type
RETURN_CHECK_FOR_STRUCT(Vector3);
RETURN_CHECK_FOR_STRUCT(Vector3i);
RETURN_CHECK_FOR_STRUCT(Basis);
- RETURN_CHECK_FOR_STRUCT(Quat);
+ RETURN_CHECK_FOR_STRUCT(Quaternion);
RETURN_CHECK_FOR_STRUCT(Transform3D);
RETURN_CHECK_FOR_STRUCT(AABB);
RETURN_CHECK_FOR_STRUCT(Color);
@@ -880,7 +880,7 @@ MonoObject *variant_to_mono_object(const Variant &p_var, const ManagedType &p_ty
RETURN_CHECK_FOR_STRUCT(Vector3);
RETURN_CHECK_FOR_STRUCT(Vector3i);
RETURN_CHECK_FOR_STRUCT(Basis);
- RETURN_CHECK_FOR_STRUCT(Quat);
+ RETURN_CHECK_FOR_STRUCT(Quaternion);
RETURN_CHECK_FOR_STRUCT(Transform3D);
RETURN_CHECK_FOR_STRUCT(AABB);
RETURN_CHECK_FOR_STRUCT(Color);
@@ -1036,8 +1036,8 @@ Variant mono_object_to_variant_impl(MonoObject *p_obj, const ManagedType &p_type
return MARSHALLED_IN(Basis, unbox_addr<GDMonoMarshal::M_Basis>(p_obj));
}
- if (vtclass == CACHED_CLASS(Quat)) {
- return MARSHALLED_IN(Quat, unbox_addr<GDMonoMarshal::M_Quat>(p_obj));
+ if (vtclass == CACHED_CLASS(Quaternion)) {
+ return MARSHALLED_IN(Quaternion, unbox_addr<GDMonoMarshal::M_Quaternion>(p_obj));
}
if (vtclass == CACHED_CLASS(Transform3D)) {
diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h
index 141d6a66bd..88afc7ebc5 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.h
+++ b/modules/mono/mono_gd/gd_mono_marshal.h
@@ -263,11 +263,11 @@ enum {
MATCHES_Basis = (MATCHES_Vector3 && (sizeof(Basis) == (sizeof(Vector3) * 3))), // No field offset required, it stores an array
- MATCHES_Quat = (MATCHES_real_t && (sizeof(Quat) == (sizeof(real_t) * 4)) &&
- offsetof(Quat, x) == (sizeof(real_t) * 0) &&
- offsetof(Quat, y) == (sizeof(real_t) * 1) &&
- offsetof(Quat, z) == (sizeof(real_t) * 2) &&
- offsetof(Quat, w) == (sizeof(real_t) * 3)),
+ MATCHES_Quaternion = (MATCHES_real_t && (sizeof(Quaternion) == (sizeof(real_t) * 4)) &&
+ offsetof(Quaternion, x) == (sizeof(real_t) * 0) &&
+ offsetof(Quaternion, y) == (sizeof(real_t) * 1) &&
+ offsetof(Quaternion, z) == (sizeof(real_t) * 2) &&
+ offsetof(Quaternion, w) == (sizeof(real_t) * 3)),
MATCHES_Transform3D = (MATCHES_Basis && MATCHES_Vector3 && (sizeof(Transform3D) == (sizeof(Basis) + sizeof(Vector3))) &&
offsetof(Transform3D, basis) == 0 &&
@@ -292,7 +292,7 @@ enum {
#ifdef GD_MONO_FORCE_INTEROP_STRUCT_COPY
/* clang-format off */
static_assert(MATCHES_Vector2 && MATCHES_Rect2 && MATCHES_Transform2D && MATCHES_Vector3 &&
- MATCHES_Basis && MATCHES_Quat && MATCHES_Transform3D && MATCHES_AABB && MATCHES_Color &&
+ MATCHES_Basis && MATCHES_Quaternion && MATCHES_Transform3D && MATCHES_AABB && MATCHES_Color &&
MATCHES_Plane && MATCHES_Vector2i && MATCHES_Rect2i && MATCHES_Vector3i);
/* clang-format on */
#endif
@@ -420,15 +420,15 @@ struct M_Basis {
}
};
-struct M_Quat {
+struct M_Quaternion {
real_t x, y, z, w;
- static _FORCE_INLINE_ Quat convert_to(const M_Quat &p_from) {
- return Quat(p_from.x, p_from.y, p_from.z, p_from.w);
+ static _FORCE_INLINE_ Quaternion convert_to(const M_Quaternion &p_from) {
+ return Quaternion(p_from.x, p_from.y, p_from.z, p_from.w);
}
- static _FORCE_INLINE_ M_Quat convert_from(const Quat &p_from) {
- M_Quat ret = { p_from.x, p_from.y, p_from.z, p_from.w };
+ static _FORCE_INLINE_ M_Quaternion convert_from(const Quaternion &p_from) {
+ M_Quaternion ret = { p_from.x, p_from.y, p_from.z, p_from.w };
return ret;
}
};
@@ -533,7 +533,7 @@ DECL_TYPE_MARSHAL_TEMPLATES(Transform2D)
DECL_TYPE_MARSHAL_TEMPLATES(Vector3)
DECL_TYPE_MARSHAL_TEMPLATES(Vector3i)
DECL_TYPE_MARSHAL_TEMPLATES(Basis)
-DECL_TYPE_MARSHAL_TEMPLATES(Quat)
+DECL_TYPE_MARSHAL_TEMPLATES(Quaternion)
DECL_TYPE_MARSHAL_TEMPLATES(Transform3D)
DECL_TYPE_MARSHAL_TEMPLATES(AABB)
DECL_TYPE_MARSHAL_TEMPLATES(Color)
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 779f366c86..9de316d4d2 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -381,7 +381,7 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) {
case Variant::PLANE:
color = Color(0.97, 0.44, 0.44);
break;
- case Variant::QUAT:
+ case Variant::QUATERNION:
color = Color(0.93, 0.41, 0.64);
break;
case Variant::AABB:
@@ -487,7 +487,7 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) {
case Variant::PLANE:
color = Color(0.97, 0.44, 0.44);
break;
- case Variant::QUAT:
+ case Variant::QUATERNION:
color = Color(0.93, 0.41, 0.64);
break;
case Variant::AABB:
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index 2dd18a492c..07dc3dfaf6 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -3918,7 +3918,7 @@ void register_visual_script_nodes() {
VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::RECT2I), create_node_deconst_typed<Variant::Type::RECT2I>);
VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::TRANSFORM2D), create_node_deconst_typed<Variant::Type::TRANSFORM2D>);
VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::PLANE), create_node_deconst_typed<Variant::Type::PLANE>);
- VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::QUAT), create_node_deconst_typed<Variant::Type::QUAT>);
+ VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::QUATERNION), create_node_deconst_typed<Variant::Type::QUATERNION>);
VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::AABB), create_node_deconst_typed<Variant::Type::AABB>);
VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::BASIS), create_node_deconst_typed<Variant::Type::BASIS>);
VisualScriptLanguage::singleton->add_register_func("functions/deconstruct/" + Variant::get_type_name(Variant::Type::TRANSFORM3D), create_node_deconst_typed<Variant::Type::TRANSFORM3D>);
diff --git a/platform/windows/godot.natvis b/platform/windows/godot.natvis
index 793265dc6f..bb855e4ac8 100644
--- a/platform/windows/godot.natvis
+++ b/platform/windows/godot.natvis
@@ -46,7 +46,7 @@
<DisplayString Condition="type == Variant::RECT2">{*(Rect2 *)_data._mem}</DisplayString>
<DisplayString Condition="type == Variant::VECTOR3">{*(Vector3 *)_data._mem}</DisplayString>
<DisplayString Condition="type == Variant::PLANE">{*(Plane *)_data._mem}</DisplayString>
- <DisplayString Condition="type == Variant::QUAT">{*(Quat *)_data._mem}</DisplayString>
+ <DisplayString Condition="type == Variant::QUATERNION">{*(Quaternion *)_data._mem}</DisplayString>
<DisplayString Condition="type == Variant::COLOR">{*(Color *)_data._mem}</DisplayString>
<DisplayString Condition="type == Variant::NODE_PATH">{*(NodePath *)_data._mem}</DisplayString>
<DisplayString Condition="type == Variant::RID">{*(::RID *)_data._mem}</DisplayString>
@@ -78,7 +78,7 @@
<Item Name="[value]" Condition="type == Variant::RECT2">*(Rect2 *)_data._mem</Item>
<Item Name="[value]" Condition="type == Variant::VECTOR3">*(Vector3 *)_data._mem</Item>
<Item Name="[value]" Condition="type == Variant::PLANE">*(Plane *)_data._mem</Item>
- <Item Name="[value]" Condition="type == Variant::QUAT">*(Quat *)_data._mem</Item>
+ <Item Name="[value]" Condition="type == Variant::QUATERNION">*(Quaternion *)_data._mem</Item>
<Item Name="[value]" Condition="type == Variant::COLOR">*(Color *)_data._mem</Item>
<Item Name="[value]" Condition="type == Variant::NODE_PATH">*(NodePath *)_data._mem</Item>
<Item Name="[value]" Condition="type == Variant::RID">*(::RID *)_data._mem</Item>
@@ -128,8 +128,8 @@
</Expand>
</Type>
- <Type Name="Quat">
- <DisplayString>Quat {{{x},{y},{z},{w}}}</DisplayString>
+ <Type Name="Quaternion">
+ <DisplayString>Quaternion {{{x},{y},{z},{w}}}</DisplayString>
<Expand>
<Item Name="x">x</Item>
<Item Name="y">y</Item>
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;
diff --git a/servers/physics_3d/joints/cone_twist_joint_3d_sw.cpp b/servers/physics_3d/joints/cone_twist_joint_3d_sw.cpp
index 04d1a60dd6..7315e9c709 100644
--- a/servers/physics_3d/joints/cone_twist_joint_3d_sw.cpp
+++ b/servers/physics_3d/joints/cone_twist_joint_3d_sw.cpp
@@ -211,7 +211,7 @@ bool ConeTwistJoint3DSW::setup(real_t p_timestep) {
// Twist limits
if (m_twistSpan >= real_t(0.)) {
Vector3 b2Axis22 = B->get_transform().basis.xform(this->m_rbBFrame.basis.get_axis(1));
- Quat rotationArc = Quat(b2Axis1, b1Axis1);
+ Quaternion rotationArc = Quaternion(b2Axis1, b1Axis1);
Vector3 TwistRef = rotationArc.xform(b2Axis22);
real_t twist = atan2fast(TwistRef.dot(b1Axis3), TwistRef.dot(b1Axis2));
diff --git a/servers/physics_3d/joints/hinge_joint_3d_sw.cpp b/servers/physics_3d/joints/hinge_joint_3d_sw.cpp
index 1166930830..b928f18231 100644
--- a/servers/physics_3d/joints/hinge_joint_3d_sw.cpp
+++ b/servers/physics_3d/joints/hinge_joint_3d_sw.cpp
@@ -126,7 +126,7 @@ HingeJoint3DSW::HingeJoint3DSW(Body3DSW *rbA, Body3DSW *rbB, const Vector3 &pivo
rbAxisA1.y, rbAxisA2.y, axisInA.y,
rbAxisA1.z, rbAxisA2.z, axisInA.z);
- Quat rotationArc = Quat(axisInA, axisInB);
+ Quaternion rotationArc = Quaternion(axisInA, axisInB);
Vector3 rbAxisB1 = rotationArc.xform(rbAxisA1);
Vector3 rbAxisB2 = axisInB.cross(rbAxisB1);
diff --git a/servers/rendering/renderer_rd/renderer_storage_rd.cpp b/servers/rendering/renderer_rd/renderer_storage_rd.cpp
index 672ef0c517..8888b2c92e 100644
--- a/servers/rendering/renderer_rd/renderer_storage_rd.cpp
+++ b/servers/rendering/renderer_rd/renderer_storage_rd.cpp
@@ -1878,8 +1878,8 @@ _FORCE_INLINE_ static void _fill_std140_variant_ubo_value(ShaderLanguage::DataTy
gui[1] = v.position.y;
gui[2] = v.size.x;
gui[3] = v.size.y;
- } else if (value.get_type() == Variant::QUAT) {
- Quat v = value;
+ } else if (value.get_type() == Variant::QUATERNION) {
+ Quaternion v = value;
gui[0] = v.x;
gui[1] = v.y;
diff --git a/tests/test_class_db.h b/tests/test_class_db.h
index 1e88792a85..17f9baab85 100644
--- a/tests/test_class_db.h
+++ b/tests/test_class_db.h
@@ -243,7 +243,7 @@ bool arg_default_value_is_assignable_to_type(const Context &p_context, const Var
case Variant::TRANSFORM3D:
case Variant::TRANSFORM2D:
case Variant::BASIS:
- case Variant::QUAT:
+ case Variant::QUATERNION:
case Variant::PLANE:
case Variant::AABB:
case Variant::COLOR:
diff --git a/tests/test_macros.h b/tests/test_macros.h
index 8e4a78de1f..a1f1932db4 100644
--- a/tests/test_macros.h
+++ b/tests/test_macros.h
@@ -91,7 +91,7 @@ DOCTEST_STRINGIFY_VARIANT(Vector3);
DOCTEST_STRINGIFY_VARIANT(Vector3i);
DOCTEST_STRINGIFY_VARIANT(Transform2D);
DOCTEST_STRINGIFY_VARIANT(Plane);
-DOCTEST_STRINGIFY_VARIANT(Quat);
+DOCTEST_STRINGIFY_VARIANT(Quaternion);
DOCTEST_STRINGIFY_VARIANT(AABB);
DOCTEST_STRINGIFY_VARIANT(Basis);
DOCTEST_STRINGIFY_VARIANT(Transform3D);
diff --git a/tests/test_math.cpp b/tests/test_math.cpp
index aae8ce08e8..7f2097699a 100644
--- a/tests/test_math.cpp
+++ b/tests/test_math.cpp
@@ -599,13 +599,13 @@ MainLoop *test() {
Basis m2(v2, a2);
- Quat q = m;
- Quat q2 = m2;
+ Quaternion q = m;
+ Quaternion q2 = m2;
Basis m3 = m.inverse() * m2;
- Quat q3 = (q.inverse() * q2); //.normalized();
+ Quaternion q3 = (q.inverse() * q2); //.normalized();
- print_line(Quat(m3));
+ print_line(Quaternion(m3));
print_line(q3);
print_line("before v: " + v + " a: " + rtos(a));
diff --git a/tests/test_validate_testing.h b/tests/test_validate_testing.h
index 608008f531..f301047509 100644
--- a/tests/test_validate_testing.h
+++ b/tests/test_validate_testing.h
@@ -84,7 +84,7 @@ TEST_SUITE("Validate tests") {
Plane plane(Vector3(1, 1, 1), 1.0);
INFO(plane);
- Quat quat(Vector3(0.5, 1.0, 2.0));
+ Quaternion quat(Vector3(0.5, 1.0, 2.0));
INFO(quat);
AABB aabb(Vector3(), Vector3(100, 100, 100));