Exemplo n.º 1
0
            public void ScheduleMeshingJob(NativeArray <Voxel> voxels, int chunkSize, SimplifyingMethod method)
            {
                nativeLightData = VoxelLightBuilder.GenerateLightData(voxels, chunkSize);
                switch (method)
                {
                case SimplifyingMethod.Culling:
                    ScheduleCullingJob(voxels, chunkSize);
                    break;

                case SimplifyingMethod.GreedyOnlyHeight:
                    ScheduleGreedyOnlyHeightJob(voxels, chunkSize);
                    break;

                case SimplifyingMethod.Greedy:
                    ScheduleGreedyJob(voxels, chunkSize);
                    break;

                default:
                    ScheduleGreedyJob(voxels, chunkSize);
                    break;
                }
            }
Exemplo n.º 2
0
            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();
            }