using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Jobs;
using UnityEngine.Scripting;
using UnityEngine.XR.ARSubsystems;
using UnityEngine.XR.MagicLeap.Native;
namespace UnityEngine.XR.MagicLeap
{
[Preserve]
public sealed class ImageTrackingSubsystem : XRImageTrackingSubsystem
{
#if !UNITY_2020_2_OR_NEWER
protected override Provider CreateProvider() => new MagicLeapProvider();
#endif
class MagicLeapProvider : Provider
{
internal static bool IsSubsystemStateValid()
{
return false;
}
public bool RequestPermissionIfNecessary()
{
return false;
}
public MagicLeapProvider()
{
}
#if UNITY_2020_2_OR_NEWER
public override void Start() { }
public override void Stop() { }
#endif
public override void Destroy()
{
}
public override RuntimeReferenceImageLibrary imageLibrary
{
set
{
}
}
public unsafe override TrackableChanges<XRTrackedImage> GetChanges(XRTrackedImage defaultTrackedImage, Allocator allocator)
{
return default(TrackableChanges<XRTrackedImage>);
}
public override int requestedMaxNumberOfMovingImages
{
get => m_RequestedNumberOfMovingImages;
set
{
m_RequestedNumberOfMovingImages = value;
}
}
int m_RequestedNumberOfMovingImages = 25;
public override int currentMaxNumberOfMovingImages => m_RequestedNumberOfMovingImages;
public override RuntimeReferenceImageLibrary CreateRuntimeLibrary(XRReferenceImageLibrary serializedLibrary)
{
return null;
}
}
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
static void RegisterDescriptor()
{
XRImageTrackingSubsystemDescriptor.Create(new XRImageTrackingSubsystemDescriptor.Cinfo
{
id = MagicLeapXrProvider.ImageTrackingSubsystemId,
#if UNITY_2020_2_OR_NEWER
providerType = typeof(MagicLeapProvider),
subsystemTypeOverride = typeof(ImageTrackingSubsystem),
#else
subsystemImplementationType = typeof(ImageTrackingSubsystem),
#endif
supportsMovingImages = false,
supportsMutableLibrary = false
});
}
}
}