提交 e3b71484 编写于 作者: G Garrett Johnson

update js examples

上级 f4fc43dd
...@@ -6,6 +6,7 @@ THREE.ClearPass = function ( clearColor, clearAlpha ) { ...@@ -6,6 +6,7 @@ THREE.ClearPass = function ( clearColor, clearAlpha ) {
this.clearColor = ( clearColor !== undefined ) ? clearColor : 0x000000; this.clearColor = ( clearColor !== undefined ) ? clearColor : 0x000000;
this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0; this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0;
this.oldClearColor = new THREE.Color();
}; };
...@@ -15,11 +16,11 @@ THREE.ClearPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ) ...@@ -15,11 +16,11 @@ THREE.ClearPass.prototype = Object.assign( Object.create( THREE.Pass.prototype )
render: function ( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) { render: function ( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) {
var oldClearColor, oldClearAlpha; var oldClearAlpha;
if ( this.clearColor ) { if ( this.clearColor ) {
oldClearColor = renderer.getClearColor().getHex(); renderer.getClearColor( this.oldClearColor );
oldClearAlpha = renderer.getClearAlpha(); oldClearAlpha = renderer.getClearAlpha();
renderer.setClearColor( this.clearColor, this.clearAlpha ); renderer.setClearColor( this.clearColor, this.clearAlpha );
...@@ -31,7 +32,7 @@ THREE.ClearPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ) ...@@ -31,7 +32,7 @@ THREE.ClearPass.prototype = Object.assign( Object.create( THREE.Pass.prototype )
if ( this.clearColor ) { if ( this.clearColor ) {
renderer.setClearColor( oldClearColor, oldClearAlpha ); renderer.setClearColor( this.oldClearColor, oldClearAlpha );
} }
......
...@@ -13,6 +13,7 @@ THREE.RenderPass = function ( scene, camera, overrideMaterial, clearColor, clear ...@@ -13,6 +13,7 @@ THREE.RenderPass = function ( scene, camera, overrideMaterial, clearColor, clear
this.clear = true; this.clear = true;
this.clearDepth = false; this.clearDepth = false;
this.needsSwap = false; this.needsSwap = false;
this.oldClearColor = new THREE.Color();
}; };
...@@ -25,7 +26,7 @@ THREE.RenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ...@@ -25,7 +26,7 @@ THREE.RenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype
var oldAutoClear = renderer.autoClear; var oldAutoClear = renderer.autoClear;
renderer.autoClear = false; renderer.autoClear = false;
var oldClearColor, oldClearAlpha, oldOverrideMaterial; var oldClearAlpha, oldOverrideMaterial;
if ( this.overrideMaterial !== undefined ) { if ( this.overrideMaterial !== undefined ) {
...@@ -37,7 +38,7 @@ THREE.RenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ...@@ -37,7 +38,7 @@ THREE.RenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype
if ( this.clearColor ) { if ( this.clearColor ) {
oldClearColor = renderer.getClearColor().getHex(); renderer.getClearColor( this.oldClearColor );
oldClearAlpha = renderer.getClearAlpha(); oldClearAlpha = renderer.getClearAlpha();
renderer.setClearColor( this.clearColor, this.clearAlpha ); renderer.setClearColor( this.clearColor, this.clearAlpha );
...@@ -58,7 +59,7 @@ THREE.RenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ...@@ -58,7 +59,7 @@ THREE.RenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype
if ( this.clearColor ) { if ( this.clearColor ) {
renderer.setClearColor( oldClearColor, oldClearAlpha ); renderer.setClearColor( this.oldClearColor, oldClearAlpha );
} }
......
...@@ -21,6 +21,7 @@ THREE.SSAARenderPass = function ( scene, camera, clearColor, clearAlpha ) { ...@@ -21,6 +21,7 @@ THREE.SSAARenderPass = function ( scene, camera, clearColor, clearAlpha ) {
// as we need to clear the buffer in this pass, clearColor must be set to something, defaults to black. // as we need to clear the buffer in this pass, clearColor must be set to something, defaults to black.
this.clearColor = ( clearColor !== undefined ) ? clearColor : 0x000000; this.clearColor = ( clearColor !== undefined ) ? clearColor : 0x000000;
this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0; this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0;
this.oldClearColor = new THREE.Color();
if ( THREE.CopyShader === undefined ) console.error( "THREE.SSAARenderPass relies on THREE.CopyShader" ); if ( THREE.CopyShader === undefined ) console.error( "THREE.SSAARenderPass relies on THREE.CopyShader" );
...@@ -77,7 +78,7 @@ THREE.SSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass.protot ...@@ -77,7 +78,7 @@ THREE.SSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass.protot
var autoClear = renderer.autoClear; var autoClear = renderer.autoClear;
renderer.autoClear = false; renderer.autoClear = false;
var oldClearColor = renderer.getClearColor().getHex(); renderer.getClearColor( this.oldClearColor );
var oldClearAlpha = renderer.getClearAlpha(); var oldClearAlpha = renderer.getClearAlpha();
var baseSampleWeight = 1.0 / jitterOffsets.length; var baseSampleWeight = 1.0 / jitterOffsets.length;
...@@ -134,7 +135,7 @@ THREE.SSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass.protot ...@@ -134,7 +135,7 @@ THREE.SSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass.protot
if ( this.camera.clearViewOffset ) this.camera.clearViewOffset(); if ( this.camera.clearViewOffset ) this.camera.clearViewOffset();
renderer.autoClear = autoClear; renderer.autoClear = autoClear;
renderer.setClearColor( oldClearColor, oldClearAlpha ); renderer.setClearColor( this.oldClearColor, oldClearAlpha );
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册