예제 #1
0
        public void Execute(int index)
        {
            var poissonPointRegionEntity = PoissonPointRegionEntities[index];
            var pointRegion        = PoissonPointRegions[poissonPointRegionEntity];
            var poissonPointBuffer = PoissonPointBuffers[poissonPointRegionEntity].Reinterpret <float2>();

            var poissonPoints = PoissonDiscSampling.Sample(
                pointRegion.Size.x,
                pointRegion.Size.y,
                MinimumRadius,
                RandomUtility.ParallelForRandomSeed(RandomSeed, index),
                PoissonDiscSampling.defaultSamplingResolution,
                Allocator.Temp);

            var offset = pointRegion.Center - pointRegion.Size / 2f;

            for (var i = 0; i < poissonPoints.Length; i++)
            {
                poissonPoints[i] += offset;
            }

            poissonPointBuffer.AddRange(poissonPoints);
        }