Removed obsolete Matrix functions.

This commit is contained in:
Jarl Gullberg 2017-06-20 15:22:51 +02:00
parent f8cc979ed5
commit 289dd1749a
No known key found for this signature in database
GPG key ID: 750FF6F6BDA72D23
2 changed files with 22 additions and 311 deletions

View file

@ -1075,187 +1075,6 @@ namespace OpenTK
#endregion
#region Obsolete Functions
#region Translation Functions
/// <summary>
/// Builds a translation matrix.
/// </summary>
/// <param name="trans">The translation vector.</param>
/// <returns>A new Matrix4 instance.</returns>
[Obsolete("Use CreateTranslation instead.")]
public static Matrix4 Translation(Vector3 trans)
{
return CreateTranslation(trans);
}
/// <summary>
/// Build a translation matrix with the given translation
/// </summary>
/// <param name="x">X translation</param>
/// <param name="y">Y translation</param>
/// <param name="z">Z translation</param>
/// <returns>A Translation matrix</returns>
[Obsolete("Use CreateTranslation instead.")]
public static Matrix4 Translation(float x, float y, float z)
{
return CreateTranslation(x, y, z);
}
#endregion
#region Rotation Functions
/// <summary>
/// Build a rotation matrix that rotates about the x-axis
/// </summary>
/// <param name="angle">angle in radians to rotate counter-clockwise around the x-axis</param>
/// <returns>A rotation matrix</returns>
[Obsolete("Use CreateRotationX instead.")]
public static Matrix4 RotateX(float angle)
{
return CreateRotationX(angle);
}
/// <summary>
/// Build a rotation matrix that rotates about the y-axis
/// </summary>
/// <param name="angle">angle in radians to rotate counter-clockwise around the y-axis</param>
/// <returns>A rotation matrix</returns>
[Obsolete("Use CreateRotationY instead.")]
public static Matrix4 RotateY(float angle)
{
return CreateRotationY(angle);
}
/// <summary>
/// Build a rotation matrix that rotates about the z-axis
/// </summary>
/// <param name="angle">angle in radians to rotate counter-clockwise around the z-axis</param>
/// <returns>A rotation matrix</returns>
[Obsolete("Use CreateRotationZ instead.")]
public static Matrix4 RotateZ(float angle)
{
return CreateRotationZ(angle);
}
/// <summary>
/// Build a rotation matrix to rotate about the given axis
/// </summary>
/// <param name="axis">the axis to rotate about</param>
/// <param name="angle">angle in radians to rotate counter-clockwise (looking in the direction of the given axis)</param>
/// <returns>A rotation matrix</returns>
[Obsolete("Use CreateFromAxisAngle instead.")]
public static Matrix4 Rotate(Vector3 axis, float angle)
{
return CreateFromAxisAngle(axis, angle);
}
/// <summary>
/// Build a rotation matrix from a quaternion
/// </summary>
/// <param name="q">the quaternion</param>
/// <returns>A rotation matrix</returns>
[Obsolete("Use CreateFromQuaternion instead.")]
public static Matrix4 Rotate(Quaternion q)
{
return CreateFromQuaternion(q);
}
#endregion
#region Scale Functions
/// <summary>
/// Build a scaling matrix
/// </summary>
/// <param name="scale">Single scale factor for x,y and z axes</param>
/// <returns>A scaling matrix</returns>
[Obsolete("Use CreateScale instead.")]
public static Matrix4 Scale(float scale)
{
return Scale(scale, scale, scale);
}
/// <summary>
/// Build a scaling matrix
/// </summary>
/// <param name="scale">Scale factors for x,y and z axes</param>
/// <returns>A scaling matrix</returns>
[Obsolete("Use CreateScale instead.")]
public static Matrix4 Scale(Vector3 scale)
{
return Scale(scale.X, scale.Y, scale.Z);
}
/// <summary>
/// Build a scaling matrix
/// </summary>
/// <param name="x">Scale factor for x-axis</param>
/// <param name="y">Scale factor for y-axis</param>
/// <param name="z">Scale factor for z-axis</param>
/// <returns>A scaling matrix</returns>
[Obsolete("Use CreateScale instead.")]
public static Matrix4 Scale(float x, float y, float z)
{
Matrix4 result;
result.Row0 = Vector4.UnitX * x;
result.Row1 = Vector4.UnitY * y;
result.Row2 = Vector4.UnitZ * z;
result.Row3 = Vector4.UnitW;
return result;
}
#endregion
#region Camera Helper Functions
/// <summary>
/// Build a projection matrix
/// </summary>
/// <param name="left">Left edge of the view frustum</param>
/// <param name="right">Right edge of the view frustum</param>
/// <param name="bottom">Bottom edge of the view frustum</param>
/// <param name="top">Top edge of the view frustum</param>
/// <param name="near">Distance to the near 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>
[Obsolete("Use CreatePerspectiveOffCenter instead.")]
public static Matrix4 Frustum(float left, float right, float bottom, float top, float near, float far)
{
float invRL = 1.0f / (right - left);
float invTB = 1.0f / (top - bottom);
float invFN = 1.0f / (far - near);
return new Matrix4(new Vector4(2.0f * near * invRL, 0.0f, 0.0f, 0.0f),
new Vector4(0.0f, 2.0f * near * invTB, 0.0f, 0.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));
}
/// <summary>
/// Build a projection matrix
/// </summary>
/// <param name="fovy">Angle of the field of view in the y direction (in radians)</param>
/// <param name="aspect">Aspect ratio of the view (width / height)</param>
/// <param name="near">Distance to the near 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>
[Obsolete("Use CreatePerspectiveFieldOfView instead.")]
public static Matrix4 Perspective(float fovy, float aspect, float near, float far)
{
float yMax = near * (float)System.Math.Tan(0.5f * fovy);
float yMin = -yMax;
float xMin = yMin * aspect;
float xMax = yMax * aspect;
return Frustum(xMin, xMax, yMin, yMax, near, far);
}
#endregion
#endregion
#region Camera Helper Functions
/// <summary>

