Added implicit conversion between Math::Matrix and glm::mat4
parent
100be95113
commit
58c75ce61a
|
@ -32,6 +32,8 @@
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <glm/glm.hpp>
|
||||||
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
|
|
||||||
|
|
||||||
// Math module namespace
|
// Math module namespace
|
||||||
|
@ -100,6 +102,32 @@ struct Matrix
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Matrix(const glm::mat4& matrix)
|
||||||
|
{
|
||||||
|
for (int c = 0; c < 4; ++c)
|
||||||
|
{
|
||||||
|
for (int r = 0; r < 4; ++r)
|
||||||
|
{
|
||||||
|
m[4 * c + r] = matrix[c][r];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
operator glm::mat4() const
|
||||||
|
{
|
||||||
|
glm::mat4 matrix;
|
||||||
|
|
||||||
|
for (int c = 0; c < 4; ++c)
|
||||||
|
{
|
||||||
|
for (int r = 0; r < 4; ++r)
|
||||||
|
{
|
||||||
|
matrix[c][r] = m[4 * c + r];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return matrix;
|
||||||
|
}
|
||||||
|
|
||||||
//! Sets value in given row and col
|
//! Sets value in given row and col
|
||||||
/**
|
/**
|
||||||
* \param row row (1 to 4)
|
* \param row row (1 to 4)
|
||||||
|
|
Loading…
Reference in New Issue