XREnvironmentProbe.cs
5.55 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
using System;
using System.Runtime.InteropServices;
namespace UnityEngine.XR.ARSubsystems
{
/// <summary>
/// Encapsulates all of the data provided for an individual environment probe in an AR session.
/// </summary>
[StructLayout (LayoutKind.Sequential)]
public struct XREnvironmentProbe : IEquatable<XREnvironmentProbe>, ITrackable
{
/// <summary>
/// Creates an <see cref="XREnvironmentProbe"/> populated with default values.
/// </summary>
public static XREnvironmentProbe defaultValue => s_Default;
static readonly XREnvironmentProbe s_Default = new XREnvironmentProbe
{
trackableId = TrackableId.invalidId,
pose = Pose.identity
};
/// <summary>
/// Uniquely identifies each environment probe in an AR session.
/// </summary>
/// <value>
/// The unique trackable ID of the environment probe.
/// </value>
public TrackableId trackableId
{
get => m_TrackableId;
private set => m_TrackableId = value;
}
TrackableId m_TrackableId;
/// <summary>
/// Contains the scale of the environment probe in the AR session.
/// </summary>
/// <value>
/// The scale of the environment probe.
/// </value>
public Vector3 scale
{
get => m_Scale;
private set => m_Scale = value;
}
Vector3 m_Scale;
/// <summary>
/// Contains the pose (position and rotation) of the environment probe in the AR session.
/// </summary>
/// <value>
/// The pose (position and rotation) of the environment probe.
/// </value>
public Pose pose
{
get => m_Pose;
private set => m_Pose = value;
}
Pose m_Pose;
/// <summary>
/// Specifies the volume size around the environment probe's position for use when projecting the environment
/// texture for parallax correction.
/// </summary>
/// <value>
/// The bounding volume size of the environment probe.
/// </value>
/// <remarks>
/// Note that <c>size</c> may validly be infinite.
/// </remarks>
public Vector3 size
{
get => m_Size;
private set => m_Size = value;
}
Vector3 m_Size;
/// <summary>
/// Contains the texture descriptor captured from the device.
/// </summary>
/// <value>
/// The texture descriptor of the environment probe.
/// </value>
/// <remarks>
/// The <c>environmentTextureData</c> value may be invalid indicating that the device has yet to capture an
/// environment texture for this probe. Newly created environment probes have no environment texture. The
/// <see cref="XRTextureDescriptor.valid" /> property should be used to determine whether the texture data
/// is valid.
/// </remarks>
public XRTextureDescriptor textureDescriptor
{
get => m_TextureDescriptor;
private set => m_TextureDescriptor = value;
}
XRTextureDescriptor m_TextureDescriptor;
/// <summary>
/// The <see cref="TrackingState"/> associated with this environment probe.
/// </summary>
public TrackingState trackingState
{
get => m_TrackingState;
private set => m_TrackingState = value;
}
TrackingState m_TrackingState;
/// <summary>
/// A native pointer associated with this environment probe.
/// The data pointed to by this pointer is implementation-defined. Its lifetime
/// is also implementation-defined, but will be valid at least until the next
/// call to <see cref="XREnvironmentProbeSubsystem.GetChanges(Allocator)"/>.
/// </summary>
public IntPtr nativePtr
{
get => m_NativePtr;
private set => m_NativePtr = value;
}
IntPtr m_NativePtr;
public bool Equals(XREnvironmentProbe other)
{
// Environment probes are equivalent if the trackable IDs match.
return m_TrackableId.Equals(other.m_TrackableId);
}
public override bool Equals(System.Object obj)
{
return (!ReferenceEquals(obj, null)
&& (ReferenceEquals(this, obj)
|| ((obj is XREnvironmentProbe) && Equals((XREnvironmentProbe)obj))));
}
public static bool operator ==(XREnvironmentProbe lhs, XREnvironmentProbe rhs) => lhs.Equals(rhs);
public static bool operator !=(XREnvironmentProbe lhs, XREnvironmentProbe rhs) => !(lhs == rhs);
public override int GetHashCode() => m_TrackableId.GetHashCode();
public override string ToString() => ToString("0.000");
public string ToString(string floatingPointformat)
{
return string.Format("{0} scale:{1} pose:{2} size:{3} environmentTextureData:{4} trackingState:{5} nativePtr:{6}",
m_TrackableId.ToString(), m_Scale.ToString(floatingPointformat),
m_Pose.ToString(floatingPointformat), m_Size.ToString(floatingPointformat),
m_TextureDescriptor.ToString(), m_TrackingState.ToString(), m_NativePtr.ToString());
}
}
}