Skip to content

Commit 88fbb04

Browse files
author
Antonio Pisano
committed
Start the light probe only when xr.getSession returns a not null session, update the VR environment only when a light probe was set up in the first place
1 parent 9d6aa43 commit 88fbb04

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎src/components/scene/reflection.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ module.exports.Component = register('reflection', {
4545
var renderer = self.el.renderer;
4646
var session = renderer.xr.getSession();
4747
if (
48-
session.requestLightProbe && self.el.is('ar-mode')
48+
session && session.requestLightProbe && self.el.is('ar-mode')
4949
) {
5050
self.startLightProbe();
5151
}
@@ -61,9 +61,9 @@ module.exports.Component = register('reflection', {
6161
this.xrLightProbe = null;
6262
if (this.probeLight) {
6363
this.probeLight.components.light.light.intensity = 0;
64+
this.needsVREnvironmentUpdate = true;
65+
this.el.object3D.environment = this.cubeRenderTarget.texture;
6466
}
65-
this.needsVREnvironmentUpdate = true;
66-
this.el.object3D.environment = this.cubeRenderTarget.texture;
6767
},
6868
startLightProbe: function () {
6969
this.needsLightProbeUpdate = true;

0 commit comments

Comments
 (0)