Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add left-handed spherical and cylindrical billboards #109605

Merged
merged 5 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 43 additions & 37 deletions src/libraries/Common/tests/TestUtilities/System/AssertExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -813,9 +813,11 @@ static string ToStringPadded(Half value)
/// <summary>Verifies that two <see cref="double"/> values are equal, within the <paramref name="allowedVariance"/>.</summary>
/// <param name="expected">The expected value</param>
/// <param name="actual">The value to be compared against</param>
/// <param name="allowedVariance">The total variance allowed between the expected and actual results.</param>
/// <param name="variance">The total variance allowed between the expected and actual results.</param>
/// <param name="banner">The banner to show; if <c>null</c>, then the standard
/// banner of "Values differ" will be used</param>
/// <exception cref="EqualException">Thrown when the values are not equal</exception>
public static void Equal(double expected, double actual, double variance)
public static void Equal(double expected, double actual, double variance, string? banner = null)
{
if (double.IsNaN(expected))
{
Expand All @@ -824,11 +826,11 @@ public static void Equal(double expected, double actual, double variance)
return;
}

throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}
else if (double.IsNaN(actual))
{
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}

if (double.IsNegativeInfinity(expected))
Expand All @@ -838,11 +840,11 @@ public static void Equal(double expected, double actual, double variance)
return;
}

throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}
else if (double.IsNegativeInfinity(actual))
{
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}

if (double.IsPositiveInfinity(expected))
Expand All @@ -852,11 +854,11 @@ public static void Equal(double expected, double actual, double variance)
return;
}

throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}
else if (double.IsPositiveInfinity(actual))
{
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}

if (IsNegativeZero(expected))
Expand All @@ -868,7 +870,7 @@ public static void Equal(double expected, double actual, double variance)

if (IsPositiveZero(variance) || IsNegativeZero(variance))
{
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}

// When the variance is not +-0.0, then we are handling a case where
Expand All @@ -879,7 +881,7 @@ public static void Equal(double expected, double actual, double variance)
{
if (IsPositiveZero(variance) || IsNegativeZero(variance))
{
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}

// When the variance is not +-0.0, then we are handling a case where
Expand All @@ -896,7 +898,7 @@ public static void Equal(double expected, double actual, double variance)

if (IsPositiveZero(variance) || IsNegativeZero(variance))
{
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}

// When the variance is not +-0.0, then we are handling a case where
Expand All @@ -907,7 +909,7 @@ public static void Equal(double expected, double actual, double variance)
{
if (IsPositiveZero(variance) || IsNegativeZero(variance))
{
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}

// When the variance is not +-0.0, then we are handling a case where
Expand All @@ -919,16 +921,18 @@ public static void Equal(double expected, double actual, double variance)

if (delta > variance)
{
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}
}

/// <summary>Verifies that two <see cref="float"/> values are equal, within the <paramref name="variance"/>.</summary>
/// <param name="expected">The expected value</param>
/// <param name="actual">The value to be compared against</param>
/// <param name="variance">The total variance allowed between the expected and actual results.</param>
/// <param name="banner">The banner to show; if <c>null</c>, then the standard
/// banner of "Values differ" will be used</param>
/// <exception cref="EqualException">Thrown when the values are not equal</exception>
public static void Equal(float expected, float actual, float variance)
public static void Equal(float expected, float actual, float variance, string? banner = null)
{
if (float.IsNaN(expected))
{
Expand All @@ -937,11 +941,11 @@ public static void Equal(float expected, float actual, float variance)
return;
}

throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}
else if (float.IsNaN(actual))
{
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}

if (float.IsNegativeInfinity(expected))
Expand All @@ -951,11 +955,11 @@ public static void Equal(float expected, float actual, float variance)
return;
}

throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}
else if (float.IsNegativeInfinity(actual))
{
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}

if (float.IsPositiveInfinity(expected))
Expand All @@ -965,11 +969,11 @@ public static void Equal(float expected, float actual, float variance)
return;
}

throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}
else if (float.IsPositiveInfinity(actual))
{
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}

if (IsNegativeZero(expected))
Expand All @@ -981,7 +985,7 @@ public static void Equal(float expected, float actual, float variance)

if (IsPositiveZero(variance) || IsNegativeZero(variance))
{
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}