View file

@ -959,114 +959,6 @@ namespace OpenTK
return result;
}
/// <summary>
/// Build a rotation matrix from the specified quaternion.
/// </summary>
/// <param name="q">Quaternion to translate.</param>
/// <param name="m">Matrix result.</param>
[Obsolete("Use double-precision overload instead")]
public static void CreateFromQuaternion(ref Quaternion q,ref Matrix4 m)
{
m = Matrix4.Identity;
float X = q.X;
float Y = q.Y;
float Z = q.Z;
float W = q.W;
float xx = X * X;
float xy = X * Y;
float xz = X * Z;
float xw = X * W;
float yy = Y * Y;
float yz = Y * Z;
float yw = Y * W;
float zz = Z * Z;
float zw = Z * W;
m.M11 = 1 - 2 * (yy + zz);
m.M21 = 2 * (xy - zw);
m.M31 = 2 * (xz + yw);
m.M12 = 2 * (xy + zw);
m.M22 = 1 - 2 * (xx + zz);
m.M32 = 2 * (yz - xw);
m.M13 = 2 * (xz - yw);
m.M23 = 2 * (yz + xw);
m.M33 = 1 - 2 * (xx + yy);
}
/// <summary>
/// Build a rotation matrix from the specified quaternion.
/// </summary>
/// <param name="q">Quaternion to translate.</param>
/// <returns>A matrix instance.</returns>
[Obsolete("Use double-precision overload instead")]
public static Matrix4 CreateFromQuaternion(ref Quaternion q)
{
Matrix4 result = Matrix4.Identity;
float X = q.X;
float Y = q.Y;
float Z = q.Z;
float W = q.W;
float xx = X * X;
float xy = X * Y;
float xz = X * Z;
float xw = X * W;
float yy = Y * Y;
float yz = Y * Z;
float yw = Y * W;
float zz = Z * Z;
float zw = Z * W;
result.M11 = 1 - 2 * (yy + zz);
result.M21 = 2 * (xy - zw);
result.M31 = 2 * (xz + yw);
result.M12 = 2 * (xy + zw);
result.M22 = 1 - 2 * (xx + zz);
result.M32 = 2 * (yz - xw);
result.M13 = 2 * (xz - yw);
result.M23 = 2 * (yz + xw);
result.M33 = 1 - 2 * (xx + yy);
return result;
}
#endregion
#region Obsolete Functions
#region Translation Functions
/// <summary>
/// Build a translation matrix with the given translation
/// </summary>
/// <param name="trans">The vector to translate along</param>
/// <returns>A Translation matrix</returns>
[Obsolete("Use CreateTranslation instead.")]
public static Matrix4d Translation(Vector3d trans)
{
return Translation(trans.X, trans.Y, trans.Z);
}
/// <summary>
/// Build a translation matrix with the given translation
/// </summary>
/// <param name="x">X translation</param>
/// <param name="y">Y translation</param>
/// <param name="z">Z translation</param>
/// <returns>A Translation matrix</returns>
[Obsolete("Use CreateTranslation instead.")]
public static Matrix4d Translation(double x, double y, double z)
{
Matrix4d result = Identity;
result.Row3 = new Vector4d(x, y, z, 1.0);
return result;
}
#endregion
#endregion
#region Scale Functions