Пример #1
0
    // Updates the chunk based on its contents
    // returns whether or not a meshing happens
    public bool UpdateChunk()
    {
        if (!loaded || dying || !NeighborsLoaded())
        {
            return(false);
        }

        if (!builtStructures && IsLocalGroupFreeForStructuring())   // build structures like trees and such if you havent yet
        {
            JobController.StartStructureJob(this);
        }
        else if ((sunBFS.Count > 0 || sunRBFS.Count > 0) && IsLocalGroupFreeForMeshing())
        {
            lightUpdate = false;
            JobController.StartSunlightJob(this);
        }
        else if (lightUpdate && !update && JobController.CanStartLightJob() && IsLocalGroupFreeToUpdateLights())
        {
            lightUpdate = false;
            JobController.StartLightUpdateJob(this);
        }
        else if (update && IsLocalGroupFreeForMeshing())
        {
            update      = false;
            lightUpdate = false;
            JobController.StartMeshJob(this);
            return(true);
        }

        return(false);
    }