Skip to content

Commit

Permalink
Revert "Matrix4::getIdentity() implemented by Eigen"
Browse files Browse the repository at this point in the history
For some reason this broke the rendering of 2D curves.

This reverts commit b8d1012.
  • Loading branch information
Matthew Mott committed Apr 5, 2021
1 parent 1c2dddb commit 30f12de
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
12 changes: 12 additions & 0 deletions libs/math/Matrix4.cpp
Expand Up @@ -48,6 +48,18 @@ Matrix4::Matrix4(double xx_, double xy_, double xz_, double xw_,

// Named constructors

// Identity matrix
const Matrix4& Matrix4::getIdentity()
{
static const Matrix4 _identity(
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
);
return _identity;
}

// Get a rotation from 2 vectors (named constructor)
Matrix4 Matrix4::getRotation(const Vector3& a, const Vector3& b)
{
Expand Down
5 changes: 1 addition & 4 deletions libs/math/Matrix4.h
Expand Up @@ -72,10 +72,7 @@ class alignas(16) Matrix4
const Eigen::Projective3d& eigen() const { return _transform; }

/// Obtain the identity matrix.
static Matrix4 getIdentity()
{
return Matrix4(Eigen::Projective3d::Identity());
}
static const Matrix4& getIdentity();

/// Get a matrix representing the given 3D translation.
static Matrix4 getTranslation(const Vector3& tr)
Expand Down
3 changes: 1 addition & 2 deletions libs/transformlib.h
Expand Up @@ -13,8 +13,7 @@ class IdentityTransform :
/// \brief Returns the identity matrix.
const Matrix4& localToParent() const
{
static const Matrix4 ID = Matrix4::getIdentity();
return ID;
return Matrix4::getIdentity();
}
};

Expand Down

0 comments on commit 30f12de

Please sign in to comment.