未验证 提交 92556a53 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #18748 from habx/fix/renderpass-preserve-overridematerial

RenderPass: Avoid discarding Scene.overrideMaterial.
......@@ -29,9 +29,15 @@ THREE.RenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype
var oldAutoClear = renderer.autoClear;
renderer.autoClear = false;
this.scene.overrideMaterial = this.overrideMaterial;
var oldClearColor, oldClearAlpha, oldOverrideMaterial;
var oldClearColor, oldClearAlpha;
if ( this.overrideMaterial !== undefined ) {
oldOverrideMaterial = this.scene.overrideMaterial;
this.scene.overrideMaterial = this.overrideMaterial;
}
if ( this.clearColor ) {
......@@ -60,7 +66,12 @@ THREE.RenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype
}
this.scene.overrideMaterial = null;
if ( this.overrideMaterial !== undefined ) {
this.scene.overrideMaterial = oldOverrideMaterial;
}
renderer.autoClear = oldAutoClear;
}
......
......@@ -32,9 +32,16 @@ RenderPass.prototype = Object.assign( Object.create( Pass.prototype ), {
var oldAutoClear = renderer.autoClear;
renderer.autoClear = false;
this.scene.overrideMaterial = this.overrideMaterial;
var oldClearColor, oldClearAlpha;
var oldClearColor, oldClearAlpha, oldOverrideMaterial;
if ( this.overrideMaterial !== undefined ) {
oldOverrideMaterial = this.scene.overrideMaterial;
this.scene.overrideMaterial = this.overrideMaterial;
}
if ( this.clearColor ) {
......@@ -63,7 +70,12 @@ RenderPass.prototype = Object.assign( Object.create( Pass.prototype ), {
}
this.scene.overrideMaterial = null;
if ( this.overrideMaterial !== undefined ) {
this.scene.overrideMaterial = oldOverrideMaterial;
}
renderer.autoClear = oldAutoClear;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册