RuntimeReferenceImageLibrary.cs
1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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"/> representing the reference image at index <paramref name="index"/>.</returns>
protected abstract XRReferenceImage GetReferenceImageAt(int index);
}
}