public static uint HashTransforms(World world, uint seed)
        {
            if (!world.IsCreated)
            {
                return(seed);
            }

            var entities = world.EntityManager;

            using (var query = entities.CreateEntityQuery(ComponentType.ReadOnly <LocalToWorld>()))
                using (var chunks = query.CreateArchetypeChunkArray(Allocator.TempJob))
                    using (var hashes = new NativeArray <uint>(chunks.Length, Allocator.TempJob))
                    {
                        if (0 == chunks.Length)
                        {
                            return(seed);
                        }

                        new HashLocalToWorldChunksJob
                        {
                            Access = entities.GetArchetypeChunkComponentType <LocalToWorld>(true),
                            Chunks = chunks,
                            Hashes = hashes,
                            Seed   = seed
                        }
                        .Schedule(chunks.Length, 1)
                        .Complete();

                        return(HashUtility.GetDenseHash(hashes, seed));
                    }
        }
            public void Execute(int index)
            {
                var data = Chunks[index].GetNativeArray(Access);

                Hashes[index] = HashUtility.GetDenseHash(data, Seed);
            }
Beispiel #3
0
 public uint Execute(NativeView view, ComponentType _, uint seed)
 {
     return(HashUtility.GetDenseHash(view, seed));
 }