Example #1
0
    public void UpdateTerrainChunk()
    {
        if (mHeightMap.sampleCenter == mSampleCenter)
        {
            int lod = mTerrain.lod;

            LODMesh lodMesh = mLODMeshes[lod];

            if (lodMesh.mesh != null && lodMesh.sampleCenter == mHeightMap.sampleCenter)
            {
                mMeshFilter.mesh = lodMesh.mesh;

                var matrix4x4 = mMeshObject.transform.localToWorldMatrix;

                ThreadQueue.RunAsync(() => GenerateTree(matrix4x4, lod));
            }
            else
            {
                lodMesh.GenerateMesh(mHeightMap, mTerrain.meshSettings);
            }
        }
        else
        {
            Load();
        }
    }