Преглед на файлове

BufferGeometry: Renamed uv2, uv3, uv4 to uv1, uv2, uv3 (#25943)

* BufferGeometry: Rename uv, uv2, uv3, uv4 to uv_0, uv_1, uv_2, uv_3.

* BufferGeometry: Clean up.

* Clean up.

* WebGLPrograms: Clean up.

* Renamed uv_0, uv_1, uv_2, uv_3 to uv0, uv1, uv2, uv3.

* BufferGeometry: Rename uv to uv0 in getAttribute(), hasAttribute(), setAttribute() and deleteAttribute().

* BufferGeometry: Removed uv to uv0 warnings.

* MMDLoader: Renamed uv to uv0.

* Examples: Fixed webgl_modifier_subdivision.

* Revert uv to uv0 change.

* BufferGeometry: Remove redundant uv2 code.

* Mesh: Renamed uv2 instances to uv1.

* ShaderMaterial: Renamed uv2 instance to uv1.

* Exporters: Renamed uv2 instances to uv1.

* Loaders: Renamed uv2 instances to uv1.

* Examples: Renamed uv2 instances to uv1.

* Docs: Updated relevant pages.

* BufferGeometry: Removed backwards compatibility code.

* Examples: Removed redundant code.

* LWOLoader: Removed redundant code.

* LWOLoader: Clean up.
mrdoob преди 2 години
родител
ревизия
ef03bdcfd1

+ 1 - 1
docs/api/en/core/Raycaster.html

@@ -184,7 +184,7 @@ object.layers.enable( 1 );
 			[page:Integer faceIndex] – index of the intersected face<br />
 			[page:Object3D object] – the intersected object<br />
 			[page:Vector2 uv] - U,V coordinates at point of intersection<br />
-			[page:Vector2 uv2] - Second set of U,V coordinates at point of
+			[page:Vector2 uv1] - Second set of U,V coordinates at point of
 			intersection<br />
 			[page:Vector3 normal] - interpolated normal vector at point of
 			intersection<br />

+ 1 - 1
docs/api/en/materials/ShaderMaterial.html

@@ -313,7 +313,7 @@ uniforms: {
 this.defaultAttributeValues = { 
 	'color': [ 1, 1, 1 ], 
 	'uv': [ 0, 0 ],
-	'uv2': [ 0, 0 ] 
+	'uv1': [ 0, 0 ] 
 };
 			</code>
 		</p>

+ 2 - 2
docs/api/en/textures/Texture.html

@@ -84,8 +84,8 @@
 
 		<h3>[property:Integer channel]</h3>
 		<p>
-			Lets you select the uv attribute to map the texture to. `0` for `uv` and
-			`1` for `uv2`.
+			Lets you select the uv attribute to map the texture to. `0` for `uv`,
+			`1` for `uv1`, `2` for `uv2` and `3` for `uv3`.
 		</p>
 
 		<h3>[property:number wrapS]</h3>

+ 1 - 1
docs/api/fr/materials/ShaderMaterial.html

@@ -283,7 +283,7 @@ et la page [page:BufferAttribute] pour un aperçu détaillé de l'API `BufferAtt
 			this.defaultAttributeValues = {
 				'color': [ 1, 1, 1 ],
 				'uv': [ 0, 0 ],
-				'uv2': [ 0, 0 ]
+				'uv1': [ 0, 0 ]
 			};
 		</code>
 

+ 1 - 1
docs/api/it/core/Raycaster.html

@@ -178,7 +178,7 @@
 			[page:Integer faceIndex] – indice della faccia intersecata<br />
 			[page:Object3D object] – l'oggetto intersecato<br />
 			[page:Vector2 uv] - le coordinate U,V nel punto di intersezione<br />
-			[page:Vector2 uv2] - Secondo insieme delle coordinate U,V nel punto di intersezione<br />
+			[page:Vector2 uv1] - Secondo insieme delle coordinate U,V nel punto di intersezione<br />
 			[page:Vector3 normal] - vettore normale interpolato nel punto di intersezione<br />
 			[page:Integer instanceId] – Il numero di indice dell'istanza in cui il raggio interseca la InstancedMesh.
 		</p>

+ 1 - 1
docs/api/it/materials/ShaderMaterial.html

@@ -288,7 +288,7 @@ uniforms: {
 this.defaultAttributeValues = {
 	'color': [ 1, 1, 1 ],
 	'uv': [ 0, 0 ],
-	'uv2': [ 0, 0 ]
+	'uv1': [ 0, 0 ]
 };
 			</code>
 

+ 1 - 1
docs/api/it/textures/Texture.html

@@ -81,7 +81,7 @@
 
 		<h3>[property:Integer channel]</h3>
 		<p>
-			Lets you select the uv attribute to map the texture to. `0` for `uv` and `1` for `uv2`.
+			Lets you select the uv attribute to map the texture to. `0` for `uv`, `1` for `uv1`, `2` for `uv2` and `3` for `uv3`.
 		</p>
 
 		<h3>[property:number wrapS]</h3>

+ 1 - 1
docs/api/ko/core/Raycaster.html

@@ -174,7 +174,7 @@
 			[page:Integer faceIndex] – 교차 면의 인덱스<br />
 			[page:Object3D object] – 교차된 객체<br />
 			[page:Vector2 uv] - 교차점의 U,V 좌표<br />
-			[page:Vector2 uv2] - 교차점의 U,V 2차 좌표<br />
+			[page:Vector2 uv1] - 교차점의 U,V 2차 좌표<br />
 			[page:Vector3 normal] - 교차점에서 보간된 법선 벡터<br />
 			[page:Integer instanceId] – InstancedMesh에 교차하는 레이의 인스턴스 인덱스 넘버입니다.
 		</p>

+ 1 - 1
docs/api/zh/core/Raycaster.html

@@ -179,7 +179,7 @@
 			[page:Integer faceIndex] —— 相交的面的索引<br />
 			[page:Object3D object] —— 相交的物体<br />
 			[page:Vector2 uv] —— 相交部分的点的UV坐标。<br />
-			[page:Vector2 uv2] —— Second set of U,V coordinates at point of intersection<br />
+			[page:Vector2 uv1] —— Second set of U,V coordinates at point of intersection<br />
 			[page:Vector3 normal] - 交点处的内插法向量<br />
 			[page:Integer instanceId] – The index number of the instance where the ray intersects the InstancedMesh
 		</p>

+ 1 - 1
docs/api/zh/materials/ShaderMaterial.html

@@ -254,7 +254,7 @@
 this.defaultAttributeValues = {
 	'color': [ 1, 1, 1 ],
 	'uv': [ 0, 0 ],
-	'uv2': [ 0, 0 ]
+	'uv1': [ 0, 0 ]
 };
 			</code>
 

+ 1 - 1
docs/api/zh/textures/Texture.html

@@ -73,7 +73,7 @@
 
 		<h3>[property:Integer channel]</h3>
 		<p>
-		Lets you select the uv attribute to map the texture to. `0` for `uv` and `1` for `uv2`.
+		Lets you select the uv attribute to map the texture to. `0` for `uv`, `1` for `uv1`, `2` for `uv2` and `3` for `uv3`.
 		</p>
 
 		<h3>[property:number wrapS]</h3>

+ 2 - 2
examples/jsm/exporters/ColladaExporter.js

@@ -307,10 +307,10 @@ class ColladaExporter {
 				}
 
 				// serialize lightmap uvs
-				if ( 'uv2' in bufferGeometry.attributes ) {
+				if ( 'uv1' in bufferGeometry.attributes ) {
 
 					const uvName = `${ meshid }-texcoord2`;
-					gnode += getAttribute( bufferGeometry.attributes.uv2, uvName, [ 'S', 'T' ], 'float' );
+					gnode += getAttribute( bufferGeometry.attributes.uv1, uvName, [ 'S', 'T' ], 'float' );
 					triangleInputs += `<input semantic="TEXCOORD" source="#${ uvName }" offset="0" set="1" />`;
 
 				}

+ 1 - 1
examples/jsm/exporters/GLTFExporter.js

@@ -1609,7 +1609,7 @@ class GLTFWriter {
 		// Conversion between attributes names in threejs and gltf spec
 		const nameConversion = {
 			uv: 'TEXCOORD_0',
-			uv2: 'TEXCOORD_1',
+			uv1: 'TEXCOORD_1',
 			color: 'COLOR_0',
 			skinWeight: 'WEIGHTS_0',
 			skinIndex: 'JOINTS_0'

+ 2 - 2
examples/jsm/lines/LineSegments2.js

@@ -80,7 +80,7 @@ function raycastWorldUnits( lineSegments, intersects ) {
 				face: null,
 				faceIndex: i,
 				uv: null,
-				uv2: null,
+				uv1: null,
 			} );
 
 		}
@@ -213,7 +213,7 @@ function raycastScreenSpace( lineSegments, camera, intersects ) {
 				face: null,
 				faceIndex: i,
 				uv: null,
-				uv2: null,
+				uv1: null,
 			} );
 
 		}

+ 5 - 5
examples/jsm/loaders/ColladaLoader.js

@@ -2337,7 +2337,7 @@ class ColladaLoader extends Loader {
 			const position = { array: [], stride: 0 };
 			const normal = { array: [], stride: 0 };
 			const uv = { array: [], stride: 0 };
-			const uv2 = { array: [], stride: 0 };
+			const uv1 = { array: [], stride: 0 };
 			const color = { array: [], stride: 0 };
 
 			const skinIndex = { array: [], stride: 4 };
@@ -2472,7 +2472,7 @@ class ColladaLoader extends Loader {
 										break;
 
 									case 'TEXCOORD1':
-										buildGeometryData( primitive, sources[ id ], input.offset, uv2.array );
+										buildGeometryData( primitive, sources[ id ], input.offset, uv1.array );
 										uv.stride = sources[ id ].stride;
 										break;
 
@@ -2501,8 +2501,8 @@ class ColladaLoader extends Loader {
 							break;
 
 						case 'TEXCOORD1':
-							buildGeometryData( primitive, sources[ input.id ], input.offset, uv2.array );
-							uv2.stride = sources[ input.id ].stride;
+							buildGeometryData( primitive, sources[ input.id ], input.offset, uv1.array );
+							uv1.stride = sources[ input.id ].stride;
 							break;
 
 					}
@@ -2517,7 +2517,7 @@ class ColladaLoader extends Loader {
 			if ( normal.array.length > 0 ) geometry.setAttribute( 'normal', new Float32BufferAttribute( normal.array, normal.stride ) );
 			if ( color.array.length > 0 ) geometry.setAttribute( 'color', new Float32BufferAttribute( color.array, color.stride ) );
 			if ( uv.array.length > 0 ) geometry.setAttribute( 'uv', new Float32BufferAttribute( uv.array, uv.stride ) );
-			if ( uv2.array.length > 0 ) geometry.setAttribute( 'uv2', new Float32BufferAttribute( uv2.array, uv2.stride ) );
+			if ( uv1.array.length > 0 ) geometry.setAttribute( 'uv1', new Float32BufferAttribute( uv1.array, uv1.stride ) );
 
 			if ( skinIndex.array.length > 0 ) geometry.setAttribute( 'skinIndex', new Float32BufferAttribute( skinIndex.array, skinIndex.stride ) );
 			if ( skinWeight.array.length > 0 ) geometry.setAttribute( 'skinWeight', new Float32BufferAttribute( skinWeight.array, skinWeight.stride ) );

+ 1 - 9
examples/jsm/loaders/FBXLoader.js

@@ -1635,15 +1635,7 @@ class GeometryParser {
 
 		buffers.uvs.forEach( function ( uvBuffer, i ) {
 
-			// subsequent uv buffers are called 'uv1', 'uv2', ...
-			let name = 'uv' + ( i + 1 ).toString();
-
-			// the first uv buffer is just called 'uv'
-			if ( i === 0 ) {
-
-				name = 'uv';
-
-			}
+			const name = i === 0 ? 'uv' : `uv${ i }`;
 
 			geo.setAttribute( name, new Float32BufferAttribute( buffers.uvs[ i ], 2 ) );
 

+ 3 - 3
examples/jsm/loaders/GLTFLoader.js

@@ -2031,9 +2031,9 @@ const ATTRIBUTES = {
 	NORMAL: 'normal',
 	TANGENT: 'tangent',
 	TEXCOORD_0: 'uv',
-	TEXCOORD_1: 'uv2',
-	TEXCOORD_2: 'uv3',
-	TEXCOORD_3: 'uv4',
+	TEXCOORD_1: 'uv1',
+	TEXCOORD_2: 'uv2',
+	TEXCOORD_3: 'uv3',
 	COLOR_0: 'color',
 	WEIGHTS_0: 'skinWeight',
 	JOINTS_0: 'skinIndex',

+ 0 - 28
examples/jsm/loaders/LWOLoader.js

@@ -14,7 +14,6 @@
 import {
 	AddOperation,
 	BackSide,
-	BufferAttribute,
 	BufferGeometry,
 	ClampToEdgeWrapping,
 	Color,
@@ -171,8 +170,6 @@ class LWOTreeParser {
 
 		const materials = this.getMaterials( geometry.userData.matNames, layer.geometry.type );
 
-		this.duplicateUVs( geometry, materials );
-
 		if ( layer.geometry.type === 'points' ) mesh = new Points( geometry, materials );
 		else if ( layer.geometry.type === 'lines' ) mesh = new LineSegments( geometry, materials );
 		else mesh = new Mesh( geometry, materials );
@@ -270,31 +267,6 @@ class LWOTreeParser {
 
 	}
 
-	// If the material has an aoMap, duplicate UVs
-	duplicateUVs( geometry, materials ) {
-
-		let duplicateUVs = false;
-
-		if ( ! Array.isArray( materials ) ) {
-
-			if ( materials.aoMap ) duplicateUVs = true;
-
-		} else {
-
-			materials.forEach( function ( material ) {
-
-				if ( material.aoMap ) duplicateUVs = true;
-
-			} );
-
-		}
-
-		if ( ! duplicateUVs ) return;
-
-		geometry.setAttribute( 'uv2', new BufferAttribute( geometry.attributes.uv.array, 2 ) );
-
-	}
-
 }
 
 class MaterialParser {

+ 8 - 8
examples/jsm/misc/ProgressiveLightMap.js

@@ -46,7 +46,7 @@ class ProgressiveLightMap {
 			// Vertex Shader: Set Vertex Positions to the Unwrapped UV Positions
 			shader.vertexShader =
 				'#define USE_LIGHTMAP\n' +
-				'#define LIGHTMAP_UV uv2\n' +
+				'#define LIGHTMAP_UV uv1\n' +
 				shader.vertexShader.slice( 0, - 1 ) +
 				'	gl_Position = vec4((LIGHTMAP_UV - 0.5) * 2.0, 1.0, 1.0); }';
 
@@ -77,7 +77,7 @@ class ProgressiveLightMap {
 	}
 
 	/**
-	 * Sets these objects' materials' lightmaps and modifies their uv2's.
+	 * Sets these objects' materials' lightmaps and modifies their uv1's.
 	 * @param {Object3D} objects An array of objects and lights to set up your lightmap.
 	 */
 	addObjectsToLightMap( objects ) {
@@ -130,16 +130,16 @@ class ProgressiveLightMap {
 		const dimensions = potpack( this.uv_boxes );
 		this.uv_boxes.forEach( ( box ) => {
 
-			const uv2 = objects[ box.index ].geometry.getAttribute( 'uv' ).clone();
-			for ( let i = 0; i < uv2.array.length; i += uv2.itemSize ) {
+			const uv1 = objects[ box.index ].geometry.getAttribute( 'uv' ).clone();
+			for ( let i = 0; i < uv1.array.length; i += uv1.itemSize ) {
 
-				uv2.array[ i ] = ( uv2.array[ i ] + box.x + padding ) / dimensions.w;
-				uv2.array[ i + 1 ] = ( uv2.array[ i + 1 ] + box.y + padding ) / dimensions.h;
+				uv1.array[ i ] = ( uv1.array[ i ] + box.x + padding ) / dimensions.w;
+				uv1.array[ i + 1 ] = ( uv1.array[ i + 1 ] + box.y + padding ) / dimensions.h;
 
 			}
 
-			objects[ box.index ].geometry.setAttribute( 'uv2', uv2 );
-			objects[ box.index ].geometry.getAttribute( 'uv2' ).needsUpdate = true;
+			objects[ box.index ].geometry.setAttribute( 'uv1', uv1 );
+			objects[ box.index ].geometry.getAttribute( 'uv1' ).needsUpdate = true;
 
 		} );
 

+ 19 - 19
examples/jsm/modifiers/TessellateModifier.js

@@ -66,19 +66,19 @@ class TessellateModifier {
 		const hasNormals = attributes.normal !== undefined;
 		const hasColors = attributes.color !== undefined;
 		const hasUVs = attributes.uv !== undefined;
-		const hasUV2s = attributes.uv2 !== undefined;
+		const hasUV1s = attributes.uv1 !== undefined;
 
 		let positions = attributes.position.array;
 		let normals = hasNormals ? attributes.normal.array : null;
 		let colors = hasColors ? attributes.color.array : null;
 		let uvs = hasUVs ? attributes.uv.array : null;
-		let uv2s = hasUV2s ? attributes.uv2.array : null;
+		let uv1s = hasUV1s ? attributes.uv1.array : null;
 
 		let positions2 = positions;
 		let normals2 = normals;
 		let colors2 = colors;
 		let uvs2 = uvs;
-		let uv2s2 = uv2s;
+		let uv1s2 = uv1s;
 
 		let iteration = 0;
 		let tessellating = true;
@@ -129,15 +129,15 @@ class TessellateModifier {
 
 			}
 
-			if ( hasUV2s ) {
+			if ( hasUV1s ) {
 
 				const u21 = u2s[ a ];
 				const u22 = u2s[ b ];
 				const u23 = u2s[ c ];
 
-				uv2s2.push( u21.x, u21.y );
-				uv2s2.push( u22.x, u22.y );
-				uv2s2.push( u23.x, u23.y );
+				uv1s2.push( u21.x, u21.y );
+				uv1s2.push( u22.x, u22.y );
+				uv1s2.push( u23.x, u23.y );
 
 			}
 
@@ -172,10 +172,10 @@ class TessellateModifier {
 
 			}
 
-			if ( hasUV2s ) {
+			if ( hasUV1s ) {
 
-				uv2s = uv2s2;
-				uv2s2 = [];
+				uv1s = uv1s2;
+				uv1s2 = [];
 
 			}
 
@@ -209,11 +209,11 @@ class TessellateModifier {
 
 				}
 
-				if ( hasUV2s ) {
+				if ( hasUV1s ) {
 
-					u2a.fromArray( uv2s, i2 + 0 );
-					u2b.fromArray( uv2s, i2 + 2 );
-					u2c.fromArray( uv2s, i2 + 4 );
+					u2a.fromArray( uv1s, i2 + 0 );
+					u2b.fromArray( uv1s, i2 + 2 );
+					u2c.fromArray( uv1s, i2 + 4 );
 
 				}
 
@@ -231,7 +231,7 @@ class TessellateModifier {
 						if ( hasNormals ) nm.lerpVectors( na, nb, 0.5 );
 						if ( hasColors ) cm.lerpColors( ca, cb, 0.5 );
 						if ( hasUVs ) um.lerpVectors( ua, ub, 0.5 );
-						if ( hasUV2s ) u2m.lerpVectors( u2a, u2b, 0.5 );
+						if ( hasUV1s ) u2m.lerpVectors( u2a, u2b, 0.5 );
 
 						addTriangle( 0, 3, 2 );
 						addTriangle( 3, 1, 2 );
@@ -242,7 +242,7 @@ class TessellateModifier {
 						if ( hasNormals ) nm.lerpVectors( nb, nc, 0.5 );
 						if ( hasColors ) cm.lerpColors( cb, cc, 0.5 );
 						if ( hasUVs ) um.lerpVectors( ub, uc, 0.5 );
-						if ( hasUV2s ) u2m.lerpVectors( u2b, u2c, 0.5 );
+						if ( hasUV1s ) u2m.lerpVectors( u2b, u2c, 0.5 );
 
 						addTriangle( 0, 1, 3 );
 						addTriangle( 3, 2, 0 );
@@ -253,7 +253,7 @@ class TessellateModifier {
 						if ( hasNormals ) nm.lerpVectors( na, nc, 0.5 );
 						if ( hasColors ) cm.lerpColors( ca, cc, 0.5 );
 						if ( hasUVs ) um.lerpVectors( ua, uc, 0.5 );
-						if ( hasUV2s ) u2m.lerpVectors( u2a, u2c, 0.5 );
+						if ( hasUV1s ) u2m.lerpVectors( u2a, u2c, 0.5 );
 
 						addTriangle( 0, 1, 3 );
 						addTriangle( 3, 1, 2 );
@@ -292,9 +292,9 @@ class TessellateModifier {
 
 		}
 
-		if ( hasUV2s ) {
+		if ( hasUV1s ) {
 
-			geometry2.setAttribute( 'uv2', new Float32BufferAttribute( uv2s2, 2 ) );
+			geometry2.setAttribute( 'uv1', new Float32BufferAttribute( uv1s2, 2 ) );
 
 		}
 

Файловите разлики са ограничени, защото са твърде много
+ 0 - 0
examples/models/json/lightmap/lightmap.json


+ 0 - 1
examples/webgl_materials_channels.html

@@ -210,7 +210,6 @@
 				loader.load( 'models/obj/ninja/ninjaHead_Low.obj', function ( group ) {
 
 					const geometry = group.children[ 0 ].geometry;
-					geometry.attributes.uv2 = geometry.attributes.uv;
 					geometry.center();
 
 					mesh = new THREE.Mesh( geometry, materialNormal );

+ 0 - 1
examples/webgl_materials_displacementmap.html

@@ -204,7 +204,6 @@
 				loader.load( 'models/obj/ninja/ninjaHead_Low.obj', function ( group ) {
 
 					const geometry = group.children[ 0 ].geometry;
-					geometry.attributes.uv2 = geometry.attributes.uv;
 					geometry.center();
 
 					mesh = new THREE.Mesh( geometry, material );

+ 1 - 1
examples/webgpu_sandbox.html

@@ -96,7 +96,7 @@
 				materialBox.colorNode = mix( textureNode, checker( animateUV ), 0.5 );
 
 				// test uv 2
-				//geometryBox.setAttribute( 'uv2', geometryBox.getAttribute( 'uv' ) );
+				//geometryBox.setAttribute( 'uv1', geometryBox.getAttribute( 'uv' ) );
 				//materialBox.colorNode = texture( uvTexture, uv( 1 ) );
 
 				box = new THREE.Mesh( geometryBox, materialBox );

+ 1 - 1
src/materials/ShaderMaterial.js

@@ -44,7 +44,7 @@ class ShaderMaterial extends Material {
 		this.defaultAttributeValues = {
 			'color': [ 1, 1, 1 ],
 			'uv': [ 0, 0 ],
-			'uv2': [ 0, 0 ]
+			'uv1': [ 0, 0 ]
 		};
 
 		this.index0AttributeName = undefined;

+ 12 - 11
src/objects/Mesh.js

@@ -199,7 +199,7 @@ class Mesh extends Object3D {
 		const index = geometry.index;
 		const position = geometry.attributes.position;
 		const uv = geometry.attributes.uv;
-		const uv2 = geometry.attributes.uv2;
+		const uv1 = geometry.attributes.uv1;
 		const normal = geometry.attributes.normal;
 		const groups = geometry.groups;
 		const drawRange = geometry.drawRange;
@@ -224,7 +224,7 @@ class Mesh extends Object3D {
 						const b = index.getX( j + 1 );
 						const c = index.getX( j + 2 );
 
-						intersection = checkGeometryIntersection( this, groupMaterial, raycaster, _ray, uv, uv2, normal, a, b, c );
+						intersection = checkGeometryIntersection( this, groupMaterial, raycaster, _ray, uv, uv1, normal, a, b, c );
 
 						if ( intersection ) {
 
@@ -249,7 +249,7 @@ class Mesh extends Object3D {
 					const b = index.getX( i + 1 );
 					const c = index.getX( i + 2 );
 
-					intersection = checkGeometryIntersection( this, material, raycaster, _ray, uv, uv2, normal, a, b, c );
+					intersection = checkGeometryIntersection( this, material, raycaster, _ray, uv, uv1, normal, a, b, c );
 
 					if ( intersection ) {
 
@@ -282,7 +282,7 @@ class Mesh extends Object3D {
 						const b = j + 1;
 						const c = j + 2;
 
-						intersection = checkGeometryIntersection( this, groupMaterial, raycaster, _ray, uv, uv2, normal, a, b, c );
+						intersection = checkGeometryIntersection( this, groupMaterial, raycaster, _ray, uv, uv1, normal, a, b, c );
 
 						if ( intersection ) {
 
@@ -307,7 +307,7 @@ class Mesh extends Object3D {
 					const b = i + 1;
 					const c = i + 2;
 
-					intersection = checkGeometryIntersection( this, material, raycaster, _ray, uv, uv2, normal, a, b, c );
+					intersection = checkGeometryIntersection( this, material, raycaster, _ray, uv, uv1, normal, a, b, c );
 
 					if ( intersection ) {
 
@@ -357,7 +357,7 @@ function checkIntersection( object, material, raycaster, ray, pA, pB, pC, point
 
 }
 
-function checkGeometryIntersection( object, material, raycaster, ray, uv, uv2, normal, a, b, c ) {
+function checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, normal, a, b, c ) {
 
 	object.getVertexPosition( a, _vA );
 	object.getVertexPosition( b, _vB );
@@ -377,13 +377,14 @@ function checkGeometryIntersection( object, material, raycaster, ray, uv, uv2, n
 
 		}
 
-		if ( uv2 ) {
+		if ( uv1 ) {
 
-			_uvA.fromBufferAttribute( uv2, a );
-			_uvB.fromBufferAttribute( uv2, b );
-			_uvC.fromBufferAttribute( uv2, c );
+			_uvA.fromBufferAttribute( uv1, a );
+			_uvB.fromBufferAttribute( uv1, b );
+			_uvC.fromBufferAttribute( uv1, c );
 
-			intersection.uv2 = Triangle.getInterpolation( _intersectionPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() );
+			intersection.uv1 = Triangle.getInterpolation( _intersectionPoint, _vA, _vB, _vC, _uvA, _uvB, _uvC, new Vector2() );
+			intersection.uv2 = intersection.uv1; // Backwards compatibility
 
 		}
 

+ 12 - 12
src/renderers/webgl/WebGLProgram.js

@@ -527,9 +527,9 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
 			parameters.vertexTangents ? '#define USE_TANGENT' : '',
 			parameters.vertexColors ? '#define USE_COLOR' : '',
 			parameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '',
-			parameters.vertexUvs2 ? '#define USE_UV2' : '',
-			parameters.vertexUvs3 ? '#define USE_UV3' : '',
-			parameters.vertexUvs4 ? '#define USE_UV4' : '',
+			parameters.vertexUv1s ? '#define USE_UV1' : '',
+			parameters.vertexUv2s ? '#define USE_UV2' : '',
+			parameters.vertexUv3s ? '#define USE_UV3' : '',
 
 			parameters.pointsUvs ? '#define USE_POINTS_UV' : '',
 
@@ -578,21 +578,21 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
 			'attribute vec3 normal;',
 			'attribute vec2 uv;',
 
-			'#ifdef USE_UV2',
+			'#ifdef USE_UV1',
 
-			'	attribute vec2 uv2;',
+			'	attribute vec2 uv1;',
 
 			'#endif',
 
-			'#ifdef USE_UV3',
+			'#ifdef USE_UV2',
 
-			'	attribute vec2 uv3;',
+			'	attribute vec2 uv2;',
 
 			'#endif',
 
-			'#ifdef USE_UV4',
+			'#ifdef USE_UV3',
 
-			'	attribute vec2 uv4;',
+			'	attribute vec2 uv3;',
 
 			'#endif',
 
@@ -708,9 +708,9 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
 			parameters.vertexTangents ? '#define USE_TANGENT' : '',
 			parameters.vertexColors || parameters.instancingColor ? '#define USE_COLOR' : '',
 			parameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '',
-			parameters.vertexUvs2 ? '#define USE_UV2' : '',
-			parameters.vertexUvs3 ? '#define USE_UV3' : '',
-			parameters.vertexUvs4 ? '#define USE_UV4' : '',
+			parameters.vertexUv1s ? '#define USE_UV1' : '',
+			parameters.vertexUv2s ? '#define USE_UV2' : '',
+			parameters.vertexUv3s ? '#define USE_UV3' : '',
 
 			parameters.pointsUvs ? '#define USE_POINTS_UV' : '',
 

+ 10 - 10
src/renderers/webgl/WebGLPrograms.js

@@ -37,9 +37,9 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
 
 	function getChannel( value ) {
 
-		if ( value === 1 ) return 'uv2';
-		if ( value === 2 ) return 'uv3';
-		if ( value === 3 ) return 'uv4';
+		if ( value === 1 ) return 'uv1';
+		if ( value === 2 ) return 'uv2';
+		if ( value === 3 ) return 'uv3';
 
 		return 'uv';
 
@@ -153,9 +153,9 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
 
 		const HAS_EXTENSIONS = !! material.extensions;
 
+		const HAS_ATTRIBUTE_UV1 = !! geometry.attributes.uv1;
 		const HAS_ATTRIBUTE_UV2 = !! geometry.attributes.uv2;
 		const HAS_ATTRIBUTE_UV3 = !! geometry.attributes.uv3;
-		const HAS_ATTRIBUTE_UV4 = !! geometry.attributes.uv4;
 
 		const parameters = {
 
@@ -267,9 +267,9 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
 			vertexTangents: HAS_NORMALMAP && !! geometry.attributes.tangent,
 			vertexColors: material.vertexColors,
 			vertexAlphas: material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4,
-			vertexUvs2: HAS_ATTRIBUTE_UV2,
-			vertexUvs3: HAS_ATTRIBUTE_UV3,
-			vertexUvs4: HAS_ATTRIBUTE_UV4,
+			vertexUv1s: HAS_ATTRIBUTE_UV1,
+			vertexUv2s: HAS_ATTRIBUTE_UV2,
+			vertexUv3s: HAS_ATTRIBUTE_UV3,
 
 			pointsUvs: object.isPoints === true && !! geometry.attributes.uv && ( HAS_MAP || HAS_ALPHAMAP ),
 
@@ -461,11 +461,11 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
 			_programLayers.enable( 11 );
 		if ( parameters.vertexAlphas )
 			_programLayers.enable( 12 );
-		if ( parameters.vertexUvs2 )
+		if ( parameters.vertexUv1s )
 			_programLayers.enable( 13 );
-		if ( parameters.vertexUvs3 )
+		if ( parameters.vertexUv2s )
 			_programLayers.enable( 14 );
-		if ( parameters.vertexUvs4 )
+		if ( parameters.vertexUv3s )
 			_programLayers.enable( 15 );
 		if ( parameters.vertexTangents )
 			_programLayers.enable( 16 );

Някои файлове не бяха показани, защото твърде много файлове са промени