Merge pull request #64727 from raulsntos/csharp-remove-ctors

Remove copy constructors in C# structs
This commit is contained in:
Ignacio Roldán Etcheverry 2022-08-24 08:28:58 +02:00 committed by GitHub
commit b438859d04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 15 additions and 126 deletions

View file

@ -73,18 +73,6 @@ namespace Godot
this.w = w;
}
/// <summary>
/// Constructs a new <see cref="Projection"/> from an existing <see cref="Projection"/>.
/// </summary>
/// <param name="proj">The existing <see cref="Projection"/>.</param>
public Projection(Projection proj)
{
x = proj.x;
y = proj.y;
z = proj.z;
w = proj.w;
}
/// <summary>
/// Constructs a new <see cref="Projection"/> from a <see cref="Transform3D"/>.
/// </summary>

View file

@ -339,15 +339,6 @@ namespace Godot
this.w = w;
}
/// <summary>
/// Constructs a <see cref="Quaternion"/> from the given <see cref="Quaternion"/>.
/// </summary>
/// <param name="q">The existing quaternion.</param>
public Quaternion(Quaternion q)
{
this = q;
}
/// <summary>
/// Constructs a <see cref="Quaternion"/> from the given <see cref="Basis"/>.
/// </summary>

View file

@ -638,16 +638,6 @@ namespace Godot
this.y = y;
}
/// <summary>
/// Constructs a new <see cref="Vector2"/> from an existing <see cref="Vector2"/>.
/// </summary>
/// <param name="v">The existing <see cref="Vector2"/>.</param>
public Vector2(Vector2 v)
{
x = v.x;
y = v.y;
}
/// <summary>
/// Creates a unit Vector2 rotated to the given angle. This is equivalent to doing
/// <c>Vector2(Mathf.Cos(angle), Mathf.Sin(angle))</c> or <c>Vector2.Right.Rotated(angle)</c>.

View file

@ -349,27 +349,6 @@ namespace Godot
this.y = y;
}
/// <summary>
/// Constructs a new <see cref="Vector2i"/> from an existing <see cref="Vector2i"/>.
/// </summary>
/// <param name="vi">The existing <see cref="Vector2i"/>.</param>
public Vector2i(Vector2i vi)
{
this.x = vi.x;
this.y = vi.y;
}
/// <summary>
/// Constructs a new <see cref="Vector2i"/> from an existing <see cref="Vector2"/>
/// by rounding the components via <see cref="Mathf.RoundToInt(real_t)"/>.
/// </summary>
/// <param name="v">The <see cref="Vector2"/> to convert.</param>
public Vector2i(Vector2 v)
{
this.x = Mathf.RoundToInt(v.x);
this.y = Mathf.RoundToInt(v.y);
}
/// <summary>
/// Adds each component of the <see cref="Vector2i"/>
/// with the components of the given <see cref="Vector2i"/>.
@ -674,7 +653,10 @@ namespace Godot
/// <param name="value">The vector to convert.</param>
public static explicit operator Vector2i(Vector2 value)
{
return new Vector2i(value);
return new Vector2i(
Mathf.RoundToInt(value.x),
Mathf.RoundToInt(value.y)
);
}
/// <summary>

View file

@ -691,17 +691,6 @@ namespace Godot
this.z = z;
}
/// <summary>
/// Constructs a new <see cref="Vector3"/> from an existing <see cref="Vector3"/>.
/// </summary>
/// <param name="v">The existing <see cref="Vector3"/>.</param>
public Vector3(Vector3 v)
{
x = v.x;
y = v.y;
z = v.z;
}
/// <summary>
/// Adds each component of the <see cref="Vector3"/>
/// with the components of the given <see cref="Vector3"/>.

View file

@ -329,29 +329,6 @@ namespace Godot
this.z = z;
}
/// <summary>
/// Constructs a new <see cref="Vector3i"/> from an existing <see cref="Vector3i"/>.
/// </summary>
/// <param name="vi">The existing <see cref="Vector3i"/>.</param>
public Vector3i(Vector3i vi)
{
this.x = vi.x;
this.y = vi.y;
this.z = vi.z;
}
/// <summary>
/// Constructs a new <see cref="Vector3i"/> from an existing <see cref="Vector3"/>
/// by rounding the components via <see cref="Mathf.RoundToInt(real_t)"/>.
/// </summary>
/// <param name="v">The <see cref="Vector3"/> to convert.</param>
public Vector3i(Vector3 v)
{
this.x = Mathf.RoundToInt(v.x);
this.y = Mathf.RoundToInt(v.y);
this.z = Mathf.RoundToInt(v.z);
}
/// <summary>
/// Adds each component of the <see cref="Vector3i"/>
/// with the components of the given <see cref="Vector3i"/>.
@ -684,7 +661,11 @@ namespace Godot
/// <param name="value">The vector to convert.</param>
public static explicit operator Vector3i(Vector3 value)
{
return new Vector3i(value);
return new Vector3i(
Mathf.RoundToInt(value.x),
Mathf.RoundToInt(value.y),
Mathf.RoundToInt(value.z)
);
}
/// <summary>

View file

@ -476,18 +476,6 @@ namespace Godot
this.w = w;
}
/// <summary>
/// Constructs a new <see cref="Vector4"/> from an existing <see cref="Vector4"/>.
/// </summary>
/// <param name="v">The existing <see cref="Vector4"/>.</param>
public Vector4(Vector4 v)
{
x = v.x;
y = v.y;
z = v.z;
w = v.w;
}
/// <summary>
/// Adds each component of the <see cref="Vector4"/>
/// with the components of the given <see cref="Vector4"/>.

View file

@ -257,31 +257,6 @@ namespace Godot
this.w = w;
}
/// <summary>
/// Constructs a new <see cref="Vector4i"/> from an existing <see cref="Vector4i"/>.
/// </summary>
/// <param name="vi">The existing <see cref="Vector4i"/>.</param>
public Vector4i(Vector4i vi)
{
this.x = vi.x;
this.y = vi.y;
this.z = vi.z;
this.w = vi.w;
}
/// <summary>
/// Constructs a new <see cref="Vector4i"/> from an existing <see cref="Vector4"/>
/// by rounding the components via <see cref="Mathf.RoundToInt(real_t)"/>.
/// </summary>
/// <param name="v">The <see cref="Vector4"/> to convert.</param>
public Vector4i(Vector4 v)
{
this.x = Mathf.RoundToInt(v.x);
this.y = Mathf.RoundToInt(v.y);
this.z = Mathf.RoundToInt(v.z);
this.w = Mathf.RoundToInt(v.w);
}
/// <summary>
/// Adds each component of the <see cref="Vector4i"/>
/// with the components of the given <see cref="Vector4i"/>.
@ -638,7 +613,12 @@ namespace Godot
/// <param name="value">The vector to convert.</param>
public static explicit operator Vector4i(Vector4 value)
{
return new Vector4i(value);
return new Vector4i(
Mathf.RoundToInt(value.x),
Mathf.RoundToInt(value.y),
Mathf.RoundToInt(value.z),
Mathf.RoundToInt(value.w)
);
}
/// <summary>