using MagicLeap.OpenXR.Futures; using UnityEngine.XR.OpenXR.NativeTypes; namespace MagicLeap.OpenXR.Features.SpatialAnchors { internal unsafe class MagicLeapSpatialAnchorsStorageNativeFunctions : FuturesNativeFunctions { internal delegate* unmanaged[Cdecl] XrCreateSpatialAnchorsStorage; internal delegate* unmanaged[Cdecl] XrDestroySpatialAnchorsStorage; internal delegate* unmanaged[Cdecl] XrQuerySpatialAnchorsAsync; internal delegate* unmanaged[Cdecl] XrQuerySpatialAnchorsComplete; internal delegate* unmanaged[Cdecl] XrPublishSpatialAnchorsAsync; internal delegate* unmanaged[Cdecl] XrPublishSpatialAnchorsComplete; internal delegate* unmanaged[Cdecl] XrDeleteSpatialAnchorsAsync; internal delegate* unmanaged[Cdecl] XrDeleteSpatialAnchorsComplete; internal delegate* unmanaged[Cdecl] XrUpdateSpatialAnchorsExpirationAsync; internal delegate* unmanaged[Cdecl] XrUpdateSpatialAnchorsExpirationComplete; private string SanitizeName(string name) => $"{name.Replace("Xr", "xr")}ML"; protected override void LocateNativeFunctions() { base.LocateNativeFunctions(); XrCreateSpatialAnchorsStorage = (delegate* unmanaged[Cdecl])LocateNativeFunction(SanitizeName(nameof(XrCreateSpatialAnchorsStorage))); XrDestroySpatialAnchorsStorage = (delegate* unmanaged[Cdecl])LocateNativeFunction(SanitizeName(nameof(XrDestroySpatialAnchorsStorage))); XrQuerySpatialAnchorsAsync = (delegate* unmanaged[Cdecl])LocateNativeFunction(SanitizeName(nameof(XrQuerySpatialAnchorsAsync))); XrQuerySpatialAnchorsComplete = (delegate* unmanaged[Cdecl])LocateNativeFunction(SanitizeName(nameof(XrQuerySpatialAnchorsComplete))); XrPublishSpatialAnchorsAsync = (delegate* unmanaged[Cdecl])LocateNativeFunction(SanitizeName(nameof(XrPublishSpatialAnchorsAsync))); XrPublishSpatialAnchorsComplete = (delegate* unmanaged[Cdecl])LocateNativeFunction(SanitizeName(nameof(XrPublishSpatialAnchorsComplete))); XrDeleteSpatialAnchorsAsync = (delegate* unmanaged[Cdecl])LocateNativeFunction(SanitizeName(nameof(XrDeleteSpatialAnchorsAsync))); XrDeleteSpatialAnchorsComplete = (delegate* unmanaged[Cdecl])LocateNativeFunction(SanitizeName(nameof(XrDeleteSpatialAnchorsComplete))); XrUpdateSpatialAnchorsExpirationAsync = (delegate* unmanaged[Cdecl])LocateNativeFunction(SanitizeName(nameof(XrUpdateSpatialAnchorsExpirationAsync))); XrUpdateSpatialAnchorsExpirationComplete = (delegate* unmanaged[Cdecl])LocateNativeFunction(SanitizeName(nameof(XrUpdateSpatialAnchorsExpirationComplete))); } } }