Browse Source

Updated to handle uv index greater than 1

Scrubs 5 years ago
parent
commit
96c7bcc25b
1 changed files with 2 additions and 4 deletions
  1. 2 4
      examples/jsm/nodes/accessors/UVNode.js

+ 2 - 4
examples/jsm/nodes/accessors/UVNode.js

@@ -5,9 +5,6 @@
 import { TempNode } from '../core/TempNode.js';
 import { NodeLib } from '../core/NodeLib.js';
 
-var vertexDict = [ 'uv', 'uv2' ],
-	fragmentDict = [ 'vUv', 'vUv2' ];
-
 function UVNode( index ) {
 
 	TempNode.call( this, 'v2', { shared: false } );
@@ -24,7 +21,8 @@ UVNode.prototype.generate = function ( builder, output ) {
 
 	builder.requires.uv[ this.index ] = true;
 
-	var result = builder.isShader( 'vertex' ) ? vertexDict[ this.index ] : fragmentDict[ this.index ];
+	var uvIndex = this.index > 0 ? this.index + 1 : '';
+	var result = builder.isShader( 'vertex' ) ? 'uv' + uvIndex : 'vUv' + uvIndex;
 
 	return builder.format( result, this.getType( builder ), output );