Browse Source

WebGLUniforms: Clean up

Mugen87 7 years ago
parent
commit
46ac01b6e9
1 changed files with 9 additions and 9 deletions
  1. 9 9
      src/renderers/webgl/WebGLUniforms.js

+ 9 - 9
src/renderers/webgl/WebGLUniforms.js

@@ -242,15 +242,7 @@ function setValue3fv( gl, v ) {
 
 
 function setValue4fv( gl, v ) {
 function setValue4fv( gl, v ) {
 
 
-	if ( v.x === undefined ) {
-
-		if ( arraysEqual( this.cache, v ) ) return;
-
-		gl.uniform4fv( this.addr, v );
-
-		copyArray( this.cache, v );
-
-	} else {
+	if ( v.x !== undefined ) {
 
 
 		if ( this.cache[ 0 ] === v.x &&
 		if ( this.cache[ 0 ] === v.x &&
 			this.cache[ 1 ] === v.y &&
 			this.cache[ 1 ] === v.y &&
@@ -264,6 +256,14 @@ function setValue4fv( gl, v ) {
 		 this.cache[ 2 ] = v.z;
 		 this.cache[ 2 ] = v.z;
 		 this.cache[ 3 ] = v.w;
 		 this.cache[ 3 ] = v.w;
 
 
+	} else {
+
+		if ( arraysEqual( this.cache, v ) ) return;
+
+		gl.uniform4fv( this.addr, v );
+
+		copyArray( this.cache, v );
+
 	}
 	}
 
 
 }
 }