summaryrefslogtreecommitdiff
path: root/core/variant
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-05-03 14:40:01 +0200
committerGitHub <noreply@github.com>2022-05-03 14:40:01 +0200
commit931838b3308442ba5084c0a9f487b05c9de74fde (patch)
tree7854739449a5b6636730ea92876ecae4ce9838e6 /core/variant
parent297241f368632dd91a3e7df47da3d9e5197e4f1e (diff)
parent1bf94dff3a6fee9fc19189ac77d81beb631b8398 (diff)
Merge pull request #60627 from aaronfranke/rename-elements
Rename Transform2D and Basis `elements` to `columns` and `rows` respectively
Diffstat (limited to 'core/variant')
-rw-r--r--core/variant/variant.cpp36
-rw-r--r--core/variant/variant_parser.cpp6
-rw-r--r--core/variant/variant_setget.cpp2
-rw-r--r--core/variant/variant_setget.h6
4 files changed, 25 insertions, 25 deletions
diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp
index 0eb93a72b4..e79da748e9 100644
--- a/core/variant/variant.cpp
+++ b/core/variant/variant.cpp
@@ -1908,12 +1908,12 @@ Variant::operator Transform3D() const {
} else if (type == TRANSFORM2D) {
const Transform2D &t = *_data._transform2d;
Transform3D m;
- m.basis.elements[0][0] = t.elements[0][0];
- m.basis.elements[1][0] = t.elements[0][1];
- m.basis.elements[0][1] = t.elements[1][0];
- m.basis.elements[1][1] = t.elements[1][1];
- m.origin[0] = t.elements[2][0];
- m.origin[1] = t.elements[2][1];
+ m.basis.rows[0][0] = t.columns[0][0];
+ m.basis.rows[1][0] = t.columns[0][1];
+ m.basis.rows[0][1] = t.columns[1][0];
+ m.basis.rows[1][1] = t.columns[1][1];
+ m.origin[0] = t.columns[2][0];
+ m.origin[1] = t.columns[2][1];
return m;
} else {
return Transform3D();
@@ -1926,12 +1926,12 @@ Variant::operator Transform2D() const {
} else if (type == TRANSFORM3D) {
const Transform3D &t = *_data._transform3d;
Transform2D m;
- m.elements[0][0] = t.basis.elements[0][0];
- m.elements[0][1] = t.basis.elements[1][0];
- m.elements[1][0] = t.basis.elements[0][1];
- m.elements[1][1] = t.basis.elements[1][1];
- m.elements[2][0] = t.origin[0];
- m.elements[2][1] = t.origin[1];
+ m.columns[0][0] = t.basis.rows[0][0];
+ m.columns[0][1] = t.basis.rows[1][0];
+ m.columns[1][0] = t.basis.rows[0][1];
+ m.columns[1][1] = t.basis.rows[1][1];
+ m.columns[2][0] = t.origin[0];
+ m.columns[2][1] = t.origin[1];
return m;
} else {
return Transform2D();
@@ -2790,7 +2790,7 @@ uint32_t Variant::recursive_hash(int recursion_count) const {
uint32_t hash = 5831;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 2; j++) {
- hash = hash_djb2_one_float(_data._transform2d->elements[i][j], hash);
+ hash = hash_djb2_one_float(_data._transform2d->columns[i][j], hash);
}
}
@@ -2834,7 +2834,7 @@ uint32_t Variant::recursive_hash(int recursion_count) const {
uint32_t hash = 5831;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
- hash = hash_djb2_one_float(_data._basis->elements[i][j], hash);
+ hash = hash_djb2_one_float(_data._basis->rows[i][j], hash);
}
}
@@ -2845,7 +2845,7 @@ uint32_t Variant::recursive_hash(int recursion_count) const {
uint32_t hash = 5831;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
- hash = hash_djb2_one_float(_data._transform3d->basis.elements[i][j], hash);
+ hash = hash_djb2_one_float(_data._transform3d->basis.rows[i][j], hash);
}
hash = hash_djb2_one_float(_data._transform3d->origin[i], hash);
}
@@ -3112,7 +3112,7 @@ bool Variant::hash_compare(const Variant &p_variant, int recursion_count) const
Transform2D *r = p_variant._data._transform2d;
for (int i = 0; i < 3; i++) {
- if (!(hash_compare_vector2(l->elements[i], r->elements[i]))) {
+ if (!(hash_compare_vector2(l->columns[i], r->columns[i]))) {
return false;
}
}
@@ -3162,7 +3162,7 @@ bool Variant::hash_compare(const Variant &p_variant, int recursion_count) const
const Basis *r = p_variant._data._basis;
for (int i = 0; i < 3; i++) {
- if (!(hash_compare_vector3(l->elements[i], r->elements[i]))) {
+ if (!(hash_compare_vector3(l->rows[i], r->rows[i]))) {
return false;
}
}
@@ -3175,7 +3175,7 @@ bool Variant::hash_compare(const Variant &p_variant, int recursion_count) const
const Transform3D *r = p_variant._data._transform3d;
for (int i = 0; i < 3; i++) {
- if (!(hash_compare_vector3(l->basis.elements[i], r->basis.elements[i]))) {
+ if (!(hash_compare_vector3(l->basis.rows[i], r->basis.rows[i]))) {
return false;
}
}
diff --git a/core/variant/variant_parser.cpp b/core/variant/variant_parser.cpp
index bd13f66a09..2864d0c956 100644
--- a/core/variant/variant_parser.cpp
+++ b/core/variant/variant_parser.cpp
@@ -1555,7 +1555,7 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str
if (i != 0 || j != 0) {
s += ", ";
}
- s += rtos_fix(m3.elements[i][j]);
+ s += rtos_fix(m3.columns[i][j]);
}
}
@@ -1570,7 +1570,7 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str
if (i != 0 || j != 0) {
s += ", ";
}
- s += rtos_fix(m3.elements[i][j]);
+ s += rtos_fix(m3.rows[i][j]);
}
}
@@ -1586,7 +1586,7 @@ Error VariantWriter::write(const Variant &p_variant, StoreStringFunc p_store_str
if (i != 0 || j != 0) {
s += ", ";
}
- s += rtos_fix(m3.elements[i][j]);
+ s += rtos_fix(m3.rows[i][j]);
}
}
diff --git a/core/variant/variant_setget.cpp b/core/variant/variant_setget.cpp
index 397a57f59f..09097e30e0 100644
--- a/core/variant/variant_setget.cpp
+++ b/core/variant/variant_setget.cpp
@@ -789,7 +789,7 @@ INDEXED_SETGET_STRUCT_BULTIN_NUMERIC(Vector3i, int64_t, int32_t, 3)
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)
+INDEXED_SETGET_STRUCT_BULTIN_ACCESSOR(Transform2D, Vector2, .columns, 3)
INDEXED_SETGET_STRUCT_BULTIN_FUNC(Basis, Vector3, set_axis, get_axis, 3)
INDEXED_SETGET_STRUCT_TYPED_NUMERIC(PackedByteArray, int64_t, uint8_t)
diff --git a/core/variant/variant_setget.h b/core/variant/variant_setget.h
index 28277fa5d0..2083e64125 100644
--- a/core/variant/variant_setget.h
+++ b/core/variant/variant_setget.h
@@ -293,9 +293,9 @@ SETGET_STRUCT(AABB, Vector3, position)
SETGET_STRUCT(AABB, Vector3, size)
SETGET_STRUCT_FUNC(AABB, Vector3, end, set_end, get_end)
-SETGET_STRUCT_CUSTOM(Transform2D, Vector2, x, elements[0])
-SETGET_STRUCT_CUSTOM(Transform2D, Vector2, y, elements[1])
-SETGET_STRUCT_CUSTOM(Transform2D, Vector2, origin, elements[2])
+SETGET_STRUCT_CUSTOM(Transform2D, Vector2, x, columns[0])
+SETGET_STRUCT_CUSTOM(Transform2D, Vector2, y, columns[1])
+SETGET_STRUCT_CUSTOM(Transform2D, Vector2, origin, columns[2])
SETGET_NUMBER_STRUCT_CUSTOM(Plane, double, x, normal.x)
SETGET_NUMBER_STRUCT_CUSTOM(Plane, double, y, normal.y)