Skip to content

Commit fb67c01

Browse files
Make the inspector work with post-processing enabled (#5684)
1 parent 2c4bae5 commit fb67c01

File tree

1 file changed

+7
-3
lines changed
  • examples/showcase/post-processing

1 file changed

+7
-3
lines changed

examples/showcase/post-processing/bloom.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ AFRAME.registerComponent('bloom', {
2929
this.size = new THREE.Vector2();
3030
this.scene = this.el.object3D;
3131
this.renderer = this.el.renderer;
32-
this.camera = this.el.camera;
3332
this.originalRender = this.el.renderer.render;
3433
this.bind();
3534
},
@@ -56,8 +55,10 @@ AFRAME.registerComponent('bloom', {
5655
this.composer = new EffectComposer(this.renderer, renderTarget);
5756

5857
// create render pass
59-
var renderScene = new RenderPass(this.scene, this.camera);
60-
this.composer.addPass(renderScene);
58+
if (!this.renderPass) {
59+
this.renderPass = new RenderPass(this.scene, this.el.camera);
60+
}
61+
this.composer.addPass(this.renderPass);
6162

6263
// create bloom pass
6364
var strength = this.data.strength;
@@ -91,6 +92,9 @@ AFRAME.registerComponent('bloom', {
9192
self.originalRender.apply(this, arguments);
9293
} else {
9394
isInsideComposerRender = true;
95+
// always set the current active camera on the RenderPass so that the
96+
// inspector controls are working properly with post-processing enabled
97+
self.renderPass.camera = self.el.camera;
9498
self.composer.render(self.el.sceneEl.delta / 1000);
9599
isInsideComposerRender = false;
96100
}

0 commit comments

Comments
 (0)