Mono: Use PascalCase in core types.
This commit is contained in:
parent
08e6590fd6
commit
e69dd3c712
13 changed files with 483 additions and 483 deletions
|
@ -38,7 +38,7 @@ namespace Godot
|
|||
}
|
||||
}
|
||||
|
||||
public bool encloses(AABB with)
|
||||
public bool Encloses(AABB with)
|
||||
{
|
||||
Vector3 src_min = position;
|
||||
Vector3 src_max = position + size;
|
||||
|
@ -53,7 +53,7 @@ namespace Godot
|
|||
(src_max.z > dst_max.z));
|
||||
}
|
||||
|
||||
public AABB expand(Vector3 to_point)
|
||||
public AABB Expand(Vector3 to_point)
|
||||
{
|
||||
Vector3 begin = position;
|
||||
Vector3 end = position + size;
|
||||
|
@ -75,12 +75,12 @@ namespace Godot
|
|||
return new AABB(begin, end - begin);
|
||||
}
|
||||
|
||||
public float get_area()
|
||||
public float GetArea()
|
||||
{
|
||||
return size.x * size.y * size.z;
|
||||
}
|
||||
|
||||
public Vector3 get_endpoint(int idx)
|
||||
public Vector3 GetEndpoint(int idx)
|
||||
{
|
||||
switch (idx)
|
||||
{
|
||||
|
@ -105,7 +105,7 @@ namespace Godot
|
|||
}
|
||||
}
|
||||
|
||||
public Vector3 get_longest_axis()
|
||||
public Vector3 GetLongestAxis()
|
||||
{
|
||||
Vector3 axis = new Vector3(1f, 0f, 0f);
|
||||
float max_size = size.x;
|
||||
|
@ -125,7 +125,7 @@ namespace Godot
|
|||
return axis;
|
||||
}
|
||||
|
||||
public Vector3.Axis get_longest_axis_index()
|
||||
public Vector3.Axis GetLongestAxisIndex()
|
||||
{
|
||||
Vector3.Axis axis = Vector3.Axis.X;
|
||||
float max_size = size.x;
|
||||
|
@ -145,7 +145,7 @@ namespace Godot
|
|||
return axis;
|
||||
}
|
||||
|
||||
public float get_longest_axis_size()
|
||||
public float GetLongestAxisSize()
|
||||
{
|
||||
float max_size = size.x;
|
||||
|
||||
|
@ -158,7 +158,7 @@ namespace Godot
|
|||
return max_size;
|
||||
}
|
||||
|
||||
public Vector3 get_shortest_axis()
|
||||
public Vector3 GetShortestAxis()
|
||||
{
|
||||
Vector3 axis = new Vector3(1f, 0f, 0f);
|
||||
float max_size = size.x;
|
||||
|
@ -178,7 +178,7 @@ namespace Godot
|
|||
return axis;
|
||||
}
|
||||
|
||||
public Vector3.Axis get_shortest_axis_index()
|
||||
public Vector3.Axis GetShortestAxisIndex()
|
||||
{
|
||||
Vector3.Axis axis = Vector3.Axis.X;
|
||||
float max_size = size.x;
|
||||
|
@ -198,7 +198,7 @@ namespace Godot
|
|||
return axis;
|
||||
}
|
||||
|
||||
public float get_shortest_axis_size()
|
||||
public float GetShortestAxisSize()
|
||||
{
|
||||
float max_size = size.x;
|
||||
|
||||
|
@ -211,7 +211,7 @@ namespace Godot
|
|||
return max_size;
|
||||
}
|
||||
|
||||
public Vector3 get_support(Vector3 dir)
|
||||
public Vector3 GetSupport(Vector3 dir)
|
||||
{
|
||||
Vector3 half_extents = size * 0.5f;
|
||||
Vector3 ofs = position + half_extents;
|
||||
|
@ -222,7 +222,7 @@ namespace Godot
|
|||
(dir.z > 0f) ? -half_extents.z : half_extents.z);
|
||||
}
|
||||
|
||||
public AABB grow(float by)
|
||||
public AABB Grow(float by)
|
||||
{
|
||||
AABB res = this;
|
||||
|
||||
|
@ -236,17 +236,17 @@ namespace Godot
|
|||
return res;
|
||||
}
|
||||
|
||||
public bool has_no_area()
|
||||
public bool HasNoArea()
|
||||
{
|
||||
return size.x <= 0f || size.y <= 0f || size.z <= 0f;
|
||||
}
|
||||
|
||||
public bool has_no_surface()
|
||||
public bool HasNoSurface()
|
||||
{
|
||||
return size.x <= 0f && size.y <= 0f && size.z <= 0f;
|
||||
}
|
||||
|
||||
public bool has_point(Vector3 point)
|
||||
public bool HasPoint(Vector3 point)
|
||||
{
|
||||
if (point.x < position.x)
|
||||
return false;
|
||||
|
@ -264,7 +264,7 @@ namespace Godot
|
|||
return true;
|
||||
}
|
||||
|
||||
public AABB intersection(AABB with)
|
||||
public AABB Intersection(AABB with)
|
||||
{
|
||||
Vector3 src_min = position;
|
||||
Vector3 src_max = position + size;
|
||||
|
@ -306,7 +306,7 @@ namespace Godot
|
|||
return new AABB(min, max - min);
|
||||
}
|
||||
|
||||
public bool intersects(AABB with)
|
||||
public bool Intersects(AABB with)
|
||||
{
|
||||
if (position.x >= (with.position.x + with.size.x))
|
||||
return false;
|
||||
|
@ -324,7 +324,7 @@ namespace Godot
|
|||
return true;
|
||||
}
|
||||
|
||||
public bool intersects_plane(Plane plane)
|
||||
public bool IntersectsPlane(Plane plane)
|
||||
{
|
||||
Vector3[] points =
|
||||
{
|
||||
|
@ -343,7 +343,7 @@ namespace Godot
|
|||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
if (plane.distance_to(points[i]) > 0)
|
||||
if (plane.DistanceTo(points[i]) > 0)
|
||||
over = true;
|
||||
else
|
||||
under = true;
|
||||
|
@ -352,7 +352,7 @@ namespace Godot
|
|||
return under && over;
|
||||
}
|
||||
|
||||
public bool intersects_segment(Vector3 from, Vector3 to)
|
||||
public bool IntersectsSegment(Vector3 from, Vector3 to)
|
||||
{
|
||||
float min = 0f;
|
||||
float max = 1f;
|
||||
|
@ -398,7 +398,7 @@ namespace Godot
|
|||
return true;
|
||||
}
|
||||
|
||||
public AABB merge(AABB with)
|
||||
public AABB Merge(AABB with)
|
||||
{
|
||||
Vector3 beg_1 = position;
|
||||
Vector3 beg_2 = with.position;
|
||||
|
|
|
@ -56,9 +56,9 @@ namespace Godot
|
|||
{
|
||||
return new Vector3
|
||||
(
|
||||
new Vector3(this[0, 0], this[1, 0], this[2, 0]).length(),
|
||||
new Vector3(this[0, 1], this[1, 1], this[2, 1]).length(),
|
||||
new Vector3(this[0, 2], this[1, 2], this[2, 2]).length()
|
||||
new Vector3(this[0, 0], this[1, 0], this[2, 0]).Length(),
|
||||
new Vector3(this[0, 1], this[1, 1], this[2, 1]).Length(),
|
||||
new Vector3(this[0, 2], this[1, 2], this[2, 2]).Length()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ namespace Godot
|
|||
}
|
||||
}
|
||||
|
||||
internal static Basis create_from_axes(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis)
|
||||
internal static Basis CreateFromAxes(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis)
|
||||
{
|
||||
return new Basis
|
||||
(
|
||||
|
@ -143,21 +143,21 @@ namespace Godot
|
|||
);
|
||||
}
|
||||
|
||||
public float determinant()
|
||||
public float Determinant()
|
||||
{
|
||||
return this[0, 0] * (this[1, 1] * this[2, 2] - this[2, 1] * this[1, 2]) -
|
||||
this[1, 0] * (this[0, 1] * this[2, 2] - this[2, 1] * this[0, 2]) +
|
||||
this[2, 0] * (this[0, 1] * this[1, 2] - this[1, 1] * this[0, 2]);
|
||||
}
|
||||
|
||||
public Vector3 get_axis(int axis)
|
||||
public Vector3 GetAxis(int axis)
|
||||
{
|
||||
return new Vector3(this[0, axis], this[1, axis], this[2, axis]);
|
||||
}
|
||||
|
||||
public Vector3 get_euler()
|
||||
public Vector3 GetEuler()
|
||||
{
|
||||
Basis m = this.orthonormalized();
|
||||
Basis m = this.Orthonormalized();
|
||||
|
||||
Vector3 euler;
|
||||
euler.z = 0.0f;
|
||||
|
@ -169,26 +169,26 @@ namespace Godot
|
|||
{
|
||||
if (mxy > -1.0f)
|
||||
{
|
||||
euler.x = Mathf.asin(-mxy);
|
||||
euler.y = Mathf.atan2(m.x[2], m.z[2]);
|
||||
euler.z = Mathf.atan2(m.y[0], m.y[1]);
|
||||
euler.x = Mathf.Asin(-mxy);
|
||||
euler.y = Mathf.Atan2(m.x[2], m.z[2]);
|
||||
euler.z = Mathf.Atan2(m.y[0], m.y[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
euler.x = Mathf.PI * 0.5f;
|
||||
euler.y = -Mathf.atan2(-m.x[1], m.x[0]);
|
||||
euler.y = -Mathf.Atan2(-m.x[1], m.x[0]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
euler.x = -Mathf.PI * 0.5f;
|
||||
euler.y = -Mathf.atan2(m.x[1], m.x[0]);
|
||||
euler.y = -Mathf.Atan2(m.x[1], m.x[0]);
|
||||
}
|
||||
|
||||
return euler;
|
||||
}
|
||||
|
||||
public int get_orthogonal_index()
|
||||
public int GetOrthogonalIndex()
|
||||
{
|
||||
Basis orth = this;
|
||||
|
||||
|
@ -218,7 +218,7 @@ namespace Godot
|
|||
return 0;
|
||||
}
|
||||
|
||||
public Basis inverse()
|
||||
public Basis Inverse()
|
||||
{
|
||||
Basis inv = this;
|
||||
|
||||
|
@ -259,27 +259,27 @@ namespace Godot
|
|||
return inv;
|
||||
}
|
||||
|
||||
public Basis orthonormalized()
|
||||
public Basis Orthonormalized()
|
||||
{
|
||||
Vector3 xAxis = get_axis(0);
|
||||
Vector3 yAxis = get_axis(1);
|
||||
Vector3 zAxis = get_axis(2);
|
||||
Vector3 xAxis = GetAxis(0);
|
||||
Vector3 yAxis = GetAxis(1);
|
||||
Vector3 zAxis = GetAxis(2);
|
||||
|
||||
xAxis.normalize();
|
||||
yAxis = (yAxis - xAxis * (xAxis.dot(yAxis)));
|
||||
yAxis.normalize();
|
||||
zAxis = (zAxis - xAxis * (xAxis.dot(zAxis)) - yAxis * (yAxis.dot(zAxis)));
|
||||
zAxis.normalize();
|
||||
xAxis.Normalize();
|
||||
yAxis = (yAxis - xAxis * (xAxis.Dot(yAxis)));
|
||||
yAxis.Normalize();
|
||||
zAxis = (zAxis - xAxis * (xAxis.Dot(zAxis)) - yAxis * (yAxis.Dot(zAxis)));
|
||||
zAxis.Normalize();
|
||||
|
||||
return Basis.create_from_axes(xAxis, yAxis, zAxis);
|
||||
return Basis.CreateFromAxes(xAxis, yAxis, zAxis);
|
||||
}
|
||||
|
||||
public Basis rotated(Vector3 axis, float phi)
|
||||
public Basis Rotated(Vector3 axis, float phi)
|
||||
{
|
||||
return new Basis(axis, phi) * this;
|
||||
}
|
||||
|
||||
public Basis scaled(Vector3 scale)
|
||||
public Basis Scaled(Vector3 scale)
|
||||
{
|
||||
Basis m = this;
|
||||
|
||||
|
@ -296,22 +296,22 @@ namespace Godot
|
|||
return m;
|
||||
}
|
||||
|
||||
public float tdotx(Vector3 with)
|
||||
public float Tdotx(Vector3 with)
|
||||
{
|
||||
return this[0, 0] * with[0] + this[1, 0] * with[1] + this[2, 0] * with[2];
|
||||
}
|
||||
|
||||
public float tdoty(Vector3 with)
|
||||
public float Tdoty(Vector3 with)
|
||||
{
|
||||
return this[0, 1] * with[0] + this[1, 1] * with[1] + this[2, 1] * with[2];
|
||||
}
|
||||
|
||||
public float tdotz(Vector3 with)
|
||||
public float Tdotz(Vector3 with)
|
||||
{
|
||||
return this[0, 2] * with[0] + this[1, 2] * with[1] + this[2, 2] * with[2];
|
||||
}
|
||||
|
||||
public Basis transposed()
|
||||
public Basis Transposed()
|
||||
{
|
||||
Basis tr = this;
|
||||
|
||||
|
@ -330,17 +330,17 @@ namespace Godot
|
|||
return tr;
|
||||
}
|
||||
|
||||
public Vector3 xform(Vector3 v)
|
||||
public Vector3 Xform(Vector3 v)
|
||||
{
|
||||
return new Vector3
|
||||
(
|
||||
this[0].dot(v),
|
||||
this[1].dot(v),
|
||||
this[2].dot(v)
|
||||
this[0].Dot(v),
|
||||
this[1].Dot(v),
|
||||
this[2].Dot(v)
|
||||
);
|
||||
}
|
||||
|
||||
public Vector3 xform_inv(Vector3 v)
|
||||
public Vector3 XformInv(Vector3 v)
|
||||
{
|
||||
return new Vector3
|
||||
(
|
||||
|
@ -354,7 +354,7 @@ namespace Godot
|
|||
float trace = x[0] + y[1] + z[2];
|
||||
|
||||
if (trace > 0.0f) {
|
||||
float s = Mathf.sqrt(trace + 1.0f) * 2f;
|
||||
float s = Mathf.Sqrt(trace + 1.0f) * 2f;
|
||||
float inv_s = 1f / s;
|
||||
return new Quat(
|
||||
(z[1] - y[2]) * inv_s,
|
||||
|
@ -363,7 +363,7 @@ namespace Godot
|
|||
s * 0.25f
|
||||
);
|
||||
} else if (x[0] > y[1] && x[0] > z[2]) {
|
||||
float s = Mathf.sqrt(x[0] - y[1] - z[2] + 1.0f) * 2f;
|
||||
float s = Mathf.Sqrt(x[0] - y[1] - z[2] + 1.0f) * 2f;
|
||||
float inv_s = 1f / s;
|
||||
return new Quat(
|
||||
s * 0.25f,
|
||||
|
@ -372,7 +372,7 @@ namespace Godot
|
|||
(z[1] - y[2]) * inv_s
|
||||
);
|
||||
} else if (y[1] > z[2]) {
|
||||
float s = Mathf.sqrt(-x[0] + y[1] - z[2] + 1.0f) * 2f;
|
||||
float s = Mathf.Sqrt(-x[0] + y[1] - z[2] + 1.0f) * 2f;
|
||||
float inv_s = 1f / s;
|
||||
return new Quat(
|
||||
(x[1] + y[0]) * inv_s,
|
||||
|
@ -381,7 +381,7 @@ namespace Godot
|
|||
(x[2] - z[0]) * inv_s
|
||||
);
|
||||
} else {
|
||||
float s = Mathf.sqrt(-x[0] - y[1] + z[2] + 1.0f) * 2f;
|
||||
float s = Mathf.Sqrt(-x[0] - y[1] + z[2] + 1.0f) * 2f;
|
||||
float inv_s = 1f / s;
|
||||
return new Quat(
|
||||
(x[2] + z[0]) * inv_s,
|
||||
|
@ -394,7 +394,7 @@ namespace Godot
|
|||
|
||||
public Basis(Quat quat)
|
||||
{
|
||||
float s = 2.0f / quat.length_squared();
|
||||
float s = 2.0f / quat.LengthSquared();
|
||||
|
||||
float xs = quat.x * s;
|
||||
float ys = quat.y * s;
|
||||
|
@ -418,8 +418,8 @@ namespace Godot
|
|||
{
|
||||
Vector3 axis_sq = new Vector3(axis.x * axis.x, axis.y * axis.y, axis.z * axis.z);
|
||||
|
||||
float cosine = Mathf.cos(phi);
|
||||
float sine = Mathf.sin(phi);
|
||||
float cosine = Mathf.Cos(phi);
|
||||
float sine = Mathf.Sin(phi);
|
||||
|
||||
this.x = new Vector3
|
||||
(
|
||||
|
@ -461,9 +461,9 @@ namespace Godot
|
|||
{
|
||||
return new Basis
|
||||
(
|
||||
right.tdotx(left[0]), right.tdoty(left[0]), right.tdotz(left[0]),
|
||||
right.tdotx(left[1]), right.tdoty(left[1]), right.tdotz(left[1]),
|
||||
right.tdotx(left[2]), right.tdoty(left[2]), right.tdotz(left[2])
|
||||
right.Tdotx(left[0]), right.Tdoty(left[0]), right.Tdotz(left[0]),
|
||||
right.Tdotx(left[1]), right.Tdoty(left[1]), right.Tdotz(left[1]),
|
||||
right.Tdotx(left[2]), right.Tdoty(left[2]), right.Tdotz(left[2])
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,8 +45,8 @@ namespace Godot
|
|||
{
|
||||
get
|
||||
{
|
||||
float max = Mathf.max(r, Mathf.max(g, b));
|
||||
float min = Mathf.min(r, 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;
|
||||
|
||||
|
@ -71,7 +71,7 @@ namespace Godot
|
|||
}
|
||||
set
|
||||
{
|
||||
this = from_hsv(value, s, v);
|
||||
this = FromHsv(value, s, v);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,8 +79,8 @@ namespace Godot
|
|||
{
|
||||
get
|
||||
{
|
||||
float max = Mathf.max(r, Mathf.max(g, b));
|
||||
float min = Mathf.min(r, 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;
|
||||
|
||||
|
@ -88,7 +88,7 @@ namespace Godot
|
|||
}
|
||||
set
|
||||
{
|
||||
this = from_hsv(h, value, v);
|
||||
this = FromHsv(h, value, v);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,11 +96,11 @@ namespace Godot
|
|||
{
|
||||
get
|
||||
{
|
||||
return Mathf.max(r, Mathf.max(g, b));
|
||||
return Mathf.Max(r, Mathf.Max(g, b));
|
||||
}
|
||||
set
|
||||
{
|
||||
this = from_hsv(h, s, value);
|
||||
this = FromHsv(h, s, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -154,10 +154,10 @@ namespace Godot
|
|||
}
|
||||
}
|
||||
|
||||
public static void to_hsv(Color color, out float hue, out float saturation, out float value)
|
||||
public static void ToHsv(Color color, out float hue, out float saturation, out float value)
|
||||
{
|
||||
int max = Mathf.max(color.r8, Mathf.max(color.g8, color.b8));
|
||||
int min = Mathf.min(color.r8, Mathf.min(color.g8, color.b8));
|
||||
int max = Mathf.Max(color.r8, Mathf.Max(color.g8, color.b8));
|
||||
int min = Mathf.Min(color.r8, Mathf.Min(color.g8, color.b8));
|
||||
|
||||
float delta = max - min;
|
||||
|
||||
|
@ -184,7 +184,7 @@ namespace Godot
|
|||
value = max / 255f;
|
||||
}
|
||||
|
||||
public static Color from_hsv(float hue, float saturation, float value, float alpha = 1.0f)
|
||||
public static Color FromHsv(float hue, float saturation, float value, float alpha = 1.0f)
|
||||
{
|
||||
if (saturation == 0)
|
||||
{
|
||||
|
@ -221,7 +221,7 @@ namespace Godot
|
|||
}
|
||||
}
|
||||
|
||||
public Color blend(Color over)
|
||||
public Color Blend(Color over)
|
||||
{
|
||||
Color res;
|
||||
|
||||
|
@ -242,7 +242,7 @@ namespace Godot
|
|||
return res;
|
||||
}
|
||||
|
||||
public Color contrasted()
|
||||
public Color Contrasted()
|
||||
{
|
||||
return new Color(
|
||||
(r + 0.5f) % 1.0f,
|
||||
|
@ -251,12 +251,12 @@ namespace Godot
|
|||
);
|
||||
}
|
||||
|
||||
public float gray()
|
||||
public float Gray()
|
||||
{
|
||||
return (r + g + b) / 3.0f;
|
||||
}
|
||||
|
||||
public Color inverted()
|
||||
public Color Inverted()
|
||||
{
|
||||
return new Color(
|
||||
1.0f - r,
|
||||
|
@ -265,7 +265,7 @@ namespace Godot
|
|||
);
|
||||
}
|
||||
|
||||
public Color linear_interpolate(Color b, float t)
|
||||
public Color LinearInterpolate(Color b, float t)
|
||||
{
|
||||
Color res = this;
|
||||
|
||||
|
@ -277,7 +277,7 @@ namespace Godot
|
|||
return res;
|
||||
}
|
||||
|
||||
public int to_32()
|
||||
public int To32()
|
||||
{
|
||||
int c = (byte)(a * 255);
|
||||
c <<= 8;
|
||||
|
@ -290,7 +290,7 @@ namespace Godot
|
|||
return c;
|
||||
}
|
||||
|
||||
public int to_ARGB32()
|
||||
public int ToArgb32()
|
||||
{
|
||||
int c = (byte)(a * 255);
|
||||
c <<= 8;
|
||||
|
@ -303,7 +303,7 @@ namespace Godot
|
|||
return c;
|
||||
}
|
||||
|
||||
public string to_html(bool include_alpha = true)
|
||||
public string ToHtml(bool include_alpha = true)
|
||||
{
|
||||
String txt = string.Empty;
|
||||
|
||||
|
@ -375,7 +375,7 @@ namespace Godot
|
|||
|
||||
private String _to_hex(float val)
|
||||
{
|
||||
int v = (int)Mathf.clamp(val * 255.0f, 0, 255);
|
||||
int v = (int)Mathf.Clamp(val * 255.0f, 0, 255);
|
||||
|
||||
string ret = string.Empty;
|
||||
|
||||
|
@ -396,7 +396,7 @@ namespace Godot
|
|||
return ret;
|
||||
}
|
||||
|
||||
internal static bool html_is_valid(string color)
|
||||
internal static bool HtmlIsValid(string color)
|
||||
{
|
||||
if (color.Length == 0)
|
||||
return false;
|
||||
|
|
|
@ -6,32 +6,32 @@ namespace Godot
|
|||
{
|
||||
/*{GodotGlobalConstants}*/
|
||||
|
||||
public static object bytes2var(byte[] bytes)
|
||||
public static object Bytes2Var(byte[] bytes)
|
||||
{
|
||||
return NativeCalls.godot_icall_Godot_bytes2var(bytes);
|
||||
}
|
||||
|
||||
public static object convert(object what, int type)
|
||||
public static object Convert(object what, int type)
|
||||
{
|
||||
return NativeCalls.godot_icall_Godot_convert(what, type);
|
||||
}
|
||||
|
||||
public static float db2linear(float db)
|
||||
public static float Db2Linear(float db)
|
||||
{
|
||||
return (float)Math.Exp(db * 0.11512925464970228420089957273422);
|
||||
}
|
||||
|
||||
public static float dectime(float value, float amount, float step)
|
||||
public static float Dectime(float value, float amount, float step)
|
||||
{
|
||||
float sgn = value < 0 ? -1.0f : 1.0f;
|
||||
float val = Mathf.abs(value);
|
||||
float val = Mathf.Abs(value);
|
||||
val -= amount * step;
|
||||
if (val < 0.0f)
|
||||
val = 0.0f;
|
||||
return val * sgn;
|
||||
}
|
||||
|
||||
public static FuncRef funcref(Object instance, string funcname)
|
||||
public static FuncRef Funcref(Object instance, string funcname)
|
||||
{
|
||||
var ret = new FuncRef();
|
||||
ret.SetInstance(instance);
|
||||
|
@ -39,57 +39,57 @@ namespace Godot
|
|||
return ret;
|
||||
}
|
||||
|
||||
public static int hash(object var)
|
||||
public static int Hash(object var)
|
||||
{
|
||||
return NativeCalls.godot_icall_Godot_hash(var);
|
||||
}
|
||||
|
||||
public static Object instance_from_id(int instance_id)
|
||||
public static Object InstanceFromId(int instanceId)
|
||||
{
|
||||
return NativeCalls.godot_icall_Godot_instance_from_id(instance_id);
|
||||
return NativeCalls.godot_icall_Godot_instance_from_id(instanceId);
|
||||
}
|
||||
|
||||
public static double linear2db(double linear)
|
||||
public static double Linear2Db(double linear)
|
||||
{
|
||||
return Math.Log(linear) * 8.6858896380650365530225783783321;
|
||||
}
|
||||
|
||||
public static Resource load(string path)
|
||||
public static Resource Load(string path)
|
||||
{
|
||||
return ResourceLoader.Load(path);
|
||||
}
|
||||
|
||||
public static void print(params object[] what)
|
||||
public static void Print(params object[] what)
|
||||
{
|
||||
NativeCalls.godot_icall_Godot_print(what);
|
||||
}
|
||||
|
||||
public static void print_stack()
|
||||
public static void PrintStack()
|
||||
{
|
||||
print(System.Environment.StackTrace);
|
||||
Print(System.Environment.StackTrace);
|
||||
}
|
||||
|
||||
public static void printerr(params object[] what)
|
||||
public static void Printerr(params object[] what)
|
||||
{
|
||||
NativeCalls.godot_icall_Godot_printerr(what);
|
||||
}
|
||||
|
||||
public static void printraw(params object[] what)
|
||||
public static void Printraw(params object[] what)
|
||||
{
|
||||
NativeCalls.godot_icall_Godot_printraw(what);
|
||||
}
|
||||
|
||||
public static void prints(params object[] what)
|
||||
public static void Prints(params object[] what)
|
||||
{
|
||||
NativeCalls.godot_icall_Godot_prints(what);
|
||||
}
|
||||
|
||||
public static void printt(params object[] what)
|
||||
public static void Printt(params object[] what)
|
||||
{
|
||||
NativeCalls.godot_icall_Godot_printt(what);
|
||||
}
|
||||
|
||||
public static int[] range(int length)
|
||||
public static int[] Range(int length)
|
||||
{
|
||||
int[] ret = new int[length];
|
||||
|
||||
|
@ -101,7 +101,7 @@ namespace Godot
|
|||
return ret;
|
||||
}
|
||||
|
||||
public static int[] range(int from, int to)
|
||||
public static int[] Range(int from, int to)
|
||||
{
|
||||
if (to < from)
|
||||
return new int[0];
|
||||
|
@ -116,7 +116,7 @@ namespace Godot
|
|||
return ret;
|
||||
}
|
||||
|
||||
public static int[] range(int from, int to, int increment)
|
||||
public static int[] Range(int from, int to, int increment)
|
||||
{
|
||||
if (to < from && increment > 0)
|
||||
return new int[0];
|
||||
|
@ -153,37 +153,37 @@ namespace Godot
|
|||
return ret;
|
||||
}
|
||||
|
||||
public static void seed(int seed)
|
||||
public static void Seed(int seed)
|
||||
{
|
||||
NativeCalls.godot_icall_Godot_seed(seed);
|
||||
}
|
||||
|
||||
public static string str(params object[] what)
|
||||
public static string Str(params object[] what)
|
||||
{
|
||||
return NativeCalls.godot_icall_Godot_str(what);
|
||||
}
|
||||
|
||||
public static object str2var(string str)
|
||||
public static object Str2Var(string str)
|
||||
{
|
||||
return NativeCalls.godot_icall_Godot_str2var(str);
|
||||
}
|
||||
|
||||
public static bool type_exists(string type)
|
||||
public static bool TypeExists(string type)
|
||||
{
|
||||
return NativeCalls.godot_icall_Godot_type_exists(type);
|
||||
}
|
||||
|
||||
public static byte[] var2bytes(object var)
|
||||
public static byte[] Var2Bytes(object var)
|
||||
{
|
||||
return NativeCalls.godot_icall_Godot_var2bytes(var);
|
||||
}
|
||||
|
||||
public static string var2str(object var)
|
||||
public static string Var2Str(object var)
|
||||
{
|
||||
return NativeCalls.godot_icall_Godot_var2str(var);
|
||||
}
|
||||
|
||||
public static WeakRef weakref(Object obj)
|
||||
public static WeakRef Weakref(Object obj)
|
||||
{
|
||||
return NativeCalls.godot_icall_Godot_weakref(Object.GetPtr(obj));
|
||||
}
|
||||
|
|
|
@ -10,42 +10,42 @@ namespace Godot
|
|||
private const float Deg2RadConst = 0.0174532924f;
|
||||
private const float Rad2DegConst = 57.29578f;
|
||||
|
||||
public static float abs(float s)
|
||||
public static float Abs(float s)
|
||||
{
|
||||
return Math.Abs(s);
|
||||
}
|
||||
|
||||
public static float acos(float s)
|
||||
public static float Acos(float s)
|
||||
{
|
||||
return (float)Math.Acos(s);
|
||||
}
|
||||
|
||||
public static float asin(float s)
|
||||
public static float Asin(float s)
|
||||
{
|
||||
return (float)Math.Asin(s);
|
||||
}
|
||||
|
||||
public static float atan(float s)
|
||||
public static float Atan(float s)
|
||||
{
|
||||
return (float)Math.Atan(s);
|
||||
}
|
||||
|
||||
public static float atan2(float x, float y)
|
||||
public static float Atan2(float x, float y)
|
||||
{
|
||||
return (float)Math.Atan2(x, y);
|
||||
}
|
||||
|
||||
public static Vector2 cartesian2polar(float x, float y)
|
||||
public static Vector2 Cartesian2Polar(float x, float y)
|
||||
{
|
||||
return new Vector2(sqrt(x * x + y * y), atan2(y, x));
|
||||
return new Vector2(Sqrt(x * x + y * y), Atan2(y, x));
|
||||
}
|
||||
|
||||
public static float ceil(float s)
|
||||
public static float Ceil(float s)
|
||||
{
|
||||
return (float)Math.Ceiling(s);
|
||||
}
|
||||
|
||||
public static float clamp(float val, float min, float max)
|
||||
public static float Clamp(float val, float min, float max)
|
||||
{
|
||||
if (val < min)
|
||||
{
|
||||
|
@ -59,32 +59,32 @@ namespace Godot
|
|||
return val;
|
||||
}
|
||||
|
||||
public static float cos(float s)
|
||||
public static float Cos(float s)
|
||||
{
|
||||
return (float)Math.Cos(s);
|
||||
}
|
||||
|
||||
public static float cosh(float s)
|
||||
public static float Cosh(float s)
|
||||
{
|
||||
return (float)Math.Cosh(s);
|
||||
}
|
||||
|
||||
public static int decimals(float step)
|
||||
public static int Decimals(float step)
|
||||
{
|
||||
return decimals(step);
|
||||
return Decimals(step);
|
||||
}
|
||||
|
||||
public static int decimals(decimal step)
|
||||
public static int Decimals(decimal step)
|
||||
{
|
||||
return BitConverter.GetBytes(decimal.GetBits(step)[3])[2];
|
||||
}
|
||||
|
||||
public static float deg2rad(float deg)
|
||||
public static float Deg2Rad(float deg)
|
||||
{
|
||||
return deg * Deg2RadConst;
|
||||
}
|
||||
|
||||
public static float ease(float s, float curve)
|
||||
public static float Ease(float s, float curve)
|
||||
{
|
||||
if (s < 0f)
|
||||
{
|
||||
|
@ -99,35 +99,35 @@ namespace Godot
|
|||
{
|
||||
if (curve < 1.0f)
|
||||
{
|
||||
return 1.0f - pow(1.0f - s, 1.0f / curve);
|
||||
return 1.0f - Pow(1.0f - s, 1.0f / curve);
|
||||
}
|
||||
|
||||
return pow(s, curve);
|
||||
return Pow(s, curve);
|
||||
}
|
||||
else if (curve < 0f)
|
||||
{
|
||||
if (s < 0.5f)
|
||||
{
|
||||
return pow(s * 2.0f, -curve) * 0.5f;
|
||||
return Pow(s * 2.0f, -curve) * 0.5f;
|
||||
}
|
||||
|
||||
return (1.0f - pow(1.0f - (s - 0.5f) * 2.0f, -curve)) * 0.5f + 0.5f;
|
||||
return (1.0f - Pow(1.0f - (s - 0.5f) * 2.0f, -curve)) * 0.5f + 0.5f;
|
||||
}
|
||||
|
||||
return 0f;
|
||||
}
|
||||
|
||||
public static float exp(float s)
|
||||
public static float Exp(float s)
|
||||
{
|
||||
return (float)Math.Exp(s);
|
||||
}
|
||||
|
||||
public static float floor(float s)
|
||||
public static float Floor(float s)
|
||||
{
|
||||
return (float)Math.Floor(s);
|
||||
}
|
||||
|
||||
public static float fposmod(float x, float y)
|
||||
public static float Fposmod(float x, float y)
|
||||
{
|
||||
if (x >= 0f)
|
||||
{
|
||||
|
@ -139,37 +139,37 @@ namespace Godot
|
|||
}
|
||||
}
|
||||
|
||||
public static float lerp(float from, float to, float weight)
|
||||
public static float Lerp(float from, float to, float weight)
|
||||
{
|
||||
return from + (to - from) * clamp(weight, 0f, 1f);
|
||||
return from + (to - from) * Clamp(weight, 0f, 1f);
|
||||
}
|
||||
|
||||
public static float log(float s)
|
||||
public static float Log(float s)
|
||||
{
|
||||
return (float)Math.Log(s);
|
||||
}
|
||||
|
||||
public static int max(int a, int b)
|
||||
public static int Max(int a, int b)
|
||||
{
|
||||
return (a > b) ? a : b;
|
||||
}
|
||||
|
||||
public static float max(float a, float b)
|
||||
public static float Max(float a, float b)
|
||||
{
|
||||
return (a > b) ? a : b;
|
||||
}
|
||||
|
||||
public static int min(int a, int b)
|
||||
public static int Min(int a, int b)
|
||||
{
|
||||
return (a < b) ? a : b;
|
||||
}
|
||||
|
||||
public static float min(float a, float b)
|
||||
public static float Min(float a, float b)
|
||||
{
|
||||
return (a < b) ? a : b;
|
||||
}
|
||||
|
||||
public static int nearest_po2(int val)
|
||||
public static int NearestPo2(int val)
|
||||
{
|
||||
val--;
|
||||
val |= val >> 1;
|
||||
|
@ -181,62 +181,62 @@ namespace Godot
|
|||
return val;
|
||||
}
|
||||
|
||||
public static Vector2 polar2cartesian(float r, float th)
|
||||
public static Vector2 Polar2Cartesian(float r, float th)
|
||||
{
|
||||
return new Vector2(r * cos(th), r * sin(th));
|
||||
return new Vector2(r * Cos(th), r * Sin(th));
|
||||
}
|
||||
|
||||
public static float pow(float x, float y)
|
||||
public static float Pow(float x, float y)
|
||||
{
|
||||
return (float)Math.Pow(x, y);
|
||||
}
|
||||
|
||||
public static float rad2deg(float rad)
|
||||
public static float Rad2Deg(float rad)
|
||||
{
|
||||
return rad * Rad2DegConst;
|
||||
}
|
||||
|
||||
public static float round(float s)
|
||||
public static float Round(float s)
|
||||
{
|
||||
return (float)Math.Round(s);
|
||||
}
|
||||
|
||||
public static float sign(float s)
|
||||
public static float Sign(float s)
|
||||
{
|
||||
return (s < 0f) ? -1f : 1f;
|
||||
}
|
||||
|
||||
public static float sin(float s)
|
||||
public static float Sin(float s)
|
||||
{
|
||||
return (float)Math.Sin(s);
|
||||
}
|
||||
|
||||
public static float sinh(float s)
|
||||
public static float Sinh(float s)
|
||||
{
|
||||
return (float)Math.Sinh(s);
|
||||
}
|
||||
|
||||
public static float sqrt(float s)
|
||||
public static float Sqrt(float s)
|
||||
{
|
||||
return (float)Math.Sqrt(s);
|
||||
}
|
||||
|
||||
public static float stepify(float s, float step)
|
||||
public static float Stepify(float s, float step)
|
||||
{
|
||||
if (step != 0f)
|
||||
{
|
||||
s = floor(s / step + 0.5f) * step;
|
||||
s = Floor(s / step + 0.5f) * step;
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
public static float tan(float s)
|
||||
public static float Tan(float s)
|
||||
{
|
||||
return (float)Math.Tan(s);
|
||||
}
|
||||
|
||||
public static float tanh(float s)
|
||||
public static float Tanh(float s)
|
||||
{
|
||||
return (float)Math.Tanh(s);
|
||||
}
|
||||
|
|
|
@ -52,44 +52,44 @@ namespace Godot
|
|||
}
|
||||
}
|
||||
|
||||
public float distance_to(Vector3 point)
|
||||
public float DistanceTo(Vector3 point)
|
||||
{
|
||||
return normal.dot(point) - d;
|
||||
return normal.Dot(point) - d;
|
||||
}
|
||||
|
||||
public Vector3 get_any_point()
|
||||
public Vector3 GetAnyPoint()
|
||||
{
|
||||
return normal * d;
|
||||
}
|
||||
|
||||
public bool has_point(Vector3 point, float epsilon = Mathf.Epsilon)
|
||||
public bool HasPoint(Vector3 point, float epsilon = Mathf.Epsilon)
|
||||
{
|
||||
float dist = normal.dot(point) - d;
|
||||
return Mathf.abs(dist) <= epsilon;
|
||||
float dist = normal.Dot(point) - d;
|
||||
return Mathf.Abs(dist) <= epsilon;
|
||||
}
|
||||
|
||||
public Vector3 intersect_3(Plane b, Plane c)
|
||||
public Vector3 Intersect3(Plane b, Plane c)
|
||||
{
|
||||
float denom = normal.cross(b.normal).dot(c.normal);
|
||||
float denom = normal.Cross(b.normal).Dot(c.normal);
|
||||
|
||||
if (Mathf.abs(denom) <= Mathf.Epsilon)
|
||||
if (Mathf.Abs(denom) <= Mathf.Epsilon)
|
||||
return new Vector3();
|
||||
|
||||
Vector3 result = (b.normal.cross(c.normal) * this.d) +
|
||||
(c.normal.cross(normal) * b.d) +
|
||||
(normal.cross(b.normal) * c.d);
|
||||
Vector3 result = (b.normal.Cross(c.normal) * this.d) +
|
||||
(c.normal.Cross(normal) * b.d) +
|
||||
(normal.Cross(b.normal) * c.d);
|
||||
|
||||
return result / denom;
|
||||
}
|
||||
|
||||
public Vector3 intersect_ray(Vector3 from, Vector3 dir)
|
||||
public Vector3 IntersectRay(Vector3 from, Vector3 dir)
|
||||
{
|
||||
float den = normal.dot(dir);
|
||||
float den = normal.Dot(dir);
|
||||
|
||||
if (Mathf.abs(den) <= Mathf.Epsilon)
|
||||
if (Mathf.Abs(den) <= Mathf.Epsilon)
|
||||
return new Vector3();
|
||||
|
||||
float dist = (normal.dot(from) - d) / den;
|
||||
float dist = (normal.Dot(from) - d) / den;
|
||||
|
||||
// This is a ray, before the emiting pos (from) does not exist
|
||||
if (dist > Mathf.Epsilon)
|
||||
|
@ -98,15 +98,15 @@ namespace Godot
|
|||
return from + dir * -dist;
|
||||
}
|
||||
|
||||
public Vector3 intersect_segment(Vector3 begin, Vector3 end)
|
||||
public Vector3 IntersectSegment(Vector3 begin, Vector3 end)
|
||||
{
|
||||
Vector3 segment = begin - end;
|
||||
float den = normal.dot(segment);
|
||||
float den = normal.Dot(segment);
|
||||
|
||||
if (Mathf.abs(den) <= Mathf.Epsilon)
|
||||
if (Mathf.Abs(den) <= Mathf.Epsilon)
|
||||
return new Vector3();
|
||||
|
||||
float dist = (normal.dot(begin) - d) / den;
|
||||
float dist = (normal.Dot(begin) - d) / den;
|
||||
|
||||
if (dist < -Mathf.Epsilon || dist > (1.0f + Mathf.Epsilon))
|
||||
return new Vector3();
|
||||
|
@ -114,14 +114,14 @@ namespace Godot
|
|||
return begin + segment * -dist;
|
||||
}
|
||||
|
||||
public bool is_point_over(Vector3 point)
|
||||
public bool IsPointOver(Vector3 point)
|
||||
{
|
||||
return normal.dot(point) > d;
|
||||
return normal.Dot(point) > d;
|
||||
}
|
||||
|
||||
public Plane normalized()
|
||||
public Plane Normalized()
|
||||
{
|
||||
float len = normal.length();
|
||||
float len = normal.Length();
|
||||
|
||||
if (len == 0)
|
||||
return new Plane(0, 0, 0, 0);
|
||||
|
@ -129,9 +129,9 @@ namespace Godot
|
|||
return new Plane(normal / len, d / len);
|
||||
}
|
||||
|
||||
public Vector3 project(Vector3 point)
|
||||
public Vector3 Project(Vector3 point)
|
||||
{
|
||||
return point - normal * distance_to(point);
|
||||
return point - normal * DistanceTo(point);
|
||||
}
|
||||
|
||||
public Plane(float a, float b, float c, float d)
|
||||
|
@ -148,9 +148,9 @@ namespace Godot
|
|||
|
||||
public Plane(Vector3 v1, Vector3 v2, Vector3 v3)
|
||||
{
|
||||
normal = (v1 - v3).cross(v1 - v2);
|
||||
normal.normalize();
|
||||
d = normal.dot(v1);
|
||||
normal = (v1 - v3).Cross(v1 - v2);
|
||||
normal.Normalize();
|
||||
d = normal.Dot(v1);
|
||||
}
|
||||
|
||||
public static Plane operator -(Plane plane)
|
||||
|
|
|
@ -58,40 +58,40 @@ namespace Godot
|
|||
}
|
||||
}
|
||||
|
||||
public Quat cubic_slerp(Quat b, Quat preA, Quat postB, float t)
|
||||
public Quat CubicSlerp(Quat b, Quat preA, Quat postB, float t)
|
||||
{
|
||||
float t2 = (1.0f - t) * t * 2f;
|
||||
Quat sp = slerp(b, t);
|
||||
Quat sq = preA.slerpni(postB, t);
|
||||
return sp.slerpni(sq, t2);
|
||||
Quat sp = Slerp(b, t);
|
||||
Quat sq = preA.Slerpni(postB, t);
|
||||
return sp.Slerpni(sq, t2);
|
||||
}
|
||||
|
||||
public float dot(Quat b)
|
||||
public float Dot(Quat b)
|
||||
{
|
||||
return x * b.x + y * b.y + z * b.z + w * b.w;
|
||||
}
|
||||
|
||||
public Quat inverse()
|
||||
public Quat Inverse()
|
||||
{
|
||||
return new Quat(-x, -y, -z, w);
|
||||
}
|
||||
|
||||
public float length()
|
||||
public float Length()
|
||||
{
|
||||
return Mathf.sqrt(length_squared());
|
||||
return Mathf.Sqrt(LengthSquared());
|
||||
}
|
||||
|
||||
public float length_squared()
|
||||
public float LengthSquared()
|
||||
{
|
||||
return dot(this);
|
||||
return Dot(this);
|
||||
}
|
||||
|
||||
public Quat normalized()
|
||||
public Quat Normalized()
|
||||
{
|
||||
return this / length();
|
||||
return this / Length();
|
||||
}
|
||||
|
||||
public void set(float x, float y, float z, float w)
|
||||
public void Set(float x, float y, float z, float w)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
@ -99,7 +99,7 @@ namespace Godot
|
|||
this.w = w;
|
||||
}
|
||||
|
||||
public Quat slerp(Quat b, float t)
|
||||
public Quat Slerp(Quat b, float t)
|
||||
{
|
||||
// Calculate cosine
|
||||
float cosom = x * b.x + y * b.y + z * b.z + w * b.w;
|
||||
|
@ -128,10 +128,10 @@ namespace Godot
|
|||
if ((1.0 - cosom) > Mathf.Epsilon)
|
||||
{
|
||||
// Standard case (Slerp)
|
||||
float omega = Mathf.acos(cosom);
|
||||
sinom = Mathf.sin(omega);
|
||||
scale0 = Mathf.sin((1.0f - t) * omega) / sinom;
|
||||
scale1 = Mathf.sin(t * omega) / sinom;
|
||||
float omega = Mathf.Acos(cosom);
|
||||
sinom = Mathf.Sin(omega);
|
||||
scale0 = Mathf.Sin((1.0f - t) * omega) / sinom;
|
||||
scale1 = Mathf.Sin(t * omega) / sinom;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -150,19 +150,19 @@ namespace Godot
|
|||
);
|
||||
}
|
||||
|
||||
public Quat slerpni(Quat b, float t)
|
||||
public Quat Slerpni(Quat b, float t)
|
||||
{
|
||||
float dot = this.dot(b);
|
||||
float dot = this.Dot(b);
|
||||
|
||||
if (Mathf.abs(dot) > 0.9999f)
|
||||
if (Mathf.Abs(dot) > 0.9999f)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
float theta = Mathf.acos(dot);
|
||||
float sinT = 1.0f / Mathf.sin(theta);
|
||||
float newFactor = Mathf.sin(t * theta) * sinT;
|
||||
float invFactor = Mathf.sin((1.0f - t) * theta) * sinT;
|
||||
float theta = Mathf.Acos(dot);
|
||||
float sinT = 1.0f / Mathf.Sin(theta);
|
||||
float newFactor = Mathf.Sin(t * theta) * sinT;
|
||||
float invFactor = Mathf.Sin((1.0f - t) * theta) * sinT;
|
||||
|
||||
return new Quat
|
||||
(
|
||||
|
@ -173,10 +173,10 @@ namespace Godot
|
|||
);
|
||||
}
|
||||
|
||||
public Vector3 xform(Vector3 v)
|
||||
public Vector3 Xform(Vector3 v)
|
||||
{
|
||||
Quat q = this * v;
|
||||
q *= this.inverse();
|
||||
q *= this.Inverse();
|
||||
return new Vector3(q.x, q.y, q.z);
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,7 @@ namespace Godot
|
|||
|
||||
public Quat(Vector3 axis, float angle)
|
||||
{
|
||||
float d = axis.length();
|
||||
float d = axis.Length();
|
||||
|
||||
if (d == 0f)
|
||||
{
|
||||
|
@ -201,12 +201,12 @@ namespace Godot
|
|||
}
|
||||
else
|
||||
{
|
||||
float s = Mathf.sin(angle * 0.5f) / d;
|
||||
float s = Mathf.Sin(angle * 0.5f) / d;
|
||||
|
||||
x = axis.x * s;
|
||||
y = axis.y * s;
|
||||
z = axis.z * s;
|
||||
w = Mathf.cos(angle * 0.5f);
|
||||
w = Mathf.Cos(angle * 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,36 +28,36 @@ namespace Godot
|
|||
|
||||
public float Area
|
||||
{
|
||||
get { return get_area(); }
|
||||
get { return GetArea(); }
|
||||
}
|
||||
|
||||
public Rect2 clip(Rect2 b)
|
||||
public Rect2 Clip(Rect2 b)
|
||||
{
|
||||
Rect2 newRect = b;
|
||||
|
||||
if (!intersects(newRect))
|
||||
if (!Intersects(newRect))
|
||||
return new Rect2();
|
||||
|
||||
newRect.position.x = Mathf.max(b.position.x, position.x);
|
||||
newRect.position.y = Mathf.max(b.position.y, position.y);
|
||||
newRect.position.x = Mathf.Max(b.position.x, position.x);
|
||||
newRect.position.y = Mathf.Max(b.position.y, position.y);
|
||||
|
||||
Vector2 bEnd = b.position + b.size;
|
||||
Vector2 end = position + size;
|
||||
|
||||
newRect.size.x = Mathf.min(bEnd.x, end.x) - newRect.position.x;
|
||||
newRect.size.y = Mathf.min(bEnd.y, end.y) - newRect.position.y;
|
||||
newRect.size.x = Mathf.Min(bEnd.x, end.x) - newRect.position.x;
|
||||
newRect.size.y = Mathf.Min(bEnd.y, end.y) - newRect.position.y;
|
||||
|
||||
return newRect;
|
||||
}
|
||||
|
||||
public bool encloses(Rect2 b)
|
||||
public bool Encloses(Rect2 b)
|
||||
{
|
||||
return (b.position.x >= position.x) && (b.position.y >= position.y) &&
|
||||
((b.position.x + b.size.x) < (position.x + size.x)) &&
|
||||
((b.position.y + b.size.y) < (position.y + size.y));
|
||||
}
|
||||
|
||||
public Rect2 expand(Vector2 to)
|
||||
public Rect2 Expand(Vector2 to)
|
||||
{
|
||||
Rect2 expanded = this;
|
||||
|
||||
|
@ -80,12 +80,12 @@ namespace Godot
|
|||
return expanded;
|
||||
}
|
||||
|
||||
public float get_area()
|
||||
public float GetArea()
|
||||
{
|
||||
return size.x * size.y;
|
||||
}
|
||||
|
||||
public Rect2 grow(float by)
|
||||
public Rect2 Grow(float by)
|
||||
{
|
||||
Rect2 g = this;
|
||||
|
||||
|
@ -97,7 +97,7 @@ namespace Godot
|
|||
return g;
|
||||
}
|
||||
|
||||
public Rect2 grow_individual(float left, float top, float right, float bottom)
|
||||
public Rect2 GrowIndividual(float left, float top, float right, float bottom)
|
||||
{
|
||||
Rect2 g = this;
|
||||
|
||||
|
@ -109,11 +109,11 @@ namespace Godot
|
|||
return g;
|
||||
}
|
||||
|
||||
public Rect2 grow_margin(int margin, float by)
|
||||
public Rect2 GrowMargin(int margin, float by)
|
||||
{
|
||||
Rect2 g = this;
|
||||
|
||||
g.grow_individual((GD.MARGIN_LEFT == margin) ? by : 0,
|
||||
g.GrowIndividual((GD.MARGIN_LEFT == margin) ? by : 0,
|
||||
(GD.MARGIN_TOP == margin) ? by : 0,
|
||||
(GD.MARGIN_RIGHT == margin) ? by : 0,
|
||||
(GD.MARGIN_BOTTOM == margin) ? by : 0);
|
||||
|
@ -121,12 +121,12 @@ namespace Godot
|
|||
return g;
|
||||
}
|
||||
|
||||
public bool has_no_area()
|
||||
public bool HasNoArea()
|
||||
{
|
||||
return size.x <= 0 || size.y <= 0;
|
||||
}
|
||||
|
||||
public bool has_point(Vector2 point)
|
||||
public bool HasPoint(Vector2 point)
|
||||
{
|
||||
if (point.x < position.x)
|
||||
return false;
|
||||
|
@ -141,7 +141,7 @@ namespace Godot
|
|||
return true;
|
||||
}
|
||||
|
||||
public bool intersects(Rect2 b)
|
||||
public bool Intersects(Rect2 b)
|
||||
{
|
||||
if (position.x > (b.position.x + b.size.x))
|
||||
return false;
|
||||
|
@ -155,15 +155,15 @@ namespace Godot
|
|||
return true;
|
||||
}
|
||||
|
||||
public Rect2 merge(Rect2 b)
|
||||
public Rect2 Merge(Rect2 b)
|
||||
{
|
||||
Rect2 newRect;
|
||||
|
||||
newRect.position.x = Mathf.min(b.position.x, position.x);
|
||||
newRect.position.y = Mathf.min(b.position.y, position.y);
|
||||
newRect.position.x = Mathf.Min(b.position.x, position.x);
|
||||
newRect.position.y = Mathf.Min(b.position.y, position.y);
|
||||
|
||||
newRect.size.x = Mathf.max(b.position.x + b.size.x, position.x + size.x);
|
||||
newRect.size.y = Mathf.max(b.position.y + b.size.y, position.y + size.y);
|
||||
newRect.size.x = Mathf.Max(b.position.x + b.size.x, position.x + size.x);
|
||||
newRect.size.y = Mathf.Max(b.position.y + b.size.y, position.y + size.y);
|
||||
|
||||
newRect.size = newRect.size - newRect.position; // Make relative again
|
||||
|
||||
|
|
|
@ -10,15 +10,15 @@ namespace Godot
|
|||
{
|
||||
public static class StringExtensions
|
||||
{
|
||||
private static int get_slice_count(this string instance, string splitter)
|
||||
private static int GetSliceCount(this string instance, string splitter)
|
||||
{
|
||||
if (instance.empty() || splitter.empty())
|
||||
if (instance.Empty() || splitter.Empty())
|
||||
return 0;
|
||||
|
||||
int pos = 0;
|
||||
int slices = 1;
|
||||
|
||||
while ((pos = instance.find(splitter, pos)) >= 0)
|
||||
while ((pos = instance.Find(splitter, pos)) >= 0)
|
||||
{
|
||||
slices++;
|
||||
pos += splitter.Length;
|
||||
|
@ -27,9 +27,9 @@ namespace Godot
|
|||
return slices;
|
||||
}
|
||||
|
||||
private static string get_slicec(this string instance, char splitter, int slice)
|
||||
private static string GetSlicec(this string instance, char splitter, int slice)
|
||||
{
|
||||
if (!instance.empty() && slice >= 0)
|
||||
if (!instance.Empty() && slice >= 0)
|
||||
{
|
||||
int i = 0;
|
||||
int prev = 0;
|
||||
|
@ -60,7 +60,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// If the string is a path to a file, return the path to the file without the extension.
|
||||
// </summary>
|
||||
public static string basename(this string instance)
|
||||
public static string Basename(this string instance)
|
||||
{
|
||||
int index = instance.LastIndexOf('.');
|
||||
|
||||
|
@ -73,7 +73,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Return true if the strings begins with the given string.
|
||||
// </summary>
|
||||
public static bool begins_with(this string instance, string text)
|
||||
public static bool BeginsWith(this string instance, string text)
|
||||
{
|
||||
return instance.StartsWith(text);
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Return the bigrams (pairs of consecutive letters) of this string.
|
||||
// </summary>
|
||||
public static string[] bigrams(this string instance)
|
||||
public static string[] Bigrams(this string instance)
|
||||
{
|
||||
string[] b = new string[instance.Length - 1];
|
||||
|
||||
|
@ -96,7 +96,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Return a copy of the string with special characters escaped using the C language standard.
|
||||
// </summary>
|
||||
public static string c_escape(this string instance)
|
||||
public static string CEscape(this string instance)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(string.Copy(instance));
|
||||
|
||||
|
@ -118,7 +118,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Return a copy of the string with escaped characters replaced by their meanings according to the C language standard.
|
||||
// </summary>
|
||||
public static string c_unescape(this string instance)
|
||||
public static string CUnescape(this string instance)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(string.Copy(instance));
|
||||
|
||||
|
@ -140,14 +140,14 @@ namespace Godot
|
|||
// <summary>
|
||||
// Change the case of some letters. Replace underscores with spaces, convert all letters to lowercase then capitalize first and every letter following the space character. For [code]capitalize camelCase mixed_with_underscores[/code] it will return [code]Capitalize Camelcase Mixed With Underscores[/code].
|
||||
// </summary>
|
||||
public static string capitalize(this string instance)
|
||||
public static string Capitalize(this string instance)
|
||||
{
|
||||
string aux = instance.Replace("_", " ").ToLower();
|
||||
string cap = string.Empty;
|
||||
|
||||
for (int i = 0; i < aux.get_slice_count(" "); i++)
|
||||
for (int i = 0; i < aux.GetSliceCount(" "); i++)
|
||||
{
|
||||
string slice = aux.get_slicec(' ', i);
|
||||
string slice = aux.GetSlicec(' ', i);
|
||||
if (slice.Length > 0)
|
||||
{
|
||||
slice = char.ToUpper(slice[0]) + slice.Substring(1);
|
||||
|
@ -163,12 +163,12 @@ namespace Godot
|
|||
// <summary>
|
||||
// Perform a case-sensitive comparison to another string, return -1 if less, 0 if equal and +1 if greater.
|
||||
// </summary>
|
||||
public static int casecmp_to(this string instance, string to)
|
||||
public static int CasecmpTo(this string instance, string to)
|
||||
{
|
||||
if (instance.empty())
|
||||
return to.empty() ? 0 : -1;
|
||||
if (instance.Empty())
|
||||
return to.Empty() ? 0 : -1;
|
||||
|
||||
if (to.empty())
|
||||
if (to.Empty())
|
||||
return 1;
|
||||
|
||||
int instance_idx = 0;
|
||||
|
@ -195,7 +195,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Return true if the string is empty.
|
||||
// </summary>
|
||||
public static bool empty(this string instance)
|
||||
public static bool Empty(this string instance)
|
||||
{
|
||||
return string.IsNullOrEmpty(instance);
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Return true if the strings ends with the given string.
|
||||
// </summary>
|
||||
public static bool ends_with(this string instance, string text)
|
||||
public static bool EndsWith(this string instance, string text)
|
||||
{
|
||||
return instance.EndsWith(text);
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Erase [code]chars[/code] characters from the string starting from [code]pos[/code].
|
||||
// </summary>
|
||||
public static void erase(this StringBuilder instance, int pos, int chars)
|
||||
public static void Erase(this StringBuilder instance, int pos, int chars)
|
||||
{
|
||||
instance.Remove(pos, chars);
|
||||
}
|
||||
|
@ -219,9 +219,9 @@ namespace Godot
|
|||
// <summary>
|
||||
// If the string is a path to a file, return the extension.
|
||||
// </summary>
|
||||
public static string extension(this string instance)
|
||||
public static string Extension(this string instance)
|
||||
{
|
||||
int pos = instance.find_last(".");
|
||||
int pos = instance.FindLast(".");
|
||||
|
||||
if (pos < 0)
|
||||
return instance;
|
||||
|
@ -232,7 +232,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Find the first occurrence of a substring, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed.
|
||||
// </summary>
|
||||
public static int find(this string instance, string what, int from = 0)
|
||||
public static int Find(this string instance, string what, int from = 0)
|
||||
{
|
||||
return instance.IndexOf(what, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Find the last occurrence of a substring, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed.
|
||||
// </summary>
|
||||
public static int find_last(this string instance, string what)
|
||||
public static int FindLast(this string instance, string what)
|
||||
{
|
||||
return instance.LastIndexOf(what, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Find the first occurrence of a substring but search as case-insensitive, return the starting position of the substring or -1 if not found. Optionally, the initial search index can be passed.
|
||||
// </summary>
|
||||
public static int findn(this string instance, string what, int from = 0)
|
||||
public static int FindN(this string instance, string what, int from = 0)
|
||||
{
|
||||
return instance.IndexOf(what, StringComparison.Ordinal);
|
||||
}
|
||||
|
@ -256,9 +256,9 @@ namespace Godot
|
|||
// <summary>
|
||||
// If the string is a path to a file, return the base directory.
|
||||
// </summary>
|
||||
public static string get_base_dir(this string instance)
|
||||
public static string GetBaseDir(this string instance)
|
||||
{
|
||||
int basepos = instance.find("://");
|
||||
int basepos = instance.Find("://");
|
||||
|
||||
string rs = string.Empty;
|
||||
string @base = string.Empty;
|
||||
|
@ -271,7 +271,7 @@ namespace Godot
|
|||
}
|
||||
else
|
||||
{
|
||||
if (instance.begins_with("/"))
|
||||
if (instance.BeginsWith("/"))
|
||||
{
|
||||
rs = instance.Substring(1, instance.Length);
|
||||
@base = "/";
|
||||
|
@ -282,7 +282,7 @@ namespace Godot
|
|||
}
|
||||
}
|
||||
|
||||
int sep = Mathf.max(rs.find_last("/"), rs.find_last("\\"));
|
||||
int sep = Mathf.Max(rs.FindLast("/"), rs.FindLast("\\"));
|
||||
|
||||
if (sep == -1)
|
||||
return @base;
|
||||
|
@ -293,9 +293,9 @@ namespace Godot
|
|||
// <summary>
|
||||
// If the string is a path to a file, return the file and ignore the base directory.
|
||||
// </summary>
|
||||
public static string get_file(this string instance)
|
||||
public static string GetFile(this string instance)
|
||||
{
|
||||
int sep = Mathf.max(instance.find_last("/"), instance.find_last("\\"));
|
||||
int sep = Mathf.Max(instance.FindLast("/"), instance.FindLast("\\"));
|
||||
|
||||
if (sep == -1)
|
||||
return instance;
|
||||
|
@ -306,7 +306,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Hash the string and return a 32 bits integer.
|
||||
// </summary>
|
||||
public static int hash(this string instance)
|
||||
public static int Hash(this string instance)
|
||||
{
|
||||
int index = 0;
|
||||
int hashv = 5381;
|
||||
|
@ -321,7 +321,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Convert a string containing an hexadecimal number into an int.
|
||||
// </summary>
|
||||
public static int hex_to_int(this string instance)
|
||||
public static int HexToInt(this string instance)
|
||||
{
|
||||
int sign = 1;
|
||||
|
||||
|
@ -340,7 +340,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Insert a substring at a given position.
|
||||
// </summary>
|
||||
public static string insert(this string instance, int pos, string what)
|
||||
public static string Insert(this string instance, int pos, string what)
|
||||
{
|
||||
return instance.Insert(pos, what);
|
||||
}
|
||||
|
@ -348,7 +348,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// If the string is a path to a file or directory, return true if the path is absolute.
|
||||
// </summary>
|
||||
public static bool is_abs_path(this string instance)
|
||||
public static bool IsAbsPath(this string instance)
|
||||
{
|
||||
return System.IO.Path.IsPathRooted(instance);
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// If the string is a path to a file or directory, return true if the path is relative.
|
||||
// </summary>
|
||||
public static bool is_rel_path(this string instance)
|
||||
public static bool IsRelPath(this string instance)
|
||||
{
|
||||
return !System.IO.Path.IsPathRooted(instance);
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Check whether this string is a subsequence of the given string.
|
||||
// </summary>
|
||||
public static bool is_subsequence_of(this string instance, string text, bool case_insensitive)
|
||||
public static bool IsSubsequenceOf(this string instance, string text, bool case_insensitive)
|
||||
{
|
||||
int len = instance.Length;
|
||||
|
||||
|
@ -407,23 +407,23 @@ namespace Godot
|
|||
// <summary>
|
||||
// Check whether this string is a subsequence of the given string, considering case.
|
||||
// </summary>
|
||||
public static bool is_subsequence_of(this string instance, string text)
|
||||
public static bool IsSubsequenceOf(this string instance, string text)
|
||||
{
|
||||
return instance.is_subsequence_of(text, false);
|
||||
return instance.IsSubsequenceOf(text, false);
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// Check whether this string is a subsequence of the given string, without considering case.
|
||||
// </summary>
|
||||
public static bool is_subsequence_ofi(this string instance, string text)
|
||||
public static bool IsSubsequenceOfI(this string instance, string text)
|
||||
{
|
||||
return instance.is_subsequence_of(text, true);
|
||||
return instance.IsSubsequenceOf(text, true);
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// Check whether the string contains a valid float.
|
||||
// </summary>
|
||||
public static bool is_valid_float(this string instance)
|
||||
public static bool IsValidFloat(this string instance)
|
||||
{
|
||||
float f;
|
||||
return float.TryParse(instance, out f);
|
||||
|
@ -432,15 +432,15 @@ namespace Godot
|
|||
// <summary>
|
||||
// Check whether the string contains a valid color in HTML notation.
|
||||
// </summary>
|
||||
public static bool is_valid_html_color(this string instance)
|
||||
public static bool IsValidHtmlColor(this string instance)
|
||||
{
|
||||
return Color.html_is_valid(instance);
|
||||
return Color.HtmlIsValid(instance);
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// Check whether the string is a valid identifier. As is common in programming languages, a valid identifier may contain only letters, digits and underscores (_) and the first character may not be a digit.
|
||||
// </summary>
|
||||
public static bool is_valid_identifier(this string instance)
|
||||
public static bool IsValidIdentifier(this string instance)
|
||||
{
|
||||
int len = instance.Length;
|
||||
|
||||
|
@ -467,7 +467,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Check whether the string contains a valid integer.
|
||||
// </summary>
|
||||
public static bool is_valid_integer(this string instance)
|
||||
public static bool IsValidInteger(this string instance)
|
||||
{
|
||||
int f;
|
||||
return int.TryParse(instance, out f);
|
||||
|
@ -476,7 +476,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Check whether the string contains a valid IP address.
|
||||
// </summary>
|
||||
public static bool is_valid_ip_address(this string instance)
|
||||
public static bool IsValidIpAddress(this string instance)
|
||||
{
|
||||
string[] ip = instance.split(".");
|
||||
|
||||
|
@ -486,7 +486,7 @@ namespace Godot
|
|||
for (int i = 0; i < ip.Length; i++)
|
||||
{
|
||||
string n = ip[i];
|
||||
if (!n.is_valid_integer())
|
||||
if (!n.IsValidInteger())
|
||||
return false;
|
||||
|
||||
int val = n.to_int();
|
||||
|
@ -500,7 +500,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Return a copy of the string with special characters escaped using the JSON standard.
|
||||
// </summary>
|
||||
public static string json_escape(this string instance)
|
||||
public static string JsonEscape(this string instance)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(string.Copy(instance));
|
||||
|
||||
|
@ -519,7 +519,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Return an amount of characters from the left of the string.
|
||||
// </summary>
|
||||
public static string left(this string instance, int pos)
|
||||
public static string Left(this string instance, int pos)
|
||||
{
|
||||
if (pos <= 0)
|
||||
return string.Empty;
|
||||
|
@ -533,7 +533,7 @@ namespace Godot
|
|||
/// <summary>
|
||||
/// Return the length of the string in characters.
|
||||
/// </summary>
|
||||
public static int length(this string instance)
|
||||
public static int Length(this string instance)
|
||||
{
|
||||
return instance.Length;
|
||||
}
|
||||
|
@ -541,7 +541,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Do a simple expression match, where '*' matches zero or more arbitrary characters and '?' matches any single character except '.'.
|
||||
// </summary>
|
||||
public static bool expr_match(this string instance, string expr, bool case_sensitive)
|
||||
public static bool ExprMatch(this string instance, string expr, bool caseSensitive)
|
||||
{
|
||||
if (expr.Length == 0 || instance.Length == 0)
|
||||
return false;
|
||||
|
@ -551,21 +551,21 @@ namespace Godot
|
|||
case '\0':
|
||||
return instance[0] == 0;
|
||||
case '*':
|
||||
return expr_match(expr + 1, instance, case_sensitive) || (instance[0] != 0 && expr_match(expr, instance + 1, case_sensitive));
|
||||
return ExprMatch(expr + 1, instance, caseSensitive) || (instance[0] != 0 && ExprMatch(expr, instance + 1, caseSensitive));
|
||||
case '?':
|
||||
return instance[0] != 0 && instance[0] != '.' && expr_match(expr + 1, instance + 1, case_sensitive);
|
||||
return instance[0] != 0 && instance[0] != '.' && ExprMatch(expr + 1, instance + 1, caseSensitive);
|
||||
default:
|
||||
return (case_sensitive ? instance[0] == expr[0] : char.ToUpper(instance[0]) == char.ToUpper(expr[0])) &&
|
||||
expr_match(expr + 1, instance + 1, case_sensitive);
|
||||
return (caseSensitive ? instance[0] == expr[0] : char.ToUpper(instance[0]) == char.ToUpper(expr[0])) &&
|
||||
ExprMatch(expr + 1, instance + 1, caseSensitive);
|
||||
}
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// Do a simple case sensitive expression match, using ? and * wildcards (see [method expr_match]).
|
||||
// </summary>
|
||||
public static bool match(this string instance, string expr)
|
||||
public static bool Match(this string instance, string expr)
|
||||
{
|
||||
return instance.expr_match(expr, true);
|
||||
return instance.ExprMatch(expr, true);
|
||||
}
|
||||
|
||||
// <summary>
|
||||
|
@ -573,13 +573,13 @@ namespace Godot
|
|||
// </summary>
|
||||
public static bool matchn(this string instance, string expr)
|
||||
{
|
||||
return instance.expr_match(expr, false);
|
||||
return instance.ExprMatch(expr, false);
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// Return the MD5 hash of the string as an array of bytes.
|
||||
// </summary>
|
||||
public static byte[] md5_buffer(this string instance)
|
||||
public static byte[] Md5Buffer(this string instance)
|
||||
{
|
||||
return NativeCalls.godot_icall_String_md5_buffer(instance);
|
||||
}
|
||||
|
@ -587,7 +587,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Return the MD5 hash of the string as a string.
|
||||
// </summary>
|
||||
public static string md5_text(this string instance)
|
||||
public static string Md5Text(this string instance)
|
||||
{
|
||||
return NativeCalls.godot_icall_String_md5_text(instance);
|
||||
}
|
||||
|
@ -595,12 +595,12 @@ namespace Godot
|
|||
// <summary>
|
||||
// Perform a case-insensitive comparison to another string, return -1 if less, 0 if equal and +1 if greater.
|
||||
// </summary>
|
||||
public static int nocasecmp_to(this string instance, string to)
|
||||
public static int NocasecmpTo(this string instance, string to)
|
||||
{
|
||||
if (instance.empty())
|
||||
return to.empty() ? 0 : -1;
|
||||
if (instance.Empty())
|
||||
return to.Empty() ? 0 : -1;
|
||||
|
||||
if (to.empty())
|
||||
if (to.Empty())
|
||||
return 1;
|
||||
|
||||
int instance_idx = 0;
|
||||
|
@ -627,7 +627,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Return the character code at position [code]at[/code].
|
||||
// </summary>
|
||||
public static int ord_at(this string instance, int at)
|
||||
public static int OrdAt(this string instance, int at)
|
||||
{
|
||||
return instance[at];
|
||||
}
|
||||
|
@ -635,9 +635,9 @@ namespace Godot
|
|||
// <summary>
|
||||
// Format a number to have an exact number of [code]digits[/code] after the decimal point.
|
||||
// </summary>
|
||||
public static string pad_decimals(this string instance, int digits)
|
||||
public static string PadDecimals(this string instance, int digits)
|
||||
{
|
||||
int c = instance.find(".");
|
||||
int c = instance.Find(".");
|
||||
|
||||
if (c == -1)
|
||||
{
|
||||
|
@ -671,10 +671,10 @@ namespace Godot
|
|||
// <summary>
|
||||
// Format a number to have an exact number of [code]digits[/code] before the decimal point.
|
||||
// </summary>
|
||||
public static string pad_zeros(this string instance, int digits)
|
||||
public static string PadZeros(this string instance, int digits)
|
||||
{
|
||||
string s = instance;
|
||||
int end = s.find(".");
|
||||
int end = s.Find(".");
|
||||
|
||||
if (end == -1)
|
||||
end = s.Length;
|
||||
|
@ -704,7 +704,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Decode a percent-encoded string. See [method percent_encode].
|
||||
// </summary>
|
||||
public static string percent_decode(this string instance)
|
||||
public static string PercentDecode(this string instance)
|
||||
{
|
||||
return Uri.UnescapeDataString(instance);
|
||||
}
|
||||
|
@ -712,7 +712,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Percent-encode a string. This is meant to encode parameters in a URL when sending a HTTP GET request and bodies of form-urlencoded POST request.
|
||||
// </summary>
|
||||
public static string percent_encode(this string instance)
|
||||
public static string PercentEncode(this string instance)
|
||||
{
|
||||
return Uri.EscapeDataString(instance);
|
||||
}
|
||||
|
@ -720,7 +720,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// If the string is a path, this concatenates [code]file[/code] at the end of the string as a subpath. E.g. [code]"this/is".plus_file("path") == "this/is/path"[/code].
|
||||
// </summary>
|
||||
public static string plus_file(this string instance, string file)
|
||||
public static string PlusFile(this string instance, string file)
|
||||
{
|
||||
if (instance.Length > 0 && instance[instance.Length - 1] == '/')
|
||||
return instance + file;
|
||||
|
@ -731,7 +731,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Replace occurrences of a substring for different ones inside the string.
|
||||
// </summary>
|
||||
public static string replace(this string instance, string what, string forwhat)
|
||||
public static string Replace(this string instance, string what, string forwhat)
|
||||
{
|
||||
return instance.Replace(what, forwhat);
|
||||
}
|
||||
|
@ -739,7 +739,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Replace occurrences of a substring for different ones inside the string, but search case-insensitive.
|
||||
// </summary>
|
||||
public static string replacen(this string instance, string what, string forwhat)
|
||||
public static string Replacen(this string instance, string what, string forwhat)
|
||||
{
|
||||
return Regex.Replace(instance, what, forwhat, RegexOptions.IgnoreCase);
|
||||
}
|
||||
|
@ -747,7 +747,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Perform a search for a substring, but start from the end of the string instead of the beginning.
|
||||
// </summary>
|
||||
public static int rfind(this string instance, string what, int from = -1)
|
||||
public static int Rfind(this string instance, string what, int from = -1)
|
||||
{
|
||||
return NativeCalls.godot_icall_String_rfind(instance, what, from);
|
||||
}
|
||||
|
@ -755,7 +755,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Perform a search for a substring, but start from the end of the string instead of the beginning. Also search case-insensitive.
|
||||
// </summary>
|
||||
public static int rfindn(this string instance, string what, int from = -1)
|
||||
public static int Rfindn(this string instance, string what, int from = -1)
|
||||
{
|
||||
return NativeCalls.godot_icall_String_rfindn(instance, what, from);
|
||||
}
|
||||
|
@ -763,7 +763,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Return the right side of the string from a given position.
|
||||
// </summary>
|
||||
public static string right(this string instance, int pos)
|
||||
public static string Right(this string instance, int pos)
|
||||
{
|
||||
if (pos >= instance.Length)
|
||||
return instance;
|
||||
|
@ -774,7 +774,7 @@ namespace Godot
|
|||
return instance.Substring(pos, (instance.Length - pos));
|
||||
}
|
||||
|
||||
public static byte[] sha256_buffer(this string instance)
|
||||
public static byte[] Sha256Buffer(this string instance)
|
||||
{
|
||||
return NativeCalls.godot_icall_String_sha256_buffer(instance);
|
||||
}
|
||||
|
@ -782,7 +782,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Return the SHA-256 hash of the string as a string.
|
||||
// </summary>
|
||||
public static string sha256_text(this string instance)
|
||||
public static string Sha256Text(this string instance)
|
||||
{
|
||||
return NativeCalls.godot_icall_String_sha256_text(instance);
|
||||
}
|
||||
|
@ -790,7 +790,7 @@ namespace Godot
|
|||
// <summary>
|
||||
// Return the similarity index of the text compared to this string. 1 means totally similar and 0 means totally dissimilar.
|
||||
// </summary>
|
||||
public static float similarity(this string instance, string text)
|
||||
public static float Similarity(this string instance, string text)
|
||||
{
|
||||
if (instance == text)
|
||||
{
|
||||
|
@ -803,11 +803,11 @@ namespace Godot
|
|||
return 0.0f;
|
||||
}
|
||||
|
||||
string[] src_bigrams = instance.bigrams();
|
||||
string[] tgt_bigrams = text.bigrams();
|
||||
string[] srcBigrams = instance.Bigrams();
|
||||
string[] tgtBigrams = text.Bigrams();
|
||||
|
||||
int src_size = src_bigrams.Length;
|
||||
int tgt_size = tgt_bigrams.Length;
|
||||
int src_size = srcBigrams.Length;
|
||||
int tgt_size = tgtBigrams.Length;
|
||||
|
||||
float sum = src_size + tgt_size;
|
||||
float inter = 0;
|
||||
|
@ -816,7 +816,7 @@ namespace Godot
|
|||
{
|
||||
for (int j = 0; j < tgt_size; j++)
|
||||
{
|
||||
if (src_bigrams[i] == tgt_bigrams[j])
|
||||
if (srcBigrams[i] == tgtBigrams[j])
|
||||
{
|
||||
inter++;
|
||||
break;
|
||||
|
@ -846,7 +846,7 @@ namespace Godot
|
|||
|
||||
while (true)
|
||||
{
|
||||
int end = instance.find(divisor, from);
|
||||
int end = instance.Find(divisor, from);
|
||||
if (end < 0)
|
||||
end = len;
|
||||
if (allow_empty || (end > from))
|
||||
|
|
|
@ -9,38 +9,38 @@ namespace Godot
|
|||
public Basis basis;
|
||||
public Vector3 origin;
|
||||
|
||||
public Transform affine_inverse()
|
||||
public Transform AffineInverse()
|
||||
{
|
||||
Basis basisInv = basis.inverse();
|
||||
return new Transform(basisInv, basisInv.xform(-origin));
|
||||
Basis basisInv = basis.Inverse();
|
||||
return new Transform(basisInv, basisInv.Xform(-origin));
|
||||
}
|
||||
|
||||
public Transform inverse()
|
||||
public Transform Inverse()
|
||||
{
|
||||
Basis basisTr = basis.transposed();
|
||||
return new Transform(basisTr, basisTr.xform(-origin));
|
||||
Basis basisTr = basis.Transposed();
|
||||
return new Transform(basisTr, basisTr.Xform(-origin));
|
||||
}
|
||||
|
||||
public Transform looking_at(Vector3 target, Vector3 up)
|
||||
public Transform LookingAt(Vector3 target, Vector3 up)
|
||||
{
|
||||
Transform t = this;
|
||||
t.set_look_at(origin, target, up);
|
||||
return t;
|
||||
}
|
||||
|
||||
public Transform orthonormalized()
|
||||
public Transform Orthonormalized()
|
||||
{
|
||||
return new Transform(basis.orthonormalized(), origin);
|
||||
return new Transform(basis.Orthonormalized(), origin);
|
||||
}
|
||||
|
||||
public Transform rotated(Vector3 axis, float phi)
|
||||
public Transform Rotated(Vector3 axis, float phi)
|
||||
{
|
||||
return new Transform(new Basis(axis, phi), new Vector3()) * this;
|
||||
}
|
||||
|
||||
public Transform scaled(Vector3 scale)
|
||||
public Transform Scaled(Vector3 scale)
|
||||
{
|
||||
return new Transform(basis.scaled(scale), origin * scale);
|
||||
return new Transform(basis.Scaled(scale), origin * scale);
|
||||
}
|
||||
|
||||
public void set_look_at(Vector3 eye, Vector3 target, Vector3 up)
|
||||
|
@ -49,44 +49,44 @@ namespace Godot
|
|||
// Z vector
|
||||
Vector3 zAxis = eye - target;
|
||||
|
||||
zAxis.normalize();
|
||||
zAxis.Normalize();
|
||||
|
||||
Vector3 yAxis = up;
|
||||
|
||||
Vector3 xAxis = yAxis.cross(zAxis);
|
||||
Vector3 xAxis = yAxis.Cross(zAxis);
|
||||
|
||||
// Recompute Y = Z cross X
|
||||
yAxis = zAxis.cross(xAxis);
|
||||
yAxis = zAxis.Cross(xAxis);
|
||||
|
||||
xAxis.normalize();
|
||||
yAxis.normalize();
|
||||
xAxis.Normalize();
|
||||
yAxis.Normalize();
|
||||
|
||||
basis = Basis.create_from_axes(xAxis, yAxis, zAxis);
|
||||
basis = Basis.CreateFromAxes(xAxis, yAxis, zAxis);
|
||||
|
||||
origin = eye;
|
||||
}
|
||||
|
||||
public Transform translated(Vector3 ofs)
|
||||
public Transform Translated(Vector3 ofs)
|
||||
{
|
||||
return new Transform(basis, new Vector3
|
||||
(
|
||||
origin[0] += basis[0].dot(ofs),
|
||||
origin[1] += basis[1].dot(ofs),
|
||||
origin[2] += basis[2].dot(ofs)
|
||||
origin[0] += basis[0].Dot(ofs),
|
||||
origin[1] += basis[1].Dot(ofs),
|
||||
origin[2] += basis[2].Dot(ofs)
|
||||
));
|
||||
}
|
||||
|
||||
public Vector3 xform(Vector3 v)
|
||||
public Vector3 Xform(Vector3 v)
|
||||
{
|
||||
return new Vector3
|
||||
(
|
||||
basis[0].dot(v) + origin.x,
|
||||
basis[1].dot(v) + origin.y,
|
||||
basis[2].dot(v) + origin.z
|
||||
basis[0].Dot(v) + origin.x,
|
||||
basis[1].Dot(v) + origin.y,
|
||||
basis[2].Dot(v) + origin.z
|
||||
);
|
||||
}
|
||||
|
||||
public Vector3 xform_inv(Vector3 v)
|
||||
public Vector3 XformInv(Vector3 v)
|
||||
{
|
||||
Vector3 vInv = v - origin;
|
||||
|
||||
|
@ -100,7 +100,7 @@ namespace Godot
|
|||
|
||||
public Transform(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis, Vector3 origin)
|
||||
{
|
||||
this.basis = Basis.create_from_axes(xAxis, yAxis, zAxis);
|
||||
this.basis = Basis.CreateFromAxes(xAxis, yAxis, zAxis);
|
||||
this.origin = origin;
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ namespace Godot
|
|||
|
||||
public static Transform operator *(Transform left, Transform right)
|
||||
{
|
||||
left.origin = left.xform(right.origin);
|
||||
left.origin = left.Xform(right.origin);
|
||||
left.basis *= right.basis;
|
||||
return left;
|
||||
}
|
||||
|
|
|
@ -29,12 +29,12 @@ namespace Godot
|
|||
|
||||
public float Rotation
|
||||
{
|
||||
get { return Mathf.atan2(y.x, o.y); }
|
||||
get { return Mathf.Atan2(y.x, o.y); }
|
||||
}
|
||||
|
||||
public Vector2 Scale
|
||||
{
|
||||
get { return new Vector2(x.length(), y.length()); }
|
||||
get { return new Vector2(x.Length(), y.Length()); }
|
||||
}
|
||||
|
||||
public Vector2 this[int index]
|
||||
|
@ -103,7 +103,7 @@ namespace Godot
|
|||
}
|
||||
}
|
||||
|
||||
public Transform2D affine_inverse()
|
||||
public Transform2D AffineInverse()
|
||||
{
|
||||
Transform2D inv = this;
|
||||
|
||||
|
@ -128,22 +128,22 @@ namespace Godot
|
|||
this[0] *= new Vector2(idet, -idet);
|
||||
this[1] *= new Vector2(-idet, idet);
|
||||
|
||||
this[2] = basis_xform(-this[2]);
|
||||
this[2] = BasisXform(-this[2]);
|
||||
|
||||
return inv;
|
||||
}
|
||||
|
||||
public Vector2 basis_xform(Vector2 v)
|
||||
public Vector2 BasisXform(Vector2 v)
|
||||
{
|
||||
return new Vector2(tdotx(v), tdoty(v));
|
||||
return new Vector2(Tdotx(v), Tdoty(v));
|
||||
}
|
||||
|
||||
public Vector2 basis_xform_inv(Vector2 v)
|
||||
public Vector2 BasisXformInv(Vector2 v)
|
||||
{
|
||||
return new Vector2(x.dot(v), y.dot(v));
|
||||
return new Vector2(x.Dot(v), y.Dot(v));
|
||||
}
|
||||
|
||||
public Transform2D interpolate_with(Transform2D m, float c)
|
||||
public Transform2D InterpolateWith(Transform2D m, float c)
|
||||
{
|
||||
float r1 = Rotation;
|
||||
float r2 = m.Rotation;
|
||||
|
@ -152,10 +152,10 @@ namespace Godot
|
|||
Vector2 s2 = m.Scale;
|
||||
|
||||
// Slerp rotation
|
||||
Vector2 v1 = new Vector2(Mathf.cos(r1), Mathf.sin(r1));
|
||||
Vector2 v2 = new Vector2(Mathf.cos(r2), Mathf.sin(r2));
|
||||
Vector2 v1 = new Vector2(Mathf.Cos(r1), Mathf.Sin(r1));
|
||||
Vector2 v2 = new Vector2(Mathf.Cos(r2), Mathf.Sin(r2));
|
||||
|
||||
float dot = v1.dot(v2);
|
||||
float dot = v1.Dot(v2);
|
||||
|
||||
// Clamp dot to [-1, 1]
|
||||
dot = (dot < -1.0f) ? -1.0f : ((dot > 1.0f) ? 1.0f : dot);
|
||||
|
@ -165,13 +165,13 @@ namespace Godot
|
|||
if (dot > 0.9995f)
|
||||
{
|
||||
// Linearly interpolate to avoid numerical precision issues
|
||||
v = v1.linear_interpolate(v2, c).normalized();
|
||||
v = v1.LinearInterpolate(v2, c).Normalized();
|
||||
}
|
||||
else
|
||||
{
|
||||
float angle = c * Mathf.acos(dot);
|
||||
Vector2 v3 = (v2 - v1 * dot).normalized();
|
||||
v = v1 * Mathf.cos(angle) + v3 * Mathf.sin(angle);
|
||||
float angle = c * Mathf.Acos(dot);
|
||||
Vector2 v3 = (v2 - v1 * dot).Normalized();
|
||||
v = v1 * Mathf.Cos(angle) + v3 * Mathf.Sin(angle);
|
||||
}
|
||||
|
||||
// Extract parameters
|
||||
|
@ -179,15 +179,15 @@ namespace Godot
|
|||
Vector2 p2 = m.Origin;
|
||||
|
||||
// Construct matrix
|
||||
Transform2D res = new Transform2D(Mathf.atan2(v.y, v.x), p1.linear_interpolate(p2, c));
|
||||
Vector2 scale = s1.linear_interpolate(s2, c);
|
||||
Transform2D res = new Transform2D(Mathf.Atan2(v.y, v.x), p1.LinearInterpolate(p2, c));
|
||||
Vector2 scale = s1.LinearInterpolate(s2, c);
|
||||
res.x *= scale;
|
||||
res.y *= scale;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public Transform2D inverse()
|
||||
public Transform2D Inverse()
|
||||
{
|
||||
Transform2D inv = this;
|
||||
|
||||
|
@ -196,21 +196,21 @@ namespace Godot
|
|||
inv.x.y = inv.y.x;
|
||||
inv.y.x = temp;
|
||||
|
||||
inv.o = inv.basis_xform(-inv.o);
|
||||
inv.o = inv.BasisXform(-inv.o);
|
||||
|
||||
return inv;
|
||||
}
|
||||
|
||||
public Transform2D orthonormalized()
|
||||
public Transform2D Orthonormalized()
|
||||
{
|
||||
Transform2D on = this;
|
||||
|
||||
Vector2 onX = on.x;
|
||||
Vector2 onY = on.y;
|
||||
|
||||
onX.normalize();
|
||||
onY = onY - onX * (onX.dot(onY));
|
||||
onY.normalize();
|
||||
onX.Normalize();
|
||||
onY = onY - onX * (onX.Dot(onY));
|
||||
onY.Normalize();
|
||||
|
||||
on.x = onX;
|
||||
on.y = onY;
|
||||
|
@ -218,12 +218,12 @@ namespace Godot
|
|||
return on;
|
||||
}
|
||||
|
||||
public Transform2D rotated(float phi)
|
||||
public Transform2D Rotated(float phi)
|
||||
{
|
||||
return this * new Transform2D(phi, new Vector2());
|
||||
}
|
||||
|
||||
public Transform2D scaled(Vector2 scale)
|
||||
public Transform2D Scaled(Vector2 scale)
|
||||
{
|
||||
Transform2D copy = this;
|
||||
copy.x *= scale;
|
||||
|
@ -232,32 +232,32 @@ namespace Godot
|
|||
return copy;
|
||||
}
|
||||
|
||||
private float tdotx(Vector2 with)
|
||||
private float Tdotx(Vector2 with)
|
||||
{
|
||||
return this[0, 0] * with[0] + this[1, 0] * with[1];
|
||||
}
|
||||
|
||||
private float tdoty(Vector2 with)
|
||||
private float Tdoty(Vector2 with)
|
||||
{
|
||||
return this[0, 1] * with[0] + this[1, 1] * with[1];
|
||||
}
|
||||
|
||||
public Transform2D translated(Vector2 offset)
|
||||
public Transform2D Translated(Vector2 offset)
|
||||
{
|
||||
Transform2D copy = this;
|
||||
copy.o += copy.basis_xform(offset);
|
||||
copy.o += copy.BasisXform(offset);
|
||||
return copy;
|
||||
}
|
||||
|
||||
public Vector2 xform(Vector2 v)
|
||||
public Vector2 Xform(Vector2 v)
|
||||
{
|
||||
return new Vector2(tdotx(v), tdoty(v)) + o;
|
||||
return new Vector2(Tdotx(v), Tdoty(v)) + o;
|
||||
}
|
||||
|
||||
public Vector2 xform_inv(Vector2 v)
|
||||
public Vector2 XformInv(Vector2 v)
|
||||
{
|
||||
Vector2 vInv = v - o;
|
||||
return new Vector2(x.dot(vInv), y.dot(vInv));
|
||||
return new Vector2(x.Dot(vInv), y.Dot(vInv));
|
||||
}
|
||||
|
||||
public Transform2D(Vector2 xAxis, Vector2 yAxis, Vector2 origin)
|
||||
|
@ -275,8 +275,8 @@ namespace Godot
|
|||
|
||||
public Transform2D(float rot, Vector2 pos)
|
||||
{
|
||||
float cr = Mathf.cos(rot);
|
||||
float sr = Mathf.sin(rot);
|
||||
float cr = Mathf.Cos(rot);
|
||||
float sr = Mathf.Sin(rot);
|
||||
x.x = cr;
|
||||
y.y = cr;
|
||||
x.y = -sr;
|
||||
|
@ -286,14 +286,14 @@ namespace Godot
|
|||
|
||||
public static Transform2D operator *(Transform2D left, Transform2D right)
|
||||
{
|
||||
left.o = left.xform(right.o);
|
||||
left.o = left.Xform(right.o);
|
||||
|
||||
float x0, x1, y0, y1;
|
||||
|
||||
x0 = left.tdotx(right.x);
|
||||
x1 = left.tdoty(right.x);
|
||||
y0 = left.tdotx(right.y);
|
||||
y1 = left.tdoty(right.y);
|
||||
x0 = left.Tdotx(right.x);
|
||||
x1 = left.Tdoty(right.x);
|
||||
y0 = left.Tdotx(right.y);
|
||||
y1 = left.Tdoty(right.y);
|
||||
|
||||
left.x.x = x0;
|
||||
left.x.y = x1;
|
||||
|
|
|
@ -46,57 +46,57 @@ namespace Godot
|
|||
}
|
||||
}
|
||||
|
||||
internal void normalize()
|
||||
internal void Normalize()
|
||||
{
|
||||
float length = x * x + y * y;
|
||||
|
||||
if (length != 0f)
|
||||
{
|
||||
length = Mathf.sqrt(length);
|
||||
length = Mathf.Sqrt(length);
|
||||
x /= length;
|
||||
y /= length;
|
||||
}
|
||||
}
|
||||
|
||||
private float cross(Vector2 b)
|
||||
private float Cross(Vector2 b)
|
||||
{
|
||||
return x * b.y - y * b.x;
|
||||
}
|
||||
|
||||
public Vector2 abs()
|
||||
public Vector2 Abs()
|
||||
{
|
||||
return new Vector2(Mathf.abs(x), Mathf.abs(y));
|
||||
return new Vector2(Mathf.Abs(x), Mathf.Abs(y));
|
||||
}
|
||||
|
||||
public float angle()
|
||||
public float Angle()
|
||||
{
|
||||
return Mathf.atan2(y, x);
|
||||
return Mathf.Atan2(y, x);
|
||||
}
|
||||
|
||||
public float angle_to(Vector2 to)
|
||||
public float AngleTo(Vector2 to)
|
||||
{
|
||||
return Mathf.atan2(cross(to), dot(to));
|
||||
return Mathf.Atan2(Cross(to), Dot(to));
|
||||
}
|
||||
|
||||
public float angle_to_point(Vector2 to)
|
||||
public float AngleToPoint(Vector2 to)
|
||||
{
|
||||
return Mathf.atan2(x - to.x, y - to.y);
|
||||
return Mathf.Atan2(x - to.x, y - to.y);
|
||||
}
|
||||
|
||||
public float aspect()
|
||||
public float Aspect()
|
||||
{
|
||||
return x / y;
|
||||
}
|
||||
|
||||
public Vector2 bounce(Vector2 n)
|
||||
public Vector2 Bounce(Vector2 n)
|
||||
{
|
||||
return -reflect(n);
|
||||
return -Reflect(n);
|
||||
}
|
||||
|
||||
public Vector2 clamped(float length)
|
||||
public Vector2 Clamped(float length)
|
||||
{
|
||||
Vector2 v = this;
|
||||
float l = this.length();
|
||||
float l = this.Length();
|
||||
|
||||
if (l > 0 && length < l)
|
||||
{
|
||||
|
@ -107,7 +107,7 @@ namespace Godot
|
|||
return v;
|
||||
}
|
||||
|
||||
public Vector2 cubic_interpolate(Vector2 b, Vector2 preA, Vector2 postB, float t)
|
||||
public Vector2 CubicInterpolate(Vector2 b, Vector2 preA, Vector2 postB, float t)
|
||||
{
|
||||
Vector2 p0 = preA;
|
||||
Vector2 p1 = this;
|
||||
|
@ -123,42 +123,42 @@ namespace Godot
|
|||
(-p0 + 3.0f * p1 - 3.0f * p2 + p3) * t3);
|
||||
}
|
||||
|
||||
public float distance_squared_to(Vector2 to)
|
||||
public float DistanceSquaredTo(Vector2 to)
|
||||
{
|
||||
return (x - to.x) * (x - to.x) + (y - to.y) * (y - to.y);
|
||||
}
|
||||
|
||||
public float distance_to(Vector2 to)
|
||||
public float DistanceTo(Vector2 to)
|
||||
{
|
||||
return Mathf.sqrt((x - to.x) * (x - to.x) + (y - to.y) * (y - to.y));
|
||||
return Mathf.Sqrt((x - to.x) * (x - to.x) + (y - to.y) * (y - to.y));
|
||||
}
|
||||
|
||||
public float dot(Vector2 with)
|
||||
public float Dot(Vector2 with)
|
||||
{
|
||||
return x * with.x + y * with.y;
|
||||
}
|
||||
|
||||
public Vector2 floor()
|
||||
public Vector2 Floor()
|
||||
{
|
||||
return new Vector2(Mathf.floor(x), Mathf.floor(y));
|
||||
return new Vector2(Mathf.Floor(x), Mathf.Floor(y));
|
||||
}
|
||||
|
||||
public bool is_normalized()
|
||||
public bool IsNormalized()
|
||||
{
|
||||
return Mathf.abs(length_squared() - 1.0f) < Mathf.Epsilon;
|
||||
return Mathf.Abs(LengthSquared() - 1.0f) < Mathf.Epsilon;
|
||||
}
|
||||
|
||||
public float length()
|
||||
public float Length()
|
||||
{
|
||||
return Mathf.sqrt(x * x + y * y);
|
||||
return Mathf.Sqrt(x * x + y * y);
|
||||
}
|
||||
|
||||
public float length_squared()
|
||||
public float LengthSquared()
|
||||
{
|
||||
return x * x + y * y;
|
||||
}
|
||||
|
||||
public Vector2 linear_interpolate(Vector2 b, float t)
|
||||
public Vector2 LinearInterpolate(Vector2 b, float t)
|
||||
{
|
||||
Vector2 res = this;
|
||||
|
||||
|
@ -168,35 +168,35 @@ namespace Godot
|
|||
return res;
|
||||
}
|
||||
|
||||
public Vector2 normalized()
|
||||
public Vector2 Normalized()
|
||||
{
|
||||
Vector2 result = this;
|
||||
result.normalize();
|
||||
result.Normalize();
|
||||
return result;
|
||||
}
|
||||
|
||||
public Vector2 reflect(Vector2 n)
|
||||
public Vector2 Reflect(Vector2 n)
|
||||
{
|
||||
return 2.0f * n * dot(n) - this;
|
||||
return 2.0f * n * Dot(n) - this;
|
||||
}
|
||||
|
||||
public Vector2 rotated(float phi)
|
||||
public Vector2 Rotated(float phi)
|
||||
{
|
||||
float rads = angle() + phi;
|
||||
return new Vector2(Mathf.cos(rads), Mathf.sin(rads)) * length();
|
||||
float rads = Angle() + phi;
|
||||
return new Vector2(Mathf.Cos(rads), Mathf.Sin(rads)) * Length();
|
||||
}
|
||||
|
||||
public Vector2 slide(Vector2 n)
|
||||
public Vector2 Slide(Vector2 n)
|
||||
{
|
||||
return this - n * dot(n);
|
||||
return this - n * Dot(n);
|
||||
}
|
||||
|
||||
public Vector2 snapped(Vector2 by)
|
||||
public Vector2 Snapped(Vector2 by)
|
||||
{
|
||||
return new Vector2(Mathf.stepify(x, by.x), Mathf.stepify(y, by.y));
|
||||
return new Vector2(Mathf.Stepify(x, by.x), Mathf.Stepify(y, by.y));
|
||||
}
|
||||
|
||||
public Vector2 tangent()
|
||||
public Vector2 Tangent()
|
||||
{
|
||||
return new Vector2(y, -x);
|
||||
}
|
||||
|
|
|
@ -59,9 +59,9 @@ namespace Godot
|
|||
}
|
||||
}
|
||||
|
||||
internal void normalize()
|
||||
internal void Normalize()
|
||||
{
|
||||
float length = this.length();
|
||||
float length = this.Length();
|
||||
|
||||
if (length == 0f)
|
||||
{
|
||||
|
@ -75,27 +75,27 @@ namespace Godot
|
|||
}
|
||||
}
|
||||
|
||||
public Vector3 abs()
|
||||
public Vector3 Abs()
|
||||
{
|
||||
return new Vector3(Mathf.abs(x), Mathf.abs(y), Mathf.abs(z));
|
||||
return new Vector3(Mathf.Abs(x), Mathf.Abs(y), Mathf.Abs(z));
|
||||
}
|
||||
|
||||
public float angle_to(Vector3 to)
|
||||
public float AngleTo(Vector3 to)
|
||||
{
|
||||
return Mathf.atan2(cross(to).length(), dot(to));
|
||||
return Mathf.Atan2(Cross(to).Length(), Dot(to));
|
||||
}
|
||||
|
||||
public Vector3 bounce(Vector3 n)
|
||||
public Vector3 Bounce(Vector3 n)
|
||||
{
|
||||
return -reflect(n);
|
||||
return -Reflect(n);
|
||||
}
|
||||
|
||||
public Vector3 ceil()
|
||||
public Vector3 Ceil()
|
||||
{
|
||||
return new Vector3(Mathf.ceil(x), Mathf.ceil(y), Mathf.ceil(z));
|
||||
return new Vector3(Mathf.Ceil(x), Mathf.Ceil(y), Mathf.Ceil(z));
|
||||
}
|
||||
|
||||
public Vector3 cross(Vector3 b)
|
||||
public Vector3 Cross(Vector3 b)
|
||||
{
|
||||
return new Vector3
|
||||
(
|
||||
|
@ -105,7 +105,7 @@ namespace Godot
|
|||
);
|
||||
}
|
||||
|
||||
public Vector3 cubic_interpolate(Vector3 b, Vector3 preA, Vector3 postB, float t)
|
||||
public Vector3 CubicInterpolate(Vector3 b, Vector3 preA, Vector3 postB, float t)
|
||||
{
|
||||
Vector3 p0 = preA;
|
||||
Vector3 p1 = this;
|
||||
|
@ -122,46 +122,46 @@ namespace Godot
|
|||
);
|
||||
}
|
||||
|
||||
public float distance_squared_to(Vector3 b)
|
||||
public float DistanceSquaredTo(Vector3 b)
|
||||
{
|
||||
return (b - this).length_squared();
|
||||
return (b - this).LengthSquared();
|
||||
}
|
||||
|
||||
public float distance_to(Vector3 b)
|
||||
public float DistanceTo(Vector3 b)
|
||||
{
|
||||
return (b - this).length();
|
||||
return (b - this).Length();
|
||||
}
|
||||
|
||||
public float dot(Vector3 b)
|
||||
public float Dot(Vector3 b)
|
||||
{
|
||||
return x * b.x + y * b.y + z * b.z;
|
||||
}
|
||||
|
||||
public Vector3 floor()
|
||||
public Vector3 Floor()
|
||||
{
|
||||
return new Vector3(Mathf.floor(x), Mathf.floor(y), Mathf.floor(z));
|
||||
return new Vector3(Mathf.Floor(x), Mathf.Floor(y), Mathf.Floor(z));
|
||||
}
|
||||
|
||||
public Vector3 inverse()
|
||||
public Vector3 Inverse()
|
||||
{
|
||||
return new Vector3(1.0f / x, 1.0f / y, 1.0f / z);
|
||||
}
|
||||
|
||||
public bool is_normalized()
|
||||
public bool IsNormalized()
|
||||
{
|
||||
return Mathf.abs(length_squared() - 1.0f) < Mathf.Epsilon;
|
||||
return Mathf.Abs(LengthSquared() - 1.0f) < Mathf.Epsilon;
|
||||
}
|
||||
|
||||
public float length()
|
||||
public float Length()
|
||||
{
|
||||
float x2 = x * x;
|
||||
float y2 = y * y;
|
||||
float z2 = z * z;
|
||||
|
||||
return Mathf.sqrt(x2 + y2 + z2);
|
||||
return Mathf.Sqrt(x2 + y2 + z2);
|
||||
}
|
||||
|
||||
public float length_squared()
|
||||
public float LengthSquared()
|
||||
{
|
||||
float x2 = x * x;
|
||||
float y2 = y * y;
|
||||
|
@ -170,7 +170,7 @@ namespace Godot
|
|||
return x2 + y2 + z2;
|
||||
}
|
||||
|
||||
public Vector3 linear_interpolate(Vector3 b, float t)
|
||||
public Vector3 LinearInterpolate(Vector3 b, float t)
|
||||
{
|
||||
return new Vector3
|
||||
(
|
||||
|
@ -180,24 +180,24 @@ namespace Godot
|
|||
);
|
||||
}
|
||||
|
||||
public Axis max_axis()
|
||||
public Axis MaxAxis()
|
||||
{
|
||||
return x < y ? (y < z ? Axis.Z : Axis.Y) : (x < z ? Axis.Z : Axis.X);
|
||||
}
|
||||
|
||||
public Axis min_axis()
|
||||
public Axis MinAxis()
|
||||
{
|
||||
return x < y ? (x < z ? Axis.X : Axis.Z) : (y < z ? Axis.Y : Axis.Z);
|
||||
}
|
||||
|
||||
public Vector3 normalized()
|
||||
public Vector3 Normalized()
|
||||
{
|
||||
Vector3 v = this;
|
||||
v.normalize();
|
||||
v.Normalize();
|
||||
return v;
|
||||
}
|
||||
|
||||
public Basis outer(Vector3 b)
|
||||
public Basis Outer(Vector3 b)
|
||||
{
|
||||
return new Basis(
|
||||
new Vector3(x * b.x, x * b.y, x * b.z),
|
||||
|
@ -206,36 +206,36 @@ namespace Godot
|
|||
);
|
||||
}
|
||||
|
||||
public Vector3 reflect(Vector3 n)
|
||||
public Vector3 Reflect(Vector3 n)
|
||||
{
|
||||
#if DEBUG
|
||||
if (!n.is_normalized())
|
||||
if (!n.IsNormalized())
|
||||
throw new ArgumentException(String.Format("{0} is not normalized", n), nameof(n));
|
||||
#endif
|
||||
return 2.0f * n * dot(n) - this;
|
||||
return 2.0f * n * Dot(n) - this;
|
||||
}
|
||||
|
||||
public Vector3 rotated(Vector3 axis, float phi)
|
||||
public Vector3 Rotated(Vector3 axis, float phi)
|
||||
{
|
||||
return new Basis(axis, phi).xform(this);
|
||||
return new Basis(axis, phi).Xform(this);
|
||||
}
|
||||
|
||||
public Vector3 slide(Vector3 n)
|
||||
public Vector3 Slide(Vector3 n)
|
||||
{
|
||||
return this - n * dot(n);
|
||||
return this - n * Dot(n);
|
||||
}
|
||||
|
||||
public Vector3 snapped(Vector3 by)
|
||||
public Vector3 Snapped(Vector3 by)
|
||||
{
|
||||
return new Vector3
|
||||
(
|
||||
Mathf.stepify(x, by.x),
|
||||
Mathf.stepify(y, by.y),
|
||||
Mathf.stepify(z, by.z)
|
||||
Mathf.Stepify(x, by.x),
|
||||
Mathf.Stepify(y, by.y),
|
||||
Mathf.Stepify(z, by.z)
|
||||
);
|
||||
}
|
||||
|
||||
public Basis to_diagonal_matrix()
|
||||
public Basis ToDiagonalMatrix()
|
||||
{
|
||||
return new Basis(
|
||||
x, 0f, 0f,
|
||||
|
|
Loading…
Reference in a new issue