Skip to content

Commit

Permalink
#5773: TextureMatrix no longer references Matrix4
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Oct 9, 2021
1 parent 6e0af0e commit cc23e5f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 29 deletions.
22 changes: 1 addition & 21 deletions radiantcore/brush/TextureMatrix.cpp
@@ -1,9 +1,9 @@
#include "TextureMatrix.h"

#include "texturelib.h"
#include "math/pi.h"
#include "math/Vector2.h"
#include "math/Matrix3.h"
#include "math/Matrix4.h"

// Constructor with empty arguments
TextureMatrix::TextureMatrix()
Expand Down Expand Up @@ -128,26 +128,6 @@ void TextureMatrix::normalise(float width, float height) {
coords[1][2] = float_mod(coords[1][2], height);
}

/* greebo: This returns the transformation matrix.
* As the member variables already ARE the matrix
* components, they are just copied into the right places.
*/
Matrix4 TextureMatrix::getTransform() const
{
// Initialise the return value with the identity matrix
Matrix4 transform = Matrix4::getIdentity();

// Just copy the member variables to the according matrix components
transform.xx() = coords[0][0];
transform.yx() = coords[0][1];
transform.tx() = coords[0][2];
transform.xy() = coords[1][0];
transform.yy() = coords[1][1];
transform.ty() = coords[1][2];

return transform;
}

Matrix3 TextureMatrix::getMatrix3() const
{
return Matrix3::byRows(
Expand Down
7 changes: 0 additions & 7 deletions radiantcore/brush/TextureMatrix.h
Expand Up @@ -2,7 +2,6 @@

#include "TexDef.h"

class Matrix4;
class Matrix3;

// Encapsulates the 2x3 matrix transforming world coordinates into texture space
Expand Down Expand Up @@ -75,12 +74,6 @@ class TextureMatrix
// This function normalises shift values to the smallest positive congruent values.
void normalise(float width, float height);

/* greebo: This returns the transformation matrix.
* As the member variables already ARE the matrix
* components, they are just copied into the right places.
*/
Matrix4 getTransform() const;

// Returns the Matrix3 form of this instance
Matrix3 getMatrix3() const;

Expand Down
2 changes: 1 addition & 1 deletion radiantcore/brush/TextureProjection.cpp
Expand Up @@ -102,7 +102,7 @@ void TextureProjection::fitTexture(std::size_t width, std::size_t height,
}

// Sanity-check the matrix, if it contains any NaNs or INFs we fall back to the default projection (#5371)
Matrix4 st2tex = _matrix.isSane() ? getMatrix4() : GetDefaultProjection().getTransform();
Matrix4 st2tex = _matrix.isSane() ? getMatrix4() : getMatrix4FromTextureMatrix(GetDefaultProjection().getMatrix3());

// the current texture transform
Matrix4 local2tex = st2tex;
Expand Down

0 comments on commit cc23e5f

Please sign in to comment.