port(m1): wave 6f — Unity primitive operators (362->304)

CS0019 operator gaps on value-type shims:
- Vector2: ==/!=, Vector2*Vector2, Equals/GetHashCode.
- Vector4: *float, +/-, ==/!=, Equals/GetHashCode.
- Color: ==/!= (Color==Color32 via existing implicit conv), Equals/GetHashCode.
- Rect: ==/!=; Matrix4x4: *, GetColumn/GetRow/indexer.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-06 00:08:11 -04:00
parent 8c9fe7a1b9
commit e5e05deadb
3 changed files with 22 additions and 1 deletions

View File

@@ -41,8 +41,12 @@ namespace UnityEngine
public bool Contains(Vector3 p) => false;
public bool Overlaps(Rect other) => false;
public static Rect MinMaxRect(float xmin, float ymin, float xmax, float ymax) => new Rect(xmin, ymin, xmax - xmin, ymax - ymin);
public static bool operator ==(Rect a, Rect b) => a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height;
public static bool operator !=(Rect a, Rect b) => !(a == b);
public override bool Equals(object o) => o is Rect r && this == r;
public override int GetHashCode() => x.GetHashCode() ^ (y.GetHashCode() << 2) ^ (width.GetHashCode() << 4) ^ (height.GetHashCode() << 6);
}
public struct Matrix4x4 { public static Matrix4x4 identity => new Matrix4x4(); public Vector3 MultiplyPoint(Vector3 p) => p; public Vector3 MultiplyPoint3x4(Vector3 p) => p; public Vector3 MultiplyVector(Vector3 v) => v; public static Matrix4x4 TRS(Vector3 t, Quaternion r, Vector3 s) => identity; public Matrix4x4 inverse => identity; }
public struct Matrix4x4 { public static Matrix4x4 identity => new Matrix4x4(); public Vector3 MultiplyPoint(Vector3 p) => p; public Vector3 MultiplyPoint3x4(Vector3 p) => p; public Vector3 MultiplyVector(Vector3 v) => v; public static Matrix4x4 TRS(Vector3 t, Quaternion r, Vector3 s) => identity; public Matrix4x4 inverse => identity; public static Matrix4x4 operator *(Matrix4x4 a, Matrix4x4 b) => identity; public Vector4 GetColumn(int i) => default; public Vector4 GetRow(int i) => default; public float this[int row, int col] { get => 0f; set { } } }
public struct Plane { public Plane(Vector3 normal, Vector3 point) { } public Plane(Vector3 a, Vector3 b, Vector3 c) { } public bool Raycast(Ray r, out float enter) { enter = 0; return false; } }
public struct Ray { public Ray(Vector3 origin, Vector3 dir) { this.origin = origin; this.direction = dir; } public Vector3 origin; public Vector3 direction; public Vector3 GetPoint(float d) => origin; }
public struct RaycastHit { public Vector3 point; public Vector3 normal; public float distance; public Collider collider; public Transform transform; public GameObject gameObject; }