public void Execute(ref EudiJobHandle <ContractUpdateSplines> handle, bool wasForcedToFinish = false) { for (int i = Iteration; i < MaxLength; i++) { var currentPointsIndex = PointsIndexes[i]; var entity = Entities[i]; var moduleIndex = entity.FastGet <CatmullromSplineModule>(); ref var spline = ref EudiModuleGroup <CatmullromSplineModule> .Get(entity).ListObject[moduleIndex]; var usedPoints = new EudiStructList <Vector3>(spline.PointsLength); for (int j = 0; j < usedPoints.Length; j++) { var p = Points[currentPointsIndex + j]; usedPoints[j] = p; Debug.Log("points"); } CatmullromSplineUtility.CalculateSpline(usedPoints, ref spline.FillerArray, spline.UsableSegments, spline.Tension, spline.IsLooping); Debug.Log(spline.FillerArray.Length); for (int j = 0; j < spline.FillerArray.Length; j++) { Debug.Log(spline.FillerArray[j]); } usedPoints.Dispose(); }
protected override void UnityLateUpdate() { base.UnityLateUpdate(); var matchLength = MatchEntities.Length; if (matchLength == 0) { return; } // ---- ---- ---- ---- ---- ---- ---- ---- ---- // Update transformAccess and points indexes // ---- ---- ---- ---- ---- ---- ---- ---- ---- var pointsIndexes = new EudiStructList <int>(matchLength); var currentCount = 0; for (int i = 0; i < matchLength; i++) { var configurator = _catmullRomSplineClassConfigurators[i]; pointsIndexes[i] = currentCount; currentCount += configurator.PointsLength; } // ---- ---- ---- ---- ---- ---- ---- ---- ---- // Schedule the job to update the points positions // ---- ---- ---- ---- ---- ---- ---- ---- ---- var points = new EudiStructList <Vector3>(m_pointsTransforms.Length); var jobUpdatePointsPos = new JobUpdatePointsPosition() { PointsToUpdate = points, }; AddDependency(jobUpdatePointsPos.Schedule(m_pointsTransforms, GetDependency())); GetDependency().Complete(); Debug.Log(m_pointsTransforms.Length); var currentChunk = -1; for (int chunk = 0, i = 0; i < matchLength; i++, chunk++) { if (chunk >= DivideChunk || currentChunk == -1) { currentChunk++; chunk = 0; _contract.Jobs.AddJob(new ContractUpdateSplines() { PointsIndexes = pointsIndexes, Points = points, Entities = MatchEntities, CurrentChunk = currentChunk, Iteration = i, MaxLength = Mathf.Clamp(DivideChunk - 1, i, matchLength) }); } } }
// Unity jobs public void Execute(int index) { var currentPointsIndex = PointsIndexes[index]; var spline = Splines[index]; var usedPoints = new EudiStructList <Vector3>(spline.PointsLength); for (int i = 0; i < usedPoints.Length; i++) { usedPoints[i] = Points[currentPointsIndex + i]; } CatmullromSplineUtility.CalculateSpline(usedPoints, ref spline.FillerArray, spline.UsableSegments, spline.Tension, spline.IsLooping); usedPoints.Dispose(); }