1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-03-13 19:29:14 +01:00

[util] move Matrix4 constructors to header

This commit is contained in:
Georg Lehmann 2021-04-15 17:50:41 +02:00 committed by Joshie
parent fb0b11903b
commit c7271d94c1
2 changed files with 21 additions and 31 deletions

View File

@ -2,33 +2,6 @@
namespace dxvk {
// Identity
Matrix4::Matrix4() {
data[0] = { 1, 0, 0, 0 };
data[1] = { 0, 1, 0, 0 };
data[2] = { 0, 0, 1, 0 };
data[3] = { 0, 0, 0, 1 };
}
// Produces a scalar matrix, x * Identity
Matrix4::Matrix4(float x) {
data[0] = { x, 0, 0, 0 };
data[1] = { 0, x, 0, 0 };
data[2] = { 0, 0, x, 0 };
data[3] = { 0, 0, 0, x };
}
Matrix4::Matrix4(
const Vector4& v0,
const Vector4& v1,
const Vector4& v2,
const Vector4& v3) {
data[0] = v0;
data[1] = v1;
data[2] = v2;
data[3] = v3;
}
Vector4& Matrix4::operator[](size_t index) { return data[index]; }
const Vector4& Matrix4::operator[](size_t index) const { return data[index]; }

View File

@ -8,15 +8,32 @@ namespace dxvk {
public:
Matrix4(); // Identity
// Identity
inline Matrix4() {
data[0] = { 1, 0, 0, 0 };
data[1] = { 0, 1, 0, 0 };
data[2] = { 0, 0, 1, 0 };
data[3] = { 0, 0, 0, 1 };
}
explicit Matrix4(float x); // Produces a scalar matrix, x * Identity
// Produces a scalar matrix, x * Identity
inline explicit Matrix4(float x) {
data[0] = { x, 0, 0, 0 };
data[1] = { 0, x, 0, 0 };
data[2] = { 0, 0, x, 0 };
data[3] = { 0, 0, 0, x };
}
Matrix4(
inline Matrix4(
const Vector4& v0,
const Vector4& v1,
const Vector4& v2,
const Vector4& v3);
const Vector4& v3) {
data[0] = v0;
data[1] = v1;
data[2] = v2;
data[3] = v3;
}
Matrix4(const Matrix4& other) = default;