Beispiel #1
0
    void StartChunkProcessing(Chunk c)
    {
        remeshJobs.Clear();
        foreach (var chunk in chunks.Values)
        {
            if (chunk.DeferRemesh)
            {
                chunk.DisposeMeshing();

                remeshJobs.Add(TerrainMesher.StartJob(chunk, genJob));

                chunk.DeferRemesh = false;
            }
        }

        if (chunkInProcess == null && c != null)
        {
            chunkInProcess = c;

            c.DisposeMeshing();

            genJob  = TerrainGenerator.StartJob(c);
            meshJob = TerrainMesher.StartJob(c, genJob);
        }
    }
Beispiel #2
0
    void OnDestroy()
    {
        genJob?.Complete();
        meshJob?.Complete();

        chunkInProcess = null;
        genJob         = null;
        meshJob        = null;

        foreach (var c in chunks.Values)
        {
            c.Dispose();
            Destroy(c);
        }
        chunks.Clear();
    }
Beispiel #3
0
    void FinishChunkProcessing()
    {
        foreach (var j in remeshJobs)
        {
            j.Complete();
        }

        if (chunkInProcess != null && (genJob?.IsCompleted ?? true) && (meshJob?.IsCompleted ?? true))
        {
            genJob?.Complete();
            meshJob?.Complete();
            chunkInProcess.Done = true;

            chunkInProcess = null;
            genJob         = null;
            meshJob        = null;
        }
    }