|
|
@@ -61,7 +61,8 @@ namespace SharpGLTF.Materials
|
|
|
this.AlphaCutoff = other.AlphaCutoff;
|
|
|
this.DoubleSided = other.DoubleSided;
|
|
|
this.ShaderStyle = other.ShaderStyle;
|
|
|
- this.IndexOfRefraction = other.IndexOfRefraction;
|
|
|
+ this.Dispersion = other.Dispersion;
|
|
|
+ this.IndexOfRefraction = other.IndexOfRefraction;
|
|
|
|
|
|
this._CompatibilityFallbackMaterial = other._CompatibilityFallbackMaterial == null
|
|
|
? null
|
|
|
@@ -106,6 +107,8 @@ namespace SharpGLTF.Materials
|
|
|
|
|
|
public float IndexOfRefraction { get; set; } = 1.5f;
|
|
|
|
|
|
+ public float Dispersion { get; set; } = 0;
|
|
|
+
|
|
|
/// <inheritdoc/>
|
|
|
/// <remarks>
|
|
|
/// Material builder uses default class equality, but NUnit4 does some weird trickery on equality
|
|
|
@@ -132,7 +135,8 @@ namespace SharpGLTF.Materials
|
|
|
// AlphaCutoff only has meaning when AlphaMode = Mask
|
|
|
if (x.AlphaMode == AlphaMode.MASK && x.AlphaCutoff != y.AlphaCutoff) return false;
|
|
|
if (x.DoubleSided != y.DoubleSided) return false;
|
|
|
- if (x.IndexOfRefraction != y.IndexOfRefraction) return false;
|
|
|
+ if (x.Dispersion != y.Dispersion) return false;
|
|
|
+ if (x.IndexOfRefraction != y.IndexOfRefraction) return false;
|
|
|
if (x._ShaderStyle != y._ShaderStyle) return false;
|
|
|
|
|
|
if (!AreEqualByContent(x._CompatibilityFallbackMaterial, y._CompatibilityFallbackMaterial)) return false;
|
|
|
@@ -164,7 +168,8 @@ namespace SharpGLTF.Materials
|
|
|
h ^= x.AlphaMode.GetHashCode();
|
|
|
h ^= x.AlphaCutoff.GetHashCode();
|
|
|
h ^= x.DoubleSided.GetHashCode();
|
|
|
- h ^= x.IndexOfRefraction.GetHashCode();
|
|
|
+ h ^= x.Dispersion.GetHashCode();
|
|
|
+ h ^= x.IndexOfRefraction.GetHashCode();
|
|
|
h ^= x.ShaderStyle.GetHashCode(StringComparison.InvariantCulture);
|
|
|
|
|
|
h ^= x._Channels
|
|
|
@@ -285,7 +290,8 @@ namespace SharpGLTF.Materials
|
|
|
Guard.IsTrue(this.AlphaMode == this.CompatibilityFallback.AlphaMode, nameof(AlphaMode));
|
|
|
Guard.MustBeEqualTo(this.AlphaCutoff, this.CompatibilityFallback.AlphaCutoff, nameof(AlphaCutoff));
|
|
|
Guard.MustBeEqualTo(this.DoubleSided, this.CompatibilityFallback.DoubleSided, nameof(DoubleSided));
|
|
|
- Guard.MustBeEqualTo(this.IndexOfRefraction, this.CompatibilityFallback.IndexOfRefraction, nameof(IndexOfRefraction));
|
|
|
+ Guard.MustBeEqualTo(this.Dispersion, this.CompatibilityFallback.Dispersion, nameof(Dispersion));
|
|
|
+ Guard.MustBeEqualTo(this.IndexOfRefraction, this.CompatibilityFallback.IndexOfRefraction, nameof(IndexOfRefraction));
|
|
|
|
|
|
foreach (var chKey in new[] { KnownChannel.Normal, KnownChannel.Occlusion, KnownChannel.Emissive })
|
|
|
{
|