@@ -24,14 +24,43 @@ public class FocusProvider : MonoBehaviour, IMixedRealityFocusProvider
2424 private IMixedRealityInputSystem inputSystem = null ;
2525 public IMixedRealityInputSystem InputSystem => inputSystem ?? ( inputSystem = MixedRealityManager . Instance . GetManager < IMixedRealityInputSystem > ( ) ) ;
2626
27- /// <summary>
28- /// Maximum distance at which the pointer can collide with an object.
29- /// </summary>
27+ private readonly HashSet < PointerData > pointers = new HashSet < PointerData > ( ) ;
28+ private readonly HashSet < GameObject > pendingOverallFocusEnterSet = new HashSet < GameObject > ( ) ;
29+ private readonly HashSet < GameObject > pendingOverallFocusExitSet = new HashSet < GameObject > ( ) ;
30+ private readonly List < PointerData > pendingPointerSpecificFocusChange = new List < PointerData > ( ) ;
31+
32+ #region IFocusProvider Properties
33+
3034 [ SerializeField ]
35+ [ Tooltip ( "Maximum distance at which all pointers can collide with a GameObject, unless it has an override extent." ) ]
3136 private float pointingExtent = 10f ;
3237
38+ /// <inheritdoc />
3339 float IMixedRealityFocusProvider . GlobalPointingExtent => pointingExtent ;
3440
41+ [ SerializeField ]
42+ [ Tooltip ( "Camera to use for raycasting uGUI pointer events." ) ]
43+ private Camera uiRaycastCamera = null ;
44+
45+ /// <inheritdoc />
46+ public Camera UIRaycastCamera
47+ {
48+ get
49+ {
50+ if ( uiRaycastCamera == null )
51+ {
52+ CreateUiRaycastCamera ( ) ;
53+ }
54+
55+ return uiRaycastCamera ;
56+ }
57+ }
58+
59+ /// <inheritdoc />
60+ public GameObject OverrideFocusedObject { get ; set ; }
61+
62+ #endregion IFocusProvider Properties
63+
3564 /// <summary>
3665 /// The LayerMasks, in prioritized order, that are used to determine the GazeTarget when raycasting.
3766 /// <example>
@@ -60,55 +89,35 @@ public class FocusProvider : MonoBehaviour, IMixedRealityFocusProvider
6089 /// </summary>
6190 private PointerData gazeManagerPointingData ;
6291
63- private readonly HashSet < PointerData > pointers = new HashSet < PointerData > ( ) ;
64- private readonly HashSet < GameObject > pendingOverallFocusEnterSet = new HashSet < GameObject > ( ) ;
65- private readonly HashSet < GameObject > pendingOverallFocusExitSet = new HashSet < GameObject > ( ) ;
66- private readonly List < PointerData > pendingPointerSpecificFocusChange = new List < PointerData > ( ) ;
67-
6892 /// <summary>
6993 /// Cached vector 3 reference to the new raycast position.
7094 /// <remarks>Only used to update UI raycast results.</remarks>
7195 /// </summary>
7296 private Vector3 newUiRaycastPosition = Vector3 . zero ;
7397
74- /// <summary>
75- /// Camera to use for raycasting uGUI pointer events.
76- /// </summary>
77- [ SerializeField ]
78- [ Tooltip ( "Camera to use for raycasting uGUI pointer events." ) ]
79- private Camera uiRaycastCamera = null ;
80-
81- /// <summary>
82- /// The Camera the Event System uses to raycast against.
83- /// <para><remarks>Every uGUI canvas in your scene should use this camera as its event camera.</remarks></para>
84- /// </summary>
85- public Camera UIRaycastCamera
86- {
87- get
88- {
89- if ( uiRaycastCamera == null )
90- {
91- CreateUiRaycastCamera ( ) ;
92- }
93-
94- return uiRaycastCamera ;
95- }
96- }
97-
98- /// <summary>
99- /// To tap on a hologram even when not focused on,
100- /// set OverrideFocusedObject to desired game object.
101- /// If it's null, then focused object will be used.
102- /// </summary>
103- public GameObject OverrideFocusedObject { get ; set ; }
104-
10598 [ Serializable ]
10699 private class PointerData : IPointerResult , IEquatable < PointerData >
107100 {
108101 public readonly IMixedRealityPointer Pointer ;
109- private FocusDetails focusDetails ;
110102
111- private GraphicInputEventData graphicData ;
103+ /// <inheritdoc />
104+ public Vector3 StartPoint { get ; private set ; }
105+
106+ /// <inheritdoc />
107+ public FocusDetails Details { get ; private set ; }
108+
109+ /// <inheritdoc />
110+ public GameObject CurrentPointerTarget { get ; private set ; }
111+
112+ /// <inheritdoc />
113+ public GameObject PreviousPointerTarget { get ; private set ; }
114+
115+ /// <inheritdoc />
116+ public int RayStepIndex { get ; private set ; }
117+
118+ /// <summary>
119+ /// The graphic input event data used for raycasting uGUI elements.
120+ /// </summary>
112121 public GraphicInputEventData GraphicEventData
113122 {
114123 get
@@ -123,6 +132,9 @@ public GraphicInputEventData GraphicEventData
123132 return graphicData ;
124133 }
125134 }
135+ private GraphicInputEventData graphicData ;
136+
137+ private FocusDetails focusDetails ;
126138
127139 public PointerData ( IMixedRealityPointer pointer )
128140 {
@@ -188,13 +200,15 @@ public void ResetFocusedObjects(bool clearPreviousObject = true)
188200 CurrentPointerTarget = null ;
189201 }
190202
203+ /// <inheritdoc />
191204 public bool Equals ( PointerData other )
192205 {
193206 if ( ReferenceEquals ( null , other ) ) return false ;
194207 if ( ReferenceEquals ( this , other ) ) return true ;
195208 return Pointer . PointerId == other . Pointer . PointerId ;
196209 }
197210
211+ /// <inheritdoc />
198212 public override bool Equals ( object obj )
199213 {
200214 if ( ReferenceEquals ( null , obj ) ) return false ;
@@ -203,16 +217,11 @@ public override bool Equals(object obj)
203217 return Equals ( ( PointerData ) obj ) ;
204218 }
205219
220+ /// <inheritdoc />
206221 public override int GetHashCode ( )
207222 {
208223 return Pointer != null ? Pointer . GetHashCode ( ) : 0 ;
209224 }
210-
211- public Vector3 StartPoint { get ; private set ; }
212- public FocusDetails Details { get ; private set ; }
213- public GameObject CurrentPointerTarget { get ; private set ; }
214- public GameObject PreviousPointerTarget { get ; private set ; }
215- public int RayStepIndex { get ; private set ; }
216225 }
217226
218227 #region MonoBehaviour Implementation
@@ -246,11 +255,7 @@ private void Update()
246255
247256 #region Focus Details by EventData
248257
249- /// <summary>
250- /// Gets the currently focused object based on specified the event data.
251- /// </summary>
252- /// <param name="eventData"></param>
253- /// <returns>Currently focused <see cref="GameObject"/> for the events input source.</returns>
258+ /// <inheritdoc />
254259 public GameObject GetFocusedObject ( BaseInputEventData eventData )
255260 {
256261 Debug . Assert ( eventData != null ) ;
@@ -266,12 +271,7 @@ public GameObject GetFocusedObject(BaseInputEventData eventData)
266271 return graphicInputEventData . selectedObject ;
267272 }
268273
269- /// <summary>
270- /// Try to get the focus details based on the specified event data.
271- /// </summary>
272- /// <param name="eventData"></param>
273- /// <param name="focusDetails"></param>
274- /// <returns>True, if event data pointer input source is registered.</returns>
274+ /// <inheritdoc />
275275 public bool TryGetFocusDetails ( BaseInputEventData eventData , out FocusDetails focusDetails )
276276 {
277277 foreach ( var pointerData in pointers )
@@ -287,12 +287,7 @@ public bool TryGetFocusDetails(BaseInputEventData eventData, out FocusDetails fo
287287 return false ;
288288 }
289289
290- /// <summary>
291- /// Try to get the registered pointer source that raised the event.
292- /// </summary>
293- /// <param name="eventData"></param>
294- /// <param name="pointer"></param>
295- /// <returns>True, if event datas pointer input source is registered.</returns>
290+ /// <inheritdoc />
296291 public bool TryGetPointingSource ( BaseInputEventData eventData , out IMixedRealityPointer pointer )
297292 {
298293 foreach ( var pointerData in pointers )
@@ -312,12 +307,7 @@ public bool TryGetPointingSource(BaseInputEventData eventData, out IMixedReality
312307
313308 #region Focus Details by IMixedRealityPointer
314309
315- /// <summary>
316- /// Gets the currently focused object for the pointing source.
317- /// <para><remarks>If the pointing source is not registered, then the Gaze's Focused <see cref="GameObject"/> is returned.</remarks></para>
318- /// </summary>
319- /// <param name="pointingSource"></param>
320- /// <returns>Currently Focused Object.</returns>
310+ /// <inheritdoc />
321311 public GameObject GetFocusedObject ( IMixedRealityPointer pointingSource )
322312 {
323313 if ( OverrideFocusedObject != null ) { return OverrideFocusedObject ; }
@@ -332,11 +322,7 @@ public GameObject GetFocusedObject(IMixedRealityPointer pointingSource)
332322 return focusDetails . Object ;
333323 }
334324
335- /// <summary>
336- /// Gets the currently focused object for the pointing source.
337- /// </summary>
338- /// <param name="pointer"></param>
339- /// <param name="focusDetails"></param>
325+ /// <inheritdoc />
340326 public bool TryGetFocusDetails ( IMixedRealityPointer pointer , out FocusDetails focusDetails )
341327 {
342328 foreach ( var pointerData in pointers )
@@ -352,11 +338,7 @@ public bool TryGetFocusDetails(IMixedRealityPointer pointer, out FocusDetails fo
352338 return false ;
353339 }
354340
355- /// <summary>
356- /// Get the Graphic Event Data for the specified pointing source.
357- /// </summary>
358- /// <param name="pointer"></param>
359- /// <returns></returns>
341+ /// <inheritdoc />
360342 public GraphicInputEventData GetSpecificPointerGraphicEventData ( IMixedRealityPointer pointer )
361343 {
362344 return GetPointerData ( pointer ) ? . GraphicEventData ;
@@ -366,10 +348,7 @@ public GraphicInputEventData GetSpecificPointerGraphicEventData(IMixedRealityPoi
366348
367349 #region Utilities
368350
369- /// <summary>
370- /// Generate a new unique pointer id.
371- /// </summary>
372- /// <returns></returns>
351+ /// <inheritdoc />
373352 public uint GenerateNewPointerId ( )
374353 {
375354 var newId = ( uint ) UnityEngine . Random . Range ( 1 , int . MaxValue ) ;
@@ -438,22 +417,14 @@ public void UpdateCanvasEventSystems()
438417 }
439418 }
440419
441- /// <summary>
442- /// Checks if the pointer is registered with the Focus Manager.
443- /// </summary>
444- /// <param name="pointer"></param>
445- /// <returns>True, if registered, otherwise false.</returns>
420+ /// <inheritdoc />
446421 public bool IsPointerRegistered ( IMixedRealityPointer pointer )
447422 {
448423 Debug . Assert ( pointer . PointerId != 0 , $ "{ pointer } does not have a valid pointer id!") ;
449424 return GetPointerData ( pointer ) != null ;
450425 }
451426
452- /// <summary>
453- /// Registers the pointer with the Focus Manager.
454- /// </summary>
455- /// <param name="pointer"></param>
456- /// <returns>True, if the pointer was registered, false if the pointer was previously registered.</returns>
427+ /// <inheritdoc />
457428 public bool RegisterPointer ( IMixedRealityPointer pointer )
458429 {
459430 Debug . Assert ( pointer . PointerId != 0 , $ "{ pointer } does not have a valid pointer id!") ;
@@ -464,11 +435,7 @@ public bool RegisterPointer(IMixedRealityPointer pointer)
464435 return true ;
465436 }
466437
467- /// <summary>
468- /// Unregisters the pointer with the Focus Manager.
469- /// </summary>
470- /// <param name="pointer"></param>
471- /// <returns>True, if the pointer was unregistered, false if the pointer was not registered.</returns>
438+ /// <inheritdoc />
472439 public bool UnregisterPointer ( IMixedRealityPointer pointer )
473440 {
474441 Debug . Assert ( pointer . PointerId != 0 , $ "{ pointer } does not have a valid pointer id!") ;
0 commit comments