Initialise Basis elements with a default Basis in the declaration.

Ensures a valid Basis is created with all constructors.

(cherry picked from commit 9149fb760c)
This commit is contained in:
Marcel Admiraal 2020-09-08 12:15:01 +01:00 committed by Rémi Verschelde
parent 4a9264271d
commit 3697cc479d
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 6 additions and 13 deletions

View File

@ -36,7 +36,11 @@
class Basis {
public:
Vector3 elements[3];
Vector3 elements[3] = {
Vector3(1, 0, 0),
Vector3(0, 1, 0),
Vector3(0, 0, 1)
};
_FORCE_INLINE_ const Vector3 &operator[](int axis) const {
@ -257,18 +261,7 @@ public:
elements[2] = row2;
}
_FORCE_INLINE_ Basis() {
elements[0][0] = 1;
elements[0][1] = 0;
elements[0][2] = 0;
elements[1][0] = 0;
elements[1][1] = 1;
elements[1][2] = 0;
elements[2][0] = 0;
elements[2][1] = 0;
elements[2][2] = 1;
}
_FORCE_INLINE_ Basis() {}
};
_FORCE_INLINE_ void Basis::operator*=(const Basis &p_matrix) {