@@ -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 an object, 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,31 @@ 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+ /// <inheritdoc />
106+ public FocusDetails Details { get ; private set ; }
107+ /// <inheritdoc />
108+ public GameObject CurrentPointerTarget { get ; private set ; }
109+ /// <inheritdoc />
110+ public GameObject PreviousPointerTarget { get ; private set ; }
111+ /// <inheritdoc />
112+ public int RayStepIndex { get ; private set ; }
113+
114+ /// <summary>
115+ /// The graphic input event data used for raycasting uGUI elements.
116+ /// </summary>
112117 public GraphicInputEventData GraphicEventData
113118 {
114119 get
@@ -123,6 +128,9 @@ public GraphicInputEventData GraphicEventData
123128 return graphicData ;
124129 }
125130 }
131+ private GraphicInputEventData graphicData ;
132+
133+ private FocusDetails focusDetails ;
126134
127135 public PointerData ( IMixedRealityPointer pointer )
128136 {
@@ -188,13 +196,15 @@ public void ResetFocusedObjects(bool clearPreviousObject = true)
188196 CurrentPointerTarget = null ;
189197 }
190198
199+ /// <inheritdoc />
191200 public bool Equals ( PointerData other )
192201 {
193202 if ( ReferenceEquals ( null , other ) ) return false ;
194203 if ( ReferenceEquals ( this , other ) ) return true ;
195204 return Pointer . PointerId == other . Pointer . PointerId ;
196205 }
197206
207+ /// <inheritdoc />
198208 public override bool Equals ( object obj )
199209 {
200210 if ( ReferenceEquals ( null , obj ) ) return false ;
@@ -203,16 +213,11 @@ public override bool Equals(object obj)
203213 return Equals ( ( PointerData ) obj ) ;
204214 }
205215
216+ /// <inheritdoc />
206217 public override int GetHashCode ( )
207218 {
208219 return Pointer != null ? Pointer . GetHashCode ( ) : 0 ;
209220 }
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 ; }
216221 }
217222
218223 #region MonoBehaviour Implementation
@@ -246,11 +251,7 @@ private void Update()
246251
247252 #region Focus Details by EventData
248253
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>
254+ /// <inheritdoc />
254255 public GameObject GetFocusedObject ( BaseInputEventData eventData )
255256 {
256257 Debug . Assert ( eventData != null ) ;
@@ -266,12 +267,7 @@ public GameObject GetFocusedObject(BaseInputEventData eventData)
266267 return graphicInputEventData . selectedObject ;
267268 }
268269
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>
270+ /// <inheritdoc />
275271 public bool TryGetFocusDetails ( BaseInputEventData eventData , out FocusDetails focusDetails )
276272 {
277273 foreach ( var pointerData in pointers )
@@ -287,12 +283,7 @@ public bool TryGetFocusDetails(BaseInputEventData eventData, out FocusDetails fo
287283 return false ;
288284 }
289285
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>
286+ /// <inheritdoc />
296287 public bool TryGetPointingSource ( BaseInputEventData eventData , out IMixedRealityPointer pointer )
297288 {
298289 foreach ( var pointerData in pointers )
@@ -312,12 +303,7 @@ public bool TryGetPointingSource(BaseInputEventData eventData, out IMixedReality
312303
313304 #region Focus Details by IMixedRealityPointer
314305
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>
306+ /// <inheritdoc />
321307 public GameObject GetFocusedObject ( IMixedRealityPointer pointingSource )
322308 {
323309 if ( OverrideFocusedObject != null ) { return OverrideFocusedObject ; }
@@ -332,11 +318,7 @@ public GameObject GetFocusedObject(IMixedRealityPointer pointingSource)
332318 return focusDetails . Object ;
333319 }
334320
335- /// <summary>
336- /// Gets the currently focused object for the pointing source.
337- /// </summary>
338- /// <param name="pointer"></param>
339- /// <param name="focusDetails"></param>
321+ /// <inheritdoc />
340322 public bool TryGetFocusDetails ( IMixedRealityPointer pointer , out FocusDetails focusDetails )
341323 {
342324 foreach ( var pointerData in pointers )
@@ -352,11 +334,7 @@ public bool TryGetFocusDetails(IMixedRealityPointer pointer, out FocusDetails fo
352334 return false ;
353335 }
354336
355- /// <summary>
356- /// Get the Graphic Event Data for the specified pointing source.
357- /// </summary>
358- /// <param name="pointer"></param>
359- /// <returns></returns>
337+ /// <inheritdoc />
360338 public GraphicInputEventData GetSpecificPointerGraphicEventData ( IMixedRealityPointer pointer )
361339 {
362340 return GetPointerData ( pointer ) ? . GraphicEventData ;
@@ -366,10 +344,7 @@ public GraphicInputEventData GetSpecificPointerGraphicEventData(IMixedRealityPoi
366344
367345 #region Utilities
368346
369- /// <summary>
370- /// Generate a new unique pointer id.
371- /// </summary>
372- /// <returns></returns>
347+ /// <inheritdoc />
373348 public uint GenerateNewPointerId ( )
374349 {
375350 var newId = ( uint ) UnityEngine . Random . Range ( 1 , int . MaxValue ) ;
@@ -438,22 +413,14 @@ public void UpdateCanvasEventSystems()
438413 }
439414 }
440415
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>
416+ /// <inheritdoc />
446417 public bool IsPointerRegistered ( IMixedRealityPointer pointer )
447418 {
448419 Debug . Assert ( pointer . PointerId != 0 , $ "{ pointer } does not have a valid pointer id!") ;
449420 return GetPointerData ( pointer ) != null ;
450421 }
451422
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>
423+ /// <inheritdoc />
457424 public bool RegisterPointer ( IMixedRealityPointer pointer )
458425 {
459426 Debug . Assert ( pointer . PointerId != 0 , $ "{ pointer } does not have a valid pointer id!") ;
@@ -464,11 +431,7 @@ public bool RegisterPointer(IMixedRealityPointer pointer)
464431 return true ;
465432 }
466433
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>
434+ /// <inheritdoc />
472435 public bool UnregisterPointer ( IMixedRealityPointer pointer )
473436 {
474437 Debug . Assert ( pointer . PointerId != 0 , $ "{ pointer } does not have a valid pointer id!") ;
0 commit comments