From ddcb5af0e3b65ee9608978db06c5ce00bfbb6780 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 26 Oct 2021 19:31:16 +0900 Subject: [PATCH] readonly struct Byte4 and UShort4. --- Assets/UniGLTF/Runtime/UniGLTF/IO/Byte4.cs | 7 ++++++- Assets/UniGLTF/Runtime/UniGLTF/IO/UShort4.cs | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/Byte4.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/Byte4.cs index 7df1446b6..57dff1c06 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/Byte4.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/Byte4.cs @@ -4,7 +4,7 @@ using System.Runtime.InteropServices; namespace UniGLTF { [Serializable, StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct Byte4 + public readonly struct Byte4 : IEquatable { public readonly byte x; public readonly byte y; @@ -17,5 +17,10 @@ namespace UniGLTF z = _z; w = _w; } + + public bool Equals(Byte4 other) + { + return x == other.x && y == other.y && z == other.z && w == other.w; + } } } diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/UShort4.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/UShort4.cs index d13c87c93..3dcee0c1e 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/UShort4.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/UShort4.cs @@ -4,7 +4,7 @@ using System.Runtime.InteropServices; namespace UniGLTF { [Serializable, StructLayout(LayoutKind.Sequential, Pack = 1)] - public struct UShort4 + public readonly struct UShort4 : IEquatable { public readonly ushort x; public readonly ushort y; @@ -18,5 +18,10 @@ namespace UniGLTF z = _z; w = _w; } + + public bool Equals(UShort4 other) + { + return x == other.x && y == other.y && z == other.z && w == other.w; + } } }