Skip to content

Commit

Permalink
Rename Basis "elements" to "rows"
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronfranke committed Apr 29, 2022
1 parent b831fb0 commit 1bf94df
Show file tree
Hide file tree
Showing 31 changed files with 679 additions and 679 deletions.
12 changes: 6 additions & 6 deletions core/io/marshalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
ERR_FAIL_COND_V((size_t)len < sizeof(double) * 9, ERR_INVALID_DATA);
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
val.elements[i][j] = decode_double(&buf[(i * 3 + j) * sizeof(double)]);
val.rows[i][j] = decode_double(&buf[(i * 3 + j) * sizeof(double)]);
}
}

Expand All @@ -412,7 +412,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
ERR_FAIL_COND_V((size_t)len < sizeof(float) * 9, ERR_INVALID_DATA);
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
val.elements[i][j] = decode_float(&buf[(i * 3 + j) * sizeof(float)]);
val.rows[i][j] = decode_float(&buf[(i * 3 + j) * sizeof(float)]);
}
}

Expand All @@ -429,7 +429,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
ERR_FAIL_COND_V((size_t)len < sizeof(double) * 12, ERR_INVALID_DATA);
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
val.basis.elements[i][j] = decode_double(&buf[(i * 3 + j) * sizeof(double)]);
val.basis.rows[i][j] = decode_double(&buf[(i * 3 + j) * sizeof(double)]);
}
}
val.origin[0] = decode_double(&buf[sizeof(double) * 9]);
Expand All @@ -443,7 +443,7 @@ Error decode_variant(Variant &r_variant, const uint8_t *p_buffer, int p_len, int
ERR_FAIL_COND_V((size_t)len < sizeof(float) * 12, ERR_INVALID_DATA);
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
val.basis.elements[i][j] = decode_float(&buf[(i * 3 + j) * sizeof(float)]);
val.basis.rows[i][j] = decode_float(&buf[(i * 3 + j) * sizeof(float)]);
}
}
val.origin[0] = decode_float(&buf[sizeof(float) * 9]);
Expand Down Expand Up @@ -1312,7 +1312,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
Basis val = p_variant;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
memcpy(&buf[(i * 3 + j) * sizeof(real_t)], &val.elements[i][j], sizeof(real_t));
memcpy(&buf[(i * 3 + j) * sizeof(real_t)], &val.rows[i][j], sizeof(real_t));
}
}
}
Expand All @@ -1325,7 +1325,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
Transform3D val = p_variant;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
memcpy(&buf[(i * 3 + j) * sizeof(real_t)], &val.basis.elements[i][j], sizeof(real_t));
memcpy(&buf[(i * 3 + j) * sizeof(real_t)], &val.basis.rows[i][j], sizeof(real_t));
}
}

Expand Down
72 changes: 36 additions & 36 deletions core/io/resource_format_binary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,29 +277,29 @@ Error ResourceLoaderBinary::parse_variant(Variant &r_v) {
} break;
case VARIANT_BASIS: {
Basis v;
v.elements[0].x = f->get_real();
v.elements[0].y = f->get_real();
v.elements[0].z = f->get_real();
v.elements[1].x = f->get_real();
v.elements[1].y = f->get_real();
v.elements[1].z = f->get_real();
v.elements[2].x = f->get_real();
v.elements[2].y = f->get_real();
v.elements[2].z = f->get_real();
v.rows[0].x = f->get_real();
v.rows[0].y = f->get_real();
v.rows[0].z = f->get_real();
v.rows[1].x = f->get_real();
v.rows[1].y = f->get_real();
v.rows[1].z = f->get_real();
v.rows[2].x = f->get_real();
v.rows[2].y = f->get_real();
v.rows[2].z = f->get_real();
r_v = v;

} break;
case VARIANT_TRANSFORM3D: {
Transform3D v;
v.basis.elements[0].x = f->get_real();
v.basis.elements[0].y = f->get_real();
v.basis.elements[0].z = f->get_real();
v.basis.elements[1].x = f->get_real();
v.basis.elements[1].y = f->get_real();
v.basis.elements[1].z = f->get_real();
v.basis.elements[2].x = f->get_real();
v.basis.elements[2].y = f->get_real();
v.basis.elements[2].z = f->get_real();
v.basis.rows[0].x = f->get_real();
v.basis.rows[0].y = f->get_real();
v.basis.rows[0].z = f->get_real();
v.basis.rows[1].x = f->get_real();
v.basis.rows[1].y = f->get_real();
v.basis.rows[1].z = f->get_real();
v.basis.rows[2].x = f->get_real();
v.basis.rows[2].y = f->get_real();
v.basis.rows[2].z = f->get_real();
v.origin.x = f->get_real();
v.origin.y = f->get_real();
v.origin.z = f->get_real();
Expand Down Expand Up @@ -1484,29 +1484,29 @@ void ResourceFormatSaverBinaryInstance::write_variant(Ref<FileAccess> f, const V
case Variant::BASIS: {
f->store_32(VARIANT_BASIS);
Basis val = p_property;
f->store_real(val.elements[0].x);
f->store_real(val.elements[0].y);
f->store_real(val.elements[0].z);
f->store_real(val.elements[1].x);
f->store_real(val.elements[1].y);
f->store_real(val.elements[1].z);
f->store_real(val.elements[2].x);
f->store_real(val.elements[2].y);
f->store_real(val.elements[2].z);
f->store_real(val.rows[0].x);
f->store_real(val.rows[0].y);
f->store_real(val.rows[0].z);
f->store_real(val.rows[1].x);
f->store_real(val.rows[1].y);
f->store_real(val.rows[1].z);
f->store_real(val.rows[2].x);
f->store_real(val.rows[2].y);
f->store_real(val.rows[2].z);

} break;
case Variant::TRANSFORM3D: {
f->store_32(VARIANT_TRANSFORM3D);
Transform3D val = p_property;
f->store_real(val.basis.elements[0].x);
f->store_real(val.basis.elements[0].y);
f->store_real(val.basis.elements[0].z);
f->store_real(val.basis.elements[1].x);
f->store_real(val.basis.elements[1].y);
f->store_real(val.basis.elements[1].z);
f->store_real(val.basis.elements[2].x);
f->store_real(val.basis.elements[2].y);
f->store_real(val.basis.elements[2].z);
f->store_real(val.basis.rows[0].x);
f->store_real(val.basis.rows[0].y);
f->store_real(val.basis.rows[0].z);
f->store_real(val.basis.rows[1].x);
f->store_real(val.basis.rows[1].y);
f->store_real(val.basis.rows[1].z);
f->store_real(val.basis.rows[2].x);
f->store_real(val.basis.rows[2].y);
f->store_real(val.basis.rows[2].z);
f->store_real(val.origin.x);
f->store_real(val.origin.y);
f->store_real(val.origin.z);
Expand Down
Loading

0 comments on commit 1bf94df

Please sign in to comment.