// When the variance is not +-0.0, then we are handling a case where
Expand All @@ -992,7 +996,7 @@ public static void Equal(float expected, float actual, float variance)
{
if (IsPositiveZero(variance) || IsNegativeZero(variance))
{
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}

// When the variance is not +-0.0, then we are handling a case where
Expand All @@ -1009,7 +1013,7 @@ public static void Equal(float expected, float actual, float variance)

if (IsPositiveZero(variance) || IsNegativeZero(variance))
{
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}

// When the variance is not +-0.0, then we are handling a case where
Expand All @@ -1020,7 +1024,7 @@ public static void Equal(float expected, float actual, float variance)
{
if (IsPositiveZero(variance) || IsNegativeZero(variance))
{
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}

// When the variance is not +-0.0, then we are handling a case where
Expand All @@ -1032,7 +1036,7 @@ public static void Equal(float expected, float actual, float variance)

if (delta > variance)
{
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}
}

Expand All @@ -1041,8 +1045,10 @@ public static void Equal(float expected, float actual, float variance)
/// <param name="expected">The expected value</param>
/// <param name="actual">The value to be compared against</param>
/// <param name="variance">The total variance allowed between the expected and actual results.</param>
/// <param name="banner">The banner to show; if <c>null</c>, then the standard
/// banner of "Values differ" will be used</param>
/// <exception cref="EqualException">Thrown when the values are not equal</exception>
public static void Equal(Half expected, Half actual, Half variance)
public static void Equal(Half expected, Half actual, Half variance, string? banner = null)
{
if (Half.IsNaN(expected))
{
Expand All @@ -1051,11 +1057,11 @@ public static void Equal(Half expected, Half actual, Half variance)
return;
}

throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}
else if (Half.IsNaN(actual))
{
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}

if (Half.IsNegativeInfinity(expected))
Expand All @@ -1065,11 +1071,11 @@ public static void Equal(Half expected, Half actual, Half variance)
return;
}

throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}
else if (Half.IsNegativeInfinity(actual))
{
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}

if (Half.IsPositiveInfinity(expected))
Expand All @@ -1079,11 +1085,11 @@ public static void Equal(Half expected, Half actual, Half variance)
return;
}

throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}
else if (Half.IsPositiveInfinity(actual))
{
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}

if (IsNegativeZero(expected))
Expand All @@ -1095,7 +1101,7 @@ public static void Equal(Half expected, Half actual, Half variance)

if (IsPositiveZero(variance) || IsNegativeZero(variance))
{
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}

// When the variance is not +-0.0, then we are handling a case where
Expand All @@ -1106,7 +1112,7 @@ public static void Equal(Half expected, Half actual, Half variance)
{
if (IsPositiveZero(variance) || IsNegativeZero(variance))
{
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}

// When the variance is not +-0.0, then we are handling a case where
Expand All @@ -1123,7 +1129,7 @@ public static void Equal(Half expected, Half actual, Half variance)

if (IsPositiveZero(variance) || IsNegativeZero(variance))
{
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}

// When the variance is not +-0.0, then we are handling a case where
Expand All @@ -1134,7 +1140,7 @@ public static void Equal(Half expected, Half actual, Half variance)
{
if (IsPositiveZero(variance) || IsNegativeZero(variance))
{
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}

// When the variance is not +-0.0, then we are handling a case where
Expand All @@ -1146,7 +1152,7 @@ public static void Equal(Half expected, Half actual, Half variance)

if (delta > variance)
{
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual));
throw EqualException.ForMismatchedValues(ToStringPadded(expected), ToStringPadded(actual), banner);
}
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ public partial struct Matrix4x4 : System.IEquatable<System.Numerics.Matrix4x4>
public System.Numerics.Vector3 Translation { readonly get { throw null; } set { } }
public static System.Numerics.Matrix4x4 Add(System.Numerics.Matrix4x4 value1, System.Numerics.Matrix4x4 value2) { throw null; }
public static System.Numerics.Matrix4x4 CreateBillboard(System.Numerics.Vector3 objectPosition, System.Numerics.Vector3 cameraPosition, System.Numerics.Vector3 cameraUpVector, System.Numerics.Vector3 cameraForwardVector) { throw null; }
public static System.Numerics.Matrix4x4 CreateBillboardLeftHanded(System.Numerics.Vector3 objectPosition, System.Numerics.Vector3 cameraPosition, System.Numerics.Vector3 cameraUpVector, System.Numerics.Vector3 cameraForwardVector) { throw null; }
public static System.Numerics.Matrix4x4 CreateConstrainedBillboard(System.Numerics.Vector3 objectPosition, System.Numerics.Vector3 cameraPosition, System.Numerics.Vector3 rotateAxis, System.Numerics.Vector3 cameraForwardVector, System.Numerics.Vector3 objectForwardVector) { throw null; }
public static System.Numerics.Matrix4x4 CreateConstrainedBillboardLeftHanded(System.Numerics.Vector3 objectPosition, System.Numerics.Vector3 cameraPosition, System.Numerics.Vector3 rotateAxis, System.Numerics.Vector3 cameraForwardVector, System.Numerics.Vector3 objectForwardVector) { throw null; }
public static System.Numerics.Matrix4x4 CreateFromAxisAngle(System.Numerics.Vector3 axis, float angle) { throw null; }
public static System.Numerics.Matrix4x4 CreateFromQuaternion(System.Numerics.Quaternion quaternion) { throw null; }
public static System.Numerics.Matrix4x4 CreateFromYawPitchRoll(float yaw, float pitch, float roll) { throw null; }
Expand Down
Loading
Loading