Apply Andy's patch on Matrix.Frustum and with skewed matrices.
This commit is contained in:
parent
1ee1f81116
commit
59e8c4be14
1 changed files with 10 additions and 10 deletions
|
@ -358,16 +358,16 @@ namespace OpenTK.Math
|
||||||
/// <param name="near">Distance to the near clip plane</param>
|
/// <param name="near">Distance to the near clip plane</param>
|
||||||
/// <param name="far">Distance to the far clip plane</param>
|
/// <param name="far">Distance to the far clip plane</param>
|
||||||
/// <returns>A projection matrix that transforms camera space to raster space</returns>
|
/// <returns>A projection matrix that transforms camera space to raster space</returns>
|
||||||
public static Matrix4 Frustum(float left, float right, float bottom, float top, float near, float far)
|
public static Matrix4 Frustum(float left, float right, float bottom, float top, float near, float far)
|
||||||
{
|
{
|
||||||
float invRL = 1.0f / (right - left);
|
float invRL = 1.0f / (right - left);
|
||||||
float invTB = 1.0f / (top - bottom);
|
float invTB = 1.0f / (top - bottom);
|
||||||
float invFN = 1.0f / (far - near);
|
float invFN = 1.0f / (far - near);
|
||||||
return new Matrix4(new Vector4(2.0f * near * invRL, 0.0f, (right + left) * invRL, 0.0f),
|
return new Matrix4(new Vector4(2.0f * near * invRL, 0.0f, 0.0f, 0.0f),
|
||||||
new Vector4(0.0f, 2.0f * near * invTB, (top + bottom) * invTB, 0.0f),
|
new Vector4(0.0f, 2.0f * near * invTB, 0.0f, 0.0f),
|
||||||
new Vector4(0.0f, 0.0f, -(far + near) * invFN, -1.0f),
|
new Vector4((right + left) * invRL, (top + bottom) * invTB, -(far + near) * invFN, -1.0f),
|
||||||
new Vector4(0.0f, 0.0f, -2.0f * far * near * invFN, 0.0f));
|
new Vector4(0.0f, 0.0f, -2.0f * far * near * invFN, 0.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Build a projection matrix
|
/// Build a projection matrix
|
||||||
|
|
Loading…
Reference in a new issue