Cleanup 7
This commit is contained in:
@@ -149,8 +149,7 @@ namespace FlaxEngine
|
||||
/// <returns>Whether the two objects intersected.</returns>
|
||||
public bool Intersects(ref Ray ray)
|
||||
{
|
||||
float distance;
|
||||
return CollisionsHelper.RayIntersectsBox(ref ray, ref this, out distance);
|
||||
return CollisionsHelper.RayIntersectsBox(ref ray, ref this, out float distance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -423,8 +422,7 @@ namespace FlaxEngine
|
||||
/// <returns>The result of the transformation.</returns>
|
||||
public static BoundingBox Transform(BoundingBox box, Matrix transform)
|
||||
{
|
||||
BoundingBox result;
|
||||
Transform(ref box, ref transform, out result);
|
||||
Transform(ref box, ref transform, out BoundingBox result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -480,8 +478,7 @@ namespace FlaxEngine
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static BoundingBox operator *(BoundingBox box, Matrix transform)
|
||||
{
|
||||
BoundingBox result;
|
||||
Transform(ref box, ref transform, out result);
|
||||
Transform(ref box, ref transform, out BoundingBox result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -760,8 +760,7 @@ namespace FlaxEngine
|
||||
for (var i = 0; i < 6; i++)
|
||||
{
|
||||
Plane plane = GetPlane(i);
|
||||
float distance;
|
||||
if (CollisionsHelper.RayIntersectsPlane(ref ray, ref plane, out distance) && (distance < nearstPlaneDistance))
|
||||
if (CollisionsHelper.RayIntersectsPlane(ref ray, ref plane, out float distance) && (distance < nearstPlaneDistance))
|
||||
nearstPlaneDistance = distance;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,8 +81,7 @@ namespace FlaxEngine
|
||||
/// <returns>Whether the two objects intersected.</returns>
|
||||
public bool Intersects(ref Ray ray)
|
||||
{
|
||||
float distance;
|
||||
return CollisionsHelper.RayIntersectsSphere(ref ray, ref this, out distance);
|
||||
return CollisionsHelper.RayIntersectsSphere(ref ray, ref this, out float distance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -259,8 +258,7 @@ namespace FlaxEngine
|
||||
{
|
||||
//We are doing a relative distance comparison to find the maximum distance
|
||||
//from the center of our sphere.
|
||||
float distance;
|
||||
Vector3.DistanceSquared(ref center, ref points[i], out distance);
|
||||
Vector3.DistanceSquared(ref center, ref points[i], out float distance);
|
||||
|
||||
if (distance > radius)
|
||||
radius = distance;
|
||||
@@ -294,8 +292,7 @@ namespace FlaxEngine
|
||||
/// <returns>The newly constructed bounding sphere.</returns>
|
||||
public static BoundingSphere FromPoints(Vector3[] points)
|
||||
{
|
||||
BoundingSphere result;
|
||||
FromPoints(points, out result);
|
||||
FromPoints(points, out BoundingSphere result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -323,8 +320,7 @@ namespace FlaxEngine
|
||||
/// <returns>The newly constructed bounding sphere.</returns>
|
||||
public static BoundingSphere FromBox(BoundingBox box)
|
||||
{
|
||||
BoundingSphere result;
|
||||
FromBox(ref box, out result);
|
||||
FromBox(ref box, out BoundingSphere result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -387,8 +383,7 @@ namespace FlaxEngine
|
||||
/// <returns>The newly constructed bounding sphere.</returns>
|
||||
public static BoundingSphere Merge(BoundingSphere value1, BoundingSphere value2)
|
||||
{
|
||||
BoundingSphere result;
|
||||
Merge(ref value1, ref value2, out result);
|
||||
Merge(ref value1, ref value2, out BoundingSphere result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -254,8 +254,7 @@ namespace FlaxEngine
|
||||
//Source: Real-Time Collision Detection by Christer Ericson
|
||||
//Reference: Page 126
|
||||
|
||||
float dot;
|
||||
Vector3.Dot(ref plane.Normal, ref point, out dot);
|
||||
Vector3.Dot(ref plane.Normal, ref point, out float dot);
|
||||
float t = dot - plane.D;
|
||||
|
||||
result = point - t * plane.Normal;
|
||||
@@ -272,8 +271,7 @@ namespace FlaxEngine
|
||||
//Source: Real-Time Collision Detection by Christer Ericson
|
||||
//Reference: Page 130
|
||||
|
||||
Vector3 temp;
|
||||
Vector3.Max(ref point, ref box.Minimum, out temp);
|
||||
Vector3.Max(ref point, ref box.Minimum, out Vector3 temp);
|
||||
Vector3.Min(ref temp, ref box.Maximum, out result);
|
||||
}
|
||||
|
||||
@@ -285,9 +283,8 @@ namespace FlaxEngine
|
||||
/// <param name="result">When the method completes, contains the closest point between the two objects.</param>
|
||||
public static void ClosestPointRectanglePoint(ref Rectangle rect, ref Vector2 point, out Vector2 result)
|
||||
{
|
||||
Vector2 temp;
|
||||
Vector2 end = rect.Location + rect.Size;
|
||||
Vector2.Max(ref point, ref rect.Location, out temp);
|
||||
Vector2.Max(ref point, ref rect.Location, out Vector2 temp);
|
||||
Vector2.Min(ref temp, ref end, out result);
|
||||
}
|
||||
|
||||
@@ -359,8 +356,7 @@ namespace FlaxEngine
|
||||
//Source: Real-Time Collision Detection by Christer Ericson
|
||||
//Reference: Page 127
|
||||
|
||||
float dot;
|
||||
Vector3.Dot(ref plane.Normal, ref point, out dot);
|
||||
Vector3.Dot(ref plane.Normal, ref point, out float dot);
|
||||
return dot - plane.D;
|
||||
}
|
||||
|
||||
@@ -458,8 +454,7 @@ namespace FlaxEngine
|
||||
//Source: Jorgy343
|
||||
//Reference: None
|
||||
|
||||
float distance;
|
||||
Vector3.Distance(ref sphere.Center, ref point, out distance);
|
||||
Vector3.Distance(ref sphere.Center, ref point, out float distance);
|
||||
distance -= sphere.Radius;
|
||||
|
||||
return Math.Max(distance, 0f);
|
||||
@@ -476,8 +471,7 @@ namespace FlaxEngine
|
||||
//Source: Jorgy343
|
||||
//Reference: None
|
||||
|
||||
float distance;
|
||||
Vector3.Distance(ref sphere1.Center, ref sphere2.Center, out distance);
|
||||
Vector3.Distance(ref sphere1.Center, ref sphere2.Center, out float distance);
|
||||
distance -= sphere1.Radius + sphere2.Radius;
|
||||
|
||||
return Math.Max(distance, 0f);
|
||||
@@ -494,8 +488,7 @@ namespace FlaxEngine
|
||||
//Source: RayIntersectsSphere
|
||||
//Reference: None
|
||||
|
||||
Vector3 m;
|
||||
Vector3.Subtract(ref ray.Position, ref point, out m);
|
||||
Vector3.Subtract(ref ray.Position, ref point, out Vector3 m);
|
||||
|
||||
//Same thing as RayIntersectsSphere except that the radius of the sphere (point)
|
||||
//is the epsilon for zero.
|
||||
@@ -538,9 +531,7 @@ namespace FlaxEngine
|
||||
//Source: Real-Time Rendering, Third Edition
|
||||
//Reference: Page 780
|
||||
|
||||
Vector3 cross;
|
||||
|
||||
Vector3.Cross(ref ray1.Direction, ref ray2.Direction, out cross);
|
||||
Vector3.Cross(ref ray1.Direction, ref ray2.Direction, out Vector3 cross);
|
||||
float denominator = cross.Length;
|
||||
|
||||
//Lines are parallel.
|
||||
@@ -625,8 +616,7 @@ namespace FlaxEngine
|
||||
//Source: Real-Time Collision Detection by Christer Ericson
|
||||
//Reference: Page 175
|
||||
|
||||
float direction;
|
||||
Vector3.Dot(ref plane.Normal, ref ray.Direction, out direction);
|
||||
Vector3.Dot(ref plane.Normal, ref ray.Direction, out float direction);
|
||||
|
||||
if (Mathf.IsZero(direction))
|
||||
{
|
||||
@@ -634,8 +624,7 @@ namespace FlaxEngine
|
||||
return false;
|
||||
}
|
||||
|
||||
float position;
|
||||
Vector3.Dot(ref plane.Normal, ref ray.Position, out position);
|
||||
Vector3.Dot(ref plane.Normal, ref ray.Position, out float position);
|
||||
distance = (-plane.D - position) / direction;
|
||||
|
||||
if (distance < 0f)
|
||||
@@ -662,8 +651,7 @@ namespace FlaxEngine
|
||||
//Source: Real-Time Collision Detection by Christer Ericson
|
||||
//Reference: Page 175
|
||||
|
||||
float distance;
|
||||
if (!RayIntersectsPlane(ref ray, ref plane, out distance))
|
||||
if (!RayIntersectsPlane(ref ray, ref plane, out float distance))
|
||||
{
|
||||
point = Vector3.Zero;
|
||||
return false;
|
||||
@@ -796,8 +784,7 @@ namespace FlaxEngine
|
||||
/// <returns>Whether the two objects intersected.</returns>
|
||||
public static bool RayIntersectsTriangle(ref Ray ray, ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3, out Vector3 point)
|
||||
{
|
||||
float distance;
|
||||
if (!RayIntersectsTriangle(ref ray, ref vertex1, ref vertex2, ref vertex3, out distance))
|
||||
if (!RayIntersectsTriangle(ref ray, ref vertex1, ref vertex2, ref vertex3, out float distance))
|
||||
{
|
||||
point = Vector3.Zero;
|
||||
return false;
|
||||
@@ -933,8 +920,7 @@ namespace FlaxEngine
|
||||
/// <returns>Whether the two objects intersected.</returns>
|
||||
public static bool RayIntersectsBox(ref Ray ray, ref BoundingBox box, out Vector3 point)
|
||||
{
|
||||
float distance;
|
||||
if (!RayIntersectsBox(ref ray, ref box, out distance))
|
||||
if (!RayIntersectsBox(ref ray, ref box, out float distance))
|
||||
{
|
||||
point = Vector3.Zero;
|
||||
return false;
|
||||
@@ -959,8 +945,7 @@ namespace FlaxEngine
|
||||
//Source: Real-Time Collision Detection by Christer Ericson
|
||||
//Reference: Page 177
|
||||
|
||||
Vector3 m;
|
||||
Vector3.Subtract(ref ray.Position, ref sphere.Center, out m);
|
||||
Vector3.Subtract(ref ray.Position, ref sphere.Center, out Vector3 m);
|
||||
|
||||
float b = Vector3.Dot(m, ray.Direction);
|
||||
float c = Vector3.Dot(m, m) - sphere.Radius * sphere.Radius;
|
||||
@@ -999,8 +984,7 @@ namespace FlaxEngine
|
||||
/// <returns>Whether the two objects intersected.</returns>
|
||||
public static bool RayIntersectsSphere(ref Ray ray, ref BoundingSphere sphere, out Vector3 point)
|
||||
{
|
||||
float distance;
|
||||
if (!RayIntersectsSphere(ref ray, ref sphere, out distance))
|
||||
if (!RayIntersectsSphere(ref ray, ref sphere, out float distance))
|
||||
{
|
||||
point = Vector3.Zero;
|
||||
return false;
|
||||
@@ -1018,8 +1002,7 @@ namespace FlaxEngine
|
||||
/// <returns>Whether the two objects intersected.</returns>
|
||||
public static PlaneIntersectionType PlaneIntersectsPoint(ref Plane plane, ref Vector3 point)
|
||||
{
|
||||
float distance;
|
||||
Vector3.Dot(ref plane.Normal, ref point, out distance);
|
||||
Vector3.Dot(ref plane.Normal, ref point, out float distance);
|
||||
distance += plane.D;
|
||||
|
||||
if (distance > 0f)
|
||||
@@ -1039,13 +1022,11 @@ namespace FlaxEngine
|
||||
/// <returns>Whether the two objects intersected.</returns>
|
||||
public static bool PlaneIntersectsPlane(ref Plane plane1, ref Plane plane2)
|
||||
{
|
||||
Vector3 direction;
|
||||
Vector3.Cross(ref plane1.Normal, ref plane2.Normal, out direction);
|
||||
Vector3.Cross(ref plane1.Normal, ref plane2.Normal, out Vector3 direction);
|
||||
|
||||
//If direction is the zero vector, the planes are parallel and possibly
|
||||
//coincident. It is not an intersection. The dot product will tell us.
|
||||
float denominator;
|
||||
Vector3.Dot(ref direction, ref direction, out denominator);
|
||||
Vector3.Dot(ref direction, ref direction, out float denominator);
|
||||
|
||||
if (Mathf.IsZero(denominator))
|
||||
return false;
|
||||
@@ -1073,13 +1054,11 @@ namespace FlaxEngine
|
||||
//Source: Real-Time Collision Detection by Christer Ericson
|
||||
//Reference: Page 207
|
||||
|
||||
Vector3 direction;
|
||||
Vector3.Cross(ref plane1.Normal, ref plane2.Normal, out direction);
|
||||
Vector3.Cross(ref plane1.Normal, ref plane2.Normal, out Vector3 direction);
|
||||
|
||||
//If direction is the zero vector, the planes are parallel and possibly
|
||||
//coincident. It is not an intersection. The dot product will tell us.
|
||||
float denominator;
|
||||
Vector3.Dot(ref direction, ref direction, out denominator);
|
||||
Vector3.Dot(ref direction, ref direction, out float denominator);
|
||||
|
||||
//We assume the planes are normalized, therefore the denominator
|
||||
//only serves as a parallel and coincident check. Otherwise we need
|
||||
@@ -1090,9 +1069,8 @@ namespace FlaxEngine
|
||||
return false;
|
||||
}
|
||||
|
||||
Vector3 point;
|
||||
Vector3 temp = plane1.D * plane2.Normal - plane2.D * plane1.Normal;
|
||||
Vector3.Cross(ref temp, ref direction, out point);
|
||||
Vector3.Cross(ref temp, ref direction, out Vector3 point);
|
||||
|
||||
line.Position = point;
|
||||
line.Direction = direction;
|
||||
@@ -1148,8 +1126,7 @@ namespace FlaxEngine
|
||||
min.Y = plane.Normal.Y >= 0.0f ? box.Maximum.Y : box.Minimum.Y;
|
||||
min.Z = plane.Normal.Z >= 0.0f ? box.Maximum.Z : box.Minimum.Z;
|
||||
|
||||
float distance;
|
||||
Vector3.Dot(ref plane.Normal, ref max, out distance);
|
||||
Vector3.Dot(ref plane.Normal, ref max, out float distance);
|
||||
|
||||
if (distance + plane.D > 0.0f)
|
||||
return PlaneIntersectionType.Front;
|
||||
@@ -1173,8 +1150,7 @@ namespace FlaxEngine
|
||||
//Source: Real-Time Collision Detection by Christer Ericson
|
||||
//Reference: Page 160
|
||||
|
||||
float distance;
|
||||
Vector3.Dot(ref plane.Normal, ref sphere.Center, out distance);
|
||||
Vector3.Dot(ref plane.Normal, ref sphere.Center, out float distance);
|
||||
distance += plane.D;
|
||||
|
||||
if (distance > sphere.Radius)
|
||||
@@ -1241,8 +1217,7 @@ namespace FlaxEngine
|
||||
//Source: Real-Time Collision Detection by Christer Ericson
|
||||
//Reference: Page 166
|
||||
|
||||
Vector3 vector;
|
||||
Vector3.Clamp(ref sphere.Center, ref box.Minimum, ref box.Maximum, out vector);
|
||||
Vector3.Clamp(ref sphere.Center, ref box.Minimum, ref box.Maximum, out Vector3 vector);
|
||||
float distance = Vector3.DistanceSquared(ref sphere.Center, ref vector);
|
||||
return distance <= sphere.Radius * sphere.Radius;
|
||||
}
|
||||
@@ -1260,12 +1235,10 @@ namespace FlaxEngine
|
||||
//Source: Real-Time Collision Detection by Christer Ericson
|
||||
//Reference: Page 167
|
||||
|
||||
Vector3 point;
|
||||
ClosestPointPointTriangle(ref sphere.Center, ref vertex1, ref vertex2, ref vertex3, out point);
|
||||
ClosestPointPointTriangle(ref sphere.Center, ref vertex1, ref vertex2, ref vertex3, out Vector3 point);
|
||||
Vector3 v = point - sphere.Center;
|
||||
|
||||
float dot;
|
||||
Vector3.Dot(ref v, ref v, out dot);
|
||||
Vector3.Dot(ref v, ref v, out float dot);
|
||||
|
||||
return dot <= sphere.Radius * sphere.Radius;
|
||||
}
|
||||
@@ -1355,8 +1328,7 @@ namespace FlaxEngine
|
||||
/// <returns>The type of containment the two objects have.</returns>
|
||||
public static ContainmentType BoxContainsSphere(ref BoundingBox box, ref BoundingSphere sphere)
|
||||
{
|
||||
Vector3 vector;
|
||||
Vector3.Clamp(ref sphere.Center, ref box.Minimum, ref box.Maximum, out vector);
|
||||
Vector3.Clamp(ref sphere.Center, ref box.Minimum, ref box.Maximum, out Vector3 vector);
|
||||
float distance = Vector3.DistanceSquared(ref sphere.Center, ref vector);
|
||||
|
||||
if (distance > sphere.Radius * sphere.Radius)
|
||||
|
||||
@@ -267,8 +267,7 @@ namespace FlaxEngine
|
||||
/// <returns>The color.</returns>
|
||||
public static Color ParseHex(string hexString)
|
||||
{
|
||||
Color value;
|
||||
if (TryParseHex(hexString, out value))
|
||||
if (TryParseHex(hexString, out Color value))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
@@ -946,8 +945,7 @@ namespace FlaxEngine
|
||||
/// <returns>The clamped value.</returns>
|
||||
public static Color Clamp(Color value, Color min, Color max)
|
||||
{
|
||||
Color result;
|
||||
Clamp(ref value, ref min, ref max, out result);
|
||||
Clamp(ref value, ref min, ref max, out Color result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -469,8 +469,7 @@ namespace FlaxEngine
|
||||
/// <returns>The clamped value.</returns>
|
||||
public static Int2 Clamp(Int2 value, Int2 min, Int2 max)
|
||||
{
|
||||
Int2 result;
|
||||
Clamp(ref value, ref min, ref max, out result);
|
||||
Clamp(ref value, ref min, ref max, out Int2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -600,8 +599,7 @@ namespace FlaxEngine
|
||||
/// <returns>A vector containing the largest components of the source vectors.</returns>
|
||||
public static Int2 Max(Int2 left, Int2 right)
|
||||
{
|
||||
Int2 result;
|
||||
Max(ref left, ref right, out result);
|
||||
Max(ref left, ref right, out Int2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -628,8 +626,7 @@ namespace FlaxEngine
|
||||
/// <returns>A vector containing the smallest components of the source vectors.</returns>
|
||||
public static Int2 Min(Int2 left, Int2 right)
|
||||
{
|
||||
Int2 result;
|
||||
Min(ref left, ref right, out result);
|
||||
Min(ref left, ref right, out Int2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -688,8 +688,7 @@ namespace FlaxEngine
|
||||
/// <returns>A vector containing the largest components of the source vectors.</returns>
|
||||
public static Int3 Max(Int3 left, Int3 right)
|
||||
{
|
||||
Int3 result;
|
||||
Max(ref left, ref right, out result);
|
||||
Max(ref left, ref right, out Int3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1063,8 +1063,7 @@ namespace FlaxEngine
|
||||
/// <returns>The transpose of the specified Matrix3x3.</returns>
|
||||
public static Matrix3x3 Transpose(Matrix3x3 value)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
Transpose(ref value, out result);
|
||||
Transpose(ref value, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1168,8 +1167,7 @@ namespace FlaxEngine
|
||||
/// </remarks>
|
||||
public static Matrix3x3 Orthogonalize(Matrix3x3 value)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
Orthogonalize(ref value, out result);
|
||||
Orthogonalize(ref value, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1233,8 +1231,7 @@ namespace FlaxEngine
|
||||
/// </remarks>
|
||||
public static Matrix3x3 Orthonormalize(Matrix3x3 value)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
Orthonormalize(ref value, out result);
|
||||
Orthonormalize(ref value, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1312,8 +1309,7 @@ namespace FlaxEngine
|
||||
/// </remarks>
|
||||
public static Matrix3x3 UpperTriangularForm(Matrix3x3 value)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
UpperTriangularForm(ref value, out result);
|
||||
UpperTriangularForm(ref value, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1395,8 +1391,7 @@ namespace FlaxEngine
|
||||
/// </remarks>
|
||||
public static Matrix3x3 LowerTriangularForm(Matrix3x3 value)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
LowerTriangularForm(ref value, out result);
|
||||
LowerTriangularForm(ref value, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1467,8 +1462,7 @@ namespace FlaxEngine
|
||||
/// <returns>When the method completes, contains the row echelon form of the Matrix3x3.</returns>
|
||||
public static Matrix3x3 RowEchelonForm(Matrix3x3 value)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
RowEchelonForm(ref value, out result);
|
||||
RowEchelonForm(ref value, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1482,8 +1476,6 @@ namespace FlaxEngine
|
||||
/// <param name="result">When the method completes, contains the created billboard Matrix3x3.</param>
|
||||
public static void Billboard(ref Vector3 objectPosition, ref Vector3 cameraPosition, ref Vector3 cameraUpVector, ref Vector3 cameraForwardVector, out Matrix3x3 result)
|
||||
{
|
||||
Vector3 crossed;
|
||||
Vector3 final;
|
||||
Vector3 difference = cameraPosition - objectPosition;
|
||||
|
||||
float lengthSq = difference.LengthSquared;
|
||||
@@ -1492,9 +1484,9 @@ namespace FlaxEngine
|
||||
else
|
||||
difference *= (float)(1.0 / Math.Sqrt(lengthSq));
|
||||
|
||||
Vector3.Cross(ref cameraUpVector, ref difference, out crossed);
|
||||
Vector3.Cross(ref cameraUpVector, ref difference, out Vector3 crossed);
|
||||
crossed.Normalize();
|
||||
Vector3.Cross(ref difference, ref crossed, out final);
|
||||
Vector3.Cross(ref difference, ref crossed, out Vector3 final);
|
||||
|
||||
result.M11 = crossed.X;
|
||||
result.M12 = crossed.Y;
|
||||
@@ -1517,8 +1509,7 @@ namespace FlaxEngine
|
||||
/// <returns>The created billboard Matrix3x3.</returns>
|
||||
public static Matrix3x3 Billboard(Vector3 objectPosition, Vector3 cameraPosition, Vector3 cameraUpVector, Vector3 cameraForwardVector)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
Billboard(ref objectPosition, ref cameraPosition, ref cameraUpVector, ref cameraForwardVector, out result);
|
||||
Billboard(ref objectPosition, ref cameraPosition, ref cameraUpVector, ref cameraForwardVector, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1531,12 +1522,13 @@ namespace FlaxEngine
|
||||
/// <param name="result">When the method completes, contains the created look-at Matrix3x3.</param>
|
||||
public static void LookAt(ref Vector3 eye, ref Vector3 target, ref Vector3 up, out Matrix3x3 result)
|
||||
{
|
||||
Vector3 xaxis, yaxis, zaxis;
|
||||
Vector3.Subtract(ref target, ref eye, out zaxis);
|
||||
Vector3.Subtract(ref target, ref eye, out Vector3 zaxis);
|
||||
zaxis.Normalize();
|
||||
Vector3.Cross(ref up, ref zaxis, out xaxis);
|
||||
|
||||
Vector3.Cross(ref up, ref zaxis, out Vector3 xaxis);
|
||||
xaxis.Normalize();
|
||||
Vector3.Cross(ref zaxis, ref xaxis, out yaxis);
|
||||
|
||||
Vector3.Cross(ref zaxis, ref xaxis, out Vector3 yaxis);
|
||||
|
||||
result = Identity;
|
||||
result.M11 = xaxis.X;
|
||||
@@ -1559,8 +1551,7 @@ namespace FlaxEngine
|
||||
/// <returns>The created look-at Matrix3x3.</returns>
|
||||
public static Matrix3x3 LookAt(Vector3 eye, Vector3 target, Vector3 up)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
LookAt(ref eye, ref target, ref up, out result);
|
||||
LookAt(ref eye, ref target, ref up, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1581,8 +1572,7 @@ namespace FlaxEngine
|
||||
/// <returns>The created scaling Matrix3x3.</returns>
|
||||
public static Matrix3x3 Scaling(Vector3 scale)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
Scaling(ref scale, out result);
|
||||
Scaling(ref scale, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1610,8 +1600,7 @@ namespace FlaxEngine
|
||||
/// <returns>The created scaling Matrix3x3.</returns>
|
||||
public static Matrix3x3 Scaling(float x, float y, float z)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
Scaling(x, y, z, out result);
|
||||
Scaling(x, y, z, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1633,8 +1622,7 @@ namespace FlaxEngine
|
||||
/// <returns>The created scaling Matrix3x3.</returns>
|
||||
public static Matrix3x3 Scaling(float scale)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
Scaling(scale, out result);
|
||||
Scaling(scale, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1680,8 +1668,7 @@ namespace FlaxEngine
|
||||
/// <returns>The created rotation Matrix3x3.</returns>
|
||||
public static Matrix3x3 RotationX(float angle)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
RotationX(angle, out result);
|
||||
RotationX(angle, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1692,8 +1679,8 @@ namespace FlaxEngine
|
||||
/// <param name="result">When the method completes, contains the created rotation Matrix3x3.</param>
|
||||
public static void RotationY(float angle, out Matrix3x3 result)
|
||||
{
|
||||
float cos = (float)Math.Cos(angle);
|
||||
float sin = (float)Math.Sin(angle);
|
||||
float cos = Mathf.Cos(angle);
|
||||
float sin = Mathf.Sin(angle);
|
||||
|
||||
result = Identity;
|
||||
result.M11 = cos;
|
||||
@@ -1709,8 +1696,7 @@ namespace FlaxEngine
|
||||
/// <returns>The created rotation Matrix3x3.</returns>
|
||||
public static Matrix3x3 RotationY(float angle)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
RotationY(angle, out result);
|
||||
RotationY(angle, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1721,8 +1707,8 @@ namespace FlaxEngine
|
||||
/// <param name="result">When the method completes, contains the created rotation Matrix3x3.</param>
|
||||
public static void RotationZ(float angle, out Matrix3x3 result)
|
||||
{
|
||||
float cos = (float)Math.Cos(angle);
|
||||
float sin = (float)Math.Sin(angle);
|
||||
float cos = Mathf.Cos(angle);
|
||||
float sin = Mathf.Sin(angle);
|
||||
|
||||
result = Identity;
|
||||
result.M11 = cos;
|
||||
@@ -1738,8 +1724,7 @@ namespace FlaxEngine
|
||||
/// <returns>The created rotation Matrix3x3.</returns>
|
||||
public static Matrix3x3 RotationZ(float angle)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
RotationZ(angle, out result);
|
||||
RotationZ(angle, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1783,8 +1768,7 @@ namespace FlaxEngine
|
||||
/// <returns>The created rotation Matrix3x3.</returns>
|
||||
public static Matrix3x3 RotationAxis(Vector3 axis, float angle)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
RotationAxis(ref axis, angle, out result);
|
||||
RotationAxis(ref axis, angle, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1824,8 +1808,7 @@ namespace FlaxEngine
|
||||
/// <returns>The created rotation Matrix3x3.</returns>
|
||||
public static Matrix3x3 RotationQuaternion(Quaternion rotation)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
RotationQuaternion(ref rotation, out result);
|
||||
RotationQuaternion(ref rotation, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1838,8 +1821,7 @@ namespace FlaxEngine
|
||||
/// <param name="result">When the method completes, contains the created rotation Matrix3x3.</param>
|
||||
public static void RotationYawPitchRoll(float yaw, float pitch, float roll, out Matrix3x3 result)
|
||||
{
|
||||
Quaternion quaternion;
|
||||
Quaternion.RotationYawPitchRoll(yaw, pitch, roll, out quaternion);
|
||||
Quaternion.RotationYawPitchRoll(yaw, pitch, roll, out Quaternion quaternion);
|
||||
RotationQuaternion(ref quaternion, out result);
|
||||
}
|
||||
|
||||
@@ -1852,8 +1834,7 @@ namespace FlaxEngine
|
||||
/// <returns>The created rotation Matrix3x3.</returns>
|
||||
public static Matrix3x3 RotationYawPitchRoll(float yaw, float pitch, float roll)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
RotationYawPitchRoll(yaw, pitch, roll, out result);
|
||||
RotationYawPitchRoll(yaw, pitch, roll, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1921,8 +1902,7 @@ namespace FlaxEngine
|
||||
/// <returns>The result.</returns>
|
||||
public static Vector2 Transform2D(Vector2 vector, Matrix3x3 transform)
|
||||
{
|
||||
Vector2 result;
|
||||
Transform2D(ref vector, ref transform, out result);
|
||||
Transform2D(ref vector, ref transform, out Vector2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1934,8 +1914,7 @@ namespace FlaxEngine
|
||||
/// <returns>The sum of the two matrices.</returns>
|
||||
public static Matrix3x3 operator +(Matrix3x3 left, Matrix3x3 right)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
Add(ref left, ref right, out result);
|
||||
Add(ref left, ref right, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1957,8 +1936,7 @@ namespace FlaxEngine
|
||||
/// <returns>The difference between the two matrices.</returns>
|
||||
public static Matrix3x3 operator -(Matrix3x3 left, Matrix3x3 right)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
Subtract(ref left, ref right, out result);
|
||||
Subtract(ref left, ref right, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1969,8 +1947,7 @@ namespace FlaxEngine
|
||||
/// <returns>The negated Matrix3x3.</returns>
|
||||
public static Matrix3x3 operator -(Matrix3x3 value)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
Negate(ref value, out result);
|
||||
Negate(ref value, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1982,8 +1959,7 @@ namespace FlaxEngine
|
||||
/// <returns>The scaled Matrix3x3.</returns>
|
||||
public static Matrix3x3 operator *(float left, Matrix3x3 right)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
Multiply(ref right, left, out result);
|
||||
Multiply(ref right, left, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1995,8 +1971,7 @@ namespace FlaxEngine
|
||||
/// <returns>The scaled Matrix3x3.</returns>
|
||||
public static Matrix3x3 operator *(Matrix3x3 left, float right)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
Multiply(ref left, right, out result);
|
||||
Multiply(ref left, right, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2008,8 +1983,7 @@ namespace FlaxEngine
|
||||
/// <returns>The product of the two matrices.</returns>
|
||||
public static Matrix3x3 operator *(Matrix3x3 left, Matrix3x3 right)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
Multiply(ref left, ref right, out result);
|
||||
Multiply(ref left, ref right, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2021,8 +1995,7 @@ namespace FlaxEngine
|
||||
/// <returns>The scaled Matrix3x3.</returns>
|
||||
public static Matrix3x3 operator /(Matrix3x3 left, float right)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
Divide(ref left, right, out result);
|
||||
Divide(ref left, right, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2034,8 +2007,7 @@ namespace FlaxEngine
|
||||
/// <returns>The quotient of the two matrices.</returns>
|
||||
public static Matrix3x3 operator /(Matrix3x3 left, Matrix3x3 right)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
Divide(ref left, ref right, out result);
|
||||
Divide(ref left, ref right, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -361,11 +361,9 @@ namespace FlaxEngine
|
||||
public ContainmentType Contains(ref Vector3 point)
|
||||
{
|
||||
// Transform the point into the obb coordinates
|
||||
Matrix invTrans;
|
||||
Matrix.Invert(ref Transformation, out invTrans);
|
||||
Matrix.Invert(ref Transformation, out Matrix invTrans);
|
||||
|
||||
Vector3 locPoint;
|
||||
Vector3.TransformCoordinate(ref point, ref invTrans, out locPoint);
|
||||
Vector3.TransformCoordinate(ref point, ref invTrans, out Vector3 locPoint);
|
||||
|
||||
locPoint.X = Math.Abs(locPoint.X);
|
||||
locPoint.Y = Math.Abs(locPoint.Y);
|
||||
@@ -396,16 +394,14 @@ namespace FlaxEngine
|
||||
/// <returns>The type of containment.</returns>
|
||||
public ContainmentType Contains(Vector3[] points)
|
||||
{
|
||||
Matrix invTrans;
|
||||
Matrix.Invert(ref Transformation, out invTrans);
|
||||
Matrix.Invert(ref Transformation, out Matrix invTrans);
|
||||
|
||||
var containsAll = true;
|
||||
var containsAny = false;
|
||||
|
||||
for (var i = 0; i < points.Length; i++)
|
||||
{
|
||||
Vector3 locPoint;
|
||||
Vector3.TransformCoordinate(ref points[i], ref invTrans, out locPoint);
|
||||
Vector3.TransformCoordinate(ref points[i], ref invTrans, out Vector3 locPoint);
|
||||
|
||||
locPoint.X = Math.Abs(locPoint.X);
|
||||
locPoint.Y = Math.Abs(locPoint.Y);
|
||||
@@ -416,6 +412,7 @@ namespace FlaxEngine
|
||||
Mathf.NearEqual(locPoint.Y, Extents.Y) &&
|
||||
Mathf.NearEqual(locPoint.Z, Extents.Z))
|
||||
containsAny = true;
|
||||
|
||||
if ((locPoint.X < Extents.X) && (locPoint.Y < Extents.Y) && (locPoint.Z < Extents.Z))
|
||||
containsAny = true;
|
||||
else
|
||||
@@ -424,8 +421,10 @@ namespace FlaxEngine
|
||||
|
||||
if (containsAll)
|
||||
return ContainmentType.Contains;
|
||||
|
||||
if (containsAny)
|
||||
return ContainmentType.Intersects;
|
||||
|
||||
return ContainmentType.Disjoint;
|
||||
}
|
||||
|
||||
@@ -445,12 +444,10 @@ namespace FlaxEngine
|
||||
/// </remarks>
|
||||
public ContainmentType Contains(BoundingSphere sphere, bool ignoreScale = false)
|
||||
{
|
||||
Matrix invTrans;
|
||||
Matrix.Invert(ref Transformation, out invTrans);
|
||||
Matrix.Invert(ref Transformation, out Matrix invTrans);
|
||||
|
||||
// Transform sphere center into the obb coordinates
|
||||
Vector3 locCenter;
|
||||
Vector3.TransformCoordinate(ref sphere.Center, ref invTrans, out locCenter);
|
||||
Vector3.TransformCoordinate(ref sphere.Center, ref invTrans, out Vector3 locCenter);
|
||||
|
||||
float locRadius;
|
||||
if (ignoreScale)
|
||||
@@ -465,8 +462,7 @@ namespace FlaxEngine
|
||||
|
||||
//Perform regular BoundingBox to BoundingSphere containment check
|
||||
Vector3 minusExtens = -Extents;
|
||||
Vector3 vector;
|
||||
Vector3.Clamp(ref locCenter, ref minusExtens, ref Extents, out vector);
|
||||
Vector3.Clamp(ref locCenter, ref minusExtens, ref Extents, out Vector3 vector);
|
||||
float distance = Vector3.DistanceSquared(ref locCenter, ref vector);
|
||||
|
||||
if (distance > locRadius * locRadius)
|
||||
@@ -591,13 +587,10 @@ namespace FlaxEngine
|
||||
|
||||
//http://www.3dkingdoms.com/weekly/bbox.cpp
|
||||
// Put line in box space
|
||||
Matrix invTrans;
|
||||
Matrix.Invert(ref Transformation, out invTrans);
|
||||
Matrix.Invert(ref Transformation, out Matrix invTrans);
|
||||
|
||||
Vector3 LB1;
|
||||
Vector3.TransformCoordinate(ref L1, ref invTrans, out LB1);
|
||||
Vector3 LB2;
|
||||
Vector3.TransformCoordinate(ref L1, ref invTrans, out LB2);
|
||||
Vector3.TransformCoordinate(ref L1, ref invTrans, out Vector3 LB1);
|
||||
Vector3.TransformCoordinate(ref L1, ref invTrans, out Vector3 LB2);
|
||||
|
||||
// Get line midpoint and extent
|
||||
Vector3 LMid = (LB1 + LB2) * 0.5f;
|
||||
@@ -608,17 +601,23 @@ namespace FlaxEngine
|
||||
// Separation vector from box center to line center is LMid, since the line is in box space
|
||||
if (Math.Abs(LMid.X) > Extents.X + LExt.X)
|
||||
return ContainmentType.Disjoint;
|
||||
|
||||
if (Math.Abs(LMid.Y) > Extents.Y + LExt.Y)
|
||||
return ContainmentType.Disjoint;
|
||||
|
||||
if (Math.Abs(LMid.Z) > Extents.Z + LExt.Z)
|
||||
return ContainmentType.Disjoint;
|
||||
|
||||
// Cross products of line and each axis
|
||||
if (Math.Abs(LMid.Y * L.Z - LMid.Z * L.Y) > Extents.Y * LExt.Z + Extents.Z * LExt.Y)
|
||||
return ContainmentType.Disjoint;
|
||||
|
||||
if (Math.Abs(LMid.X * L.Z - LMid.Z * L.X) > Extents.X * LExt.Z + Extents.Z * LExt.X)
|
||||
return ContainmentType.Disjoint;
|
||||
|
||||
if (Math.Abs(LMid.X * L.Y - LMid.Y * L.X) > Extents.X * LExt.Y + Extents.Y * LExt.X)
|
||||
return ContainmentType.Disjoint;
|
||||
|
||||
// No separating axis, the line intersects
|
||||
return ContainmentType.Intersects;
|
||||
}
|
||||
@@ -649,8 +648,8 @@ namespace FlaxEngine
|
||||
float ExtentA, ExtentB, Separation;
|
||||
int i, k;
|
||||
|
||||
Matrix R; // Rotation from B to A
|
||||
Matrix.Invert(ref Transformation, out R);
|
||||
// Rotation from B to A
|
||||
Matrix.Invert(ref Transformation, out Matrix R);
|
||||
var AR = new Matrix(); // absolute values of R matrix, to use with box extents
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
@@ -713,8 +712,7 @@ namespace FlaxEngine
|
||||
public bool Intersects(ref Ray ray, out Vector3 point)
|
||||
{
|
||||
// Put ray in box space
|
||||
Matrix invTrans;
|
||||
Matrix.Invert(ref Transformation, out invTrans);
|
||||
Matrix.Invert(ref Transformation, out Matrix invTrans);
|
||||
|
||||
Ray bRay;
|
||||
Vector3.TransformNormal(ref ray.Direction, ref invTrans, out bRay.Direction);
|
||||
@@ -742,8 +740,7 @@ namespace FlaxEngine
|
||||
/// <returns>Whether the two objects intersected.</returns>
|
||||
public bool Intersects(ref Ray ray, out float distance)
|
||||
{
|
||||
Vector3 point;
|
||||
if (Intersects(ref ray, out point))
|
||||
if (Intersects(ref ray, out Vector3 point))
|
||||
{
|
||||
Vector3.Distance(ref ray.Position, ref point, out distance);
|
||||
return true;
|
||||
@@ -759,8 +756,7 @@ namespace FlaxEngine
|
||||
/// <returns>Whether the two objects intersected.</returns>
|
||||
public bool Intersects(ref Ray ray)
|
||||
{
|
||||
Vector3 point;
|
||||
return Intersects(ref ray, out point);
|
||||
return Intersects(ref ray, out Vector3 point);
|
||||
}
|
||||
|
||||
private Vector3[] GetLocalCorners()
|
||||
@@ -824,8 +820,7 @@ namespace FlaxEngine
|
||||
}
|
||||
else
|
||||
{
|
||||
Matrix AInvMat;
|
||||
Matrix.Invert(ref A.Transformation, out AInvMat);
|
||||
Matrix.Invert(ref A.Transformation, out Matrix AInvMat);
|
||||
AtoB_Matrix = B.Transformation * AInvMat;
|
||||
}
|
||||
|
||||
@@ -861,8 +856,7 @@ namespace FlaxEngine
|
||||
BoundingBox B_LocalBB = BoundingBox.FromPoints(bCorners);
|
||||
|
||||
//Merger A and B local Bounding Boxes
|
||||
BoundingBox mergedBB;
|
||||
BoundingBox.Merge(ref B_LocalBB, ref A_LocalBB, out mergedBB);
|
||||
BoundingBox.Merge(ref B_LocalBB, ref A_LocalBB, out BoundingBox mergedBB);
|
||||
|
||||
//Find the new Extents and Center, Transform Center back to world
|
||||
Vector3 newCenter = mergedBB.Minimum + (mergedBB.Maximum - mergedBB.Minimum) / 2f;
|
||||
|
||||
@@ -254,8 +254,7 @@ namespace FlaxEngine
|
||||
/// <returns>Whether the two objects intersected.</returns>
|
||||
public bool Intersects(ref Ray ray)
|
||||
{
|
||||
float distance;
|
||||
return CollisionsHelper.RayIntersectsPlane(ref ray, ref this, out distance);
|
||||
return CollisionsHelper.RayIntersectsPlane(ref ray, ref this, out float distance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -379,8 +378,7 @@ namespace FlaxEngine
|
||||
/// <returns>The reflection matrix.</returns>
|
||||
public Matrix Reflection()
|
||||
{
|
||||
Matrix result;
|
||||
Reflection(out result);
|
||||
Reflection(out Matrix result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -432,8 +430,7 @@ namespace FlaxEngine
|
||||
/// <returns>The shadow matrix.</returns>
|
||||
public Matrix Shadow(Vector4 light)
|
||||
{
|
||||
Matrix result;
|
||||
Shadow(ref light, out result);
|
||||
Shadow(ref light, out Matrix result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -469,8 +466,7 @@ namespace FlaxEngine
|
||||
/// <returns>The reflection Matrix3x3.</returns>
|
||||
public Matrix3x3 Reflection3x3()
|
||||
{
|
||||
Matrix3x3 result;
|
||||
Reflection(out result);
|
||||
Reflection(out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -519,8 +515,7 @@ namespace FlaxEngine
|
||||
/// <returns>The shadow Matrix3x3.</returns>
|
||||
public static Matrix3x3 Shadow(Vector4 light, Plane plane)
|
||||
{
|
||||
Matrix3x3 result;
|
||||
Shadow(ref light, ref plane, out result);
|
||||
Shadow(ref light, ref plane, out Matrix3x3 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -765,8 +760,7 @@ namespace FlaxEngine
|
||||
float z = plane.Normal.Z;
|
||||
float d = plane.D;
|
||||
|
||||
Matrix inverse;
|
||||
Matrix.Invert(ref transformation, out inverse);
|
||||
Matrix.Invert(ref transformation, out Matrix inverse);
|
||||
|
||||
result.Normal.X = x * inverse.M11 + y * inverse.M12 + z * inverse.M13 + d * inverse.M14;
|
||||
result.Normal.Y = x * inverse.M21 + y * inverse.M22 + z * inverse.M23 + d * inverse.M24;
|
||||
@@ -808,8 +802,7 @@ namespace FlaxEngine
|
||||
if (planes == null)
|
||||
throw new ArgumentNullException(nameof(planes));
|
||||
|
||||
Matrix inverse;
|
||||
Matrix.Invert(ref transformation, out inverse);
|
||||
Matrix.Invert(ref transformation, out Matrix inverse);
|
||||
|
||||
for (var i = 0; i < planes.Length; ++i)
|
||||
Transform(ref planes[i], ref transformation, out planes[i]);
|
||||
|
||||
@@ -540,8 +540,7 @@ namespace FlaxEngine
|
||||
/// <returns>A new <see cref="Vector2" /> containing the 2D Cartesian coordinates of the specified point.</returns>
|
||||
public static Vector2 Barycentric(Vector2 value1, Vector2 value2, Vector2 value3, float amount1, float amount2)
|
||||
{
|
||||
Vector2 result;
|
||||
Barycentric(ref value1, ref value2, ref value3, amount1, amount2, out result);
|
||||
Barycentric(ref value1, ref value2, ref value3, amount1, amount2, out Vector2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -574,8 +573,7 @@ namespace FlaxEngine
|
||||
/// <returns>The clamped value.</returns>
|
||||
public static Vector2 Clamp(Vector2 value, Vector2 min, Vector2 max)
|
||||
{
|
||||
Vector2 result;
|
||||
Clamp(ref value, ref min, ref max, out result);
|
||||
Clamp(ref value, ref min, ref max, out Vector2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -895,8 +893,7 @@ namespace FlaxEngine
|
||||
/// </remarks>
|
||||
public static Vector2 Lerp(Vector2 start, Vector2 end, float amount)
|
||||
{
|
||||
Vector2 result;
|
||||
Lerp(ref start, ref end, amount, out result);
|
||||
Lerp(ref start, ref end, amount, out Vector2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -930,8 +927,7 @@ namespace FlaxEngine
|
||||
/// </remarks>
|
||||
public static Vector2 Lerp(Vector2 start, Vector2 end, Vector2 amount)
|
||||
{
|
||||
Vector2 result;
|
||||
Lerp(ref start, ref end, ref amount, out result);
|
||||
Lerp(ref start, ref end, ref amount, out Vector2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -957,8 +953,7 @@ namespace FlaxEngine
|
||||
/// <returns>The cubic interpolation of the two vectors.</returns>
|
||||
public static Vector2 SmoothStep(Vector2 start, Vector2 end, float amount)
|
||||
{
|
||||
Vector2 result;
|
||||
SmoothStep(ref start, ref end, amount, out result);
|
||||
SmoothStep(ref start, ref end, amount, out Vector2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -995,8 +990,7 @@ namespace FlaxEngine
|
||||
/// <returns>The result of the Hermite spline interpolation.</returns>
|
||||
public static Vector2 Hermite(Vector2 value1, Vector2 tangent1, Vector2 value2, Vector2 tangent2, float amount)
|
||||
{
|
||||
Vector2 result;
|
||||
Hermite(ref value1, ref tangent1, ref value2, ref tangent2, amount, out result);
|
||||
Hermite(ref value1, ref tangent1, ref value2, ref tangent2, amount, out Vector2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1054,8 +1048,7 @@ namespace FlaxEngine
|
||||
/// <returns>A vector that is the result of the Catmull-Rom interpolation.</returns>
|
||||
public static Vector2 CatmullRom(Vector2 value1, Vector2 value2, Vector2 value3, Vector2 value4, float amount)
|
||||
{
|
||||
Vector2 result;
|
||||
CatmullRom(ref value1, ref value2, ref value3, ref value4, amount, out result);
|
||||
CatmullRom(ref value1, ref value2, ref value3, ref value4, amount, out Vector2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1082,8 +1075,7 @@ namespace FlaxEngine
|
||||
/// <returns>A vector containing the largest components of the source vectors.</returns>
|
||||
public static Vector2 Max(Vector2 left, Vector2 right)
|
||||
{
|
||||
Vector2 result;
|
||||
Max(ref left, ref right, out result);
|
||||
Max(ref left, ref right, out Vector2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1110,8 +1102,7 @@ namespace FlaxEngine
|
||||
/// <returns>A vector containing the smallest components of the source vectors.</returns>
|
||||
public static Vector2 Min(Vector2 left, Vector2 right)
|
||||
{
|
||||
Vector2 result;
|
||||
Min(ref left, ref right, out result);
|
||||
Min(ref left, ref right, out Vector2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1155,8 +1146,7 @@ namespace FlaxEngine
|
||||
/// </remarks>
|
||||
public static Vector2 Reflect(Vector2 vector, Vector2 normal)
|
||||
{
|
||||
Vector2 result;
|
||||
Reflect(ref vector, ref normal, out result);
|
||||
Reflect(ref vector, ref normal, out Vector2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1252,8 +1242,10 @@ namespace FlaxEngine
|
||||
|
||||
if (source == null)
|
||||
throw new ArgumentNullException(nameof(source));
|
||||
|
||||
if (destination == null)
|
||||
throw new ArgumentNullException(nameof(destination));
|
||||
|
||||
if (destination.Length < source.Length)
|
||||
throw new ArgumentOutOfRangeException(nameof(destination), "The destination array must be of same length or larger length than the source array.");
|
||||
|
||||
@@ -1297,8 +1289,7 @@ namespace FlaxEngine
|
||||
/// <returns>The transformed <see cref="Vector4" />.</returns>
|
||||
public static Vector2 Transform(Vector2 vector, Quaternion rotation)
|
||||
{
|
||||
Vector2 result;
|
||||
Transform(ref vector, ref rotation, out result);
|
||||
Transform(ref vector, ref rotation, out Vector2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1323,8 +1314,10 @@ namespace FlaxEngine
|
||||
{
|
||||
if (source == null)
|
||||
throw new ArgumentNullException(nameof(source));
|
||||
|
||||
if (destination == null)
|
||||
throw new ArgumentNullException(nameof(destination));
|
||||
|
||||
if (destination.Length < source.Length)
|
||||
throw new ArgumentOutOfRangeException(nameof(destination), "The destination array must be of same length or larger length than the source array.");
|
||||
|
||||
@@ -1371,8 +1364,7 @@ namespace FlaxEngine
|
||||
/// <returns>The transformed <see cref="Vector4" />.</returns>
|
||||
public static Vector4 Transform(Vector2 vector, Matrix transform)
|
||||
{
|
||||
Vector4 result;
|
||||
Transform(ref vector, ref transform, out result);
|
||||
Transform(ref vector, ref transform, out Vector4 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1394,8 +1386,10 @@ namespace FlaxEngine
|
||||
{
|
||||
if (source == null)
|
||||
throw new ArgumentNullException(nameof(source));
|
||||
|
||||
if (destination == null)
|
||||
throw new ArgumentNullException(nameof(destination));
|
||||
|
||||
if (destination.Length < source.Length)
|
||||
throw new ArgumentOutOfRangeException(nameof(destination), "The destination array must be of same length or larger length than the source array.");
|
||||
|
||||
@@ -1444,8 +1438,7 @@ namespace FlaxEngine
|
||||
/// </remarks>
|
||||
public static Vector2 TransformCoordinate(Vector2 coordinate, Matrix transform)
|
||||
{
|
||||
Vector2 result;
|
||||
TransformCoordinate(ref coordinate, ref transform, out result);
|
||||
TransformCoordinate(ref coordinate, ref transform, out Vector2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1477,8 +1470,10 @@ namespace FlaxEngine
|
||||
{
|
||||
if (source == null)
|
||||
throw new ArgumentNullException(nameof(source));
|
||||
|
||||
if (destination == null)
|
||||
throw new ArgumentNullException(nameof(destination));
|
||||
|
||||
if (destination.Length < source.Length)
|
||||
throw new ArgumentOutOfRangeException(nameof(destination), "The destination array must be of same length or larger length than the source array.");
|
||||
|
||||
@@ -1521,8 +1516,7 @@ namespace FlaxEngine
|
||||
/// </remarks>
|
||||
public static Vector2 TransformNormal(Vector2 normal, Matrix transform)
|
||||
{
|
||||
Vector2 result;
|
||||
TransformNormal(ref normal, ref transform, out result);
|
||||
TransformNormal(ref normal, ref transform, out Vector2 result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1554,8 +1548,10 @@ namespace FlaxEngine
|
||||
{
|
||||
if (source == null)
|
||||
throw new ArgumentNullException(nameof(source));
|
||||
|
||||
if (destination == null)
|
||||
throw new ArgumentNullException(nameof(destination));
|
||||
|
||||
if (destination.Length < source.Length)
|
||||
throw new ArgumentOutOfRangeException(nameof(destination), "The destination array must be of same length or larger length than the source array.");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user