public void UpdateTerrainChunk()
        {
            if (mapDataReceived)
            {
                float viwerDistanceFromNearestEdge = Mathf.Sqrt(bounds.SqrDistance(viewerPosition));
                bool  visible = viwerDistanceFromNearestEdge <= maxViewDistance;

                if (visible)
                {
                    int lodIndex = 0;

                    for (int i = 0; i < detailLevels.Length - 1; i++)
                    {
                        if (viwerDistanceFromNearestEdge > detailLevels[i].visibleDistanceThreshold)
                        {
                            lodIndex = i + 1;
                        }
                        else
                        {
                            break;
                        }
                    }

                    if (lodIndex != previousLODIndex)
                    {
                        LODMesh lodMesh = lodMeshes[lodIndex];

                        if (lodMesh.hasMesh)
                        {
                            previousLODIndex = lodIndex;
                            meshFilter.mesh  = lodMesh.mesh;
                        }
                        else if (!lodMesh.hasResquestedMesh)
                        {
                            lodMesh.ResquestMesh(mapData);
                        }
                    }
                }

                SetVisible(visible);
            }
        }