@@ -604,12 +604,7 @@ setTimeout(function () {
604
604
605
605
XRManager . prototype . UpdateXRCapabilities = function ( ) {
606
606
// Send browser capabilities to Unity.
607
- this . gameModule . WebXR . OnXRCapabilities (
608
- JSON . stringify ( {
609
- canPresentAR : this . isARSupported ,
610
- canPresentVR : this . isVRSupported
611
- } )
612
- ) ;
607
+ this . gameModule . WebXR . OnXRCapabilities ( this . isARSupported , this . isVRSupported ) ;
613
608
}
614
609
615
610
// http://answers.unity.com/answers/11372/view.html
@@ -1064,47 +1059,41 @@ Module['WebXR'].GetJSEventsObject = function () {
1064
1059
1065
1060
Module [ 'WebXR' ] . OnStartAR = function ( views_count , left_rect , right_rect ) {
1066
1061
Module . WebXR . isInXR = true ;
1067
- this . OnStartARInternal = this . OnStartARInternal || Module . cwrap ( "on_start_ar" , null , [ "number" ,
1068
- "number" , "number" , "number" , "number" ,
1069
- "number" , "number" , "number" , "number" ] ) ;
1070
- this . OnStartARInternal ( views_count ,
1062
+ Module . dynCall_viffffffff ( Module . WebXR . onStartARPtr , views_count ,
1071
1063
left_rect . x , left_rect . y , left_rect . w , left_rect . h ,
1072
1064
right_rect . x , right_rect . y , right_rect . w , right_rect . h ) ;
1073
1065
}
1074
1066
1075
1067
Module [ 'WebXR' ] . OnStartVR = function ( views_count , left_rect , right_rect ) {
1076
1068
Module . WebXR . isInXR = true ;
1077
- this . OnStartVRInternal = this . OnStartVRInternal || Module . cwrap ( "on_start_vr" , null , [ "number" ,
1078
- "number" , "number" , "number" , "number" ,
1079
- "number" , "number" , "number" , "number" ] ) ;
1080
- this . OnStartVRInternal ( views_count ,
1069
+ Module . dynCall_viffffffff ( Module . WebXR . onStartVRPtr , views_count ,
1081
1070
left_rect . x , left_rect . y , left_rect . w , left_rect . h ,
1082
1071
right_rect . x , right_rect . y , right_rect . w , right_rect . h ) ;
1083
1072
}
1084
1073
1085
1074
Module [ 'WebXR' ] . OnVisibilityChange = function ( visibility_state ) {
1086
- this . OnVisibilityChangeInternal = this . OnVisibilityChangeInternal || Module . cwrap ( "on_visibility_change" , null , [ "number" ] ) ;
1087
1075
var visibility_state_int = 0 ;
1088
1076
if ( visibility_state == "visible-blurred" ) {
1089
1077
visibility_state_int = 1 ;
1090
1078
} else if ( visibility_state == "hidden" ) {
1091
1079
visibility_state_int = 2 ;
1092
1080
}
1093
- this . OnVisibilityChangeInternal ( visibility_state_int ) ;
1081
+ Module . dynCall_vi ( Module . WebXR . onVisibilityChangePtr , visibility_state_int ) ;
1094
1082
}
1095
1083
1096
1084
Module [ 'WebXR' ] . OnEndXR = function ( ) {
1097
1085
Module . WebXR . isInXR = false ;
1098
- this . OnEndXRInternal = this . OnEndXRInternal || Module . cwrap ( "on_end_xr" , null , [ ] ) ;
1099
- this . OnEndXRInternal ( ) ;
1086
+ Module . dynCall_v ( Module . WebXR . onEndXRPtr ) ;
1100
1087
}
1101
1088
1102
- Module [ 'WebXR' ] . OnXRCapabilities = function ( display_capabilities ) {
1103
- this . OnXRCapabilitiesInternal = this . OnXRCapabilitiesInternal || Module . cwrap ( "on_xr_capabilities" , null , [ "string" ] ) ;
1104
- this . OnXRCapabilitiesInternal ( display_capabilities ) ;
1089
+ Module [ 'WebXR' ] . OnXRCapabilities = function ( isARSupported , isVRSupported ) {
1090
+ Module . dynCall_vii ( Module . WebXR . onXRCapabilitiesPtr , isARSupported , isVRSupported ) ;
1105
1091
}
1106
1092
1107
1093
Module [ 'WebXR' ] . OnInputProfiles = function ( input_profiles ) {
1108
- this . OnInputProfilesInternal = this . OnInputProfilesInternal || Module . cwrap ( "on_input_profiles" , null , [ "string" ] ) ;
1109
- this . OnInputProfilesInternal ( input_profiles ) ;
1094
+ var strBufferSize = lengthBytesUTF8 ( input_profiles ) + 1 ;
1095
+ var strBuffer = Module . _malloc ( strBufferSize ) ;
1096
+ stringToUTF8 ( input_profiles , strBuffer , strBufferSize ) ;
1097
+ Module . dynCall_vi ( Module . WebXR . onInputProfilesPtr , strBuffer ) ;
1098
+ Module . _free ( strBuffer ) ;
1110
1099
}
0 commit comments