Commit 09cb08b9 by Nicolas Capens

Implement float4 transform.

Bug 22124687 Change-Id: I88ea87bbf7785d61a2ca61db2855d07c0347f719 Reviewed-on: https://swiftshader-review.googlesource.com/3582Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent f7ac1a17
......@@ -225,6 +225,17 @@ namespace sw
return M * r;
}
float4 Matrix::operator*(const float4 &v) const
{
const Matrix &M = *this;
float Mx = M(1, 1) * v.x + M(1, 2) * v.y + M(1, 3) * v.z + M(1, 4) * v.w;
float My = M(2, 1) * v.x + M(2, 2) * v.y + M(2, 3) * v.z + M(2, 4) * v.w;
float Mz = M(3, 1) * v.x + M(3, 2) * v.y + M(3, 3) * v.z + M(3, 4) * v.w;
float Mw = M(4, 1) * v.x + M(4, 2) * v.y + M(4, 3) * v.z + M(4, 4) * v.w;
return {Mx, My, Mz, Mw};
}
float Matrix::det(const Matrix &M)
{
float M3344 = M(3, 3) * M(4, 4) - M(4, 3) * M(3, 4);
......
......@@ -16,6 +16,7 @@ namespace sw
{
struct Vector;
struct Point;
struct float4;
struct Matrix
{
......@@ -68,6 +69,8 @@ namespace sw
friend Matrix operator*(const Matrix &M, const Matrix &N);
friend Matrix operator/(const Matrix &M, float s);
float4 operator*(const float4 &v) const;
static float det(const Matrix &M);
static float det(float m11);
static float det(float m11, float m12,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment