Browse Source

Nodes: Fix UV attributes (#26220)

* Nodes: Fix uv attributes

* cleanup
sunag 2 years ago
parent
commit
7bd15773b8

+ 1 - 1
examples/jsm/nodes/accessors/UVNode.js

@@ -18,7 +18,7 @@ class UVNode extends AttributeNode {
 
 		const index = this.index;
 
-		return 'uv' + ( index > 0 ? index + 1 : '' );
+		return 'uv' + ( index > 0 ? index : '' );
 
 	}
 

+ 1 - 1
examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js

@@ -501,7 +501,7 @@ class WebGLNodeBuilder extends NodeBuilder {
 			for ( const attribute of attributes ) {
 
 				// ignore common attributes to prevent redefinitions
-				if ( attribute.name === 'uv' || attribute.name === 'position' || attribute.name === 'normal' )
+				if ( /^(position|normal|uv\d?)$/.test( attribute.name ) )
 					continue;
 
 				snippet += `attribute ${attribute.type} ${attribute.name}; `;

+ 0 - 1
playground/index.html

@@ -127,7 +127,6 @@
 				//
 
 				renderer.setAnimationLoop( render );
-				renderer.outputEncoding = THREE.sRGBEncoding;
 				renderer.toneMapping = THREE.LinearToneMapping;
 				renderer.toneMappingExposure = 1;
 				document.body.appendChild( renderer.domElement );