未验证 提交 4a96f81f 编写于 作者: M Michael Herzog 提交者: GitHub

Examples: More clean up. (#21549)

上级 0e8e0430
......@@ -198,14 +198,14 @@ var SSRrPass = function ( { renderer, scene, camera, width, height, selects, enc
this.refractiveOffMaterial = new MeshBasicMaterial( {
color: 'black'
});
} );
// specular material
this.specularMaterial = new MeshStandardMaterial({
this.specularMaterial = new MeshStandardMaterial( {
color: 'black',
metalness: 0,
roughness: .2,
});
} );
// material for rendering the depth
......@@ -279,45 +279,67 @@ SSRrPass.prototype = Object.assign( Object.create( Pass.prototype ), {
if ( this.encoding ) this.beautyRenderTarget.texture.encoding = this.encoding;
renderer.setRenderTarget( this.beautyRenderTarget );
renderer.clear();
this.scene.children.forEach(child => {
if (this.selects.includes(child)) {
child.visible = false
this.scene.children.forEach( child => {
if ( this.selects.includes( child ) ) {
child.visible = false;
} else {
child.visible = true
child.visible = true;
}
})
renderer.render(this.scene, this.camera);
} );
renderer.render( this.scene, this.camera );
renderer.setRenderTarget( this.specularRenderTarget );
renderer.clear();
this.scene.children.forEach(child => {
if (this.selects.includes(child)) {
child.visible=true
child._SSRrPassBackupMaterial = child.material
child.material=this.specularMaterial
} else if(!child.isLight) {
child.visible = false
this.scene.children.forEach( child => {
if ( this.selects.includes( child ) ) {
child.visible = true;
child._SSRrPassBackupMaterial = child.material;
child.material = this.specularMaterial;
} else if ( ! child.isLight ) {
child.visible = false;
}
})
renderer.render(this.scene, this.camera);
this.scene.children.forEach(child => {
if (this.selects.includes(child)) {
child.material=child._SSRrPassBackupMaterial
} );
renderer.render( this.scene, this.camera );
this.scene.children.forEach( child => {
if ( this.selects.includes( child ) ) {
child.material = child._SSRrPassBackupMaterial;
}
})
} );
// render normalSelectss
this.scene.children.forEach(child => {
if (this.selects.includes(child)) {
child.visible=true
} else{
child.visible = false
this.scene.children.forEach( child => {
if ( this.selects.includes( child ) ) {
child.visible = true;
} else {
child.visible = false;
}
})
this.renderOverride(renderer, this.normalMaterial, this.normalSelectsRenderTarget, 0, 0);
} );
this.renderOverride( renderer, this.normalMaterial, this.normalSelectsRenderTarget, 0, 0 );
this.renderRefractive( renderer, this.refractiveOnMaterial, this.refractiveRenderTarget, 0, 0 );
......@@ -488,9 +510,11 @@ SSRrPass.prototype = Object.assign( Object.create( Pass.prototype ), {
}
this.scene.children.forEach(child => {
child.visible=true
})
this.scene.children.forEach( child => {
child.visible = true;
} );
this.scene.traverse( child => {
child._SSRrPassBackupMaterial = child.material;
......@@ -504,14 +528,14 @@ SSRrPass.prototype = Object.assign( Object.create( Pass.prototype ), {
}
});
this.scene._SSRrPassBackupBackground=this.scene.background
this.scene.background=null
this.scene._SSRrPassBackupFog=this.scene.fog
this.scene.fog=null
renderer.render(this.scene, this.camera);
this.scene.fog=this.scene._SSRrPassBackupFog
this.scene.background=this.scene._SSRrPassBackupBackground
} );
this.scene._SSRrPassBackupBackground = this.scene.background;
this.scene.background = null;
this.scene._SSRrPassBackupFog = this.scene.fog;
this.scene.fog = null;
renderer.render( this.scene, this.camera );
this.scene.fog = this.scene._SSRrPassBackupFog;
this.scene.background = this.scene._SSRrPassBackupBackground;
this.scene.traverse( child => {
child.material = child._SSRrPassBackupMaterial;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册