Skip to content

Commit a69b022

Browse files
committed
Clean up.
1 parent 4f27317 commit a69b022

File tree

3 files changed

+9
-22
lines changed

3 files changed

+9
-22
lines changed

examples/jsm/postprocessing/SSRPass.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ class SSRPass extends Pass {
5050
this.tempColor = new Color();
5151

5252
this.selects = [];
53-
this.setSelects( selects );
5453

5554
this._bouncing = bouncing;
5655
Object.defineProperty( this, 'bouncing', {
@@ -292,6 +291,8 @@ class SSRPass extends Pass {
292291

293292
this.originalClearColor = new Color();
294293

294+
this.setSelects( selects );
295+
295296
}
296297

297298
dispose() {
@@ -560,9 +561,9 @@ class SSRPass extends Pass {
560561

561562
}
562563

563-
let materialBack = child.material;
564+
const materialBack = child.material;
564565
child.material = this.intensityMaterial;
565-
renderer.render( child, this.camera, false ); // TODO: Will render all descendants?
566+
renderer.render( child, this.camera, false );
566567
child.material = materialBack;
567568

568569
}
9.86 KB
Loading

examples/webgl_postprocessing_ssr.html

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
const params = {
3737
enableSSR: true,
38-
autoRotate: false,
38+
autoRotate: true,
3939
otherMeshes: true,
4040
groundReflector: true,
4141
};
@@ -48,7 +48,6 @@
4848
const otherMeshes = [];
4949
let groundReflector;
5050
const selects = [];
51-
window.selects = selects;
5251
let bunny, cube, sphere, cone;
5352
let folder;
5453

@@ -67,12 +66,10 @@
6766
camera.position.set( 0.13271600513224902, 0.3489546826045913, 0.43921296427927076 );
6867

6968
scene = new THREE.Scene();
70-
window.scene = scene;
71-
// scene.fog = new THREE.Fog( 0x443333, 1, 4 );
7269

7370
// Ground
7471
const groundPlane = new THREE.Mesh(
75-
new THREE.PlaneGeometry( 8, 8 ),
72+
new THREE.PlaneGeometry( 1, 1 ),
7673
new THREE.MeshPhongMaterial( { color: 0x999999, specular: 0x101010 } )
7774
);
7875
groundPlane.rotation.x = - Math.PI / 2;
@@ -81,7 +78,6 @@
8178
scene.add( groundPlane );
8279
if ( ! params.groundReflector ) selects.push( groundPlane );
8380
groundPlane.name = 'groundPlane';
84-
window.groundPlane = groundPlane;
8581

8682
// Lights
8783
const hemiLight = new THREE.HemisphereLight( 0x443333, 0x111122 );
@@ -118,8 +114,7 @@
118114
} );
119115

120116
let geometry, material, mesh;
121-
let group = new THREE.Group();
122-
window.group = group;
117+
const group = new THREE.Group();
123118
scene.add( group );
124119
otherMeshes.push( group );
125120
selects.push( group );
@@ -134,7 +129,6 @@
134129
// selects.push( mesh );
135130
cube = mesh;
136131
mesh.name = 'cube';
137-
window.cube = cube;
138132

139133
geometry = new THREE.IcosahedronBufferGeometry( .025, 4 );
140134
material = new THREE.MeshPhysicalMaterial( { metalness: .5, roughness: .5, color: 'cyan' } );
@@ -145,7 +139,6 @@
145139
// selects.push( mesh );
146140
sphere = mesh;
147141
mesh.name = 'sphere';
148-
window.sphere = sphere;
149142

150143
geometry = new THREE.ConeBufferGeometry( .025, .05, 64 );
151144
material = new THREE.MeshStandardMaterial( { metalness: .5, roughness: .5, color: 'yellow' } );
@@ -158,7 +151,6 @@
158151
mesh.position.sub( cube.position );
159152
cone = mesh;
160153
mesh.name = 'cone';
161-
window.cone = cone;
162154

163155
geometry = new THREE.PlaneBufferGeometry( 1, 1 );
164156
groundReflector = new ReflectorForSSRPass( geometry, {
@@ -179,11 +171,6 @@
179171
renderer.setSize( window.innerWidth, window.innerHeight );
180172
renderer.outputEncoding = THREE.sRGBEncoding;
181173
container.appendChild( renderer.domElement );
182-
// scene.background = new THREE.Color( 0x443333 );
183-
// new THREE.TextureLoader().load('textures/equirectangular/venice_sunset_1k.hdr', envMap=>{
184-
// scene.background=envMap
185-
// })
186-
187174

188175
const pmremGenerator = new THREE.PMREMGenerator( renderer );
189176
pmremGenerator.compileEquirectangularShader();
@@ -192,7 +179,7 @@
192179
.setPath( 'textures/equirectangular/' )
193180
.load( 'venice_sunset_1k.hdr', function ( texture ) {
194181

195-
let envMap = pmremGenerator.fromEquirectangular( texture ).texture;
182+
const envMap = pmremGenerator.fromEquirectangular( texture ).texture;
196183
pmremGenerator.dispose();
197184

198185
scene.background = envMap;
@@ -226,9 +213,8 @@
226213
height: innerHeight,
227214
encoding: THREE.sRGBEncoding,
228215
groundReflector: params.groundReflector ? groundReflector : null,
229-
selects: params.groundReflector ? selects : null
216+
selects,
230217
} );
231-
window.ssrPass = ssrPass;
232218

233219
composer.addPass( ssrPass );
234220

0 commit comments

Comments
 (0)