Exemplo n.º 1
0
            public static JobHandle Schedule(NativeArray <float3> vertices, NativeArray <float2> scales, float transfromStepDistance, int innerBatchCount, JobHandle dependOn)
            {
                var applyScales = new ApplyScales
                {
                    transfromStepDistance = transfromStepDistance,
                    scales   = scales,
                    vertices = vertices
                };

                return(applyScales.Schedule(vertices.Length, innerBatchCount, dependOn));
            }
Exemplo n.º 2
0
        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);
        }