#18051: Remove redundant casts and 'using', 'else', 'this' statements
(cherry picked from commit 0ef3e0577b
)
This commit is contained in:
parent
95004aafb2
commit
e7b97af276
|
@ -1,12 +1,10 @@
|
|||
using System;
|
||||
|
||||
// file: core/math/aabb.h
|
||||
// commit: 7ad14e7a3e6f87ddc450f7e34621eb5200808451
|
||||
// file: core/math/aabb.cpp
|
||||
// commit: bd282ff43f23fe845f29a3e25c8efc01bd65ffb0
|
||||
// file: core/variant_call.cpp
|
||||
// commit: 5ad9be4c24e9d7dc5672fdc42cea896622fe5685
|
||||
|
||||
using System;
|
||||
#if REAL_T_IS_DOUBLE
|
||||
using real_t = System.Double;
|
||||
#else
|
||||
|
@ -283,31 +281,25 @@ namespace Godot
|
|||
{
|
||||
return new AABB();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
min.x = (src_min.x > dst_min.x) ? src_min.x : dst_min.x;
|
||||
max.x = (src_max.x < dst_max.x) ? src_max.x : dst_max.x;
|
||||
}
|
||||
|
||||
if (src_min.y > dst_max.y || src_max.y < dst_min.y)
|
||||
{
|
||||
return new AABB();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
min.y = (src_min.y > dst_min.y) ? src_min.y : dst_min.y;
|
||||
max.y = (src_max.y < dst_max.y) ? src_max.y : dst_max.y;
|
||||
}
|
||||
|
||||
if (src_min.z > dst_max.z || src_max.z < dst_min.z)
|
||||
{
|
||||
return new AABB();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
min.z = (src_min.z > dst_min.z) ? src_min.z : dst_min.z;
|
||||
max.z = (src_max.z < dst_max.z) ? src_max.z : dst_max.z;
|
||||
}
|
||||
|
||||
return new AABB(min, max - min);
|
||||
}
|
||||
|
@ -341,7 +333,7 @@ namespace Godot
|
|||
new Vector3(position.x + size.x, position.y, position.z),
|
||||
new Vector3(position.x + size.x, position.y, position.z + size.z),
|
||||
new Vector3(position.x + size.x, position.y + size.y, position.z),
|
||||
new Vector3(position.x + size.x, position.y + size.y, position.z + size.z),
|
||||
new Vector3(position.x + size.x, position.y + size.y, position.z + size.z)
|
||||
};
|
||||
|
||||
bool over = false;
|
||||
|
@ -467,8 +459,8 @@ namespace Godot
|
|||
{
|
||||
return String.Format("{0} - {1}", new object[]
|
||||
{
|
||||
this.position.ToString(),
|
||||
this.size.ToString()
|
||||
position.ToString(),
|
||||
size.ToString()
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -476,8 +468,8 @@ namespace Godot
|
|||
{
|
||||
return String.Format("{0} - {1}", new object[]
|
||||
{
|
||||
this.position.ToString(format),
|
||||
this.size.ToString(format)
|
||||
position.ToString(format),
|
||||
size.ToString(format)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#if REAL_T_IS_DOUBLE
|
||||
using real_t = System.Double;
|
||||
#else
|
||||
|
@ -188,7 +187,7 @@ namespace Godot
|
|||
|
||||
public Vector3 GetEuler()
|
||||
{
|
||||
Basis m = this.Orthonormalized();
|
||||
Basis m = Orthonormalized();
|
||||
|
||||
Vector3 euler;
|
||||
euler.z = 0.0f;
|
||||
|
@ -302,7 +301,7 @@ namespace Godot
|
|||
zAxis = (zAxis - xAxis * (xAxis.Dot(zAxis)) - yAxis * (yAxis.Dot(zAxis)));
|
||||
zAxis.Normalize();
|
||||
|
||||
return Basis.CreateFromAxes(xAxis, yAxis, zAxis);
|
||||
return CreateFromAxes(xAxis, yAxis, zAxis);
|
||||
}
|
||||
|
||||
public Basis Rotated(Vector3 axis, real_t phi)
|
||||
|
@ -393,7 +392,9 @@ namespace Godot
|
|||
(_y[0] - _x[1]) * inv_s,
|
||||
s * 0.25f
|
||||
);
|
||||
} else if (_x[0] > _y[1] && _x[0] > _z[2]) {
|
||||
}
|
||||
|
||||
if (_x[0] > _y[1] && _x[0] > _z[2]) {
|
||||
real_t s = Mathf.Sqrt(_x[0] - _y[1] - _z[2] + 1.0f) * 2f;
|
||||
real_t inv_s = 1f / s;
|
||||
return new Quat(
|
||||
|
@ -402,7 +403,9 @@ namespace Godot
|
|||
(_x[2] + _z[0]) * inv_s,
|
||||
(_z[1] - _y[2]) * inv_s
|
||||
);
|
||||
} else if (_y[1] > _z[2]) {
|
||||
}
|
||||
|
||||
if (_y[1] > _z[2]) {
|
||||
real_t s = Mathf.Sqrt(-_x[0] + _y[1] - _z[2] + 1.0f) * 2f;
|
||||
real_t inv_s = 1f / s;
|
||||
return new Quat(
|
||||
|
@ -440,33 +443,33 @@ namespace Godot
|
|||
real_t yz = quat.y * zs;
|
||||
real_t zz = quat.z * zs;
|
||||
|
||||
this._x = new Vector3(1.0f - (yy + zz), xy - wz, xz + wy);
|
||||
this._y = new Vector3(xy + wz, 1.0f - (xx + zz), yz - wx);
|
||||
this._z = new Vector3(xz - wy, yz + wx, 1.0f - (xx + yy));
|
||||
_x = new Vector3(1.0f - (yy + zz), xy - wz, xz + wy);
|
||||
_y = new Vector3(xy + wz, 1.0f - (xx + zz), yz - wx);
|
||||
_z = new Vector3(xz - wy, yz + wx, 1.0f - (xx + yy));
|
||||
}
|
||||
|
||||
public Basis(Vector3 axis, real_t phi)
|
||||
{
|
||||
Vector3 axis_sq = new Vector3(axis.x * axis.x, axis.y * axis.y, axis.z * axis.z);
|
||||
|
||||
real_t cosine = Mathf.Cos( (real_t)phi);
|
||||
real_t sine = Mathf.Sin( (real_t)phi);
|
||||
real_t cosine = Mathf.Cos( phi);
|
||||
real_t sine = Mathf.Sin( phi);
|
||||
|
||||
this._x = new Vector3
|
||||
_x = new Vector3
|
||||
(
|
||||
axis_sq.x + cosine * (1.0f - axis_sq.x),
|
||||
axis.x * axis.y * (1.0f - cosine) - axis.z * sine,
|
||||
axis.z * axis.x * (1.0f - cosine) + axis.y * sine
|
||||
);
|
||||
|
||||
this._y = new Vector3
|
||||
_y = new Vector3
|
||||
(
|
||||
axis.x * axis.y * (1.0f - cosine) + axis.z * sine,
|
||||
axis_sq.y + cosine * (1.0f - axis_sq.y),
|
||||
axis.y * axis.z * (1.0f - cosine) - axis.x * sine
|
||||
);
|
||||
|
||||
this._z = new Vector3
|
||||
_z = new Vector3
|
||||
(
|
||||
axis.z * axis.x * (1.0f - cosine) - axis.y * sine,
|
||||
axis.y * axis.z * (1.0f - cosine) + axis.x * sine,
|
||||
|
@ -476,16 +479,16 @@ namespace Godot
|
|||
|
||||
public Basis(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis)
|
||||
{
|
||||
this._x = xAxis;
|
||||
this._y = yAxis;
|
||||
this._z = zAxis;
|
||||
_x = xAxis;
|
||||
_y = yAxis;
|
||||
_z = zAxis;
|
||||
}
|
||||
|
||||
public Basis(real_t xx, real_t xy, real_t xz, real_t yx, real_t yy, real_t yz, real_t zx, real_t zy, real_t zz)
|
||||
{
|
||||
this._x = new Vector3(xx, xy, xz);
|
||||
this._y = new Vector3(yx, yy, yz);
|
||||
this._z = new Vector3(zx, zy, zz);
|
||||
_x = new Vector3(xx, xy, xz);
|
||||
_y = new Vector3(yx, yy, yz);
|
||||
_z = new Vector3(zx, zy, zz);
|
||||
}
|
||||
|
||||
public static Basis operator *(Basis left, Basis right)
|
||||
|
@ -532,9 +535,9 @@ namespace Godot
|
|||
{
|
||||
return String.Format("({0}, {1}, {2})", new object[]
|
||||
{
|
||||
this._x.ToString(),
|
||||
this._y.ToString(),
|
||||
this._z.ToString()
|
||||
_x.ToString(),
|
||||
_y.ToString(),
|
||||
_z.ToString()
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -542,9 +545,9 @@ namespace Godot
|
|||
{
|
||||
return String.Format("({0}, {1}, {2})", new object[]
|
||||
{
|
||||
this._x.ToString(format),
|
||||
this._y.ToString(format),
|
||||
this._z.ToString(format)
|
||||
_x.ToString(format),
|
||||
_y.ToString(format),
|
||||
_z.ToString(format)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,8 +45,8 @@ namespace Godot
|
|||
{
|
||||
get
|
||||
{
|
||||
float max = (float) Mathf.Max(r, (float) Mathf.Max(g, b));
|
||||
float min = (float) Mathf.Min(r, (float) Mathf.Min(g, b));
|
||||
float max = Mathf.Max(r, Mathf.Max(g, b));
|
||||
float min = Mathf.Min(r, Mathf.Min(g, b));
|
||||
|
||||
float delta = max - min;
|
||||
|
||||
|
@ -79,8 +79,8 @@ namespace Godot
|
|||
{
|
||||
get
|
||||
{
|
||||
float max = (float) Mathf.Max(r, (float) Mathf.Max(g, b));
|
||||
float min = (float) Mathf.Min(r, (float) Mathf.Min(g, b));
|
||||
float max = Mathf.Max(r, Mathf.Max(g, b));
|
||||
float min = Mathf.Min(r, Mathf.Min(g, b));
|
||||
|
||||
float delta = max - min;
|
||||
|
||||
|
@ -96,7 +96,7 @@ namespace Godot
|
|||
{
|
||||
get
|
||||
{
|
||||
return (float) Mathf.Max(r, (float) Mathf.Max(g, b));
|
||||
return Mathf.Max(r, Mathf.Max(g, b));
|
||||
}
|
||||
set
|
||||
{
|
||||
|
@ -232,12 +232,10 @@ namespace Godot
|
|||
{
|
||||
return new Color(0, 0, 0, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
res.r = (r * a * sa + over.r * over.a) / res.a;
|
||||
res.g = (g * a * sa + over.g * over.a) / res.a;
|
||||
res.b = (b * a * sa + over.b * over.a) / res.a;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -269,10 +267,10 @@ namespace Godot
|
|||
{
|
||||
Color res = this;
|
||||
|
||||
res.r += (t * (b.r - this.r));
|
||||
res.g += (t * (b.g - this.g));
|
||||
res.r += (t * (b.r - r));
|
||||
res.g += (t * (b.g - g));
|
||||
res.b += (t * (b.b - this.b));
|
||||
res.a += (t * (b.a - this.a));
|
||||
res.a += (t * (b.a - a));
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -328,13 +326,13 @@ namespace Godot
|
|||
|
||||
public Color(int rgba)
|
||||
{
|
||||
this.a = (rgba & 0xFF) / 255.0f;
|
||||
a = (rgba & 0xFF) / 255.0f;
|
||||
rgba >>= 8;
|
||||
this.b = (rgba & 0xFF) / 255.0f;
|
||||
b = (rgba & 0xFF) / 255.0f;
|
||||
rgba >>= 8;
|
||||
this.g = (rgba & 0xFF) / 255.0f;
|
||||
g = (rgba & 0xFF) / 255.0f;
|
||||
rgba >>= 8;
|
||||
this.r = (rgba & 0xFF) / 255.0f;
|
||||
r = (rgba & 0xFF) / 255.0f;
|
||||
}
|
||||
|
||||
private static int _parse_col(string str, int ofs)
|
||||
|
@ -434,7 +432,7 @@ namespace Godot
|
|||
|
||||
public static Color Color8(byte r8, byte g8, byte b8, byte a8)
|
||||
{
|
||||
return new Color((float)r8 / 255f, (float)g8 / 255f, (float)b8 / 255f, (float)a8 / 255f);
|
||||
return new Color(r8 / 255f, g8 / 255f, b8 / 255f, a8 / 255f);
|
||||
}
|
||||
|
||||
public Color(string rgba)
|
||||
|
@ -514,14 +512,11 @@ namespace Godot
|
|||
{
|
||||
if (left.b == right.b)
|
||||
return (left.a < right.a);
|
||||
else
|
||||
return (left.b < right.b);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return left.g < right.g;
|
||||
}
|
||||
}
|
||||
|
||||
return left.r < right.r;
|
||||
}
|
||||
|
@ -534,14 +529,11 @@ namespace Godot
|
|||
{
|
||||
if (left.b == right.b)
|
||||
return (left.a > right.a);
|
||||
else
|
||||
return (left.b > right.b);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return left.g > right.g;
|
||||
}
|
||||
}
|
||||
|
||||
return left.r > right.r;
|
||||
}
|
||||
|
@ -568,24 +560,12 @@ namespace Godot
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("{0},{1},{2},{3}", new object[]
|
||||
{
|
||||
this.r.ToString(),
|
||||
this.g.ToString(),
|
||||
this.b.ToString(),
|
||||
this.a.ToString()
|
||||
});
|
||||
return String.Format("{0},{1},{2},{3}", r.ToString(), g.ToString(), b.ToString(), a.ToString());
|
||||
}
|
||||
|
||||
public string ToString(string format)
|
||||
{
|
||||
return String.Format("{0},{1},{2},{3}", new object[]
|
||||
{
|
||||
this.r.ToString(format),
|
||||
this.g.ToString(format),
|
||||
this.b.ToString(format),
|
||||
this.a.ToString(format)
|
||||
});
|
||||
return String.Format("{0},{1},{2},{3}", r.ToString(format), g.ToString(format), b.ToString(format), a.ToString(format));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Godot
|
|||
else if (type == typeof(void))
|
||||
sb.Append("void");
|
||||
else
|
||||
sb.Append(type.ToString());
|
||||
sb.Append(type);
|
||||
|
||||
sb.Append(" ");
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ using System;
|
|||
|
||||
namespace Godot
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method, Inherited = true)]
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
internal class GodotMethodAttribute : Attribute
|
||||
{
|
||||
private string methodName;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace Godot
|
|||
TryDequeue(task);
|
||||
}
|
||||
|
||||
return base.TryExecuteTask(task);
|
||||
return TryExecuteTask(task);
|
||||
}
|
||||
|
||||
protected sealed override bool TryDequeue(Task task)
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Godot
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
|
||||
#if REAL_T_IS_DOUBLE
|
||||
using real_t = System.Double;
|
||||
#else
|
||||
|
@ -115,7 +114,8 @@ namespace Godot
|
|||
|
||||
return Pow(s, curve);
|
||||
}
|
||||
else if (curve < 0f)
|
||||
|
||||
if (curve < 0f)
|
||||
{
|
||||
if (s < 0.5f)
|
||||
{
|
||||
|
@ -144,11 +144,9 @@ namespace Godot
|
|||
{
|
||||
return x % y;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return y - (-x % y);
|
||||
}
|
||||
}
|
||||
|
||||
public static real_t InverseLerp(real_t from, real_t to, real_t weight)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
|
||||
#if REAL_T_IS_DOUBLE
|
||||
using real_t = System.Double;
|
||||
#else
|
||||
|
@ -81,7 +80,7 @@ namespace Godot
|
|||
if (Mathf.Abs(denom) <= Mathf.Epsilon)
|
||||
return new Vector3();
|
||||
|
||||
Vector3 result = (b.normal.Cross(c.normal) * this.d) +
|
||||
Vector3 result = (b.normal.Cross(c.normal) * d) +
|
||||
(c.normal.Cross(normal) * b.d) +
|
||||
(normal.Cross(b.normal) * c.d);
|
||||
|
||||
|
@ -198,8 +197,8 @@ namespace Godot
|
|||
{
|
||||
return String.Format("({0}, {1})", new object[]
|
||||
{
|
||||
this.normal.ToString(),
|
||||
this.d.ToString()
|
||||
normal.ToString(),
|
||||
d.ToString()
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -207,8 +206,8 @@ namespace Godot
|
|||
{
|
||||
return String.Format("({0}, {1})", new object[]
|
||||
{
|
||||
this.normal.ToString(format),
|
||||
this.d.ToString(format)
|
||||
normal.ToString(format),
|
||||
d.ToString(format)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#if REAL_T_IS_DOUBLE
|
||||
using real_t = System.Double;
|
||||
#else
|
||||
|
@ -106,10 +105,10 @@ namespace Godot
|
|||
}
|
||||
public void Set(Quat q)
|
||||
{
|
||||
this.x = q.x;
|
||||
this.y = q.y;
|
||||
this.z = q.z;
|
||||
this.w = q.w;
|
||||
x = q.x;
|
||||
y = q.y;
|
||||
z = q.z;
|
||||
w = q.w;
|
||||
}
|
||||
|
||||
public Quat Slerp(Quat b, real_t t)
|
||||
|
@ -165,7 +164,7 @@ namespace Godot
|
|||
|
||||
public Quat Slerpni(Quat b, real_t t)
|
||||
{
|
||||
real_t dot = this.Dot(b);
|
||||
real_t dot = Dot(b);
|
||||
|
||||
if (Mathf.Abs(dot) > 0.9999f)
|
||||
{
|
||||
|
@ -179,17 +178,17 @@ namespace Godot
|
|||
|
||||
return new Quat
|
||||
(
|
||||
invFactor * this.x + newFactor * b.x,
|
||||
invFactor * this.y + newFactor * b.y,
|
||||
invFactor * this.z + newFactor * b.z,
|
||||
invFactor * this.w + newFactor * b.w
|
||||
invFactor * x + newFactor * b.x,
|
||||
invFactor * y + newFactor * b.y,
|
||||
invFactor * z + newFactor * b.z,
|
||||
invFactor * w + newFactor * b.w
|
||||
);
|
||||
}
|
||||
|
||||
public Vector3 Xform(Vector3 v)
|
||||
{
|
||||
Quat q = this * v;
|
||||
q *= this.Inverse();
|
||||
q *= Inverse();
|
||||
return new Vector3(q.x, q.y, q.z);
|
||||
}
|
||||
|
||||
|
@ -203,10 +202,10 @@ namespace Godot
|
|||
}
|
||||
public Quat(Quat q)
|
||||
{
|
||||
this.x = q.x;
|
||||
this.y = q.y;
|
||||
this.z = q.z;
|
||||
this.w = q.w;
|
||||
x = q.x;
|
||||
y = q.y;
|
||||
z = q.z;
|
||||
w = q.w;
|
||||
}
|
||||
|
||||
public Quat(Vector3 axis, real_t angle)
|
||||
|
@ -327,24 +326,12 @@ namespace Godot
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format("({0}, {1}, {2}, {3})", new object[]
|
||||
{
|
||||
this.x.ToString(),
|
||||
this.y.ToString(),
|
||||
this.z.ToString(),
|
||||
this.w.ToString()
|
||||
});
|
||||
return String.Format("({0}, {1}, {2}, {3})", x.ToString(), y.ToString(), z.ToString(), w.ToString());
|
||||
}
|
||||
|
||||
public string ToString(string format)
|
||||
{
|
||||
return String.Format("({0}, {1}, {2}, {3})", new object[]
|
||||
{
|
||||
this.x.ToString(format),
|
||||
this.y.ToString(format),
|
||||
this.z.ToString(format),
|
||||
this.w.ToString(format)
|
||||
});
|
||||
return String.Format("({0}, {1}, {2}, {3})", x.ToString(format), y.ToString(format), z.ToString(format), w.ToString(format));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#if REAL_T_IS_DOUBLE
|
||||
using real_t = System.Double;
|
||||
#else
|
||||
|
@ -185,17 +184,17 @@ namespace Godot
|
|||
public Rect2(Vector2 position, real_t width, real_t height)
|
||||
{
|
||||
this.position = position;
|
||||
this.size = new Vector2(width, height);
|
||||
size = new Vector2(width, height);
|
||||
}
|
||||
public Rect2(real_t x, real_t y, Vector2 size)
|
||||
{
|
||||
this.position = new Vector2(x, y);
|
||||
position = new Vector2(x, y);
|
||||
this.size = size;
|
||||
}
|
||||
public Rect2(real_t x, real_t y, real_t width, real_t height)
|
||||
{
|
||||
this.position = new Vector2(x, y);
|
||||
this.size = new Vector2(width, height);
|
||||
position = new Vector2(x, y);
|
||||
size = new Vector2(width, height);
|
||||
}
|
||||
|
||||
public static bool operator ==(Rect2 left, Rect2 right)
|
||||
|
@ -232,8 +231,8 @@ namespace Godot
|
|||
{
|
||||
return String.Format("({0}, {1})", new object[]
|
||||
{
|
||||
this.position.ToString(),
|
||||
this.size.ToString()
|
||||
position.ToString(),
|
||||
size.ToString()
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -241,8 +240,8 @@ namespace Godot
|
|||
{
|
||||
return String.Format("({0}, {1})", new object[]
|
||||
{
|
||||
this.position.ToString(format),
|
||||
this.size.ToString(format)
|
||||
position.ToString(format),
|
||||
size.ToString(format)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,9 +4,6 @@ namespace Godot
|
|||
{
|
||||
[AttributeUsage(AttributeTargets.Delegate)]
|
||||
public class SignalAttribute : Attribute
|
||||
{
|
||||
public SignalAttribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,15 +4,15 @@ namespace Godot
|
|||
{
|
||||
public class SignalAwaiter : IAwaiter<object[]>, IAwaitable<object[]>
|
||||
{
|
||||
private bool completed = false;
|
||||
private object[] result = null;
|
||||
private Action action = null;
|
||||
private bool completed;
|
||||
private object[] result;
|
||||
private Action action;
|
||||
|
||||
public SignalAwaiter(Godot.Object source, string signal, Godot.Object target)
|
||||
public SignalAwaiter(Object source, string signal, Object target)
|
||||
{
|
||||
NativeCalls.godot_icall_Object_connect_signal_awaiter(
|
||||
Godot.Object.GetPtr(source),
|
||||
signal, Godot.Object.GetPtr(target), this
|
||||
Object.GetPtr(source),
|
||||
signal, Object.GetPtr(target), this
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
//using System;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
@ -43,12 +44,10 @@ namespace Godot
|
|||
{
|
||||
return instance.Substring(prev, i - prev);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
count++;
|
||||
prev = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
@ -178,13 +177,13 @@ namespace Godot
|
|||
{
|
||||
if (to[to_idx] == 0 && instance[instance_idx] == 0)
|
||||
return 0; // We're equal
|
||||
else if (instance[instance_idx] == 0)
|
||||
if (instance[instance_idx] == 0)
|
||||
return -1; // If this is empty, and the other one is not, then we're less... I think?
|
||||
else if (to[to_idx] == 0)
|
||||
if (to[to_idx] == 0)
|
||||
return 1; // Otherwise the other one is smaller...
|
||||
else if (instance[instance_idx] < to[to_idx]) // More than
|
||||
if (instance[instance_idx] < to[to_idx]) // More than
|
||||
return -1;
|
||||
else if (instance[instance_idx] > to[to_idx]) // Less than
|
||||
if (instance[instance_idx] > to[to_idx]) // Less than
|
||||
return 1;
|
||||
|
||||
instance_idx++;
|
||||
|
@ -312,7 +311,7 @@ namespace Godot
|
|||
int hashv = 5381;
|
||||
int c;
|
||||
|
||||
while ((c = (int)instance[index++]) != 0)
|
||||
while ((c = instance[index++]) != 0)
|
||||
hashv = ((hashv << 5) + hashv) + c; // hash * 33 + c
|
||||
|
||||
return hashv;
|
||||
|
@ -610,13 +609,13 @@ namespace Godot
|
|||
{
|
||||
if (to[to_idx] == 0 && instance[instance_idx] == 0)
|
||||
return 0; // We're equal
|
||||
else if (instance[instance_idx] == 0)
|
||||
if (instance[instance_idx] == 0)
|
||||
return -1; // If this is empty, and the other one is not, then we're less... I think?
|
||||
else if (to[to_idx] == 0)
|
||||
if (to[to_idx] == 0)
|
||||
return 1; // Otherwise the other one is smaller..
|
||||
else if (char.ToUpper(instance[instance_idx]) < char.ToUpper(to[to_idx])) // More than
|
||||
if (char.ToUpper(instance[instance_idx]) < char.ToUpper(to[to_idx])) // More than
|
||||
return -1;
|
||||
else if (char.ToUpper(instance[instance_idx]) > char.ToUpper(to[to_idx])) // Less than
|
||||
if (char.ToUpper(instance[instance_idx]) > char.ToUpper(to[to_idx])) // Less than
|
||||
return 1;
|
||||
|
||||
instance_idx++;
|
||||
|
@ -724,7 +723,6 @@ namespace Godot
|
|||
{
|
||||
if (instance.Length > 0 && instance[instance.Length - 1] == '/')
|
||||
return instance + file;
|
||||
else
|
||||
return instance + "/" + file;
|
||||
}
|
||||
|
||||
|
@ -832,7 +830,7 @@ namespace Godot
|
|||
// </summary>
|
||||
public static string[] Split(this string instance, string divisor, bool allow_empty = true)
|
||||
{
|
||||
return instance.Split(new string[] { divisor }, StringSplitOptions.RemoveEmptyEntries);
|
||||
return instance.Split(new[] { divisor }, StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
// <summary>
|
||||
|
@ -878,14 +876,11 @@ namespace Godot
|
|||
{
|
||||
if (right)
|
||||
return instance.Trim(non_printable);
|
||||
else
|
||||
return instance.TrimStart(non_printable);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return instance.TrimEnd(non_printable);
|
||||
}
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// Return part of the string from the position [code]from[/code], with length [code]len[/code].
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#if REAL_T_IS_DOUBLE
|
||||
using real_t = System.Double;
|
||||
#else
|
||||
|
@ -107,13 +106,13 @@ namespace Godot
|
|||
// Constructors
|
||||
public Transform(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis, Vector3 origin)
|
||||
{
|
||||
this.basis = Basis.CreateFromAxes(xAxis, yAxis, zAxis);
|
||||
basis = Basis.CreateFromAxes(xAxis, yAxis, zAxis);
|
||||
this.origin = origin;
|
||||
}
|
||||
|
||||
public Transform(Quat quat, Vector3 origin)
|
||||
{
|
||||
this.basis = new Basis(quat);
|
||||
basis = new Basis(quat);
|
||||
this.origin = origin;
|
||||
}
|
||||
|
||||
|
@ -164,8 +163,8 @@ namespace Godot
|
|||
{
|
||||
return String.Format("{0} - {1}", new object[]
|
||||
{
|
||||
this.basis.ToString(),
|
||||
this.origin.ToString()
|
||||
basis.ToString(),
|
||||
origin.ToString()
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -173,8 +172,8 @@ namespace Godot
|
|||
{
|
||||
return String.Format("{0} - {1}", new object[]
|
||||
{
|
||||
this.basis.ToString(format),
|
||||
this.origin.ToString(format)
|
||||
basis.ToString(format),
|
||||
origin.ToString(format)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#if REAL_T_IS_DOUBLE
|
||||
using real_t = System.Double;
|
||||
#else
|
||||
|
@ -269,22 +268,22 @@ namespace Godot
|
|||
// Constructors
|
||||
public Transform2D(Vector2 xAxis, Vector2 yAxis, Vector2 origin)
|
||||
{
|
||||
this.x = xAxis;
|
||||
this.y = yAxis;
|
||||
this.o = origin;
|
||||
x = xAxis;
|
||||
y = yAxis;
|
||||
o = origin;
|
||||
}
|
||||
|
||||
public Transform2D(real_t xx, real_t xy, real_t yx, real_t yy, real_t ox, real_t oy)
|
||||
{
|
||||
this.x = new Vector2(xx, xy);
|
||||
this.y = new Vector2(yx, yy);
|
||||
this.o = new Vector2(ox, oy);
|
||||
x = new Vector2(xx, xy);
|
||||
y = new Vector2(yx, yy);
|
||||
o = new Vector2(ox, oy);
|
||||
}
|
||||
|
||||
public Transform2D(real_t rot, Vector2 pos)
|
||||
{
|
||||
real_t cr = Mathf.Cos( (real_t)rot);
|
||||
real_t sr = Mathf.Sin( (real_t)rot);
|
||||
real_t cr = Mathf.Cos(rot);
|
||||
real_t sr = Mathf.Sin(rot);
|
||||
x.x = cr;
|
||||
y.y = cr;
|
||||
x.y = -sr;
|
||||
|
@ -345,9 +344,9 @@ namespace Godot
|
|||
{
|
||||
return String.Format("({0}, {1}, {2})", new object[]
|
||||
{
|
||||
this.x.ToString(),
|
||||
this.y.ToString(),
|
||||
this.o.ToString()
|
||||
x.ToString(),
|
||||
y.ToString(),
|
||||
o.ToString()
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -355,9 +354,9 @@ namespace Godot
|
|||
{
|
||||
return String.Format("({0}, {1}, {2})", new object[]
|
||||
{
|
||||
this.x.ToString(format),
|
||||
this.y.ToString(format),
|
||||
this.o.ToString(format)
|
||||
x.ToString(format),
|
||||
y.ToString(format),
|
||||
o.ToString(format)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// file: core/math/math_2d.h
|
||||
// commit: 7ad14e7a3e6f87ddc450f7e34621eb5200808451
|
||||
// file: core/math/math_2d.cpp
|
||||
// commit: 7ad14e7a3e6f87ddc450f7e34621eb5200808451
|
||||
// file: core/variant_call.cpp
|
||||
// commit: 5ad9be4c24e9d7dc5672fdc42cea896622fe5685
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
#if REAL_T_IS_DOUBLE
|
||||
using real_t = System.Double;
|
||||
#else
|
||||
|
@ -102,7 +100,7 @@ namespace Godot
|
|||
public Vector2 Clamped(real_t length)
|
||||
{
|
||||
Vector2 v = this;
|
||||
real_t l = this.Length();
|
||||
real_t l = Length();
|
||||
|
||||
if (l > 0 && length < l)
|
||||
{
|
||||
|
@ -199,8 +197,8 @@ namespace Godot
|
|||
}
|
||||
public void Set(Vector2 v)
|
||||
{
|
||||
this.x = v.x;
|
||||
this.y = v.y;
|
||||
x = v.x;
|
||||
y = v.y;
|
||||
}
|
||||
|
||||
public Vector2 Slide(Vector2 n)
|
||||
|
@ -244,8 +242,8 @@ namespace Godot
|
|||
}
|
||||
public Vector2(Vector2 v)
|
||||
{
|
||||
this.x = v.x;
|
||||
this.y = v.y;
|
||||
x = v.x;
|
||||
y = v.y;
|
||||
}
|
||||
|
||||
public static Vector2 operator +(Vector2 left, Vector2 right)
|
||||
|
@ -320,11 +318,9 @@ namespace Godot
|
|||
{
|
||||
return left.y < right.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return left.x < right.x;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool operator >(Vector2 left, Vector2 right)
|
||||
{
|
||||
|
@ -332,11 +328,9 @@ namespace Godot
|
|||
{
|
||||
return left.y > right.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return left.x > right.x;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool operator <=(Vector2 left, Vector2 right)
|
||||
{
|
||||
|
@ -344,11 +338,9 @@ namespace Godot
|
|||
{
|
||||
return left.y <= right.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return left.x <= right.x;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool operator >=(Vector2 left, Vector2 right)
|
||||
{
|
||||
|
@ -356,11 +348,9 @@ namespace Godot
|
|||
{
|
||||
return left.y >= right.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return left.x >= right.x;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
|
@ -386,8 +376,8 @@ namespace Godot
|
|||
{
|
||||
return String.Format("({0}, {1})", new object[]
|
||||
{
|
||||
this.x.ToString(),
|
||||
this.y.ToString()
|
||||
x.ToString(),
|
||||
y.ToString()
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -395,8 +385,8 @@ namespace Godot
|
|||
{
|
||||
return String.Format("({0}, {1})", new object[]
|
||||
{
|
||||
this.x.ToString(format),
|
||||
this.y.ToString(format)
|
||||
x.ToString(format),
|
||||
y.ToString(format)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// file: core/math/vector3.h
|
||||
// commit: bd282ff43f23fe845f29a3e25c8efc01bd65ffb0
|
||||
// file: core/math/vector3.cpp
|
||||
// commit: 7ad14e7a3e6f87ddc450f7e34621eb5200808451
|
||||
// file: core/variant_call.cpp
|
||||
// commit: 5ad9be4c24e9d7dc5672fdc42cea896622fe5685
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
#if REAL_T_IS_DOUBLE
|
||||
using real_t = System.Double;
|
||||
#else
|
||||
|
@ -67,7 +65,7 @@ namespace Godot
|
|||
|
||||
internal void Normalize()
|
||||
{
|
||||
real_t length = this.Length();
|
||||
real_t length = Length();
|
||||
|
||||
if (length == 0f)
|
||||
{
|
||||
|
@ -234,9 +232,9 @@ namespace Godot
|
|||
}
|
||||
public void Set(Vector3 v)
|
||||
{
|
||||
this.x = v.x;
|
||||
this.y = v.y;
|
||||
this.z = v.z;
|
||||
x = v.x;
|
||||
y = v.y;
|
||||
z = v.z;
|
||||
}
|
||||
|
||||
public Vector3 Slide(Vector3 n)
|
||||
|
@ -294,9 +292,9 @@ namespace Godot
|
|||
}
|
||||
public Vector3(Vector3 v)
|
||||
{
|
||||
this.x = v.x;
|
||||
this.y = v.y;
|
||||
this.z = v.z;
|
||||
x = v.x;
|
||||
y = v.y;
|
||||
z = v.z;
|
||||
}
|
||||
|
||||
public static Vector3 operator +(Vector3 left, Vector3 right)
|
||||
|
@ -379,7 +377,6 @@ namespace Godot
|
|||
{
|
||||
if (left.y == right.y)
|
||||
return left.z < right.z;
|
||||
else
|
||||
return left.y < right.y;
|
||||
}
|
||||
|
||||
|
@ -392,7 +389,6 @@ namespace Godot
|
|||
{
|
||||
if (left.y == right.y)
|
||||
return left.z > right.z;
|
||||
else
|
||||
return left.y > right.y;
|
||||
}
|
||||
|
||||
|
@ -405,7 +401,6 @@ namespace Godot
|
|||
{
|
||||
if (left.y == right.y)
|
||||
return left.z <= right.z;
|
||||
else
|
||||
return left.y < right.y;
|
||||
}
|
||||
|
||||
|
@ -418,7 +413,6 @@ namespace Godot
|
|||
{
|
||||
if (left.y == right.y)
|
||||
return left.z >= right.z;
|
||||
else
|
||||
return left.y > right.y;
|
||||
}
|
||||
|
||||
|
@ -449,9 +443,9 @@ namespace Godot
|
|||
{
|
||||
return String.Format("({0}, {1}, {2})", new object[]
|
||||
{
|
||||
this.x.ToString(),
|
||||
this.y.ToString(),
|
||||
this.z.ToString()
|
||||
x.ToString(),
|
||||
y.ToString(),
|
||||
z.ToString()
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -459,9 +453,9 @@ namespace Godot
|
|||
{
|
||||
return String.Format("({0}, {1}, {2})", new object[]
|
||||
{
|
||||
this.x.ToString(format),
|
||||
this.y.ToString(format),
|
||||
this.z.ToString(format)
|
||||
x.ToString(format),
|
||||
y.ToString(format),
|
||||
z.ToString(format)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue