Skip to content

Commit

Permalink
Start the light probe only when xr.getSession returns a not null sess…
Browse files Browse the repository at this point in the history
…ion, update the VR environment only when a light probe was set up in the first place
  • Loading branch information
Antonio Pisano committed Nov 14, 2023
1 parent 9d6aa43 commit 88fbb04
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/scene/reflection.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports.Component = register('reflection', {
var renderer = self.el.renderer;
var session = renderer.xr.getSession();
if (
session.requestLightProbe && self.el.is('ar-mode')
session && session.requestLightProbe && self.el.is('ar-mode')
) {
self.startLightProbe();
}
Expand All @@ -61,9 +61,9 @@ module.exports.Component = register('reflection', {
this.xrLightProbe = null;
if (this.probeLight) {
this.probeLight.components.light.light.intensity = 0;
this.needsVREnvironmentUpdate = true;
this.el.object3D.environment = this.cubeRenderTarget.texture;
}
this.needsVREnvironmentUpdate = true;
this.el.object3D.environment = this.cubeRenderTarget.texture;
},
startLightProbe: function () {
this.needsLightProbeUpdate = true;
Expand Down

0 comments on commit 88fbb04

Please sign in to comment.