Skip to content

Commit 7842cba

Browse files
committed
Removed old AR Overlay hack
1 parent f05e959 commit 7842cba

File tree

3 files changed

+3
-63
lines changed

3 files changed

+3
-63
lines changed

Build/webxr.js

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@
134134
this.isARSupported = false;
135135
this.isVRSupported = false;
136136
this.onInputEvent = null;
137-
this.waitingHandheldARHack = false;
138137
this.BrowserObject = null;
139138
this.JSEventsObject = null;
140139
this.init();
@@ -186,32 +185,15 @@
186185

187186
XRManager.prototype.onRequestARSession = function () {
188187
if (!this.isARSupported) return;
189-
// The window on Chrome for Android lose focus when asking permissions.
190-
// A popup is opened and the Canvas is painted with the last frame.
191-
// We want to make sure that the Canvas is transparent when entering Handheld AR Session.
192-
this.waitingHandheldARHack = true;
193-
var thisXRMananger = this;
194-
var tempRender = function () {
195-
thisXRMananger.ctx.clearColor(0, 0, 0, 0);
196-
thisXRMananger.ctx.clear(thisXRMananger.ctx.COLOR_BUFFER_BIT | thisXRMananger.ctx.DEPTH_BUFFER_BIT);
197-
if (thisXRMananger.waitingHandheldARHack)
198-
{
199-
window.requestAnimationFrame( tempRender );
200-
}
201-
}
202-
window.requestAnimationFrame( tempRender );
203188
navigator.xr.requestSession('immersive-ar', {
204189
requiredFeatures: ['local-floor'], // TODO: Get this value from Unity
205190
optionalFeatures: ['hand-tracking', 'hit-test']
206191
}).then(async (session) => {
207-
this.waitingHandheldARHack = false;
208192
session.isImmersive = true;
209193
session.isInSession = true;
210194
session.isAR = true;
211195
this.xrSession = session;
212196
this.onSessionStarted(session);
213-
}).catch((error) => {
214-
thisXRMananger.waitingHandheldARHack = false;
215197
});
216198
}
217199

@@ -422,9 +404,7 @@
422404
func(time);
423405
});
424406
} else {
425-
if (!thisXRMananger.waitingHandheldARHack) {
426-
window.requestAnimationFrame(func);
427-
}
407+
window.requestAnimationFrame(func);
428408
}
429409
};
430410

Packages/webxr/Hidden~/WebGLTemplates/WebXR/webxr.js

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@
134134
this.isARSupported = false;
135135
this.isVRSupported = false;
136136
this.onInputEvent = null;
137-
this.waitingHandheldARHack = false;
138137
this.BrowserObject = null;
139138
this.JSEventsObject = null;
140139
this.init();
@@ -186,32 +185,15 @@
186185

187186
XRManager.prototype.onRequestARSession = function () {
188187
if (!this.isARSupported) return;
189-
// The window on Chrome for Android lose focus when asking permissions.
190-
// A popup is opened and the Canvas is painted with the last frame.
191-
// We want to make sure that the Canvas is transparent when entering Handheld AR Session.
192-
this.waitingHandheldARHack = true;
193-
var thisXRMananger = this;
194-
var tempRender = function () {
195-
thisXRMananger.ctx.clearColor(0, 0, 0, 0);
196-
thisXRMananger.ctx.clear(thisXRMananger.ctx.COLOR_BUFFER_BIT | thisXRMananger.ctx.DEPTH_BUFFER_BIT);
197-
if (thisXRMananger.waitingHandheldARHack)
198-
{
199-
window.requestAnimationFrame( tempRender );
200-
}
201-
}
202-
window.requestAnimationFrame( tempRender );
203188
navigator.xr.requestSession('immersive-ar', {
204189
requiredFeatures: ['local-floor'], // TODO: Get this value from Unity
205190
optionalFeatures: ['hand-tracking', 'hit-test']
206191
}).then(async (session) => {
207-
this.waitingHandheldARHack = false;
208192
session.isImmersive = true;
209193
session.isInSession = true;
210194
session.isAR = true;
211195
this.xrSession = session;
212196
this.onSessionStarted(session);
213-
}).catch((error) => {
214-
thisXRMananger.waitingHandheldARHack = false;
215197
});
216198
}
217199

@@ -422,9 +404,7 @@
422404
func(time);
423405
});
424406
} else {
425-
if (!thisXRMananger.waitingHandheldARHack) {
426-
window.requestAnimationFrame(func);
427-
}
407+
window.requestAnimationFrame(func);
428408
}
429409
};
430410

Packages/webxr/Hidden~/WebGLTemplates/WebXRFullView/webxr.js

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@
134134
this.isARSupported = false;
135135
this.isVRSupported = false;
136136
this.onInputEvent = null;
137-
this.waitingHandheldARHack = false;
138137
this.BrowserObject = null;
139138
this.JSEventsObject = null;
140139
this.init();
@@ -186,32 +185,15 @@
186185

187186
XRManager.prototype.onRequestARSession = function () {
188187
if (!this.isARSupported) return;
189-
// The window on Chrome for Android lose focus when asking permissions.
190-
// A popup is opened and the Canvas is painted with the last frame.
191-
// We want to make sure that the Canvas is transparent when entering Handheld AR Session.
192-
this.waitingHandheldARHack = true;
193-
var thisXRMananger = this;
194-
var tempRender = function () {
195-
thisXRMananger.ctx.clearColor(0, 0, 0, 0);
196-
thisXRMananger.ctx.clear(thisXRMananger.ctx.COLOR_BUFFER_BIT | thisXRMananger.ctx.DEPTH_BUFFER_BIT);
197-
if (thisXRMananger.waitingHandheldARHack)
198-
{
199-
window.requestAnimationFrame( tempRender );
200-
}
201-
}
202-
window.requestAnimationFrame( tempRender );
203188
navigator.xr.requestSession('immersive-ar', {
204189
requiredFeatures: ['local-floor'], // TODO: Get this value from Unity
205190
optionalFeatures: ['hand-tracking', 'hit-test']
206191
}).then(async (session) => {
207-
this.waitingHandheldARHack = false;
208192
session.isImmersive = true;
209193
session.isInSession = true;
210194
session.isAR = true;
211195
this.xrSession = session;
212196
this.onSessionStarted(session);
213-
}).catch((error) => {
214-
thisXRMananger.waitingHandheldARHack = false;
215197
});
216198
}
217199

@@ -422,9 +404,7 @@
422404
func(time);
423405
});
424406
} else {
425-
if (!thisXRMananger.waitingHandheldARHack) {
426-
window.requestAnimationFrame(func);
427-
}
407+
window.requestAnimationFrame(func);
428408
}
429409
};
430410

0 commit comments

Comments
 (0)