mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-11 14:05:40 +00:00
Deprecated Mult in favor of Multiply.
Modified operator * to use Multiply internally (reduces code duplication).
This commit is contained in:
parent
eeda1bf866
commit
b5eb7fdb93
|
@ -296,6 +296,7 @@ namespace OpenTK
|
|||
/// <param name="left">The first instance.</param>
|
||||
/// <param name="right">The second instance.</param>
|
||||
/// <returns>A new instance containing the result of the calculation.</returns>
|
||||
[Obsolete("Use Multiply instead.")]
|
||||
public static Quaternion Mult(Quaternion left, Quaternion right)
|
||||
{
|
||||
return new Quaternion(
|
||||
|
@ -309,6 +310,7 @@ namespace OpenTK
|
|||
/// <param name="left">The first instance.</param>
|
||||
/// <param name="right">The second instance.</param>
|
||||
/// <param name="result">A new instance containing the result of the calculation.</param>
|
||||
[Obsolete("Use Multiply instead.")]
|
||||
public static void Mult(ref Quaternion left, ref Quaternion right, out Quaternion result)
|
||||
{
|
||||
result = new Quaternion(
|
||||
|
@ -316,13 +318,39 @@ namespace OpenTK
|
|||
left.W * right.W - Vector3.Dot(left.Xyz, right.Xyz));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Multiplies two instances.
|
||||
/// </summary>
|
||||
/// <param name="left">The first instance.</param>
|
||||
/// <param name="right">The second instance.</param>
|
||||
/// <returns>A new instance containing the result of the calculation.</returns>
|
||||
public static Quaternion Multiply(Quaternion left, Quaternion right)
|
||||
{
|
||||
Quaternion result;
|
||||
Multiply(ref left, ref right, out result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Multiplies two instances.
|
||||
/// </summary>
|
||||
/// <param name="left">The first instance.</param>
|
||||
/// <param name="right">The second instance.</param>
|
||||
/// <param name="result">A new instance containing the result of the calculation.</param>
|
||||
public static void Multiply(ref Quaternion left, ref Quaternion right, out Quaternion result)
|
||||
{
|
||||
result = new Quaternion(
|
||||
right.W * left.Xyz + left.W * right.Xyz + Vector3.Cross(left.Xyz, right.Xyz),
|
||||
left.W * right.W - Vector3.Dot(left.Xyz, right.Xyz));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Multiplies an instance by a scalar.
|
||||
/// </summary>
|
||||
/// <param name="quaternion">The instance.</param>
|
||||
/// <param name="scale">The scalar.</param>
|
||||
/// <param name="result">A new instance containing the result of the calculation.</param>
|
||||
public static void Multiply(ref Quaternion quaternion, ref float scale, out Quaternion result)
|
||||
public static void Multiply(ref Quaternion quaternion, float scale, out Quaternion result)
|
||||
{
|
||||
result = new Quaternion(quaternion.X * scale, quaternion.Y * scale, quaternion.Z * scale, quaternion.W * scale);
|
||||
}
|
||||
|
@ -556,9 +584,7 @@ namespace OpenTK
|
|||
/// <returns>The result of the calculation.</returns>
|
||||
public static Quaternion operator *(Quaternion left, Quaternion right)
|
||||
{
|
||||
float w = left.W * right.W - Vector3.Dot(left.Xyz, right.Xyz);
|
||||
left.Xyz = right.W * left.Xyz + left.W * right.Xyz + Vector3.Cross(left.Xyz, right.Xyz);
|
||||
left.W = w;
|
||||
Multiply(ref left, ref right, out left);
|
||||
return left;
|
||||
}
|
||||
|
||||
|
@ -570,7 +596,8 @@ namespace OpenTK
|
|||
/// <returns>A new instance containing the result of the calculation.</returns>
|
||||
public static Quaternion operator *(Quaternion quaternion, float scale)
|
||||
{
|
||||
return new Quaternion(quaternion.X * scale, quaternion.Y * scale, quaternion.Z * scale, quaternion.W * scale);
|
||||
Multiply(ref quaternion, scale, out quaternion);
|
||||
return quaternion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -296,6 +296,7 @@ namespace OpenTK
|
|||
/// <param name="left">The first instance.</param>
|
||||
/// <param name="right">The second instance.</param>
|
||||
/// <returns>A new instance containing the result of the calculation.</returns>
|
||||
[Obsolete("Use Multiply instead.")]
|
||||
public static Quaterniond Mult(Quaterniond left, Quaterniond right)
|
||||
{
|
||||
return new Quaterniond(
|
||||
|
@ -309,6 +310,7 @@ namespace OpenTK
|
|||
/// <param name="left">The first instance.</param>
|
||||
/// <param name="right">The second instance.</param>
|
||||
/// <param name="result">A new instance containing the result of the calculation.</param>
|
||||
[Obsolete("Use Multiply instead.")]
|
||||
public static void Mult(ref Quaterniond left, ref Quaterniond right, out Quaterniond result)
|
||||
{
|
||||
result = new Quaterniond(
|
||||
|
@ -316,13 +318,39 @@ namespace OpenTK
|
|||
left.W * right.W - Vector3d.Dot(left.Xyz, right.Xyz));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Multiplies two instances.
|
||||
/// </summary>
|
||||
/// <param name="left">The first instance.</param>
|
||||
/// <param name="right">The second instance.</param>
|
||||
/// <returns>A new instance containing the result of the calculation.</returns>
|
||||
public static Quaterniond Multiply(Quaterniond left, Quaterniond right)
|
||||
{
|
||||
Quaterniond result;
|
||||
Multiply(ref left, ref right, out result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Multiplies two instances.
|
||||
/// </summary>
|
||||
/// <param name="left">The first instance.</param>
|
||||
/// <param name="right">The second instance.</param>
|
||||
/// <param name="result">A new instance containing the result of the calculation.</param>
|
||||
public static void Multiply(ref Quaterniond left, ref Quaterniond right, out Quaterniond result)
|
||||
{
|
||||
result = new Quaterniond(
|
||||
right.W * left.Xyz + left.W * right.Xyz + Vector3d.Cross(left.Xyz, right.Xyz),
|
||||
left.W * right.W - Vector3d.Dot(left.Xyz, right.Xyz));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Multiplies an instance by a scalar.
|
||||
/// </summary>
|
||||
/// <param name="quaternion">The instance.</param>
|
||||
/// <param name="scale">The scalar.</param>
|
||||
/// <param name="result">A new instance containing the result of the calculation.</param>
|
||||
public static void Multiply(ref Quaterniond quaternion, ref double scale, out Quaterniond result)
|
||||
public static void Multiply(ref Quaterniond quaternion, double scale, out Quaterniond result)
|
||||
{
|
||||
result = new Quaterniond(quaternion.X * scale, quaternion.Y * scale, quaternion.Z * scale, quaternion.W * scale);
|
||||
}
|
||||
|
@ -556,9 +584,7 @@ namespace OpenTK
|
|||
/// <returns>The result of the calculation.</returns>
|
||||
public static Quaterniond operator *(Quaterniond left, Quaterniond right)
|
||||
{
|
||||
double w = left.W * right.W - Vector3d.Dot(left.Xyz, right.Xyz);
|
||||
left.Xyz = right.W * left.Xyz + left.W * right.Xyz + Vector3d.Cross(left.Xyz, right.Xyz);
|
||||
left.W = w;
|
||||
Multiply(ref left, ref right, out left);
|
||||
return left;
|
||||
}
|
||||
|
||||
|
@ -570,7 +596,8 @@ namespace OpenTK
|
|||
/// <returns>A new instance containing the result of the calculation.</returns>
|
||||
public static Quaterniond operator *(Quaterniond quaternion, double scale)
|
||||
{
|
||||
return new Quaterniond(quaternion.X * scale, quaternion.Y * scale, quaternion.Z * scale, quaternion.W * scale);
|
||||
Multiply(ref quaternion, scale, out quaternion);
|
||||
return quaternion;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in a new issue