Esempio n. 1
0
        internal static bool UnmergeLodMesh(this MyMergedLodMeshId mergedLodMesh, LodMeshId lodMesh)
        {
            var pendingLodMeshes = mergedLodMesh.Info.PendingLodMeshes;
            var mergedLodMeshes  = mergedLodMesh.Info.MergedLodMeshes;

            bool alreadyMerged = mergedLodMeshes.Contains(lodMesh);

            if (alreadyMerged)
            {
                MyMeshes.UnlinkLodMeshFromMerged(lodMesh);
            }

            if (pendingLodMeshes.Remove(lodMesh))
            {
                Debug.Assert(!alreadyMerged, "Lod mesh set as pending and merged at the same time!");
            }

            if (alreadyMerged)
            {
                mergedLodMeshes.Remove(lodMesh);
                pendingLodMeshes.UnionWith(mergedLodMeshes);
                mergedLodMeshes.Clear();
            }

            return(alreadyMerged);
        }