コード例 #1
0
        /// <summary>
        /// A representative hash code.
        /// </summary>
        /// <returns>A number that is guaranteed to be the same when generated from two objects that are the same.</returns>
        public override int GetHashCode()
        {
            int hash  = 0;
            int flags = 0;

            flags |= (receiveShadows ? 1 : 0) << 0;
            flags |= (needMotionVectorPass ? 1 : 0) << 1;

            unsafe
            {
                var buffer = stackalloc[]
                {
                    ReferenceEquals(mesh, null) ? 0 : mesh.GetHashCode(),
                    ReferenceEquals(material, null) ? 0 : material.GetHashCode(),
                    subMesh.GetHashCode(),
                    layer.GetHashCode(),
                    castShadows.GetHashCode(),
                    flags
                };

                hash = (int)XXHash.Hash32((byte *)buffer, 6 * 4);
            }

            return(hash);
        }
コード例 #2
0
        public override int GetHashCode()
        {
            int hash = 0;

            if (!ReferenceEquals(mesh, null))
            {
                hash ^= mesh.GetHashCode();
            }
            if (!ReferenceEquals(material, null))
            {
                hash ^= material.GetHashCode();
            }
            hash ^= subMesh.GetHashCode();
            hash ^= layer.GetHashCode();
            hash ^= castShadows.GetHashCode();
            hash ^= receiveShadows.GetHashCode();
            return(hash);
        }
コード例 #3
0
        public override int GetHashCode()
        {
            int hash = 0;

            if (!ReferenceEquals(Mesh, null))
            {
                hash ^= Mesh.GetHashCode();
            }
            if (!ReferenceEquals(Material, null))
            {
                hash ^= Material.GetHashCode();
            }
            hash ^= SubMesh.GetHashCode();
            hash ^= CastShadows.GetHashCode();
            hash ^= ReceiveShadows.GetHashCode();
            hash ^= CullDistance.GetHashCode();
            hash ^= InstanceShaderPropertyId.GetHashCode();
            return(hash);
        }