Ejemplo n.º 1
0
        /// <inheritdoc />
        public bool Equals([AllowNull] Lighting other)
        {
            if (other == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     VertexNormalsEpsilon == other.VertexNormalsEpsilon ||
                     VertexNormalsEpsilon != null &&
                     VertexNormalsEpsilon.Equals(other.VertexNormalsEpsilon)
                     ) &&
                 (
                     FaceNormalsEpsilon == other.FaceNormalsEpsilon ||
                     FaceNormalsEpsilon != null &&
                     FaceNormalsEpsilon.Equals(other.FaceNormalsEpsilon)
                 ) &&
                 (
                     Ambient == other.Ambient ||
                     Ambient != null &&
                     Ambient.Equals(other.Ambient)
                 ) &&
                 (
                     Diffuse == other.Diffuse ||
                     Diffuse != null &&
                     Diffuse.Equals(other.Diffuse)
                 ) &&
                 (
                     Specular == other.Specular ||
                     Specular != null &&
                     Specular.Equals(other.Specular)
                 ) &&
                 (
                     Roughness == other.Roughness ||
                     Roughness != null &&
                     Roughness.Equals(other.Roughness)
                 ) &&
                 (
                     Fresnel == other.Fresnel ||
                     Fresnel != null &&
                     Fresnel.Equals(other.Fresnel)
                 ));
        }
Ejemplo n.º 2
0
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hashCode = 41;

                if (VertexNormalsEpsilon != null)
                {
                    hashCode = hashCode * 59 + VertexNormalsEpsilon.GetHashCode();
                }

                if (FaceNormalsEpsilon != null)
                {
                    hashCode = hashCode * 59 + FaceNormalsEpsilon.GetHashCode();
                }

                if (Ambient != null)
                {
                    hashCode = hashCode * 59 + Ambient.GetHashCode();
                }

                if (Diffuse != null)
                {
                    hashCode = hashCode * 59 + Diffuse.GetHashCode();
                }

                if (Specular != null)
                {
                    hashCode = hashCode * 59 + Specular.GetHashCode();
                }

                if (Roughness != null)
                {
                    hashCode = hashCode * 59 + Roughness.GetHashCode();
                }

                if (Fresnel != null)
                {
                    hashCode = hashCode * 59 + Fresnel.GetHashCode();
                }

                return(hashCode);
            }
        }