Skip to content

Commit

Permalink
Start the light probe only when entering ar-mode, update the VR envir…
Browse files Browse the repository at this point in the history
…onment only when a light probe was set up in the first place
  • Loading branch information
Elettrotecnica committed Nov 14, 2023
1 parent 9d6aa43 commit 94ae721
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/components/scene/reflection.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ module.exports.Component = register('reflection', {
}

this.el.addEventListener('enter-vr', function () {
if (!self.el.is('ar-mode')) { return; }
var renderer = self.el.renderer;
var session = renderer.xr.getSession();
if (
session.requestLightProbe && self.el.is('ar-mode')
) {
if (session.requestLightProbe) {
self.startLightProbe();
}
});
Expand All @@ -61,9 +60,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 94ae721

Please sign in to comment.