浏览代码

vectorized offset loop

/main
sleal-unity 4 年前
当前提交
8881d893
共有 1 个文件被更改,包括 8 次插入5 次删除
  1. 13
      com.unity.perception/Runtime/Randomization/Randomizers/RandomizerExamples/Utilities/PoissonDiskSampling.cs

13
com.unity.perception/Runtime/Randomization/Randomizers/RandomizerExamples/Utilities/PoissonDiskSampling.cs


var results = new NativeArray<bool>(
superSampledPoints.Length, Allocator.Temp, NativeArrayOptions.UninitializedMemory);
// The comparisons operations made in this loop are done separately from the second loop
// The comparisons operations made in this loop are done separately from the list-building loop
// so that burst can automatically generate vectorized assembly code this portion of the job.
for (var i = 0; i < superSampledPoints.Length; i++)
{

for (var i = 0; i < superSampledPoints.Length; i++)
{
if (results[i])
{
var p = superSampledPoints[i];
croppedSamples.Add(new float2(p.x - minimumRadius, p.y - minimumRadius));
}
croppedSamples.Add(superSampledPoints[i]);
}
// Remove the positional offset from the filtered-but-still-super-sampled points
for (var i = 0; i < croppedSamples.Length; i++)
{
croppedSamples[i] -= new float2(minimumRadius, minimumRadius);
}
results.Dispose();

正在加载...
取消
保存