mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 20:25:39 +00:00
Fixed bug in Matrix4.LookAt.
This commit is contained in:
parent
074af1035e
commit
afefc93fc6
|
@ -806,13 +806,20 @@ namespace OpenTK
|
||||||
float c = -(zFar + zNear) / (zFar - zNear);
|
float c = -(zFar + zNear) / (zFar - zNear);
|
||||||
float d = -(2.0f * zFar * zNear) / (zFar - zNear);
|
float d = -(2.0f * zFar * zNear) / (zFar - zNear);
|
||||||
|
|
||||||
result = Identity;
|
|
||||||
result.Row0.X = x;
|
result.Row0.X = x;
|
||||||
|
result.Row0.Y = 0;
|
||||||
|
result.Row0.Z = 0;
|
||||||
|
result.Row0.W = 0;
|
||||||
|
result.Row1.X = 0;
|
||||||
result.Row1.Y = y;
|
result.Row1.Y = y;
|
||||||
|
result.Row1.Z = 0;
|
||||||
|
result.Row1.W = 0;
|
||||||
result.Row2.X = a;
|
result.Row2.X = a;
|
||||||
result.Row2.Y = b;
|
result.Row2.Y = b;
|
||||||
result.Row2.Z = c;
|
result.Row2.Z = c;
|
||||||
result.Row2.W = -1;
|
result.Row2.W = -1;
|
||||||
|
result.Row3.X = 0;
|
||||||
|
result.Row3.Y = 0;
|
||||||
result.Row3.Z = d;
|
result.Row3.Z = d;
|
||||||
result.Row3.W = 0;
|
result.Row3.W = 0;
|
||||||
}
|
}
|
||||||
|
@ -1040,23 +1047,24 @@ namespace OpenTK
|
||||||
Vector3 x = Vector3.Normalize(Vector3.Cross(up, z));
|
Vector3 x = Vector3.Normalize(Vector3.Cross(up, z));
|
||||||
Vector3 y = Vector3.Normalize(Vector3.Cross(z, x));
|
Vector3 y = Vector3.Normalize(Vector3.Cross(z, x));
|
||||||
|
|
||||||
Matrix4 result = Identity;
|
Matrix4 result;
|
||||||
|
|
||||||
//rotation
|
|
||||||
result.Row0.X = x.X;
|
result.Row0.X = x.X;
|
||||||
result.Row0.Y = y.X;
|
result.Row0.Y = y.X;
|
||||||
result.Row0.Z = z.X;
|
result.Row0.Z = z.X;
|
||||||
|
result.Row0.W = 0;
|
||||||
result.Row1.X = x.Y;
|
result.Row1.X = x.Y;
|
||||||
result.Row1.Y = y.Y;
|
result.Row1.Y = y.Y;
|
||||||
result.Row1.Z = z.Y;
|
result.Row1.Z = z.Y;
|
||||||
|
result.Row1.W = 0;
|
||||||
result.Row2.X = x.Z;
|
result.Row2.X = x.Z;
|
||||||
result.Row2.Y = y.Z;
|
result.Row2.Y = y.Z;
|
||||||
result.Row2.Z = z.Z;
|
result.Row2.Z = z.Z;
|
||||||
|
result.Row2.W = 0;
|
||||||
//position
|
result.Row3.X = -((x.X * eye.X) + (x.Y * eye.Y) + (x.Z * eye.Z));
|
||||||
result.Row0.W = -eye.X;
|
result.Row3.Y = -((y.X * eye.X) + (y.Y * eye.Y) + (y.Z * eye.Z));
|
||||||
result.Row1.W = -eye.Y;
|
result.Row3.Z = -((z.X * eye.X) + (z.Y * eye.Y) + (z.Z * eye.Z));
|
||||||
result.Row2.W = -eye.Z;
|
result.Row3.W = 1;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue