|
| 1 | +// Minimal Unity API stubs for DocFX metadata extraction (not used at runtime). |
| 2 | + |
| 3 | +using System; |
| 4 | +using System.Runtime.InteropServices; |
| 5 | +using Unity.Mathematics; |
| 6 | + |
| 7 | +namespace UnityEngine |
| 8 | +{ |
| 9 | + public struct Vector2 |
| 10 | + { |
| 11 | + public float x, y; |
| 12 | + public Vector2(float x, float y) { this.x = x; this.y = y; } |
| 13 | + public static implicit operator float2(Vector2 v) { unsafe { return *(float2*)&v; } } |
| 14 | + public static implicit operator Vector2(float2 v) { unsafe { return *(Vector2*)&v; } } |
| 15 | + public static Vector2 operator -(Vector2 v) => new(-v.x, -v.y); |
| 16 | + } |
| 17 | + |
| 18 | + public struct Vector3 |
| 19 | + { |
| 20 | + public float x, y, z; |
| 21 | + public Vector3(float x, float y, float z) { this.x = x; this.y = y; this.z = z; } |
| 22 | + public static implicit operator float3(Vector3 v) { unsafe { return *(float3*)&v; } } |
| 23 | + public static implicit operator Vector3(float3 v) { unsafe { return *(Vector3*)&v; } } |
| 24 | + public static Vector3 operator -(Vector3 v) => new(-v.x, -v.y, -v.z); |
| 25 | + } |
| 26 | + |
| 27 | + public struct Vector4 |
| 28 | + { |
| 29 | + public float x, y, z, w; |
| 30 | + public Vector4(float x, float y, float z, float w) { this.x = x; this.y = y; this.z = z; this.w = w; } |
| 31 | + public static implicit operator float4(Vector4 v) { unsafe { return *(float4*)&v; } } |
| 32 | + public static Vector4 operator -(Vector4 v) => new(-v.x, -v.y, -v.z, -v.w); |
| 33 | + } |
| 34 | + public struct Vector2Int { public int x, y; public Vector2Int(int x, int y) { this.x = x; this.y = y; } } |
| 35 | + public struct Vector3Int { public int x, y, z; public Vector3Int(int x, int y, int z) { this.x = x; this.y = y; this.z = z; } } |
| 36 | + public struct Matrix4x4 |
| 37 | + { |
| 38 | + public float m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33; |
| 39 | + public static explicit operator float4x4(Matrix4x4 m) { unsafe { return *(float4x4*)&m; } } |
| 40 | + } |
| 41 | + public struct Color { public float r, g, b, a; public Color(float r, float g, float b, float a) { this.r = r; this.g = g; this.b = b; this.a = a; } } |
| 42 | + public struct Color32 { public byte r, g, b, a; public Color32(byte r, byte g, byte b, byte a) { this.r = r; this.g = g; this.b = b; this.a = a; } } |
| 43 | + public struct Bounds { public Vector3 center, size; public Bounds(Vector3 center, Vector3 size) { this.center = center; this.size = size; } } |
| 44 | + public struct Ray { public Vector3 origin, direction; public Ray(Vector3 origin, Vector3 direction) { this.origin = origin; this.direction = direction; } } |
| 45 | + public static class Time { public static float deltaTime => 0.016f; } |
| 46 | + |
| 47 | + public class Transform |
| 48 | + { |
| 49 | + public Matrix4x4 localToWorldMatrix => default; |
| 50 | + } |
| 51 | +} |
| 52 | + |
| 53 | +namespace AOT |
| 54 | +{ |
| 55 | + [AttributeUsage(AttributeTargets.Method)] |
| 56 | + public class MonoPInvokeCallbackAttribute : Attribute |
| 57 | + { |
| 58 | + public MonoPInvokeCallbackAttribute(Type type) { } |
| 59 | + } |
| 60 | +} |
| 61 | + |
| 62 | +namespace Unity.Burst |
| 63 | +{ |
| 64 | + public enum FloatPrecision { Standard, Low, Medium, High } |
| 65 | + public enum FloatMode { Default, Strict, Deterministic, Fast } |
| 66 | + public enum OptimizeFor { Default, Performance, Size, FastCompilation } |
| 67 | + |
| 68 | + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method)] |
| 69 | + public class BurstCompileAttribute : Attribute |
| 70 | + { |
| 71 | + public FloatPrecision FloatPrecision { get; set; } |
| 72 | + public FloatMode FloatMode { get; set; } |
| 73 | + public bool CompileSynchronously { get; set; } |
| 74 | + public OptimizeFor OptimizeFor { get; set; } |
| 75 | + |
| 76 | + public BurstCompileAttribute() { } |
| 77 | + public BurstCompileAttribute(FloatPrecision precision, FloatMode mode) { FloatPrecision = precision; FloatMode = mode; } |
| 78 | + } |
| 79 | + |
| 80 | + public readonly struct FunctionPointer<T> where T : class |
| 81 | + { |
| 82 | + public FunctionPointer(IntPtr ptr) { Invoke = default!; } |
| 83 | + public T Invoke { get; } |
| 84 | + public void InvokeMethod() { } |
| 85 | + } |
| 86 | + |
| 87 | + public static class BurstCompiler |
| 88 | + { |
| 89 | + public static FunctionPointer<T> CompileFunctionPointer<T>(T delegateMethod) where T : class => |
| 90 | + new FunctionPointer<T>(IntPtr.Zero); |
| 91 | + } |
| 92 | +} |
| 93 | + |
| 94 | +namespace Unity.Burst.Intrinsics |
| 95 | +{ |
| 96 | + public struct v128 |
| 97 | + { |
| 98 | + public int Int0, Int1, Int2, Int3; |
| 99 | + public v128(int a, int b, int c, int d) { Int0 = a; Int1 = b; Int2 = c; Int3 = d; } |
| 100 | + } |
| 101 | + |
| 102 | + public static class X86 |
| 103 | + { |
| 104 | + public static class Sse |
| 105 | + { |
| 106 | + public static v128 rcp_ss(v128 a) => a; |
| 107 | + } |
| 108 | + |
| 109 | + public static class Sse2 |
| 110 | + { |
| 111 | + public static v128 sub_epi32(v128 a, v128 b) => a; |
| 112 | + } |
| 113 | + } |
| 114 | +} |
| 115 | + |
| 116 | +namespace Unity.Collections |
| 117 | +{ |
| 118 | + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter)] |
| 119 | + public class ReadOnlyAttribute : Attribute { } |
| 120 | + |
| 121 | + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter)] |
| 122 | + public class WriteOnlyAttribute : Attribute { } |
| 123 | + |
| 124 | + public struct NativeArray<T> where T : struct |
| 125 | + { |
| 126 | + public int Length => 0; |
| 127 | + public T this[int index] { get => default; set { } } |
| 128 | + public void CopyFrom(T[] array) { } |
| 129 | + } |
| 130 | +} |
| 131 | + |
| 132 | +namespace Unity.Collections.LowLevel.Unsafe |
| 133 | +{ |
| 134 | + public static class Unsafe |
| 135 | + { |
| 136 | + public static ref TTo As<TFrom, TTo>(ref TFrom source) where TFrom : struct where TTo : struct |
| 137 | + { |
| 138 | + // Doc stub only — not invoked at runtime. |
| 139 | + throw new NotSupportedException(); |
| 140 | + } |
| 141 | + } |
| 142 | +} |
| 143 | + |
| 144 | +namespace Unity.Jobs |
| 145 | +{ |
| 146 | + public struct JobHandle { } |
| 147 | + |
| 148 | + public static class JobHandleExtensions |
| 149 | + { |
| 150 | + public static void Complete(this JobHandle handle) { } |
| 151 | + } |
| 152 | + |
| 153 | + public interface IJob |
| 154 | + { |
| 155 | + void Execute(); |
| 156 | + } |
| 157 | + |
| 158 | + public interface IJobParallelFor |
| 159 | + { |
| 160 | + void Execute(int index); |
| 161 | + } |
| 162 | + |
| 163 | + public static class IJobExtensions |
| 164 | + { |
| 165 | + public static JobHandle Schedule<T>(this T jobData) where T : struct, IJob => default; |
| 166 | + public static JobHandle Schedule<T>(this T jobData, JobHandle dependsOn) where T : struct, IJob => default; |
| 167 | + } |
| 168 | + |
| 169 | + public static class IJobParallelForExtensions |
| 170 | + { |
| 171 | + public static JobHandle Schedule<T>(this T jobData, int arrayLength, int innerloopBatchCount) where T : struct, IJobParallelFor => default; |
| 172 | + public static JobHandle Schedule<T>(this T jobData, int arrayLength, int innerloopBatchCount, JobHandle dependsOn) where T : struct, IJobParallelFor => default; |
| 173 | + } |
| 174 | +} |
0 commit comments