Skip to content

Commit 94ae721

Browse files
Start the light probe only when entering ar-mode, update the VR environment only when a light probe was set up in the first place
1 parent 9d6aa43 commit 94ae721

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

‎src/components/scene/reflection.js‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,10 @@ module.exports.Component = register('reflection', {
4242
}
4343

4444
this.el.addEventListener('enter-vr', function () {
45+
if (!self.el.is('ar-mode')) { return; }
4546
var renderer = self.el.renderer;
4647
var session = renderer.xr.getSession();
47-
if (
48-
session.requestLightProbe && self.el.is('ar-mode')
49-
) {
48+
if (session.requestLightProbe) {
5049
self.startLightProbe();
5150
}
5251
});
@@ -61,9 +60,9 @@ module.exports.Component = register('reflection', {
6160
this.xrLightProbe = null;
6261
if (this.probeLight) {
6362
this.probeLight.components.light.light.intensity = 0;
63+
this.needsVREnvironmentUpdate = true;
64+
this.el.object3D.environment = this.cubeRenderTarget.texture;
6465
}
65-
this.needsVREnvironmentUpdate = true;
66-
this.el.object3D.environment = this.cubeRenderTarget.texture;
6766
},
6867
startLightProbe: function () {
6968
this.needsLightProbeUpdate = true;

0 commit comments

Comments
 (0)