XRImageTrackingSubsystemDescriptor.cs
5.54 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
using System;
namespace UnityEngine.XR.ARSubsystems
{
/// <summary>
/// Describes the capabilities of an <see cref="XRImageTrackingSubsystem"/>.
/// </summary>
public class XRImageTrackingSubsystemDescriptor : SubsystemDescriptor<XRImageTrackingSubsystem>
{
/// <summary>
/// Construction information for the <see cref="XRImageTrackingSubsystemDescriptor"/>.
/// </summary>
public struct Cinfo : IEquatable<Cinfo>
{
/// <summary>
/// A string identifier used to name the subsystem provider.
/// </summary>
public string id { get; set; }
/// <summary>
/// The <c>System.Type</c> of the provider implementation, used to instantiate the class.
/// </summary>
public Type subsystemImplementationType { get; set; }
/// <summary>
/// Whether the subsystem supports tracking the poses of moving images in realtime.
/// </summary>
/// <remarks>
/// If <c>true</c>,
/// <see cref="XRImageTrackingSubsystem.IProvider.maxNumberOfMovingImages"/>
/// must be implemented.
/// </remarks>
public bool supportsMovingImages { get; set; }
/// <summary>
/// Whether the subsystem requires physical image dimensions to be provided for all reference images.
/// If <c>false</c>, specifying the physical dimensions is optional.
/// </summary>
public bool requiresPhysicalImageDimensions { get; set; }
/// <summary>
/// Whether the subsystem supports image libraries that may be mutated at runtime.
/// </summary>
/// <remarks>
/// If <c>true</c>,
/// <see cref="XRImageTrackingSubsystem.IProvider.CreateRuntimeLibrary(XRReferenceImageLibrary)"/>
/// must be implemented and
/// <see cref="XRImageTrackingSubsystem.IProvider.imageLibrary"/>
/// will never be called.
/// </remarks>
/// <seealso cref="MutableRuntimeReferenceImageLibrary"/>
public bool supportsMutableLibrary { get; set; }
public override int GetHashCode()
{
unchecked
{
var hashCode = id == null ? 0 : id.GetHashCode();
hashCode = hashCode * 486187739 + (subsystemImplementationType == null ? 0 : subsystemImplementationType.GetHashCode());
hashCode = hashCode * 486187739 + supportsMovingImages.GetHashCode();
hashCode = hashCode * 486187739 + requiresPhysicalImageDimensions.GetHashCode();
hashCode = hashCode * 486187739 + supportsMutableLibrary.GetHashCode();
return hashCode;
}
}
public bool Equals(Cinfo other)
{
return
(id == other.id) &&
(subsystemImplementationType == subsystemImplementationType) &&
(supportsMovingImages == other.supportsMovingImages) &&
(requiresPhysicalImageDimensions == other.requiresPhysicalImageDimensions) &&
(supportsMutableLibrary == other.supportsMutableLibrary);
}
public override bool Equals(object obj) => (obj is Cinfo) && Equals((Cinfo)obj);
public static bool operator==(Cinfo lhs, Cinfo rhs) => lhs.Equals(rhs);
public static bool operator!=(Cinfo lhs, Cinfo rhs) => !lhs.Equals(rhs);
}
/// <summary>
/// Whether the subsystem supports tracking the poses of moving images in realtime.
/// </summary>
public bool supportsMovingImages { get; private set; }
/// <summary>
/// Whether the subsystem requires physical image dimensions to be provided for all reference images.
/// If <c>false</c>, specifying the physical dimensions is optional.
/// </summary>
public bool requiresPhysicalImageDimensions { get; private set; }
/// <summary>
/// Whether the subsystem supports <see cref="MutableRuntimeReferenceImageLibrary"/>, a reference
/// image library which can modified at runtime, as opposed to the <see cref="XRReferenceImageLibrary"/>,
/// which is generated at edit time and cannot be modified at runtime.
/// </summary>
/// <seealso cref="MutableRuntimeReferenceImageLibrary"/>
/// <seealso cref="XRImageTrackingSubsystem.CreateRuntimeLibrary(XRReferenceImageLibrary)"/>
public bool supportsMutableLibrary { get; private set; }
/// <summary>
/// Registers a new descriptor with the <c>SubsystemManager</c>.
/// </summary>
/// <param name="cinfo">The construction information for the new descriptor.</param>
public static void Create(Cinfo cinfo)
{
SubsystemRegistration.CreateDescriptor(new XRImageTrackingSubsystemDescriptor(cinfo));
}
XRImageTrackingSubsystemDescriptor(Cinfo cinfo)
{
this.id = cinfo.id;
this.subsystemImplementationType = cinfo.subsystemImplementationType;
this.supportsMovingImages = cinfo.supportsMovingImages;
this.requiresPhysicalImageDimensions = cinfo.requiresPhysicalImageDimensions;
this.supportsMutableLibrary = cinfo.supportsMutableLibrary;
}
}
}