@@ -205,12 +205,12 @@ private static class Native
205
205
public static extern void ControllerPulse ( int controller , float intensity , float duration ) ;
206
206
207
207
[ DllImport ( "__Internal" ) ]
208
- public static extern void SetWebXREvents ( Action < int , float , float , float , float , float , float , float , float > on_start_ar ,
209
- Action < int , float , float , float , float , float , float , float , float > on_start_vr ,
210
- Action < int > on_visibility_change ,
211
- Action on_end_xr ,
212
- Action < bool , bool > on_xr_capabilities ,
213
- Action < string > on_input_profiles ) ;
208
+ public static extern void SetWebXREvents ( StartXREvent on_start_ar ,
209
+ StartXREvent on_start_vr ,
210
+ VisibilityChangeEvent on_visibility_change ,
211
+ EndXREvent on_end_xr ,
212
+ XRCapabilitiesEvent on_xr_capabilities ,
213
+ InputProfilesEvent on_input_profiles ) ;
214
214
}
215
215
#endif
216
216
@@ -256,6 +256,18 @@ public delegate void HeadsetUpdate(
256
256
257
257
internal static event HitTestUpdate OnViewerHitTestUpdate ;
258
258
259
+ internal delegate void StartXREvent ( int viewsCount ,
260
+ float left_x , float left_y , float left_w , float left_h ,
261
+ float right_x , float right_y , float right_w , float right_h ) ;
262
+
263
+ internal delegate void VisibilityChangeEvent ( int visibilityState ) ;
264
+
265
+ internal delegate void EndXREvent ( ) ;
266
+
267
+ internal delegate void XRCapabilitiesEvent ( bool isARSupported , bool isVRSupported ) ;
268
+
269
+ internal delegate void InputProfilesEvent ( string json ) ;
270
+
259
271
// Cameras calculations helpers
260
272
private Matrix4x4 leftProjectionMatrix = new Matrix4x4 ( ) ;
261
273
private Matrix4x4 rightProjectionMatrix = new Matrix4x4 ( ) ;
@@ -292,15 +304,15 @@ public delegate void HeadsetUpdate(
292
304
internal WebXRDisplayCapabilities capabilities = new WebXRDisplayCapabilities ( ) ;
293
305
294
306
// Handles WebXR capabilities from browser
295
- [ MonoPInvokeCallback ( typeof ( Action < bool , bool > ) ) ]
307
+ [ MonoPInvokeCallback ( typeof ( XRCapabilitiesEvent ) ) ]
296
308
public static void OnXRCapabilities ( bool isARSupported , bool isVRSupported )
297
309
{
298
310
Instance . capabilities . canPresentAR = isARSupported ;
299
311
Instance . capabilities . canPresentVR = isVRSupported ;
300
312
Instance . OnXRCapabilities ( Instance . capabilities ) ;
301
313
}
302
314
303
- [ MonoPInvokeCallback ( typeof ( Action < string > ) ) ]
315
+ [ MonoPInvokeCallback ( typeof ( InputProfilesEvent ) ) ]
304
316
public static void OnInputProfiles ( string json )
305
317
{
306
318
WebXRControllersProfiles controllersProfiles = JsonUtility . FromJson < WebXRControllersProfiles > ( json ) ;
@@ -335,7 +347,7 @@ public void setXrState(WebXRState state, int viewsCount, Rect leftRect, Rect rig
335
347
}
336
348
337
349
// received start AR from WebXR browser
338
- [ MonoPInvokeCallback ( typeof ( Action < int , float , float , float , float , float , float , float , float > ) ) ]
350
+ [ MonoPInvokeCallback ( typeof ( StartXREvent ) ) ]
339
351
public static void OnStartAR ( int viewsCount ,
340
352
float left_x , float left_y , float left_w , float left_h ,
341
353
float right_x , float right_y , float right_w , float right_h )
@@ -346,7 +358,7 @@ public static void OnStartAR(int viewsCount,
346
358
}
347
359
348
360
// received start VR from WebXR browser
349
- [ MonoPInvokeCallback ( typeof ( Action < int , float , float , float , float , float , float , float , float > ) ) ]
361
+ [ MonoPInvokeCallback ( typeof ( StartXREvent ) ) ]
350
362
public static void OnStartVR ( int viewsCount ,
351
363
float left_x , float left_y , float left_w , float left_h ,
352
364
float right_x , float right_y , float right_w , float right_h )
@@ -356,7 +368,7 @@ public static void OnStartVR(int viewsCount,
356
368
new Rect ( right_x , right_y , right_w , right_h ) ) ;
357
369
}
358
370
359
- [ MonoPInvokeCallback ( typeof ( Action < int > ) ) ]
371
+ [ MonoPInvokeCallback ( typeof ( VisibilityChangeEvent ) ) ]
360
372
public static void UpdateVisibilityState ( int visibilityState )
361
373
{
362
374
if ( Instance . visibilityState != ( WebXRVisibilityState ) visibilityState )
@@ -367,7 +379,7 @@ public static void UpdateVisibilityState(int visibilityState)
367
379
}
368
380
369
381
// receive end VR from WebVR browser
370
- [ MonoPInvokeCallback ( typeof ( Action ) ) ]
382
+ [ MonoPInvokeCallback ( typeof ( EndXREvent ) ) ]
371
383
public static void OnEndXR ( )
372
384
{
373
385
Instance . updatedControllersOnEnd = false ;
0 commit comments