diff options
Diffstat (limited to 'modules/mono/glue')
25 files changed, 233 insertions, 220 deletions
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs index bfbf1a097e..656796c5c7 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs @@ -209,27 +209,6 @@ namespace Godot } } - /// <summary> - /// Returns the <see cref="Basis"/>'s rotation in the form of a - /// <see cref="Quaternion"/>. See <see cref="GetEuler"/> if you - /// need Euler angles, but keep in mind quaternions should generally - /// be preferred to Euler angles. - /// </summary> - /// <returns>The basis rotation.</returns> - public Quaternion GetRotationQuaternion() - { - Basis orthonormalizedBasis = Orthonormalized(); - real_t det = orthonormalizedBasis.Determinant(); - if (det < 0) - { - // Ensure that the determinant is 1, such that result is a proper - // rotation matrix which can be represented by Euler angles. - orthonormalizedBasis = orthonormalizedBasis.Scaled(-Vector3.One); - } - - return orthonormalizedBasis.Quaternion(); - } - internal void SetQuaternionScale(Quaternion quaternion, Vector3 scale) { SetDiagonal(scale); @@ -272,8 +251,8 @@ namespace Godot /// The returned vector contains the rotation angles in /// the format (X angle, Y angle, Z angle). /// - /// Consider using the <see cref="Quaternion()"/> method instead, which - /// returns a <see cref="Godot.Quaternion"/> quaternion instead of Euler angles. + /// Consider using the <see cref="GetRotationQuaternion"/> method instead, which + /// returns a <see cref="Quaternion"/> quaternion instead of Euler angles. /// </summary> /// <returns>A <see cref="Vector3"/> representing the basis rotation in Euler angles.</returns> public Vector3 GetEuler() @@ -309,6 +288,85 @@ namespace Godot } /// <summary> + /// Returns the basis's rotation in the form of a quaternion. + /// See <see cref="GetEuler()"/> if you need Euler angles, but keep in + /// mind that quaternions should generally be preferred to Euler angles. + /// </summary> + /// <returns>A <see cref="Quaternion"/> representing the basis's rotation.</returns> + internal Quaternion GetQuaternion() + { + real_t trace = Row0[0] + Row1[1] + Row2[2]; + + if (trace > 0.0f) + { + real_t s = Mathf.Sqrt(trace + 1.0f) * 2f; + real_t inv_s = 1f / s; + return new Quaternion( + (Row2[1] - Row1[2]) * inv_s, + (Row0[2] - Row2[0]) * inv_s, + (Row1[0] - Row0[1]) * inv_s, + s * 0.25f + ); + } + + if (Row0[0] > Row1[1] && Row0[0] > Row2[2]) + { + real_t s = Mathf.Sqrt(Row0[0] - Row1[1] - Row2[2] + 1.0f) * 2f; + real_t inv_s = 1f / s; + return new Quaternion( + s * 0.25f, + (Row0[1] + Row1[0]) * inv_s, + (Row0[2] + Row2[0]) * inv_s, + (Row2[1] - Row1[2]) * inv_s + ); + } + + if (Row1[1] > Row2[2]) + { + real_t s = Mathf.Sqrt(-Row0[0] + Row1[1] - Row2[2] + 1.0f) * 2f; + real_t inv_s = 1f / s; + return new Quaternion( + (Row0[1] + Row1[0]) * inv_s, + s * 0.25f, + (Row1[2] + Row2[1]) * inv_s, + (Row0[2] - Row2[0]) * inv_s + ); + } + else + { + real_t s = Mathf.Sqrt(-Row0[0] - Row1[1] + Row2[2] + 1.0f) * 2f; + real_t inv_s = 1f / s; + return new Quaternion( + (Row0[2] + Row2[0]) * inv_s, + (Row1[2] + Row2[1]) * inv_s, + s * 0.25f, + (Row1[0] - Row0[1]) * inv_s + ); + } + } + + /// <summary> + /// Returns the <see cref="Basis"/>'s rotation in the form of a + /// <see cref="Quaternion"/>. See <see cref="GetEuler"/> if you + /// need Euler angles, but keep in mind quaternions should generally + /// be preferred to Euler angles. + /// </summary> + /// <returns>The basis rotation.</returns> + public Quaternion GetRotationQuaternion() + { + Basis orthonormalizedBasis = Orthonormalized(); + real_t det = orthonormalizedBasis.Determinant(); + if (det < 0) + { + // Ensure that the determinant is 1, such that result is a proper + // rotation matrix which can be represented by Euler angles. + orthonormalizedBasis = orthonormalizedBasis.Scaled(-Vector3.One); + } + + return orthonormalizedBasis.GetQuaternion(); + } + + /// <summary> /// Get rows by index. Rows are not very useful for user code, /// but are more efficient for some internal calculations. /// </summary> @@ -600,64 +658,6 @@ namespace Godot ); } - /// <summary> - /// Returns the basis's rotation in the form of a quaternion. - /// See <see cref="GetEuler()"/> if you need Euler angles, but keep in - /// mind that quaternions should generally be preferred to Euler angles. - /// </summary> - /// <returns>A <see cref="Godot.Quaternion"/> representing the basis's rotation.</returns> - public Quaternion Quaternion() - { - real_t trace = Row0[0] + Row1[1] + Row2[2]; - - if (trace > 0.0f) - { - real_t s = Mathf.Sqrt(trace + 1.0f) * 2f; - real_t inv_s = 1f / s; - return new Quaternion( - (Row2[1] - Row1[2]) * inv_s, - (Row0[2] - Row2[0]) * inv_s, - (Row1[0] - Row0[1]) * inv_s, - s * 0.25f - ); - } - - if (Row0[0] > Row1[1] && Row0[0] > Row2[2]) - { - real_t s = Mathf.Sqrt(Row0[0] - Row1[1] - Row2[2] + 1.0f) * 2f; - real_t inv_s = 1f / s; - return new Quaternion( - s * 0.25f, - (Row0[1] + Row1[0]) * inv_s, - (Row0[2] + Row2[0]) * inv_s, - (Row2[1] - Row1[2]) * inv_s - ); - } - - if (Row1[1] > Row2[2]) - { - real_t s = Mathf.Sqrt(-Row0[0] + Row1[1] - Row2[2] + 1.0f) * 2f; - real_t inv_s = 1f / s; - return new Quaternion( - (Row0[1] + Row1[0]) * inv_s, - s * 0.25f, - (Row1[2] + Row2[1]) * inv_s, - (Row0[2] - Row2[0]) * inv_s - ); - } - else - { - real_t s = Mathf.Sqrt(-Row0[0] - Row1[1] + Row2[2] + 1.0f) * 2f; - real_t inv_s = 1f / s; - return new Quaternion( - (Row0[2] + Row2[0]) * inv_s, - (Row1[2] + Row2[1]) * inv_s, - s * 0.25f, - (Row1[0] - Row0[1]) * inv_s - ); - } - } - private static readonly Basis[] _orthoBases = { new Basis(1f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 1f), new Basis(0f, -1f, 0f, 1f, 0f, 0f, 0f, 0f, 1f), @@ -745,7 +745,7 @@ namespace Godot /// given in the vector format as (X angle, Y angle, Z angle). /// /// Consider using the <see cref="Basis(Quaternion)"/> constructor instead, which - /// uses a <see cref="Godot.Quaternion"/> quaternion instead of Euler angles. + /// uses a <see cref="Quaternion"/> quaternion instead of Euler angles. /// </summary> /// <param name="eulerYXZ">The Euler angles to create the basis from.</param> public Basis(Vector3 eulerYXZ) diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs index a3afc83222..74aa38386f 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs @@ -127,7 +127,7 @@ namespace Godot /// </code> /// </example> /// <param name="linear">The linear energy to convert.</param> - /// <returns>Audio as decibels</returns> + /// <returns>Audio as decibels.</returns> public static real_t Linear2Db(real_t linear) { return (real_t)(Math.Log(linear) * 8.6858896380650365530225783783321); @@ -400,7 +400,7 @@ namespace Godot /// </summary> /// <param name="seed"> /// Seed to use to generate the random number. - /// If a different seed is used, its value will be modfied. + /// If a different seed is used, its value will be modified. /// </param> /// <returns>A random <see langword="uint"/> number.</returns> public static uint RandFromSeed(ref ulong seed) diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/MarshalUtils.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/MarshalUtils.cs index 3051bcedc7..ee4d0eed08 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/MarshalUtils.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/MarshalUtils.cs @@ -80,6 +80,18 @@ namespace Godot private static bool TypeIsGenericIDictionary(Type type) => type.GetGenericTypeDefinition() == typeof(IDictionary<,>); /// <summary> + /// Returns the generic type definition of <paramref name="type"/>. + /// </summary> + /// <exception cref="InvalidOperationException"> + /// Thrown when the given <paramref name="type"/> is not a generic type. + /// That is, <see cref="Type.IsGenericType"/> returns <see langword="false"/>. + /// </exception> + private static void GetGenericTypeDefinition(Type type, out Type genericTypeDefinition) + { + genericTypeDefinition = type.GetGenericTypeDefinition(); + } + + /// <summary> /// Gets the element type for the given <paramref name="arrayType"/>. /// </summary> /// <param name="arrayType">Type for the generic array.</param> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs index fbc8ff64a6..bfe9600084 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs @@ -624,7 +624,7 @@ namespace Godot /// </summary> /// <param name="s">The value to snap.</param> /// <param name="step">The step size to snap to.</param> - /// <returns></returns> + /// <returns>The snapped value.</returns> public static real_t Snapped(real_t s, real_t step) { if (step != 0f) diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/MathfEx.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/MathfEx.cs index 9bb73ce7dd..f15d01b34b 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/MathfEx.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/MathfEx.cs @@ -44,7 +44,7 @@ namespace Godot /// <summary> /// Returns the amount of digits after the decimal place. /// </summary> - /// <param name="s">The input <see cref="decimal"/> value.</param> + /// <param name="s">The input <see langword="decimal"/> value.</param> /// <returns>The amount of digits.</returns> public static int DecimalCount(decimal s) { @@ -54,7 +54,7 @@ namespace Godot /// <summary> /// Rounds <paramref name="s"/> upward (towards positive infinity). /// - /// This is the same as <see cref="Ceil(real_t)"/>, but returns an <c>int</c>. + /// This is the same as <see cref="Ceil(real_t)"/>, but returns an <see langword="int"/>. /// </summary> /// <param name="s">The number to ceil.</param> /// <returns>The smallest whole number that is not less than <paramref name="s"/>.</returns> @@ -66,7 +66,7 @@ namespace Godot /// <summary> /// Rounds <paramref name="s"/> downward (towards negative infinity). /// - /// This is the same as <see cref="Floor(real_t)"/>, but returns an <c>int</c>. + /// This is the same as <see cref="Floor(real_t)"/>, but returns an <see langword="int"/>. /// </summary> /// <param name="s">The number to floor.</param> /// <returns>The largest whole number that is not more than <paramref name="s"/>.</returns> @@ -78,7 +78,7 @@ namespace Godot /// <summary> /// Rounds <paramref name="s"/> to the nearest whole number. /// - /// This is the same as <see cref="Round(real_t)"/>, but returns an <c>int</c>. + /// This is the same as <see cref="Round(real_t)"/>, but returns an <see langword="int"/>. /// </summary> /// <param name="s">The number to round.</param> /// <returns>The rounded number.</returns> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NodePath.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NodePath.cs index f53b5dc904..40fb5f8788 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NodePath.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NodePath.cs @@ -122,7 +122,7 @@ namespace Godot /// "/root/Level/Path2D" /// </code> /// </example> - /// <param name="path"></param> + /// <param name="path">A string that represents a path in a scene tree.</param> public NodePath(string path) { ptr = godot_icall_NodePath_Ctor(path); diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs index dfb8e87bce..e38dca414f 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs @@ -377,7 +377,7 @@ namespace Godot /// <param name="basis">The <see cref="Basis"/> to construct from.</param> public Quaternion(Basis basis) { - this = basis.Quaternion(); + this = basis.GetQuaternion(); } /// <summary> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs index d9ee684c5b..a89dca6c34 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringExtensions.cs @@ -415,6 +415,10 @@ namespace Godot /// <summary> /// Find the first occurrence of a substring. Optionally, the search starting position can be passed. /// </summary> + /// <seealso cref="Find(string, char, int, bool)"/> + /// <seealso cref="FindLast(string, string, bool)"/> + /// <seealso cref="FindLast(string, string, int, bool)"/> + /// <seealso cref="FindN(string, string, int)"/> /// <param name="instance">The string that will be searched.</param> /// <param name="what">The substring to find.</param> /// <param name="from">The search starting position.</param> @@ -690,7 +694,7 @@ namespace Godot /// <summary> /// Returns <see langword="true"/> if the string is a path to a file or - /// directory and its startign point is explicitly defined. This includes + /// directory and its starting point is explicitly defined. This includes /// <c>res://</c>, <c>user://</c>, <c>C:\</c>, <c>/</c>, etc. /// </summary> /// <seealso cref="IsRelativePath(string)"/> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs index 6f1d9574a8..8e253388bf 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs @@ -23,7 +23,6 @@ namespace Godot /// <summary> /// The basis matrix's X vector (column 0). Equivalent to array index <c>[0]</c>. /// </summary> - /// <value></value> public Vector2 x; /// <summary> @@ -420,12 +419,12 @@ namespace Godot /// Constructs a transformation matrix from the given components. /// Arguments are named such that xy is equal to calling x.y /// </summary> - /// <param name="xx">The X component of the X column vector, accessed via <c>t.x.x</c> or <c>[0][0]</c></param> - /// <param name="xy">The Y component of the X column vector, accessed via <c>t.x.y</c> or <c>[0][1]</c></param> - /// <param name="yx">The X component of the Y column vector, accessed via <c>t.y.x</c> or <c>[1][0]</c></param> - /// <param name="yy">The Y component of the Y column vector, accessed via <c>t.y.y</c> or <c>[1][1]</c></param> - /// <param name="ox">The X component of the origin vector, accessed via <c>t.origin.x</c> or <c>[2][0]</c></param> - /// <param name="oy">The Y component of the origin vector, accessed via <c>t.origin.y</c> or <c>[2][1]</c></param> + /// <param name="xx">The X component of the X column vector, accessed via <c>t.x.x</c> or <c>[0][0]</c>.</param> + /// <param name="xy">The Y component of the X column vector, accessed via <c>t.x.y</c> or <c>[0][1]</c>.</param> + /// <param name="yx">The X component of the Y column vector, accessed via <c>t.y.x</c> or <c>[1][0]</c>.</param> + /// <param name="yy">The Y component of the Y column vector, accessed via <c>t.y.y</c> or <c>[1][1]</c>.</param> + /// <param name="ox">The X component of the origin vector, accessed via <c>t.origin.x</c> or <c>[2][0]</c>.</param> + /// <param name="oy">The Y component of the origin vector, accessed via <c>t.origin.y</c> or <c>[2][1]</c>.</param> public Transform2D(real_t xx, real_t xy, real_t yx, real_t yy, real_t ox, real_t oy) { x = new Vector2(xx, xy); diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs index 4bb8308c12..5d9aabdd2f 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform3D.cs @@ -166,7 +166,7 @@ namespace Godot /// Operations take place in global space. /// </summary> /// <param name="target">The object to look at.</param> - /// <param name="up">The relative up direction</param> + /// <param name="up">The relative up direction.</param> /// <returns>The resulting transform.</returns> public Transform3D LookingAt(Vector3 target, Vector3 up) { diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs index 0c3331900a..1f5282e88f 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs @@ -17,7 +17,7 @@ namespace Godot { /// <summary> /// Enumerated index values for the axes. - /// Returned by <see cref="MaxAxis"/> and <see cref="MinAxis"/>. + /// Returned by <see cref="MaxAxisIndex"/> and <see cref="MinAxisIndex"/>. /// </summary> public enum Axis { @@ -184,13 +184,13 @@ namespace Godot } /// <summary> - /// Returns the cross product of this vector and <paramref name="b"/>. + /// Returns the cross product of this vector and <paramref name="with"/>. /// </summary> - /// <param name="b">The other vector.</param> + /// <param name="with">The other vector.</param> /// <returns>The cross product value.</returns> - public real_t Cross(Vector2 b) + public real_t Cross(Vector2 with) { - return (x * b.y) - (y * b.x); + return (x * with.y) - (y * with.x); } /// <summary> @@ -222,13 +222,13 @@ namespace Godot } /// <summary> - /// Returns the normalized vector pointing from this vector to <paramref name="b"/>. + /// Returns the normalized vector pointing from this vector to <paramref name="to"/>. /// </summary> - /// <param name="b">The other vector to point towards.</param> - /// <returns>The direction from this vector to <paramref name="b"/>.</returns> - public Vector2 DirectionTo(Vector2 b) + /// <param name="to">The other vector to point towards.</param> + /// <returns>The direction from this vector to <paramref name="to"/>.</returns> + public Vector2 DirectionTo(Vector2 to) { - return new Vector2(b.x - x, b.y - y).Normalized(); + return new Vector2(to.x - x, to.y - y).Normalized(); } /// <summary> @@ -365,21 +365,21 @@ namespace Godot } /// <summary> - /// Returns the axis of the vector's largest value. See <see cref="Axis"/>. + /// Returns the axis of the vector's highest value. See <see cref="Axis"/>. /// If both components are equal, this method returns <see cref="Axis.X"/>. /// </summary> - /// <returns>The index of the largest axis.</returns> - public Axis MaxAxis() + /// <returns>The index of the highest axis.</returns> + public Axis MaxAxisIndex() { return x < y ? Axis.Y : Axis.X; } /// <summary> - /// Returns the axis of the vector's smallest value. See <see cref="Axis"/>. + /// Returns the axis of the vector's lowest value. See <see cref="Axis"/>. /// If both components are equal, this method returns <see cref="Axis.Y"/>. /// </summary> - /// <returns>The index of the smallest axis.</returns> - public Axis MinAxis() + /// <returns>The index of the lowest axis.</returns> + public Axis MinAxisIndex() { return x < y ? Axis.X : Axis.Y; } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs index 6cac16d53b..9b51de5c8c 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs @@ -17,7 +17,7 @@ namespace Godot { /// <summary> /// Enumerated index values for the axes. - /// Returned by <see cref="MaxAxis"/> and <see cref="MinAxis"/>. + /// Returned by <see cref="MaxAxisIndex"/> and <see cref="MinAxisIndex"/>. /// </summary> public enum Axis { @@ -149,45 +149,45 @@ namespace Godot } /// <summary> - /// Returns the cross product of this vector and <paramref name="b"/>. + /// Returns the cross product of this vector and <paramref name="with"/>. /// </summary> - /// <param name="b">The other vector.</param> + /// <param name="with">The other vector.</param> /// <returns>The cross product vector.</returns> - public int Cross(Vector2i b) + public int Cross(Vector2i with) { - return x * b.y - y * b.x; + return x * with.y - y * with.x; } /// <summary> - /// Returns the squared distance between this vector and <paramref name="b"/>. + /// Returns the squared distance between this vector and <paramref name="to"/>. /// This method runs faster than <see cref="DistanceTo"/>, so prefer it if /// you need to compare vectors or need the squared distance for some formula. /// </summary> - /// <param name="b">The other vector to use.</param> + /// <param name="to">The other vector to use.</param> /// <returns>The squared distance between the two vectors.</returns> - public int DistanceSquaredTo(Vector2i b) + public int DistanceSquaredTo(Vector2i to) { - return (b - this).LengthSquared(); + return (to - this).LengthSquared(); } /// <summary> - /// Returns the distance between this vector and <paramref name="b"/>. + /// Returns the distance between this vector and <paramref name="to"/>. /// </summary> - /// <param name="b">The other vector to use.</param> + /// <param name="to">The other vector to use.</param> /// <returns>The distance between the two vectors.</returns> - public real_t DistanceTo(Vector2i b) + public real_t DistanceTo(Vector2i to) { - return (b - this).Length(); + return (to - this).Length(); } /// <summary> - /// Returns the dot product of this vector and <paramref name="b"/>. + /// Returns the dot product of this vector and <paramref name="with"/>. /// </summary> - /// <param name="b">The other vector to use.</param> + /// <param name="with">The other vector to use.</param> /// <returns>The dot product of the two vectors.</returns> - public int Dot(Vector2i b) + public int Dot(Vector2i with) { - return x * b.x + y * b.y; + return x * with.x + y * with.y; } /// <summary> @@ -218,21 +218,21 @@ namespace Godot } /// <summary> - /// Returns the axis of the vector's largest value. See <see cref="Axis"/>. + /// Returns the axis of the vector's highest value. See <see cref="Axis"/>. /// If both components are equal, this method returns <see cref="Axis.X"/>. /// </summary> - /// <returns>The index of the largest axis.</returns> - public Axis MaxAxis() + /// <returns>The index of the highest axis.</returns> + public Axis MaxAxisIndex() { return x < y ? Axis.Y : Axis.X; } /// <summary> - /// Returns the axis of the vector's smallest value. See <see cref="Axis"/>. + /// Returns the axis of the vector's lowest value. See <see cref="Axis"/>. /// If both components are equal, this method returns <see cref="Axis.Y"/>. /// </summary> - /// <returns>The index of the smallest axis.</returns> - public Axis MinAxis() + /// <returns>The index of the lowest axis.</returns> + public Axis MinAxisIndex() { return x < y ? Axis.X : Axis.Y; } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs index 63d9be0a6d..433a5d9dc9 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs @@ -17,7 +17,7 @@ namespace Godot { /// <summary> /// Enumerated index values for the axes. - /// Returned by <see cref="MaxAxis"/> and <see cref="MinAxis"/>. + /// Returned by <see cref="MaxAxisIndex"/> and <see cref="MinAxisIndex"/>. /// </summary> public enum Axis { @@ -170,17 +170,17 @@ namespace Godot } /// <summary> - /// Returns the cross product of this vector and <paramref name="b"/>. + /// Returns the cross product of this vector and <paramref name="with"/>. /// </summary> - /// <param name="b">The other vector.</param> + /// <param name="with">The other vector.</param> /// <returns>The cross product vector.</returns> - public Vector3 Cross(Vector3 b) + public Vector3 Cross(Vector3 with) { return new Vector3 ( - (y * b.z) - (z * b.y), - (z * b.x) - (x * b.z), - (x * b.y) - (y * b.x) + (y * with.z) - (z * with.y), + (z * with.x) - (x * with.z), + (x * with.y) - (y * with.x) ); } @@ -212,46 +212,46 @@ namespace Godot } /// <summary> - /// Returns the normalized vector pointing from this vector to <paramref name="b"/>. + /// Returns the normalized vector pointing from this vector to <paramref name="to"/>. /// </summary> - /// <param name="b">The other vector to point towards.</param> - /// <returns>The direction from this vector to <paramref name="b"/>.</returns> - public Vector3 DirectionTo(Vector3 b) + /// <param name="to">The other vector to point towards.</param> + /// <returns>The direction from this vector to <paramref name="to"/>.</returns> + public Vector3 DirectionTo(Vector3 to) { - return new Vector3(b.x - x, b.y - y, b.z - z).Normalized(); + return new Vector3(to.x - x, to.y - y, to.z - z).Normalized(); } /// <summary> - /// Returns the squared distance between this vector and <paramref name="b"/>. + /// Returns the squared distance between this vector and <paramref name="to"/>. /// This method runs faster than <see cref="DistanceTo"/>, so prefer it if /// you need to compare vectors or need the squared distance for some formula. /// </summary> - /// <param name="b">The other vector to use.</param> + /// <param name="to">The other vector to use.</param> /// <returns>The squared distance between the two vectors.</returns> - public real_t DistanceSquaredTo(Vector3 b) + public real_t DistanceSquaredTo(Vector3 to) { - return (b - this).LengthSquared(); + return (to - this).LengthSquared(); } /// <summary> - /// Returns the distance between this vector and <paramref name="b"/>. + /// Returns the distance between this vector and <paramref name="to"/>. /// </summary> /// <seealso cref="DistanceSquaredTo(Vector3)"/> - /// <param name="b">The other vector to use.</param> + /// <param name="to">The other vector to use.</param> /// <returns>The distance between the two vectors.</returns> - public real_t DistanceTo(Vector3 b) + public real_t DistanceTo(Vector3 to) { - return (b - this).Length(); + return (to - this).Length(); } /// <summary> - /// Returns the dot product of this vector and <paramref name="b"/>. + /// Returns the dot product of this vector and <paramref name="with"/>. /// </summary> - /// <param name="b">The other vector to use.</param> + /// <param name="with">The other vector to use.</param> /// <returns>The dot product of the two vectors.</returns> - public real_t Dot(Vector3 b) + public real_t Dot(Vector3 with) { - return (x * b.x) + (y * b.y) + (z * b.z); + return (x * with.x) + (y * with.y) + (z * with.z); } /// <summary> @@ -364,21 +364,21 @@ namespace Godot } /// <summary> - /// Returns the axis of the vector's largest value. See <see cref="Axis"/>. + /// Returns the axis of the vector's highest value. See <see cref="Axis"/>. /// If all components are equal, this method returns <see cref="Axis.X"/>. /// </summary> - /// <returns>The index of the largest axis.</returns> - public Axis MaxAxis() + /// <returns>The index of the highest axis.</returns> + public Axis MaxAxisIndex() { return x < y ? (y < z ? Axis.Z : Axis.Y) : (x < z ? Axis.Z : Axis.X); } /// <summary> - /// Returns the axis of the vector's smallest value. See <see cref="Axis"/>. + /// Returns the axis of the vector's lowest value. See <see cref="Axis"/>. /// If all components are equal, this method returns <see cref="Axis.Z"/>. /// </summary> - /// <returns>The index of the smallest axis.</returns> - public Axis MinAxis() + /// <returns>The index of the lowest axis.</returns> + public Axis MinAxisIndex() { return x < y ? (x < z ? Axis.X : Axis.Z) : (y < z ? Axis.Y : Axis.Z); } @@ -412,16 +412,16 @@ namespace Godot } /// <summary> - /// Returns the outer product with <paramref name="b"/>. + /// Returns the outer product with <paramref name="with"/>. /// </summary> - /// <param name="b">The other vector.</param> + /// <param name="with">The other vector.</param> /// <returns>A <see cref="Basis"/> representing the outer product matrix.</returns> - public Basis Outer(Vector3 b) + public Basis Outer(Vector3 with) { return new Basis( - x * b.x, x * b.y, x * b.z, - y * b.x, y * b.y, y * b.z, - z * b.x, z * b.y, z * b.z + x * with.x, x * with.y, x * with.z, + y * with.x, y * with.y, y * with.z, + z * with.x, z * with.y, z * with.z ); } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs index 474876fc91..eb06d2b87e 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs @@ -17,7 +17,7 @@ namespace Godot { /// <summary> /// Enumerated index values for the axes. - /// Returned by <see cref="MaxAxis"/> and <see cref="MinAxis"/>. + /// Returned by <see cref="MaxAxisIndex"/> and <see cref="MinAxisIndex"/>. /// </summary> public enum Axis { @@ -124,36 +124,36 @@ namespace Godot } /// <summary> - /// Returns the squared distance between this vector and <paramref name="b"/>. + /// Returns the squared distance between this vector and <paramref name="to"/>. /// This method runs faster than <see cref="DistanceTo"/>, so prefer it if /// you need to compare vectors or need the squared distance for some formula. /// </summary> - /// <param name="b">The other vector to use.</param> + /// <param name="to">The other vector to use.</param> /// <returns>The squared distance between the two vectors.</returns> - public int DistanceSquaredTo(Vector3i b) + public int DistanceSquaredTo(Vector3i to) { - return (b - this).LengthSquared(); + return (to - this).LengthSquared(); } /// <summary> - /// Returns the distance between this vector and <paramref name="b"/>. + /// Returns the distance between this vector and <paramref name="to"/>. /// </summary> /// <seealso cref="DistanceSquaredTo(Vector3i)"/> - /// <param name="b">The other vector to use.</param> + /// <param name="to">The other vector to use.</param> /// <returns>The distance between the two vectors.</returns> - public real_t DistanceTo(Vector3i b) + public real_t DistanceTo(Vector3i to) { - return (b - this).Length(); + return (to - this).Length(); } /// <summary> - /// Returns the dot product of this vector and <paramref name="b"/>. + /// Returns the dot product of this vector and <paramref name="with"/>. /// </summary> - /// <param name="b">The other vector to use.</param> + /// <param name="with">The other vector to use.</param> /// <returns>The dot product of the two vectors.</returns> - public int Dot(Vector3i b) + public int Dot(Vector3i with) { - return x * b.x + y * b.y + z * b.z; + return x * with.x + y * with.y + z * with.z; } /// <summary> @@ -186,21 +186,21 @@ namespace Godot } /// <summary> - /// Returns the axis of the vector's largest value. See <see cref="Axis"/>. + /// Returns the axis of the vector's highest value. See <see cref="Axis"/>. /// If all components are equal, this method returns <see cref="Axis.X"/>. /// </summary> - /// <returns>The index of the largest axis.</returns> - public Axis MaxAxis() + /// <returns>The index of the highest axis.</returns> + public Axis MaxAxisIndex() { return x < y ? (y < z ? Axis.Z : Axis.Y) : (x < z ? Axis.Z : Axis.X); } /// <summary> - /// Returns the axis of the vector's smallest value. See <see cref="Axis"/>. + /// Returns the axis of the vector's lowest value. See <see cref="Axis"/>. /// If all components are equal, this method returns <see cref="Axis.Z"/>. /// </summary> - /// <returns>The index of the smallest axis.</returns> - public Axis MinAxis() + /// <returns>The index of the lowest axis.</returns> + public Axis MinAxisIndex() { return x < y ? (x < z ? Axis.X : Axis.Z) : (y < z ? Axis.Y : Axis.Z); } diff --git a/modules/mono/glue/arguments_vector.h b/modules/mono/glue/arguments_vector.h index 9ba6a05ac6..7c991d87a4 100644 --- a/modules/mono/glue/arguments_vector.h +++ b/modules/mono/glue/arguments_vector.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/mono/glue/base_object_glue.cpp b/modules/mono/glue/base_object_glue.cpp index 6c5503a3bd..8e7b125ed5 100644 --- a/modules/mono/glue/base_object_glue.cpp +++ b/modules/mono/glue/base_object_glue.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/mono/glue/callable_glue.cpp b/modules/mono/glue/callable_glue.cpp index 54b65fdb94..e59b34313c 100644 --- a/modules/mono/glue/callable_glue.cpp +++ b/modules/mono/glue/callable_glue.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/mono/glue/collections_glue.cpp b/modules/mono/glue/collections_glue.cpp index e367ecb7d6..56a08a0dd5 100644 --- a/modules/mono/glue/collections_glue.cpp +++ b/modules/mono/glue/collections_glue.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -237,10 +237,8 @@ int32_t godot_icall_Dictionary_KeyValuePairs(Dictionary *ptr, Array **keys, Arra } void godot_icall_Dictionary_KeyValuePairAt(Dictionary *ptr, int index, MonoObject **key, MonoObject **value) { - Array *keys = godot_icall_Dictionary_Keys(ptr); - Array *values = godot_icall_Dictionary_Values(ptr); - *key = GDMonoMarshal::variant_to_mono_object(keys->get(index)); - *value = GDMonoMarshal::variant_to_mono_object(values->get(index)); + *key = GDMonoMarshal::variant_to_mono_object(ptr->get_key_at_index(index)); + *value = GDMonoMarshal::variant_to_mono_object(ptr->get_value_at_index(index)); } void godot_icall_Dictionary_Add(Dictionary *ptr, MonoObject *key, MonoObject *value) { diff --git a/modules/mono/glue/gd_glue.cpp b/modules/mono/glue/gd_glue.cpp index 07ddf5d945..8aead217cf 100644 --- a/modules/mono/glue/gd_glue.cpp +++ b/modules/mono/glue/gd_glue.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/mono/glue/glue_header.h b/modules/mono/glue/glue_header.h index 074220bb9b..9638b23410 100644 --- a/modules/mono/glue/glue_header.h +++ b/modules/mono/glue/glue_header.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/mono/glue/nodepath_glue.cpp b/modules/mono/glue/nodepath_glue.cpp index 4ddb94e1a8..0ea9814b1a 100644 --- a/modules/mono/glue/nodepath_glue.cpp +++ b/modules/mono/glue/nodepath_glue.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/mono/glue/rid_glue.cpp b/modules/mono/glue/rid_glue.cpp index f464e63a81..3e09564539 100644 --- a/modules/mono/glue/rid_glue.cpp +++ b/modules/mono/glue/rid_glue.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/mono/glue/scene_tree_glue.cpp b/modules/mono/glue/scene_tree_glue.cpp index 5a6fd69db8..c60e7c4869 100644 --- a/modules/mono/glue/scene_tree_glue.cpp +++ b/modules/mono/glue/scene_tree_glue.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/mono/glue/string_glue.cpp b/modules/mono/glue/string_glue.cpp index bb80a836ad..fc6b13ceb3 100644 --- a/modules/mono/glue/string_glue.cpp +++ b/modules/mono/glue/string_glue.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/modules/mono/glue/string_name_glue.cpp b/modules/mono/glue/string_name_glue.cpp index f537896559..46d15316ba 100644 --- a/modules/mono/glue/string_name_glue.cpp +++ b/modules/mono/glue/string_name_glue.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ |