Skip to content

Commit

Permalink
Merge pull request #52846 from lawnjelly/fixed_timestep_simple
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga authored Feb 16, 2022
2 parents 9cb1695 + 522bce1 commit 7974ea4
Show file tree
Hide file tree
Showing 41 changed files with 2,498 additions and 398 deletions.
16 changes: 16 additions & 0 deletions core/local_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,22 @@ class LocalVector {
}
}

U erase_multiple_unordered(const T &p_val) {
U from = 0;
U count = 0;
while (true) {
int64_t idx = find(p_val, from);

if (idx == -1) {
break;
}
remove_unordered(idx);
from = idx;
count++;
}
return count;
}

void invert() {
for (U i = 0; i < count / 2; i++) {
SWAP(data[i], data[count - i - 1]);
Expand Down
10 changes: 10 additions & 0 deletions core/math/basis.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ class _NO_DISCARD_CLASS_ Basis {
bool is_rotation() const;

Basis slerp(const Basis &p_to, const real_t &p_weight) const;
_FORCE_INLINE_ Basis lerp(const Basis &p_to, const real_t &p_weight) const;

operator String() const;

Expand Down Expand Up @@ -340,4 +341,13 @@ real_t Basis::determinant() const {
elements[1][0] * (elements[0][1] * elements[2][2] - elements[2][1] * elements[0][2]) +
elements[2][0] * (elements[0][1] * elements[1][2] - elements[1][1] * elements[0][2]);
}

Basis Basis::lerp(const Basis &p_to, const real_t &p_weight) const {
Basis b;
b.elements[0] = elements[0].linear_interpolate(p_to.elements[0], p_weight);
b.elements[1] = elements[1].linear_interpolate(p_to.elements[1], p_weight);
b.elements[2] = elements[2].linear_interpolate(p_to.elements[2], p_weight);

return b;
}
#endif // BASIS_H
Loading

0 comments on commit 7974ea4

Please sign in to comment.