mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 20:25:39 +00:00
commit
d1713ff47a
|
@ -322,9 +322,9 @@ namespace OpenTK
|
||||||
#region GetDisplay
|
#region GetDisplay
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the <see cref="DisplayDevice"/> for the specified <see cref="DeviceIndex"/>.
|
/// Gets the <see cref="DisplayDevice"/> for the specified <see cref="DisplayIndex"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="index">The <see cref="DeviceIndex"/> that defines the desired display.</param>
|
/// <param name="index">The <see cref="DisplayIndex"/> that defines the desired display.</param>
|
||||||
/// <returns>A <see cref="DisplayDevice"/> or null, if no device corresponds to the specified index.</returns>
|
/// <returns>A <see cref="DisplayDevice"/> or null, if no device corresponds to the specified index.</returns>
|
||||||
public static DisplayDevice GetDisplay(DisplayIndex index)
|
public static DisplayDevice GetDisplay(DisplayIndex index)
|
||||||
{
|
{
|
||||||
|
|
|
@ -193,6 +193,9 @@ namespace OpenTK
|
||||||
|
|
||||||
#region public void Invert()
|
#region public void Invert()
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts this instance into its inverse.
|
||||||
|
/// </summary>
|
||||||
public void Invert()
|
public void Invert()
|
||||||
{
|
{
|
||||||
this = Matrix3.Invert(this);
|
this = Matrix3.Invert(this);
|
||||||
|
@ -202,6 +205,9 @@ namespace OpenTK
|
||||||
|
|
||||||
#region public void Transpose()
|
#region public void Transpose()
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts this instance into its transpose.
|
||||||
|
/// </summary>
|
||||||
public void Transpose()
|
public void Transpose()
|
||||||
{
|
{
|
||||||
this = Matrix3.Transpose(this);
|
this = Matrix3.Transpose(this);
|
||||||
|
@ -215,6 +221,12 @@ namespace OpenTK
|
||||||
|
|
||||||
#region CreateFromAxisAngle
|
#region CreateFromAxisAngle
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Build a rotation matrix from the specified axis/angle rotation.
|
||||||
|
/// </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>
|
||||||
|
/// <param name="result">A matrix instance.</param>
|
||||||
public static void CreateFromAxisAngle(Vector3 axis, float angle, out Matrix3 result)
|
public static void CreateFromAxisAngle(Vector3 axis, float angle, out Matrix3 result)
|
||||||
{
|
{
|
||||||
//normalize and create a local copy of the vector.
|
//normalize and create a local copy of the vector.
|
||||||
|
@ -249,6 +261,12 @@ namespace OpenTK
|
||||||
result.Row2.Z = tZZ + cos;
|
result.Row2.Z = tZZ + cos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Build a rotation matrix from the specified axis/angle rotation.
|
||||||
|
/// </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 matrix instance.</returns>
|
||||||
public static Matrix3 CreateFromAxisAngle(Vector3 axis, float angle)
|
public static Matrix3 CreateFromAxisAngle(Vector3 axis, float angle)
|
||||||
{
|
{
|
||||||
Matrix3 result;
|
Matrix3 result;
|
||||||
|
@ -260,6 +278,11 @@ namespace OpenTK
|
||||||
|
|
||||||
#region CreateFromQuaternion
|
#region CreateFromQuaternion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Build a rotation matrix from the specified quaternion.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="q">Quaternion to translate.</param>
|
||||||
|
/// <param name="result">Matrix result.</param>
|
||||||
public static void CreateFromQuaternion(ref Quaternion q, out Matrix3 result)
|
public static void CreateFromQuaternion(ref Quaternion q, out Matrix3 result)
|
||||||
{
|
{
|
||||||
Vector3 axis;
|
Vector3 axis;
|
||||||
|
@ -268,6 +291,11 @@ namespace OpenTK
|
||||||
CreateFromAxisAngle(axis, angle, out result);
|
CreateFromAxisAngle(axis, angle, out result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Build a rotation matrix from the specified quaternion.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="q">Quaternion to translate.</param>
|
||||||
|
/// <returns>A matrix instance.</returns>
|
||||||
public static Matrix3 CreateFromQuaternion(Quaternion q)
|
public static Matrix3 CreateFromQuaternion(Quaternion q)
|
||||||
{
|
{
|
||||||
Matrix3 result;
|
Matrix3 result;
|
||||||
|
@ -279,6 +307,11 @@ namespace OpenTK
|
||||||
|
|
||||||
#region CreateRotation[XYZ]
|
#region CreateRotation[XYZ]
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Builds a rotation matrix for a rotation around the x-axis.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="angle">The counter-clockwise angle in radians.</param>
|
||||||
|
/// <param name="result">The resulting Matrix3 instance.</param>
|
||||||
public static void CreateRotationX(float angle, out Matrix3 result)
|
public static void CreateRotationX(float angle, out Matrix3 result)
|
||||||
{
|
{
|
||||||
float cos = (float)System.Math.Cos(angle);
|
float cos = (float)System.Math.Cos(angle);
|
||||||
|
@ -291,6 +324,11 @@ namespace OpenTK
|
||||||
result.Row2.Z = cos;
|
result.Row2.Z = cos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Builds a rotation matrix for a rotation around the x-axis.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="angle">The counter-clockwise angle in radians.</param>
|
||||||
|
/// <returns>The resulting Matrix3 instance.</returns>
|
||||||
public static Matrix3 CreateRotationX(float angle)
|
public static Matrix3 CreateRotationX(float angle)
|
||||||
{
|
{
|
||||||
Matrix3 result;
|
Matrix3 result;
|
||||||
|
@ -298,6 +336,11 @@ namespace OpenTK
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Builds a rotation matrix for a rotation around the y-axis.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="angle">The counter-clockwise angle in radians.</param>
|
||||||
|
/// <param name="result">The resulting Matrix3 instance.</param>
|
||||||
public static void CreateRotationY(float angle, out Matrix3 result)
|
public static void CreateRotationY(float angle, out Matrix3 result)
|
||||||
{
|
{
|
||||||
float cos = (float)System.Math.Cos(angle);
|
float cos = (float)System.Math.Cos(angle);
|
||||||
|
@ -310,6 +353,11 @@ namespace OpenTK
|
||||||
result.Row2.Z = cos;
|
result.Row2.Z = cos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Builds a rotation matrix for a rotation around the y-axis.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="angle">The counter-clockwise angle in radians.</param>
|
||||||
|
/// <returns>The resulting Matrix3 instance.</returns>
|
||||||
public static Matrix3 CreateRotationY(float angle)
|
public static Matrix3 CreateRotationY(float angle)
|
||||||
{
|
{
|
||||||
Matrix3 result;
|
Matrix3 result;
|
||||||
|
@ -317,6 +365,11 @@ namespace OpenTK
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Builds a rotation matrix for a rotation around the z-axis.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="angle">The counter-clockwise angle in radians.</param>
|
||||||
|
/// <param name="result">The resulting Matrix3 instance.</param>
|
||||||
public static void CreateRotationZ(float angle, out Matrix3 result)
|
public static void CreateRotationZ(float angle, out Matrix3 result)
|
||||||
{
|
{
|
||||||
float cos = (float)System.Math.Cos(angle);
|
float cos = (float)System.Math.Cos(angle);
|
||||||
|
@ -329,6 +382,11 @@ namespace OpenTK
|
||||||
result.Row1.Y = cos;
|
result.Row1.Y = cos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Builds a rotation matrix for a rotation around the z-axis.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="angle">The counter-clockwise angle in radians.</param>
|
||||||
|
/// <returns>The resulting Matrix3 instance.</returns>
|
||||||
public static Matrix3 CreateRotationZ(float angle)
|
public static Matrix3 CreateRotationZ(float angle)
|
||||||
{
|
{
|
||||||
Matrix3 result;
|
Matrix3 result;
|
||||||
|
@ -410,7 +468,7 @@ namespace OpenTK
|
||||||
/// <param name="x">Scale factor for the x axis.</param>
|
/// <param name="x">Scale factor for the x axis.</param>
|
||||||
/// <param name="y">Scale factor for the y axis.</param>
|
/// <param name="y">Scale factor for the y axis.</param>
|
||||||
/// <param name="z">Scale factor for the z axis.</param>
|
/// <param name="z">Scale factor for the z axis.</param>
|
||||||
/// <param name="result">A scale matrix.</returns>
|
/// <param name="result">A scale matrix.</param>
|
||||||
public static void CreateScale(float x, float y, float z, out Matrix3 result)
|
public static void CreateScale(float x, float y, float z, out Matrix3 result)
|
||||||
{
|
{
|
||||||
result = Identity;
|
result = Identity;
|
||||||
|
@ -423,6 +481,12 @@ namespace OpenTK
|
||||||
|
|
||||||
#region Multiply Functions
|
#region Multiply Functions
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Multiplies two instances.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="left">The left operand of the multiplication.</param>
|
||||||
|
/// <param name="right">The right operand of the multiplication.</param>
|
||||||
|
/// <returns>A new instance that is the result of the multiplication</returns>
|
||||||
public static Matrix3 Mult(Matrix3 left, Matrix3 right)
|
public static Matrix3 Mult(Matrix3 left, Matrix3 right)
|
||||||
{
|
{
|
||||||
Matrix3 result;
|
Matrix3 result;
|
||||||
|
@ -430,6 +494,12 @@ namespace OpenTK
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Multiplies two instances.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="left">The left operand of the multiplication.</param>
|
||||||
|
/// <param name="right">The right operand of the multiplication.</param>
|
||||||
|
/// <param name="result">A new instance that is the result of the multiplication</param>
|
||||||
public static void Mult(ref Matrix3 left, ref Matrix3 right, out Matrix3 result)
|
public static void Mult(ref Matrix3 left, ref Matrix3 right, out Matrix3 result)
|
||||||
{
|
{
|
||||||
float lM11 = left.Row0.X, lM12 = left.Row0.Y, lM13 = left.Row0.Z,
|
float lM11 = left.Row0.X, lM12 = left.Row0.Y, lM13 = left.Row0.Z,
|
||||||
|
@ -579,11 +649,21 @@ namespace OpenTK
|
||||||
|
|
||||||
#region Transpose
|
#region Transpose
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Calculate the transpose of the given matrix
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mat">The matrix to transpose</param>
|
||||||
|
/// <returns>The transpose of the given matrix</returns>
|
||||||
public static Matrix3 Transpose(Matrix3 mat)
|
public static Matrix3 Transpose(Matrix3 mat)
|
||||||
{
|
{
|
||||||
return new Matrix3(mat.Column0, mat.Column1, mat.Column2);
|
return new Matrix3(mat.Column0, mat.Column1, mat.Column2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Calculate the transpose of the given matrix
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mat">The matrix to transpose</param>
|
||||||
|
/// <param name="result">The result of the calculation</param>
|
||||||
public static void Transpose(ref Matrix3 mat, out Matrix3 result)
|
public static void Transpose(ref Matrix3 mat, out Matrix3 result)
|
||||||
{
|
{
|
||||||
result.Row0 = mat.Column0;
|
result.Row0 = mat.Column0;
|
||||||
|
@ -597,16 +677,34 @@ namespace OpenTK
|
||||||
|
|
||||||
#region Operators
|
#region Operators
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Matrix multiplication
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="left">left-hand operand</param>
|
||||||
|
/// <param name="right">right-hand operand</param>
|
||||||
|
/// <returns>A new Matrix3d which holds the result of the multiplication</returns>
|
||||||
public static Matrix3 operator *(Matrix3 left, Matrix3 right)
|
public static Matrix3 operator *(Matrix3 left, Matrix3 right)
|
||||||
{
|
{
|
||||||
return Matrix3.Mult(left, right);
|
return Matrix3.Mult(left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Compares two instances for equality.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="left">The first instance.</param>
|
||||||
|
/// <param name="right">The second instance.</param>
|
||||||
|
/// <returns>True, if left equals right; false otherwise.</returns>
|
||||||
public static bool operator ==(Matrix3 left, Matrix3 right)
|
public static bool operator ==(Matrix3 left, Matrix3 right)
|
||||||
{
|
{
|
||||||
return left.Equals(right);
|
return left.Equals(right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Compares two instances for inequality.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="left">The first instance.</param>
|
||||||
|
/// <param name="right">The second instance.</param>
|
||||||
|
/// <returns>True, if left does not equal right; false otherwise.</returns>
|
||||||
public static bool operator !=(Matrix3 left, Matrix3 right)
|
public static bool operator !=(Matrix3 left, Matrix3 right)
|
||||||
{
|
{
|
||||||
return !left.Equals(right);
|
return !left.Equals(right);
|
||||||
|
@ -665,6 +763,9 @@ namespace OpenTK
|
||||||
|
|
||||||
#region IEquatable<Matrix3> Members
|
#region IEquatable<Matrix3> Members
|
||||||
|
|
||||||
|
/// <summary>Indicates whether the current matrix is equal to another matrix.</summary>
|
||||||
|
/// <param name="other">A matrix to compare with this matrix.</param>
|
||||||
|
/// <returns>true if the current matrix is equal to the matrix parameter; otherwise, false.</returns>
|
||||||
public bool Equals(Matrix3 other)
|
public bool Equals(Matrix3 other)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
|
|
|
@ -193,6 +193,9 @@ namespace OpenTK
|
||||||
|
|
||||||
#region public void Invert()
|
#region public void Invert()
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts this instance into its inverse.
|
||||||
|
/// </summary>
|
||||||
public void Invert()
|
public void Invert()
|
||||||
{
|
{
|
||||||
this = Matrix3d.Invert(this);
|
this = Matrix3d.Invert(this);
|
||||||
|
@ -202,6 +205,9 @@ namespace OpenTK
|
||||||
|
|
||||||
#region public void Transpose()
|
#region public void Transpose()
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts this instance into its transpose.
|
||||||
|
/// </summary>
|
||||||
public void Transpose()
|
public void Transpose()
|
||||||
{
|
{
|
||||||
this = Matrix3d.Transpose(this);
|
this = Matrix3d.Transpose(this);
|
||||||
|
@ -215,6 +221,12 @@ namespace OpenTK
|
||||||
|
|
||||||
#region CreateFromAxisAngle
|
#region CreateFromAxisAngle
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Build a rotation matrix from the specified axis/angle rotation.
|
||||||
|
/// </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>
|
||||||
|
/// <param name="result">A matrix instance.</param>
|
||||||
public static void CreateFromAxisAngle(Vector3d axis, double angle, out Matrix3d result)
|
public static void CreateFromAxisAngle(Vector3d axis, double angle, out Matrix3d result)
|
||||||
{
|
{
|
||||||
//normalize and create a local copy of the vector.
|
//normalize and create a local copy of the vector.
|
||||||
|
@ -249,6 +261,12 @@ namespace OpenTK
|
||||||
result.Row2.Z = tZZ + cos;
|
result.Row2.Z = tZZ + cos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Build a rotation matrix from the specified axis/angle rotation.
|
||||||
|
/// </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 matrix instance.</returns>
|
||||||
public static Matrix3d CreateFromAxisAngle(Vector3d axis, double angle)
|
public static Matrix3d CreateFromAxisAngle(Vector3d axis, double angle)
|
||||||
{
|
{
|
||||||
Matrix3d result;
|
Matrix3d result;
|
||||||
|
@ -260,6 +278,11 @@ namespace OpenTK
|
||||||
|
|
||||||
#region CreateFromQuaternion
|
#region CreateFromQuaternion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Build a rotation matrix from the specified quaternion.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="q">Quaternion to translate.</param>
|
||||||
|
/// <param name="result">Matrix result.</param>
|
||||||
public static void CreateFromQuaternion(ref Quaterniond q, out Matrix3d result)
|
public static void CreateFromQuaternion(ref Quaterniond q, out Matrix3d result)
|
||||||
{
|
{
|
||||||
Vector3d axis;
|
Vector3d axis;
|
||||||
|
@ -268,6 +291,11 @@ namespace OpenTK
|
||||||
CreateFromAxisAngle(axis, angle, out result);
|
CreateFromAxisAngle(axis, angle, out result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Build a rotation matrix from the specified quaternion.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="q">Quaternion to translate.</param>
|
||||||
|
/// <returns>A matrix instance.</returns>
|
||||||
public static Matrix3d CreateFromQuaternion(Quaterniond q)
|
public static Matrix3d CreateFromQuaternion(Quaterniond q)
|
||||||
{
|
{
|
||||||
Matrix3d result;
|
Matrix3d result;
|
||||||
|
@ -279,6 +307,11 @@ namespace OpenTK
|
||||||
|
|
||||||
#region CreateRotation[XYZ]
|
#region CreateRotation[XYZ]
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Builds a rotation matrix for a rotation around the x-axis.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="angle">The counter-clockwise angle in radians.</param>
|
||||||
|
/// <param name="result">The resulting Matrix3d instance.</param>
|
||||||
public static void CreateRotationX(double angle, out Matrix3d result)
|
public static void CreateRotationX(double angle, out Matrix3d result)
|
||||||
{
|
{
|
||||||
double cos = System.Math.Cos(angle);
|
double cos = System.Math.Cos(angle);
|
||||||
|
@ -291,6 +324,11 @@ namespace OpenTK
|
||||||
result.Row2.Z = cos;
|
result.Row2.Z = cos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Builds a rotation matrix for a rotation around the x-axis.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="angle">The counter-clockwise angle in radians.</param>
|
||||||
|
/// <returns>The resulting Matrix3d instance.</returns>
|
||||||
public static Matrix3d CreateRotationX(double angle)
|
public static Matrix3d CreateRotationX(double angle)
|
||||||
{
|
{
|
||||||
Matrix3d result;
|
Matrix3d result;
|
||||||
|
@ -298,6 +336,11 @@ namespace OpenTK
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Builds a rotation matrix for a rotation around the y-axis.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="angle">The counter-clockwise angle in radians.</param>
|
||||||
|
/// <param name="result">The resulting Matrix3d instance.</param>
|
||||||
public static void CreateRotationY(double angle, out Matrix3d result)
|
public static void CreateRotationY(double angle, out Matrix3d result)
|
||||||
{
|
{
|
||||||
double cos = System.Math.Cos(angle);
|
double cos = System.Math.Cos(angle);
|
||||||
|
@ -310,6 +353,11 @@ namespace OpenTK
|
||||||
result.Row2.Z = cos;
|
result.Row2.Z = cos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Builds a rotation matrix for a rotation around the y-axis.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="angle">The counter-clockwise angle in radians.</param>
|
||||||
|
/// <returns>The resulting Matrix3d instance.</returns>
|
||||||
public static Matrix3d CreateRotationY(double angle)
|
public static Matrix3d CreateRotationY(double angle)
|
||||||
{
|
{
|
||||||
Matrix3d result;
|
Matrix3d result;
|
||||||
|
@ -317,6 +365,11 @@ namespace OpenTK
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Builds a rotation matrix for a rotation around the z-axis.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="angle">The counter-clockwise angle in radians.</param>
|
||||||
|
/// <param name="result">The resulting Matrix3d instance.</param>
|
||||||
public static void CreateRotationZ(double angle, out Matrix3d result)
|
public static void CreateRotationZ(double angle, out Matrix3d result)
|
||||||
{
|
{
|
||||||
double cos = System.Math.Cos(angle);
|
double cos = System.Math.Cos(angle);
|
||||||
|
@ -329,6 +382,11 @@ namespace OpenTK
|
||||||
result.Row1.Y = cos;
|
result.Row1.Y = cos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Builds a rotation matrix for a rotation around the z-axis.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="angle">The counter-clockwise angle in radians.</param>
|
||||||
|
/// <returns>The resulting Matrix3d instance.</returns>
|
||||||
public static Matrix3d CreateRotationZ(double angle)
|
public static Matrix3d CreateRotationZ(double angle)
|
||||||
{
|
{
|
||||||
Matrix3d result;
|
Matrix3d result;
|
||||||
|
@ -410,7 +468,7 @@ namespace OpenTK
|
||||||
/// <param name="x">Scale factor for the x axis.</param>
|
/// <param name="x">Scale factor for the x axis.</param>
|
||||||
/// <param name="y">Scale factor for the y axis.</param>
|
/// <param name="y">Scale factor for the y axis.</param>
|
||||||
/// <param name="z">Scale factor for the z axis.</param>
|
/// <param name="z">Scale factor for the z axis.</param>
|
||||||
/// <param name="result">A scale matrix.</returns>
|
/// <param name="result">A scale matrix.</param>
|
||||||
public static void CreateScale(double x, double y, double z, out Matrix3d result)
|
public static void CreateScale(double x, double y, double z, out Matrix3d result)
|
||||||
{
|
{
|
||||||
result = Identity;
|
result = Identity;
|
||||||
|
@ -423,6 +481,12 @@ namespace OpenTK
|
||||||
|
|
||||||
#region Multiply Functions
|
#region Multiply Functions
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Multiplies two instances.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="left">The left operand of the multiplication.</param>
|
||||||
|
/// <param name="right">The right operand of the multiplication.</param>
|
||||||
|
/// <returns>A new instance that is the result of the multiplication</returns>
|
||||||
public static Matrix3d Mult(Matrix3d left, Matrix3d right)
|
public static Matrix3d Mult(Matrix3d left, Matrix3d right)
|
||||||
{
|
{
|
||||||
Matrix3d result;
|
Matrix3d result;
|
||||||
|
@ -430,6 +494,12 @@ namespace OpenTK
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Multiplies two instances.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="left">The left operand of the multiplication.</param>
|
||||||
|
/// <param name="right">The right operand of the multiplication.</param>
|
||||||
|
/// <param name="result">A new instance that is the result of the multiplication</param>
|
||||||
public static void Mult(ref Matrix3d left, ref Matrix3d right, out Matrix3d result)
|
public static void Mult(ref Matrix3d left, ref Matrix3d right, out Matrix3d result)
|
||||||
{
|
{
|
||||||
double lM11 = left.Row0.X, lM12 = left.Row0.Y, lM13 = left.Row0.Z,
|
double lM11 = left.Row0.X, lM12 = left.Row0.Y, lM13 = left.Row0.Z,
|
||||||
|
@ -579,11 +649,21 @@ namespace OpenTK
|
||||||
|
|
||||||
#region Transpose
|
#region Transpose
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Calculate the transpose of the given matrix
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mat">The matrix to transpose</param>
|
||||||
|
/// <returns>The transpose of the given matrix</returns>
|
||||||
public static Matrix3d Transpose(Matrix3d mat)
|
public static Matrix3d Transpose(Matrix3d mat)
|
||||||
{
|
{
|
||||||
return new Matrix3d(mat.Column0, mat.Column1, mat.Column2);
|
return new Matrix3d(mat.Column0, mat.Column1, mat.Column2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Calculate the transpose of the given matrix
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="mat">The matrix to transpose</param>
|
||||||
|
/// <param name="result">The result of the calculation</param>
|
||||||
public static void Transpose(ref Matrix3d mat, out Matrix3d result)
|
public static void Transpose(ref Matrix3d mat, out Matrix3d result)
|
||||||
{
|
{
|
||||||
result.Row0 = mat.Column0;
|
result.Row0 = mat.Column0;
|
||||||
|
@ -597,16 +677,34 @@ namespace OpenTK
|
||||||
|
|
||||||
#region Operators
|
#region Operators
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Matrix multiplication
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="left">left-hand operand</param>
|
||||||
|
/// <param name="right">right-hand operand</param>
|
||||||
|
/// <returns>A new Matrix3d which holds the result of the multiplication</returns>
|
||||||
public static Matrix3d operator *(Matrix3d left, Matrix3d right)
|
public static Matrix3d operator *(Matrix3d left, Matrix3d right)
|
||||||
{
|
{
|
||||||
return Matrix3d.Mult(left, right);
|
return Matrix3d.Mult(left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Compares two instances for equality.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="left">The first instance.</param>
|
||||||
|
/// <param name="right">The second instance.</param>
|
||||||
|
/// <returns>True, if left equals right; false otherwise.</returns>
|
||||||
public static bool operator ==(Matrix3d left, Matrix3d right)
|
public static bool operator ==(Matrix3d left, Matrix3d right)
|
||||||
{
|
{
|
||||||
return left.Equals(right);
|
return left.Equals(right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Compares two instances for inequality.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="left">The first instance.</param>
|
||||||
|
/// <param name="right">The second instance.</param>
|
||||||
|
/// <returns>True, if left does not equal right; false otherwise.</returns>
|
||||||
public static bool operator !=(Matrix3d left, Matrix3d right)
|
public static bool operator !=(Matrix3d left, Matrix3d right)
|
||||||
{
|
{
|
||||||
return !left.Equals(right);
|
return !left.Equals(right);
|
||||||
|
@ -665,6 +763,9 @@ namespace OpenTK
|
||||||
|
|
||||||
#region IEquatable<Matrix3d> Members
|
#region IEquatable<Matrix3d> Members
|
||||||
|
|
||||||
|
/// <summary>Indicates whether the current matrix is equal to another matrix.</summary>
|
||||||
|
/// <param name="other">A matrix to compare with this matrix.</param>
|
||||||
|
/// <returns>true if the current matrix is equal to the matrix parameter; otherwise, false.</returns>
|
||||||
public bool Equals(Matrix3d other)
|
public bool Equals(Matrix3d other)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
|
|
|
@ -613,7 +613,7 @@ namespace OpenTK
|
||||||
/// <param name="x">Scale factor for the x axis.</param>
|
/// <param name="x">Scale factor for the x axis.</param>
|
||||||
/// <param name="y">Scale factor for the y axis.</param>
|
/// <param name="y">Scale factor for the y axis.</param>
|
||||||
/// <param name="z">Scale factor for the z axis.</param>
|
/// <param name="z">Scale factor for the z axis.</param>
|
||||||
/// <param name="result">A scale matrix.</returns>
|
/// <param name="result">A scale matrix.</param>
|
||||||
public static void CreateScale(float x, float y, float z, out Matrix4 result)
|
public static void CreateScale(float x, float y, float z, out Matrix4 result)
|
||||||
{
|
{
|
||||||
result = Identity;
|
result = Identity;
|
||||||
|
|
|
@ -336,7 +336,7 @@ namespace OpenTK
|
||||||
/// Builds a rotation matrix for a rotation around the x-axis.
|
/// Builds a rotation matrix for a rotation around the x-axis.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="angle">The counter-clockwise angle in radians.</param>
|
/// <param name="angle">The counter-clockwise angle in radians.</param>
|
||||||
/// <param name="result">The resulting Matrix4 instance.</param>
|
/// <param name="result">The resulting Matrix4d instance.</param>
|
||||||
public static void CreateRotationX(double angle, out Matrix4d result)
|
public static void CreateRotationX(double angle, out Matrix4d result)
|
||||||
{
|
{
|
||||||
double cos = System.Math.Cos(angle);
|
double cos = System.Math.Cos(angle);
|
||||||
|
@ -352,7 +352,7 @@ namespace OpenTK
|
||||||
/// Builds a rotation matrix for a rotation around the x-axis.
|
/// Builds a rotation matrix for a rotation around the x-axis.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="angle">The counter-clockwise angle in radians.</param>
|
/// <param name="angle">The counter-clockwise angle in radians.</param>
|
||||||
/// <returns>The resulting Matrix4 instance.</returns>
|
/// <returns>The resulting Matrix4d instance.</returns>
|
||||||
public static Matrix4d CreateRotationX(double angle)
|
public static Matrix4d CreateRotationX(double angle)
|
||||||
{
|
{
|
||||||
Matrix4d result;
|
Matrix4d result;
|
||||||
|
@ -364,7 +364,7 @@ namespace OpenTK
|
||||||
/// Builds a rotation matrix for a rotation around the y-axis.
|
/// Builds a rotation matrix for a rotation around the y-axis.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="angle">The counter-clockwise angle in radians.</param>
|
/// <param name="angle">The counter-clockwise angle in radians.</param>
|
||||||
/// <param name="result">The resulting Matrix4 instance.</param>
|
/// <param name="result">The resulting Matrix4d instance.</param>
|
||||||
public static void CreateRotationY(double angle, out Matrix4d result)
|
public static void CreateRotationY(double angle, out Matrix4d result)
|
||||||
{
|
{
|
||||||
double cos = System.Math.Cos(angle);
|
double cos = System.Math.Cos(angle);
|
||||||
|
@ -380,7 +380,7 @@ namespace OpenTK
|
||||||
/// Builds a rotation matrix for a rotation around the y-axis.
|
/// Builds a rotation matrix for a rotation around the y-axis.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="angle">The counter-clockwise angle in radians.</param>
|
/// <param name="angle">The counter-clockwise angle in radians.</param>
|
||||||
/// <returns>The resulting Matrix4 instance.</returns>
|
/// <returns>The resulting Matrix4d instance.</returns>
|
||||||
public static Matrix4d CreateRotationY(double angle)
|
public static Matrix4d CreateRotationY(double angle)
|
||||||
{
|
{
|
||||||
Matrix4d result;
|
Matrix4d result;
|
||||||
|
@ -392,7 +392,7 @@ namespace OpenTK
|
||||||
/// Builds a rotation matrix for a rotation around the z-axis.
|
/// Builds a rotation matrix for a rotation around the z-axis.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="angle">The counter-clockwise angle in radians.</param>
|
/// <param name="angle">The counter-clockwise angle in radians.</param>
|
||||||
/// <param name="result">The resulting Matrix4 instance.</param>
|
/// <param name="result">The resulting Matrix4d instance.</param>
|
||||||
public static void CreateRotationZ(double angle, out Matrix4d result)
|
public static void CreateRotationZ(double angle, out Matrix4d result)
|
||||||
{
|
{
|
||||||
double cos = System.Math.Cos(angle);
|
double cos = System.Math.Cos(angle);
|
||||||
|
@ -408,7 +408,7 @@ namespace OpenTK
|
||||||
/// Builds a rotation matrix for a rotation around the z-axis.
|
/// Builds a rotation matrix for a rotation around the z-axis.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="angle">The counter-clockwise angle in radians.</param>
|
/// <param name="angle">The counter-clockwise angle in radians.</param>
|
||||||
/// <returns>The resulting Matrix4 instance.</returns>
|
/// <returns>The resulting Matrix4d instance.</returns>
|
||||||
public static Matrix4d CreateRotationZ(double angle)
|
public static Matrix4d CreateRotationZ(double angle)
|
||||||
{
|
{
|
||||||
Matrix4d result;
|
Matrix4d result;
|
||||||
|
@ -1220,7 +1220,7 @@ namespace OpenTK
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="left">left-hand operand</param>
|
/// <param name="left">left-hand operand</param>
|
||||||
/// <param name="right">right-hand operand</param>
|
/// <param name="right">right-hand operand</param>
|
||||||
/// <returns>A new Matrix44 which holds the result of the multiplication</returns>
|
/// <returns>A new Matrix4d which holds the result of the multiplication</returns>
|
||||||
public static Matrix4d operator *(Matrix4d left, Matrix4d right)
|
public static Matrix4d operator *(Matrix4d left, Matrix4d right)
|
||||||
{
|
{
|
||||||
return Matrix4d.Mult(left, right);
|
return Matrix4d.Mult(left, right);
|
||||||
|
@ -1302,7 +1302,7 @@ namespace OpenTK
|
||||||
#region IEquatable<Matrix4d> Members
|
#region IEquatable<Matrix4d> Members
|
||||||
|
|
||||||
/// <summary>Indicates whether the current matrix is equal to another matrix.</summary>
|
/// <summary>Indicates whether the current matrix is equal to another matrix.</summary>
|
||||||
/// <param name="other">An matrix to compare with this matrix.</param>
|
/// <param name="other">A matrix to compare with this matrix.</param>
|
||||||
/// <returns>true if the current matrix is equal to the matrix parameter; otherwise, false.</returns>
|
/// <returns>true if the current matrix is equal to the matrix parameter; otherwise, false.</returns>
|
||||||
public bool Equals(Matrix4d other)
|
public bool Equals(Matrix4d other)
|
||||||
{
|
{
|
||||||
|
|
|
@ -821,7 +821,7 @@ namespace OpenTK
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when a keybord key is released.
|
/// Called when a keybord key is released.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="e">The <see cref="OpenTK.KeyboardKeyEventArgs"/> for this event.</param>
|
/// <param name="e">The <see cref="OpenTK.Input.KeyboardKeyEventArgs"/> for this event.</param>
|
||||||
protected virtual void OnKeyUp(KeyboardKeyEventArgs e)
|
protected virtual void OnKeyUp(KeyboardKeyEventArgs e)
|
||||||
{
|
{
|
||||||
KeyUp(this, e);
|
KeyUp(this, e);
|
||||||
|
|
Loading…
Reference in a new issue