Browse Source

#7758 - Doesn't manage blending activation with the "currentBlending" attribute but with the "enable/disable" functions using "capabilities".

Alexandre Lemire 9 years ago
parent
commit
363b69a581
1 changed files with 10 additions and 12 deletions
  1. 10 12
      src/renderers/webgl/WebGLState.js

+ 10 - 12
src/renderers/webgl/WebGLState.js

@@ -176,15 +176,20 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {
 
 
 	this.setBlending = function ( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha ) {
 	this.setBlending = function ( blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha ) {
 
 
-		if ( blending !== currentBlending ) {
+		if ( blending === THREE.NoBlending ) {
 
 
-			if ( blending === THREE.NoBlending ) {
+			this.disable( gl.BLEND );
 
 
-				this.disable( gl.BLEND );
+		} else {
 
 
-			} else if ( blending === THREE.AdditiveBlending ) {
+			this.enable( gl.BLEND );
+
+		}
+
+		if ( blending !== currentBlending ) {
+
+			if ( blending === THREE.AdditiveBlending ) {
 
 
-				this.enable( gl.BLEND );
 				gl.blendEquation( gl.FUNC_ADD );
 				gl.blendEquation( gl.FUNC_ADD );
 				gl.blendFunc( gl.SRC_ALPHA, gl.ONE );
 				gl.blendFunc( gl.SRC_ALPHA, gl.ONE );
 
 
@@ -192,7 +197,6 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {
 
 
 				// TODO: Find blendFuncSeparate() combination
 				// TODO: Find blendFuncSeparate() combination
 
 
-				this.enable( gl.BLEND );
 				gl.blendEquation( gl.FUNC_ADD );
 				gl.blendEquation( gl.FUNC_ADD );
 				gl.blendFunc( gl.ZERO, gl.ONE_MINUS_SRC_COLOR );
 				gl.blendFunc( gl.ZERO, gl.ONE_MINUS_SRC_COLOR );
 
 
@@ -200,17 +204,11 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {
 
 
 				// TODO: Find blendFuncSeparate() combination
 				// TODO: Find blendFuncSeparate() combination
 
 
-				this.enable( gl.BLEND );
 				gl.blendEquation( gl.FUNC_ADD );
 				gl.blendEquation( gl.FUNC_ADD );
 				gl.blendFunc( gl.ZERO, gl.SRC_COLOR );
 				gl.blendFunc( gl.ZERO, gl.SRC_COLOR );
 
 
-			} else if ( blending === THREE.CustomBlending ) {
-
-				this.enable( gl.BLEND );
-
 			} else {
 			} else {
 
 
-				this.enable( gl.BLEND );
 				gl.blendEquationSeparate( gl.FUNC_ADD, gl.FUNC_ADD );
 				gl.blendEquationSeparate( gl.FUNC_ADD, gl.FUNC_ADD );
 				gl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA );
 				gl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA );