Browse Source

auto rgba to xyzw

SUNAG 9 years ago
parent
commit
26882fc587
1 changed files with 5 additions and 4 deletions
  1. 5 4
      examples/js/nodes/utils/SwitchNode.js

+ 5 - 4
examples/js/nodes/utils/SwitchNode.js

@@ -24,18 +24,19 @@ THREE.SwitchNode.prototype.generate = function( builder, output ) {
 
 	var type = this.node.getType( builder );
 	var inputLength = builder.getFormatLength( type ) - 1;
+	var components = builder.colorToVector( this.components );
 
 	var node = this.node.build( builder, type );
 
 	var outputLength = 0;
 
-	var i, len = this.components.length;
+	var i, len = components.length;
 
 	// get max length
 
 	for ( i = 0; i < len; i ++ ) {
 
-		outputLength = Math.max( outputLength, builder.getIndexByElement( this.components.charAt( i ) ) );
+		outputLength = Math.max( outputLength, builder.getIndexByElement( components.charAt( i ) ) );
 
 	}
 
@@ -47,8 +48,8 @@ THREE.SwitchNode.prototype.generate = function( builder, output ) {
 
 	for ( i = 0; i < len; i ++ ) {
 
-		var elm = this.components.charAt( i );
-		var idx = builder.getIndexByElement( this.components.charAt( i ) );
+		var elm = components.charAt( i );
+		var idx = builder.getIndexByElement( components.charAt( i ) );
 
 		if ( idx > outputLength ) idx = outputLength;