This repository has been archived on 2025-04-28. You can view files and clone it, but cannot push or open issues or pull requests.
ARPlusSystem/ARPlusSystem-250418/Library/PackageCache/com.unity.xr.arsubsystems@4.../Runtime/ImageTrackingSubsystem/RuntimeReferenceImageLibrar...

42 lines
1.7 KiB
C#

using System;
namespace UnityEngine.XR.ARSubsystems
{
/// <summary>
/// The runtime representation of a <see cref="XRReferenceImageLibrary"/>.
/// Some libraries are mutable; see <see cref="MutableRuntimeReferenceImageLibrary"/>.
/// </summary>
public abstract class RuntimeReferenceImageLibrary : IReferenceImageLibrary
{
/// <summary>
/// Gets the <see cref="XRReferenceImage"/> at the given <paramref name="index"/>.
/// </summary>
public XRReferenceImage this[int index]
{
get
{
if (index < 0)
throw new ArgumentOutOfRangeException(nameof(index), index, $"{nameof(index)} must be greater than or equal to zero.");
if (index >= count)
throw new ArgumentOutOfRangeException(nameof(index), index, $"{nameof(index)} must be less than count ({count}).");
return GetReferenceImageAt(index);
}
}
/// <summary>
/// The number of reference images contained in this library.
/// </summary>
public abstract int count { get; }
/// <summary>
/// Derived methods should return the <see cref="XRReferenceImage"/> at the given <paramref name="index"/>.
/// The <paramref name="index"/> has already been validated to be within the range [0..<see cref="count"/>].
/// </summary>
/// <param name="index">The index of the reference image to get.</param>
/// <returns>A <see cref="XRReferenceImage"/> that represents the reference image at index <paramref name="index"/>.</returns>
protected abstract XRReferenceImage GetReferenceImageAt(int index);
}
}