private static IEnumerable <Transform> GenerateTransforms(int axes) { var indices = Enumerable.Range(0, axes).ToImmutableArray(); var result = new List <Transform>(); GenerateTransforms(indices, ImmutableArray <(int, int)> .Empty, result); return(result); }
public static JobHandle Schedule(SplineCache spline, NativeArray <PointTransform> transforms, float transfromStepDistance, int innerBatchCount, JobHandle dependOn) { var generateTransforms = new GenerateTransforms { cacheStepDistance = spline.CacheStepDistance, transfromStepDistance = transfromStepDistance, splineCachePositions = spline.Positions, transforms = transforms }; return(generateTransforms.Schedule(transforms.Length, innerBatchCount, dependOn)); }
protected override JobHandle StartGeneration(MeshData meshData, JobHandle dependOn) { int rowNum = Mathf.CeilToInt(SplineCache.Distance / TransformStepDistance); var transforms = new NativeArray <PointTransform>(rowNum, Allocator.TempJob, NativeArrayOptions.UninitializedMemory); AddTemp(transforms); if (ScaleValues != null) { var scales = new NativeArray <float2>(transforms.Length, Allocator.TempJob, NativeArrayOptions.UninitializedMemory); AddTemp(scales); FillScales(scales, TransformStepDistance, ScaleValues); dependOn = ApplyScales.Schedule(meshData.Vertices, scales, TransformStepDistance, DefApplyScalesInnerBatchCount, dependOn); } if (RotationValues != null) { var rotations = CalcRotations(rowNum, TransformStepDistance, RotationValues); AddTemp(rotations); dependOn = GenerateRotatedTransforms.Schedule(SplineCache, transforms, rotations, TransformStepDistance, GenerateTransformsInnerBatchCount, dependOn); } else { dependOn = GenerateTransforms.Schedule(SplineCache, transforms, TransformStepDistance, GenerateTransformsInnerBatchCount, dependOn); } if (LerpValues == null) { dependOn = ApplyTransforms.Schedule(meshData.Vertices, transforms, TransformStepDistance, ApplyTransformsInnerBatchCount, dependOn); } else { if (LerpValues.Length <= ApplyLerpedTransformsLimited.MaxLerpValueCount) { dependOn = ApplyLerpedTransformsLimited.Schedule(meshData.Vertices, transforms, LerpValues, TransformStepDistance, ApplyTransformsInnerBatchCount, dependOn); } else { var lerpArray = new NativeArray <LerpValue>(LerpValues, Allocator.TempJob); AddTemp(lerpArray); dependOn = ApplyLerpedTransforms.Schedule(meshData.Vertices, transforms, lerpArray, TransformStepDistance, ApplyTransformsInnerBatchCount, dependOn); } } return(dependOn); }