You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
Don't create unnecessary arrays in C#
This commit is contained in:
@@ -479,8 +479,8 @@ namespace Godot
|
|||||||
/// </returns>
|
/// </returns>
|
||||||
public readonly bool IntersectsPlane(Plane plane)
|
public readonly bool IntersectsPlane(Plane plane)
|
||||||
{
|
{
|
||||||
Vector3[] points =
|
ReadOnlySpan<Vector3> points =
|
||||||
{
|
[
|
||||||
new Vector3(_position.X, _position.Y, _position.Z),
|
new Vector3(_position.X, _position.Y, _position.Z),
|
||||||
new Vector3(_position.X, _position.Y, _position.Z + _size.Z),
|
new Vector3(_position.X, _position.Y, _position.Z + _size.Z),
|
||||||
new Vector3(_position.X, _position.Y + _size.Y, _position.Z),
|
new Vector3(_position.X, _position.Y + _size.Y, _position.Z),
|
||||||
@@ -489,7 +489,7 @@ namespace Godot
|
|||||||
new Vector3(_position.X + _size.X, _position.Y, _position.Z + _size.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),
|
||||||
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;
|
bool over = false;
|
||||||
bool under = false;
|
bool under = false;
|
||||||
|
|||||||
@@ -1665,8 +1665,8 @@ namespace Godot
|
|||||||
/// <returns>The position of the first non-zero digit.</returns>
|
/// <returns>The position of the first non-zero digit.</returns>
|
||||||
public static int StepDecimals(double step)
|
public static int StepDecimals(double step)
|
||||||
{
|
{
|
||||||
double[] sd = new double[]
|
ReadOnlySpan<double> sd =
|
||||||
{
|
[
|
||||||
0.9999,
|
0.9999,
|
||||||
0.09999,
|
0.09999,
|
||||||
0.009999,
|
0.009999,
|
||||||
@@ -1676,7 +1676,7 @@ namespace Godot
|
|||||||
0.0000009999,
|
0.0000009999,
|
||||||
0.00000009999,
|
0.00000009999,
|
||||||
0.000000009999,
|
0.000000009999,
|
||||||
};
|
];
|
||||||
double abs = Math.Abs(step);
|
double abs = Math.Abs(step);
|
||||||
double decs = abs - (int)abs; // Strip away integer part
|
double decs = abs - (int)abs; // Strip away integer part
|
||||||
for (int i = 0; i < sd.Length; i++)
|
for (int i = 0; i < sd.Length; i++)
|
||||||
|
|||||||
Reference in New Issue
Block a user