make MaterialDescriptor class

This commit is contained in:
Masataka SUMI 2022-12-05 16:05:20 +09:00
parent 12b82c12cf
commit aed1d170d4

View File

@ -4,7 +4,7 @@ using UnityEngine;
namespace VRMShaders
{
public readonly struct MaterialDescriptor : IEquatable<MaterialDescriptor>
public sealed class MaterialDescriptor
{
public readonly string Name;
public readonly string ShaderName;
@ -43,31 +43,5 @@ namespace VRMShaders
Vectors = vectors;
Actions = actions;
}
public bool Equals(MaterialDescriptor other)
{
return Name == other.Name && ShaderName == other.ShaderName && RenderQueue == other.RenderQueue && Equals(TextureSlots, other.TextureSlots) && Equals(FloatValues, other.FloatValues) && Equals(Colors, other.Colors) && Equals(Vectors, other.Vectors) && Equals(Actions, other.Actions);
}
public override bool Equals(object obj)
{
return obj is MaterialDescriptor other && Equals(other);
}
public override int GetHashCode()
{
unchecked
{
var hashCode = (Name != null ? Name.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (ShaderName != null ? ShaderName.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ RenderQueue.GetHashCode();
hashCode = (hashCode * 397) ^ (TextureSlots != null ? TextureSlots.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (FloatValues != null ? FloatValues.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (Colors != null ? Colors.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (Vectors != null ? Vectors.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (Actions != null ? Actions.GetHashCode() : 0);
return hashCode;
}
}
}
}