mirror of
https://github.com/celisej567/LibBSP.git
synced 2025-12-31 13:48:15 +03:00
Initial support for Godot engine.
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
namespace LibBSP {
|
||||
#if UNITY
|
||||
using Color = UnityEngine.Color32;
|
||||
#elif GODOT
|
||||
using Color = Godot.Color;
|
||||
#else
|
||||
using Color = System.Drawing.Color;
|
||||
#endif
|
||||
@@ -25,6 +27,8 @@ namespace LibBSP {
|
||||
public static Color FromArgb(int a, int r, int g, int b) {
|
||||
#if UNITY
|
||||
return new Color((byte)r, (byte)g, (byte)b, (byte)a);
|
||||
#elif GODOT
|
||||
return new Color(r << 24 | g << 16 | b << 8 | a);
|
||||
#else
|
||||
return Color.FromArgb(a, r, g, b);
|
||||
#endif
|
||||
@@ -42,6 +46,11 @@ namespace LibBSP {
|
||||
bytes[1] = color.g;
|
||||
bytes[2] = color.b;
|
||||
bytes[3] = color.a;
|
||||
#elif GODOT
|
||||
bytes[0] = (byte)color.r8;
|
||||
bytes[1] = (byte)color.g8;
|
||||
bytes[2] = (byte)color.b8;
|
||||
bytes[3] = (byte)color.a8;
|
||||
#else
|
||||
bytes[0] = color.R;
|
||||
bytes[1] = color.G;
|
||||
|
||||
@@ -4,13 +4,15 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if UNITY
|
||||
using UnityEngine;
|
||||
#endif
|
||||
|
||||
namespace LibBSP {
|
||||
#if UNITY
|
||||
using Vector3d = Vector3;
|
||||
using Plane = UnityEngine.Plane;
|
||||
using Vector3d = UnityEngine.Vector3;
|
||||
using Ray = UnityEngine.Ray;
|
||||
#elif GODOT
|
||||
using Plane = Godot.Plane;
|
||||
using Vector3d = Godot.Vector3;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
@@ -30,6 +32,32 @@ namespace LibBSP {
|
||||
new Vector3d(0, -1, 0), new Vector3d(1, 0, 0), new Vector3d(0, 0, -1)
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Gets the normal of this <see cref="Plane"/>.
|
||||
/// </summary>
|
||||
/// <param name="p">This <see cref="Plane"/>.</param>
|
||||
/// <returns>The normal of this <see cref="Plane"/>.</returns>
|
||||
public static Vector3d GetNormal(this Plane p) {
|
||||
#if GODOT
|
||||
return p.Normal;
|
||||
#else
|
||||
return p.normal;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the distance of this <see cref="Plane"/> from the origin.
|
||||
/// </summary>
|
||||
/// <param name="p">This <see cref="Plane"/>.</param>
|
||||
/// <returns>The distance of this <see cref="Plane"/> from the origin.</returns>
|
||||
public static double GetDistance(this Plane p) {
|
||||
#if GODOT
|
||||
return p.D;
|
||||
#else
|
||||
return p.distance;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Intersects three <see cref="Plane"/>s at a <see cref="Vector3d"/>. Returns NaN for all components if two or more <see cref="Plane"/>s are parallel.
|
||||
/// </summary>
|
||||
@@ -38,9 +66,15 @@ namespace LibBSP {
|
||||
/// <param name="p3"><see cref="Plane"/> to intersect.</param>
|
||||
/// <returns>Point of intersection if all three <see cref="Plane"/>s meet at a point, (NaN, NaN, NaN) otherwise.</returns>
|
||||
public static Vector3d Intersection(Plane p1, Plane p2, Plane p3) {
|
||||
Vector3d aN = p1.normal;
|
||||
Vector3d bN = p2.normal;
|
||||
Vector3d cN = p3.normal;
|
||||
#if GODOT
|
||||
return p1.Intersect3(p2, p3);
|
||||
#else
|
||||
Vector3d aN = p1.GetNormal();
|
||||
Vector3d bN = p2.GetNormal();
|
||||
Vector3d cN = p3.GetNormal();
|
||||
var p1d = p1.distance;
|
||||
var p2d = p2.distance;
|
||||
var p3d = p3.distance;
|
||||
|
||||
var partSolx1 = (bN.y * cN.z) - (bN.z * cN.y);
|
||||
var partSoly1 = (bN.z * cN.x) - (bN.x * cN.z);
|
||||
@@ -50,9 +84,10 @@ namespace LibBSP {
|
||||
return new Vector3d(float.NaN, float.NaN, float.NaN);
|
||||
}
|
||||
|
||||
return new Vector3d((p1.distance * partSolx1 + p2.distance * (cN.y * aN.z - cN.z * aN.y) + p3.distance * (aN.y * bN.z - aN.z * bN.y)) / det,
|
||||
(p1.distance * partSoly1 + p2.distance * (aN.x * cN.z - aN.z * cN.x) + p3.distance * (bN.x * aN.z - bN.z * aN.x)) / det,
|
||||
(p1.distance * partSolz1 + p2.distance * (cN.x * aN.y - cN.y * aN.x) + p3.distance * (aN.x * bN.y - aN.y * bN.x)) / det);
|
||||
return new Vector3d((p1d * partSolx1 + p2d * (cN.y * aN.z - cN.z * aN.y) + p3d * (aN.y * bN.z - aN.z * bN.y)) / det,
|
||||
(p1d * partSoly1 + p2d * (aN.x * cN.z - aN.z * cN.x) + p3d * (bN.x * aN.z - bN.z * aN.x)) / det,
|
||||
(p1d * partSolz1 + p2d * (cN.x * aN.y - cN.y * aN.x) + p3d * (aN.x * bN.y - aN.y * bN.x)) / det);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -63,7 +98,11 @@ namespace LibBSP {
|
||||
/// <param name="p3"><see cref="Plane"/> to intersect.</param>
|
||||
/// <returns>Point of intersection if all three <see cref="Plane"/>s meet at a point, (NaN, NaN, NaN) otherwise.</returns>
|
||||
public static Vector3d Intersect(this Plane p1, Plane p2, Plane p3) {
|
||||
#if GODOT
|
||||
return p1.Intersect3(p2, p3);
|
||||
#else
|
||||
return Intersection(p1, p2, p3);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -86,6 +125,28 @@ namespace LibBSP {
|
||||
}
|
||||
}
|
||||
|
||||
#if GODOT
|
||||
/// <summary>
|
||||
/// Raycasts a <see cref="Ray"/> against this <see cref="Plane"/>.
|
||||
/// </summary>
|
||||
/// <param name="ray"><see cref="Ray"/> to raycast against.</param>
|
||||
/// <param name="enter"><c>out</c> parameter that will contain the distance along <paramref name="ray"/> where the collision happened.</param>
|
||||
/// <returns>
|
||||
/// <c>true</c> and <paramref name="enter"/> is positive if <see cref="Ray"/> intersects this <see cref="Plane"/> in front of the ray,
|
||||
/// <c>false</c> and <paramref name="enter"/> is negative if <see cref="Ray"/> intersects this <see cref="Plane"/> behind the ray,
|
||||
/// <c>false</c> and <paramref name="enter"/> is 0 if the <see cref="Ray"/> is parallel to this <see cref="Plane"/>.
|
||||
/// </returns>
|
||||
public static bool Raycast(this Plane p, Ray ray, out double enter) {
|
||||
double denom = ray.direction.Dot(p.Normal);
|
||||
if (denom > -0.005 && denom < 0.005) {
|
||||
enter = 0;
|
||||
return false;
|
||||
}
|
||||
enter = (-1 * ray.origin.Dot(p.Normal) + p.D) / denom;
|
||||
return enter > 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Intersects this <see cref="Plane"/> with a <see cref="Ray"/> "<paramref name="r"/>" at a <see cref="Vector3d"/>. Returns NaN for all components if they do not intersect.
|
||||
/// </summary>
|
||||
@@ -113,29 +174,29 @@ namespace LibBSP {
|
||||
/// <param name="p2"><see cref="Plane"/> to intersect.</param>
|
||||
/// <returns>Line of intersection where "<paramref name="p1"/>" intersects "<paramref name="p2"/>", ((NaN, NaN, NaN) + p(NaN, NaN, NaN)) otherwise.</returns>
|
||||
public static Ray Intersection(Plane p1, Plane p2) {
|
||||
Vector3d direction = Vector3d.Cross(p1.normal, p2.normal);
|
||||
if (direction == Vector3d.zero) {
|
||||
Vector3d direction = p1.GetNormal().Cross(p2.GetNormal());
|
||||
if (direction == new Vector3d(0, 0, 0)) {
|
||||
return new Ray(new Vector3d(float.NaN, float.NaN, float.NaN), new Vector3d(float.NaN, float.NaN, float.NaN));
|
||||
}
|
||||
// If x == 0, solve for y in terms of z, or z in terms of y
|
||||
|
||||
Vector3d origin;
|
||||
|
||||
Vector3d sqrDirection = Vector3d.Scale(direction, direction);
|
||||
Vector3d sqrDirection = new Vector3d(direction.x * direction.x, direction.y * direction.y, direction.z * direction.z);
|
||||
if (sqrDirection.x >= sqrDirection.y && sqrDirection.x >= sqrDirection.z) {
|
||||
var denom = (p1.normal.y * p2.normal.z) - (p2.normal.y * p1.normal.z);
|
||||
var denom = (p1.GetNormal().y * p2.GetNormal().z) - (p2.GetNormal().y * p1.GetNormal().z);
|
||||
origin = new Vector3d(0,
|
||||
((p1.normal.z * p2.distance) - (p2.normal.z * p1.distance)) / denom,
|
||||
((p2.normal.y * p1.distance) - (p1.normal.y * p2.distance)) / denom);
|
||||
((p1.GetNormal().z * (float)p2.GetDistance()) - (p2.GetNormal().z * (float)p1.GetDistance())) / denom,
|
||||
((p2.GetNormal().y * (float)p1.GetDistance()) - (p1.GetNormal().y * (float)p2.GetDistance())) / denom);
|
||||
} else if (sqrDirection.y >= sqrDirection.x && sqrDirection.y >= sqrDirection.z) {
|
||||
var denom = (p1.normal.x * p2.normal.z) - (p2.normal.x * p1.normal.z);
|
||||
origin = new Vector3d(((p1.normal.z * p2.distance) - (p2.normal.z * p1.distance)) / denom,
|
||||
var denom = (p1.GetNormal().x * p2.GetNormal().z) - (p2.GetNormal().x * p1.GetNormal().z);
|
||||
origin = new Vector3d(((p1.GetNormal().z * (float)p2.GetDistance()) - (p2.GetNormal().z * (float)p1.GetDistance())) / denom,
|
||||
0,
|
||||
((p2.normal.x * p1.distance) - (p1.normal.x * p2.distance)) / denom);
|
||||
((p2.GetNormal().x * (float)p1.GetDistance()) - (p1.GetNormal().x * (float)p2.GetDistance())) / denom);
|
||||
} else {
|
||||
var denom = (p1.normal.x * p2.normal.y) - (p2.normal.x * p1.normal.y);
|
||||
origin = new Vector3d(((p1.normal.y * p2.distance) - (p2.normal.y * p1.distance)) / denom,
|
||||
((p2.normal.x * p1.distance) - (p1.normal.x * p2.distance)) / denom,
|
||||
var denom = (p1.GetNormal().x * p2.GetNormal().y) - (p2.GetNormal().x * p1.GetNormal().y);
|
||||
origin = new Vector3d(((p1.GetNormal().y * (float)p2.GetDistance()) - (p2.GetNormal().y * (float)p1.GetDistance())) / denom,
|
||||
((p2.GetNormal().x * (float)p1.GetDistance()) - (p1.GetNormal().x * (float)p2.GetDistance())) / denom,
|
||||
0);
|
||||
}
|
||||
|
||||
@@ -161,61 +222,61 @@ namespace LibBSP {
|
||||
public static Vector3d[] GenerateThreePoints(this Plane p, float scalar = 16) {
|
||||
Vector3d[] points = new Vector3d[3];
|
||||
// Figure out if the plane is parallel to two of the axes.
|
||||
if (p.normal.y == 0 && p.normal.z == 0) {
|
||||
if (p.GetNormal().y == 0 && p.GetNormal().z == 0) {
|
||||
// parallel to plane YZ
|
||||
points[0] = new Vector3d(p.distance / p.normal.x, -scalar, scalar);
|
||||
points[1] = new Vector3d(p.distance / p.normal.x, 0, 0);
|
||||
points[2] = new Vector3d(p.distance / p.normal.x, scalar, scalar);
|
||||
if (p.normal.x > 0) {
|
||||
points[0] = new Vector3d((float)p.GetDistance() / p.GetNormal().x, -scalar, scalar);
|
||||
points[1] = new Vector3d((float)p.GetDistance() / p.GetNormal().x, 0, 0);
|
||||
points[2] = new Vector3d((float)p.GetDistance() / p.GetNormal().x, scalar, scalar);
|
||||
if (p.GetNormal().x > 0) {
|
||||
Array.Reverse(points);
|
||||
}
|
||||
} else if (p.normal.x == 0 && p.normal.z == 0) {
|
||||
} else if (p.GetNormal().x == 0 && p.GetNormal().z == 0) {
|
||||
// parallel to plane XZ
|
||||
points[0] = new Vector3d(scalar, p.distance / p.normal.y, -scalar);
|
||||
points[1] = new Vector3d(0, p.distance / p.normal.y, 0);
|
||||
points[2] = new Vector3d(scalar, p.distance / p.normal.y, scalar);
|
||||
if (p.normal.y > 0) {
|
||||
points[0] = new Vector3d(scalar, (float)p.GetDistance() / p.GetNormal().y, -scalar);
|
||||
points[1] = new Vector3d(0, (float)p.GetDistance() / p.GetNormal().y, 0);
|
||||
points[2] = new Vector3d(scalar, (float)p.GetDistance() / p.GetNormal().y, scalar);
|
||||
if (p.GetNormal().y > 0) {
|
||||
Array.Reverse(points);
|
||||
}
|
||||
} else if (p.normal.x == 0 && p.normal.y == 0) {
|
||||
} else if (p.GetNormal().x == 0 && p.GetNormal().y == 0) {
|
||||
// parallel to plane XY
|
||||
points[0] = new Vector3d(-scalar, scalar, p.distance / p.normal.z);
|
||||
points[1] = new Vector3d(0, 0, p.distance / p.normal.z);
|
||||
points[2] = new Vector3d(scalar, scalar, p.distance / p.normal.z);
|
||||
if (p.normal.z > 0) {
|
||||
points[0] = new Vector3d(-scalar, scalar, (float)p.GetDistance() / p.GetNormal().z);
|
||||
points[1] = new Vector3d(0, 0, (float)p.GetDistance() / p.GetNormal().z);
|
||||
points[2] = new Vector3d(scalar, scalar, (float)p.GetDistance() / p.GetNormal().z);
|
||||
if (p.GetNormal().z > 0) {
|
||||
Array.Reverse(points);
|
||||
}
|
||||
} else if (p.normal.x == 0) {
|
||||
} else if (p.GetNormal().x == 0) {
|
||||
// If you reach this point the plane is not parallel to any two-axis plane.
|
||||
// parallel to X axis
|
||||
points[0] = new Vector3d(-scalar, scalar * scalar, (-(scalar * scalar * p.normal.y - p.distance)) / p.normal.z);
|
||||
points[1] = new Vector3d(0, 0, p.distance / p.normal.z);
|
||||
points[2] = new Vector3d(scalar, scalar * scalar, (-(scalar * scalar * p.normal.y - p.distance)) / p.normal.z);
|
||||
if (p.normal.z > 0) {
|
||||
points[0] = new Vector3d(-scalar, scalar * scalar, (-(scalar * scalar * p.GetNormal().y - (float)p.GetDistance())) / p.GetNormal().z);
|
||||
points[1] = new Vector3d(0, 0, (float)p.GetDistance() / p.GetNormal().z);
|
||||
points[2] = new Vector3d(scalar, scalar * scalar, (-(scalar * scalar * p.GetNormal().y - (float)p.GetDistance())) / p.GetNormal().z);
|
||||
if (p.GetNormal().z > 0) {
|
||||
Array.Reverse(points);
|
||||
}
|
||||
} else if (p.normal.y == 0) {
|
||||
} else if (p.GetNormal().y == 0) {
|
||||
// parallel to Y axis
|
||||
points[0] = new Vector3d((-(scalar * scalar * p.normal.z - p.distance)) / p.normal.x, -scalar, scalar * scalar);
|
||||
points[1] = new Vector3d(p.distance / p.normal.x, 0, 0);
|
||||
points[2] = new Vector3d((-(scalar * scalar * p.normal.z - p.distance)) / p.normal.x, scalar, scalar * scalar);
|
||||
if (p.normal.x > 0) {
|
||||
points[0] = new Vector3d((-(scalar * scalar * p.GetNormal().z - (float)p.GetDistance())) / p.GetNormal().x, -scalar, scalar * scalar);
|
||||
points[1] = new Vector3d((float)p.GetDistance() / p.GetNormal().x, 0, 0);
|
||||
points[2] = new Vector3d((-(scalar * scalar * p.GetNormal().z - (float)p.GetDistance())) / p.GetNormal().x, scalar, scalar * scalar);
|
||||
if (p.GetNormal().x > 0) {
|
||||
Array.Reverse(points);
|
||||
}
|
||||
} else if (p.normal.z == 0) {
|
||||
} else if (p.GetNormal().z == 0) {
|
||||
// parallel to Z axis
|
||||
points[0] = new Vector3d(scalar * scalar, (-(scalar * scalar * p.normal.x - p.distance)) / p.normal.y, -scalar);
|
||||
points[1] = new Vector3d(0, p.distance / p.normal.y, 0);
|
||||
points[2] = new Vector3d(scalar * scalar, (-(scalar * scalar * p.normal.x - p.distance)) / p.normal.y, scalar);
|
||||
if (p.normal.y > 0) {
|
||||
points[0] = new Vector3d(scalar * scalar, (-(scalar * scalar * p.GetNormal().x - (float)p.GetDistance())) / p.GetNormal().y, -scalar);
|
||||
points[1] = new Vector3d(0, (float)p.GetDistance() / p.GetNormal().y, 0);
|
||||
points[2] = new Vector3d(scalar * scalar, (-(scalar * scalar * p.GetNormal().x - (float)p.GetDistance())) / p.GetNormal().y, scalar);
|
||||
if (p.GetNormal().y > 0) {
|
||||
Array.Reverse(points);
|
||||
}
|
||||
} else {
|
||||
// If you reach this point the plane is not parallel to any axis. Therefore, any two coordinates will give a third.
|
||||
points[0] = new Vector3d(-scalar, scalar * scalar, -(-scalar * p.normal.x + scalar * scalar * p.normal.y - p.distance) / p.normal.z);
|
||||
points[1] = new Vector3d(0, 0, p.distance / p.normal.z);
|
||||
points[2] = new Vector3d(scalar, scalar * scalar, -(scalar * p.normal.x + scalar * scalar * p.normal.y - p.distance) / p.normal.z);
|
||||
if (p.normal.z > 0) {
|
||||
points[0] = new Vector3d(-scalar, scalar * scalar, -(-scalar * p.GetNormal().x + scalar * scalar * p.GetNormal().y - (float)p.GetDistance()) / p.GetNormal().z);
|
||||
points[1] = new Vector3d(0, 0, (float)p.GetDistance() / p.GetNormal().z);
|
||||
points[2] = new Vector3d(scalar, scalar * scalar, -(scalar * p.GetNormal().x + scalar * scalar * p.GetNormal().y - (float)p.GetDistance()) / p.GetNormal().z);
|
||||
if (p.GetNormal().z > 0) {
|
||||
Array.Reverse(points);
|
||||
}
|
||||
}
|
||||
@@ -231,14 +292,15 @@ namespace LibBSP {
|
||||
/// <remarks>Unity uses the plane equation "Ax + By + Cz + D = 0" while Quake-based engines
|
||||
/// use "Ax + By + Cz = D". The distance equation needs to be evaluated differently from
|
||||
/// Unity's default implementation to properly apply to planes read from BSPs.</remarks>
|
||||
#if UNITY
|
||||
#if UNITY || GODOT
|
||||
public static float GetBSPDistanceToPoint(this Plane p, Vector3d to) {
|
||||
return (p.normal.x * to.x + p.normal.y * to.y + p.normal.z * to.z - p.distance) / p.normal.magnitude;
|
||||
return (p.GetNormal().x * to.x + p.GetNormal().y * to.y + p.GetNormal().z * to.z - (float)p.GetDistance()) / (float)p.GetNormal().GetMagnitude();
|
||||
}
|
||||
#else
|
||||
public static double GetBSPDistanceToPoint(this Plane p, Vector3d to) {
|
||||
return p.GetDistanceToPoint(to);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Is <paramref name="v"/> on the positive side of this <see cref="Plane"/>?
|
||||
@@ -323,8 +385,8 @@ namespace LibBSP {
|
||||
break;
|
||||
}
|
||||
}
|
||||
p.normal.GetBytes().CopyTo(bytes, 0);
|
||||
BitConverter.GetBytes(p.distance).CopyTo(bytes, 12);
|
||||
p.GetNormal().GetBytes().CopyTo(bytes, 0);
|
||||
BitConverter.GetBytes((float)p.GetDistance()).CopyTo(bytes, 12);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
@@ -345,7 +407,11 @@ namespace LibBSP {
|
||||
double best = 0; // "Best" dot product so far
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
// For all possible axes, positive and negative
|
||||
double dot = Vector3d.Dot(p.normal, baseAxes[i * 3]);
|
||||
#if GODOT
|
||||
double dot = p.Normal.Dot(baseAxes[i * 3]);
|
||||
#else
|
||||
double dot = p.normal.Dot(baseAxes[i * 3]);
|
||||
#endif
|
||||
if (dot > best) {
|
||||
best = dot;
|
||||
bestaxis = i;
|
||||
@@ -370,17 +436,17 @@ namespace LibBSP {
|
||||
/// <param name="p">This <see cref="Plane"/>.</param>
|
||||
/// <returns>The axial type of this plane.</returns>
|
||||
public static int Type(this Plane p) {
|
||||
double ax = Math.Abs(p.normal.x);
|
||||
double ax = Math.Abs(p.GetNormal().x);
|
||||
if (ax >= 1.0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
double ay = Math.Abs(p.normal.y);
|
||||
double ay = Math.Abs(p.GetNormal().y);
|
||||
if (ay >= 1.0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
double az = Math.Abs(p.normal.z);
|
||||
double az = Math.Abs(p.GetNormal().z);
|
||||
if (az >= 1.0) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if UNITY
|
||||
using UnityEngine;
|
||||
# endif
|
||||
|
||||
namespace LibBSP {
|
||||
#if UNITY
|
||||
using Vector2d = Vector2;
|
||||
using Vector2d = UnityEngine.Vector2;
|
||||
#elif GODOT
|
||||
using Vector2d = Godot.Vector2;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
@@ -18,6 +17,31 @@ namespace LibBSP {
|
||||
/// </summary>
|
||||
public static class Vector2dExtensions {
|
||||
|
||||
#if !GODOT
|
||||
/// <summary>
|
||||
/// Vector dot product. This operation is commutative.
|
||||
/// </summary>
|
||||
/// <param name="v1">This <see cref="Vector2d"/>.</param>
|
||||
/// <param name="v2">The <see cref="Vector2d"/> to dot with this <see cref="Vector2d"/>.</param>
|
||||
/// <returns>Dot product of this <see cref="Vector2d"/> and <paramref name="v"/>.</returns>
|
||||
public static double Dot(this Vector2d v1, Vector2d v) {
|
||||
return Vector2d.Dot(v1, v);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Gets the magnitude of this <see cref="Vector2d"/>.
|
||||
/// </summary>
|
||||
/// <param name="v">This <see cref="Vector2d"/>.</param>
|
||||
/// <returns>The magnitude of this <see cref="Vector2d"/>.</returns>
|
||||
public static double GetMagnitude(this Vector2d v) {
|
||||
#if GODOT
|
||||
return v.Length();
|
||||
#else
|
||||
return v.magnitude;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <c>byte</c> array representing the components of this <see cref="Vector2d"/> as <c>float</c>s.
|
||||
/// </summary>
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if UNITY
|
||||
using UnityEngine;
|
||||
#endif
|
||||
|
||||
namespace LibBSP {
|
||||
#if UNITY
|
||||
using Vector3d = Vector3;
|
||||
using Vector3d = UnityEngine.Vector3;
|
||||
#elif GODOT
|
||||
using Vector3d = Godot.Vector3;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
@@ -18,6 +17,41 @@ namespace LibBSP {
|
||||
/// </summary>
|
||||
public static class Vector3dExtensions {
|
||||
|
||||
#if !GODOT
|
||||
/// <summary>
|
||||
/// Vector dot product. This operation is commutative.
|
||||
/// </summary>
|
||||
/// <param name="v1">This <see cref="Vector3d"/>.</param>
|
||||
/// <param name="v">The <see cref="Vector3d"/> to dot with this <see cref="Vector3d"/>.</param>
|
||||
/// <returns>Dot product of this <see cref="Vector3d"/> and <paramref name="v"/>.</returns>
|
||||
public static double Dot(this Vector3d v1, Vector3d v) {
|
||||
return Vector3d.Dot(v1, v);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Vector cross product. This operation is NOT commutative.
|
||||
/// </summary>
|
||||
/// <param name="v1">This <see cref="Vector3d"/>.</param>
|
||||
/// <param name="v">The <see cref="Vector3d"/> to have this <see cref="Vector3d"/> cross.</param>
|
||||
/// <returns>Cross product of these two vectors. Can be thought of as the normal to the plane defined by these two vectors.</returns>
|
||||
public static Vector3d Cross(this Vector3d v1, Vector3d v) {
|
||||
return Vector3d.Cross(v1, v);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Gets the magnitude of this <see cref="Vector3d"/>.
|
||||
/// </summary>
|
||||
/// <param name="v">This <see cref="Vector3d"/>.</param>
|
||||
/// <returns>The magnitude of this <see cref="Vector3d"/>.</returns>
|
||||
public static double GetMagnitude(this Vector3d v) {
|
||||
#if GODOT
|
||||
return v.Length();
|
||||
#else
|
||||
return v.magnitude;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <c>byte</c> array representing the components of this <see cref="Vector3d"/> as <c>float</c>s.
|
||||
/// </summary>
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if UNITY
|
||||
using UnityEngine;
|
||||
#endif
|
||||
|
||||
namespace LibBSP {
|
||||
#if UNITY
|
||||
using Vector4d = Vector4;
|
||||
using Vector4d = UnityEngine.Vector4;
|
||||
#elif GODOT
|
||||
using Vector4d = Godot.Quat;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
@@ -18,6 +17,31 @@ namespace LibBSP {
|
||||
/// </summary>
|
||||
public static class Vector4dExtensions {
|
||||
|
||||
#if !GODOT
|
||||
/// <summary>
|
||||
/// Vector dot product. This operation is commutative.
|
||||
/// </summary>
|
||||
/// <param name="v1">This <see cref="Vector4d"/>.</param>
|
||||
/// <param name="v2">The <see cref="Vector4d"/> to dot with this <see cref="Vector4d"/>.</param>
|
||||
/// <returns>Dot product of this <see cref="Vector4d"/> and <paramref name="v"/>.</returns>
|
||||
public static double Dot(this Vector4d v1, Vector4d v) {
|
||||
return Vector4d.Dot(v1, v);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Gets the magnitude of this <see cref="Vector4d"/>.
|
||||
/// </summary>
|
||||
/// <param name="v">This <see cref="Vector4d"/>.</param>
|
||||
/// <returns>The magnitude of this <see cref="Vector4d"/>.</returns>
|
||||
public static double GetMagnitude(this Vector4d v) {
|
||||
#if GODOT
|
||||
return v.Length;
|
||||
#else
|
||||
return v.magnitude;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <c>byte</c> array representing the components of this <see cref="Vector4d"/> as <c>float</c>s.
|
||||
/// </summary>
|
||||
|
||||
@@ -7,18 +7,19 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if UNITY
|
||||
using UnityEngine;
|
||||
#endif
|
||||
|
||||
namespace LibBSP {
|
||||
#if UNITY
|
||||
using Vector2d = Vector2;
|
||||
using Vector3d = Vector3;
|
||||
using Vector4d = Vector4;
|
||||
using Vector2d = UnityEngine.Vector2;
|
||||
using Vector3d = UnityEngine.Vector3;
|
||||
using Vector4d = UnityEngine.Vector4;
|
||||
#if !OLDUNITY
|
||||
using Vertex = UIVertex;
|
||||
using Vertex = UnityEngine.UIVertex;
|
||||
#endif
|
||||
#elif GODOT
|
||||
using Vector2d = Godot.Vector2;
|
||||
using Vector3d = Godot.Vector3;
|
||||
using Vector4d = Godot.Quat;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -9,13 +9,15 @@ using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
#if UNITY
|
||||
using UnityEngine;
|
||||
#endif
|
||||
|
||||
namespace LibBSP {
|
||||
#if UNITY && !OLDUNITY
|
||||
using Vertex = UIVertex;
|
||||
#if UNITY
|
||||
using Plane = UnityEngine.Plane;
|
||||
#if !OLDUNITY
|
||||
using Vertex = UnityEngine.UIVertex;
|
||||
#endif
|
||||
#elif GODOT
|
||||
using Plane = Godot.Plane;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if UNITY
|
||||
using UnityEngine;
|
||||
#endif
|
||||
|
||||
namespace LibBSP {
|
||||
#if UNITY
|
||||
using Vector3d = Vector3;
|
||||
using Vector3d = UnityEngine.Vector3;
|
||||
#elif GODOT
|
||||
using Vector3d = Godot.Vector3;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if UNITY
|
||||
using UnityEngine;
|
||||
#endif
|
||||
|
||||
namespace LibBSP {
|
||||
#if UNITY
|
||||
using Vector3d = Vector3;
|
||||
using Vector3d = UnityEngine.Vector3;
|
||||
#elif GODOT
|
||||
using Vector3d = Godot.Vector3;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -3,13 +3,12 @@
|
||||
#endif
|
||||
|
||||
using System;
|
||||
#if UNITY
|
||||
using UnityEngine;
|
||||
#endif
|
||||
|
||||
namespace LibBSP {
|
||||
#if UNITY
|
||||
using Vector3d = Vector3;
|
||||
using Vector3d = UnityEngine.Vector3;
|
||||
#elif GODOT
|
||||
using Vector3d = Godot.Vector3;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -4,15 +4,14 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if UNITY
|
||||
using UnityEngine;
|
||||
#endif
|
||||
|
||||
namespace LibBSP {
|
||||
#if UNITY
|
||||
using Vector2d = Vector2;
|
||||
using Vector2d = UnityEngine.Vector2;
|
||||
#elif GODOT
|
||||
using Vector2d = Godot.Vector2;
|
||||
#endif
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Holds all the data for a face in a BSP map.
|
||||
/// </summary>
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if UNITY
|
||||
using UnityEngine;
|
||||
#endif
|
||||
|
||||
namespace LibBSP {
|
||||
#if UNITY
|
||||
using Vector2d = Vector2;
|
||||
using Vector2d = UnityEngine.Vector2;
|
||||
#elif GODOT
|
||||
using Vector2d = Godot.Vector2;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -5,13 +5,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
#if UNITY
|
||||
using UnityEngine;
|
||||
#endif
|
||||
|
||||
namespace LibBSP {
|
||||
#if UNITY
|
||||
using Vector3d = Vector3;
|
||||
using Vector3d = UnityEngine.Vector3;
|
||||
#elif GODOT
|
||||
using Vector3d = Godot.Vector3;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
#if UNITY
|
||||
using UnityEngine;
|
||||
#endif
|
||||
|
||||
namespace LibBSP {
|
||||
#if UNITY
|
||||
using Color = Color32;
|
||||
using Vector3d = Vector3;
|
||||
using Color = UnityEngine.Color32;
|
||||
using Vector3d = UnityEngine.Vector3;
|
||||
#elif GODOT
|
||||
using Color = Godot.Color;
|
||||
using Vector3d = Godot.Vector3;
|
||||
#else
|
||||
using Color = System.Drawing.Color;
|
||||
#endif
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
#if UNITY
|
||||
using UnityEngine;
|
||||
#endif
|
||||
|
||||
namespace LibBSP {
|
||||
#if UNITY
|
||||
using Vector2d = Vector2;
|
||||
using Vector3d = Vector3;
|
||||
using Vector2d = UnityEngine.Vector2;
|
||||
using Vector3d = UnityEngine.Vector3;
|
||||
#elif GODOT
|
||||
using Vector2d = Godot.Vector2;
|
||||
using Vector3d = Godot.Vector3;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
@@ -262,7 +262,7 @@ namespace LibBSP {
|
||||
return new TextureInfo(new Vector3d(BitConverter.ToSingle(data, 0), BitConverter.ToSingle(data, 4), BitConverter.ToSingle(data, 8)),
|
||||
new Vector3d(BitConverter.ToSingle(data, 16), BitConverter.ToSingle(data, 20), BitConverter.ToSingle(data, 24)),
|
||||
new Vector2d(BitConverter.ToSingle(data, 12), BitConverter.ToSingle(data, 28)),
|
||||
Vector2d.one,
|
||||
new Vector2d(1, 1),
|
||||
-1, -1, 0);
|
||||
}
|
||||
default: {
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if UNITY
|
||||
using UnityEngine;
|
||||
#endif
|
||||
|
||||
namespace LibBSP {
|
||||
#if UNITY
|
||||
using Vector3d = Vector3;
|
||||
using Vector3d = UnityEngine.Vector3;
|
||||
#elif GODOT
|
||||
using Vector3d = Godot.Vector3;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -7,14 +7,14 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Globalization;
|
||||
#if UNITY
|
||||
using UnityEngine;
|
||||
#endif
|
||||
|
||||
namespace LibBSP {
|
||||
#if UNITY
|
||||
using Vector3d = Vector3;
|
||||
using Vector4d = Vector4;
|
||||
using Vector3d = UnityEngine.Vector3;
|
||||
using Vector4d = UnityEngine.Vector4;
|
||||
#elif GODOT
|
||||
using Vector3d = Godot.Vector3;
|
||||
using Vector4d = Godot.Quat;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
@@ -56,7 +56,10 @@ namespace LibBSP {
|
||||
/// Wrapper for the "origin" attribute.
|
||||
/// </summary>
|
||||
public Vector3d origin {
|
||||
get { return GetVector("origin"); }
|
||||
get {
|
||||
Vector4d vec = GetVector("origin");
|
||||
return new Vector3d(vec.x, vec.y, vec.z);
|
||||
}
|
||||
set { this["origin"] = value.x + " " + value.y + " " + value.z; }
|
||||
}
|
||||
|
||||
@@ -64,7 +67,10 @@ namespace LibBSP {
|
||||
/// Wrapper for the "angles" attribute.
|
||||
/// </summary>
|
||||
public Vector3d angles {
|
||||
get { return GetVector("angles"); }
|
||||
get {
|
||||
Vector4d vec = GetVector("angles");
|
||||
return new Vector3d(vec.x, vec.y, vec.z);
|
||||
}
|
||||
set { this["angles"] = value.x + " " + value.y + " " + value.z; }
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#if !(UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_5_3_OR_NEWER)
|
||||
#if !(UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_5_3_OR_NEWER || GODOT)
|
||||
using System;
|
||||
|
||||
namespace LibBSP {
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
using System;
|
||||
|
||||
namespace LibBSP {
|
||||
#if GODOT
|
||||
using Vector3d = Godot.Vector3;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// A struct for a <see cref="Ray"/> defined by a starting point and a direction vector.
|
||||
@@ -16,7 +19,11 @@ namespace LibBSP {
|
||||
return _direction;
|
||||
}
|
||||
set {
|
||||
#if GODOT
|
||||
_direction = value.Normalized();
|
||||
#else
|
||||
_direction = value.normalized;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +34,11 @@ namespace LibBSP {
|
||||
/// <param name="direction">Direction vector of this <see cref="Ray"/>.</param>
|
||||
public Ray(Vector3d origin, Vector3d direction) {
|
||||
this.origin = origin;
|
||||
#if GODOT
|
||||
_direction = direction.Normalized();
|
||||
#else
|
||||
_direction = direction.normalized;
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -36,7 +47,7 @@ namespace LibBSP {
|
||||
/// <param name="distance">Distance of the point to get.</param>
|
||||
/// <returns>The point at <paramref name="distance"/> units along this <see cref="Ray"/>.</returns>
|
||||
public Vector3d GetPoint(double distance) {
|
||||
return origin + (distance * direction);
|
||||
return origin + ((float)distance * direction);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -47,7 +58,7 @@ namespace LibBSP {
|
||||
return string.Format("( {0}, {1} )", origin, direction);
|
||||
}
|
||||
|
||||
#region IEquatable
|
||||
#region IEquatable
|
||||
/// <summary>
|
||||
/// Determines whether this <see cref="Ray"/> is equivalent to another.
|
||||
/// </summary>
|
||||
@@ -94,7 +105,7 @@ namespace LibBSP {
|
||||
public override int GetHashCode() {
|
||||
return origin.GetHashCode() ^ direction.GetHashCode();
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,14 +4,16 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if UNITY
|
||||
using UnityEngine;
|
||||
#endif
|
||||
|
||||
namespace LibBSP {
|
||||
#if UNITY
|
||||
using Vector2d = Vector2;
|
||||
using Vector3d = Vector3;
|
||||
using Vector2d = UnityEngine.Vector2;
|
||||
using Vector3d = UnityEngine.Vector3;
|
||||
using Plane = UnityEngine.Plane;
|
||||
#elif GODOT
|
||||
using Vector2d = Godot.Vector2;
|
||||
using Vector3d = Godot.Vector3;
|
||||
using Plane = Godot.Plane;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
@@ -26,7 +28,7 @@ namespace LibBSP {
|
||||
public int version;
|
||||
|
||||
// No BSP format uses these so they are fields.
|
||||
public Vector2d scale = Vector2d.one;
|
||||
public Vector2d scale = new Vector2d(1, 1);
|
||||
public double rotation = 0;
|
||||
|
||||
public Vector3d uAxis {
|
||||
@@ -177,13 +179,13 @@ namespace LibBSP {
|
||||
type = MapType.Quake;
|
||||
version = 0;
|
||||
|
||||
uAxis = Vector3d.zero;
|
||||
vAxis = Vector3d.zero;
|
||||
translation = Vector2d.zero;
|
||||
uAxis = new Vector3d(0, 0, 0);
|
||||
vAxis = new Vector3d(0, 0, 0);
|
||||
translation = new Vector2d(0, 0);
|
||||
flags = 0;
|
||||
texture = -1;
|
||||
|
||||
scale = Vector2d.one;
|
||||
scale = new Vector2d(1, 1);
|
||||
rotation = 0;
|
||||
}
|
||||
|
||||
@@ -202,7 +204,7 @@ namespace LibBSP {
|
||||
this.type = type;
|
||||
this.version = version;
|
||||
|
||||
scale = Vector2d.one;
|
||||
scale = new Vector2d(1, 1);
|
||||
rotation = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#if !(UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_5_3_OR_NEWER)
|
||||
#if !(UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_5_3_OR_NEWER || GODOT)
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#if !(UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_5_3_OR_NEWER)
|
||||
#if !(UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_5_3_OR_NEWER || GODOT)
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#if !(UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_5_3_OR_NEWER)
|
||||
#if !(UNITY_3_4 || UNITY_3_5 || UNITY_4_0 || UNITY_4_0_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_5 || UNITY_5_3_OR_NEWER || GODOT)
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -17,6 +17,11 @@ namespace LibBSP {
|
||||
using Vector2d = UnityEngine.Vector2;
|
||||
using Vector3d = UnityEngine.Vector3;
|
||||
using Vector4d = UnityEngine.Vector4;
|
||||
#elif GODOT
|
||||
using Color = Godot.Color;
|
||||
using Vector2d = Godot.Vector2;
|
||||
using Vector3d = Godot.Vector3;
|
||||
using Vector4d = Godot.Quat;
|
||||
#else
|
||||
using Color = System.Drawing.Color;
|
||||
#endif
|
||||
|
||||
@@ -5,14 +5,16 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
#if UNITY
|
||||
using UnityEngine;
|
||||
#endif
|
||||
|
||||
namespace LibBSP {
|
||||
#if UNITY
|
||||
using Vector2d = Vector2;
|
||||
using Vector3d = Vector3;
|
||||
using Vector2d = UnityEngine.Vector2;
|
||||
using Vector3d = UnityEngine.Vector3;
|
||||
using Plane = UnityEngine.Plane;
|
||||
#elif GODOT
|
||||
using Vector2d = Godot.Vector2;
|
||||
using Vector3d = Godot.Vector3;
|
||||
using Plane = Godot.Plane;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
@@ -52,8 +54,8 @@ namespace LibBSP {
|
||||
plane = new Plane(new Vector3d(float.Parse(tokens[1], _format), float.Parse(tokens[2], _format), float.Parse(tokens[3], _format)), dist);
|
||||
textureInfo = new TextureInfo(new Vector3d(float.Parse(tokens[8], _format), float.Parse(tokens[9], _format), float.Parse(tokens[10], _format)),
|
||||
new Vector3d(float.Parse(tokens[13], _format), float.Parse(tokens[14], _format), float.Parse(tokens[15], _format)),
|
||||
Vector2d.zero,
|
||||
Vector2d.one,
|
||||
new Vector2d(0, 0),
|
||||
new Vector2d(1, 1),
|
||||
0, 0, 0);
|
||||
texture = tokens[18];
|
||||
} else {
|
||||
|
||||
@@ -5,13 +5,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
#if UNITY
|
||||
using UnityEngine;
|
||||
#endif
|
||||
|
||||
namespace LibBSP {
|
||||
#if UNITY
|
||||
using Vector3d = Vector3;
|
||||
using Vector3d = UnityEngine.Vector3;
|
||||
#elif GODOT
|
||||
using Vector3d = Godot.Vector3;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -17,6 +17,10 @@ namespace LibBSP {
|
||||
#if !OLDUNITY
|
||||
using Vertex = UnityEngine.UIVertex;
|
||||
#endif
|
||||
#elif GODOT
|
||||
using Vector2d = Godot.Vector2;
|
||||
using Vector3d = Godot.Vector3;
|
||||
using Color = Godot.Color;
|
||||
#else
|
||||
using Color = System.Drawing.Color;
|
||||
#endif
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
#if UNITY
|
||||
using UnityEngine;
|
||||
#endif
|
||||
|
||||
namespace LibBSP {
|
||||
#if UNITY
|
||||
using Vector4d = Vector4;
|
||||
using Vector3d = Vector3;
|
||||
using Vector4d = UnityEngine.Vector4;
|
||||
using Vector3d = UnityEngine.Vector3;
|
||||
#elif GODOT
|
||||
using Vector4d = Godot.Quat;
|
||||
using Vector3d = Godot.Vector3;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
#if UNITY
|
||||
using UnityEngine;
|
||||
#endif
|
||||
|
||||
namespace LibBSP {
|
||||
#if UNITY
|
||||
using Vector2d = Vector2;
|
||||
using Vector3d = Vector3;
|
||||
using Vector2d = UnityEngine.Vector2;
|
||||
using Vector3d = UnityEngine.Vector3;
|
||||
#elif GODOT
|
||||
using Vector2d = Godot.Vector2;
|
||||
using Vector3d = Godot.Vector3;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user