public IEnumerator ScheduleMeshingJob(Voxel[] voxels, VoxelLightBuilder.NativeLightData lightData, int3 chunkSize, SimplifyingMethod method, bool argent = false) { nativeVoxels.CopyFrom(voxels); switch (method) { case SimplifyingMethod.Culling: ScheduleCullingJob(nativeVoxels, lightData, chunkSize); break; case SimplifyingMethod.GreedyOnlyHeight: ScheduleGreedyOnlyHeightJob(nativeVoxels, lightData, chunkSize); break; case SimplifyingMethod.Greedy: ScheduleGreedyJob(nativeVoxels, lightData, chunkSize); break; default: ScheduleGreedyJob(nativeVoxels, lightData, chunkSize); break; } int frameCount = lightData.frameCount; yield return(new WaitUntil(() => { frameCount++; return jobHandle.IsCompleted || frameCount >= 4 || argent; })); jobHandle.Complete(); }
void ScheduleGreedyJob(NativeArray <Voxel> voxels, VoxelLightBuilder.NativeLightData lightData, int3 chunkSize) { VoxelGreedyMeshingJob voxelMeshingOnlyHeightJob = new VoxelGreedyMeshingJob { voxels = voxels, chunkSize = chunkSize, vertices = nativeVertices, normals = nativeNormals, uvs = nativeUVs, indices = nativeIndices, colors = nativeColors, lightData = lightData.nativeLightData, counter = counter, }; jobHandle = voxelMeshingOnlyHeightJob.Schedule(); JobHandle.ScheduleBatchedJobs(); }