unsafe public bool Merge(out FragmentId targetFragment, out FragmentPose[] mergedFragments)
        {
            targetFragment = FragmentId.Invalid;

            if (!FrozenWorld_RefitMerge_Init())
            {
                checkError();
                targetFragment  = GetMostSignificantFragmentId();
                mergedFragments = new FragmentPose[0];
                return(false);
            }
            checkError();

            FrozenWorld_RefitMerge_Prepare();
            checkError();

            int bufSize = FrozenWorld_RefitMerge_GetNumAdjustedFragments();

            checkError();

            FrozenWorld_RefitMerge_AdjustedFragment *buf = stackalloc FrozenWorld_RefitMerge_AdjustedFragment[bufSize];
            int numAdjustedFragments = FrozenWorld_RefitMerge_GetAdjustedFragments(bufSize, buf);

            checkError();
            mergedFragments = new FragmentPose[numAdjustedFragments];

            for (int i = 0; i < numAdjustedFragments; i++)
            {
                var fragmentAdjust = new FragmentPose()
                {
                    fragmentId = (FragmentId)buf[i].fragmentId, pose = FtoU(buf[i].adjustment)
                };
                mergedFragments[i] = fragmentAdjust;
            }

            FrozenWorld_FragmentId mergedFragmentId;

            FrozenWorld_RefitMerge_GetMergedFragmentId(&mergedFragmentId);
            checkError();
            targetFragment = (FragmentId)mergedFragmentId;

            FrozenWorld_RefitMerge_Apply();
            checkError();

            return(true);
        }
 [DllImport("FrozenWorldPlugin")] public static extern int FrozenWorld_RefitMerge_GetAdjustedFragments(int adjustedFragmentsBufferSize, FrozenWorld_RefitMerge_AdjustedFragment *adjustedFragmentsOut);