Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/api/en/core/Raycaster.html
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ <h3>[method:Array intersectObject]( [param:Object3D object], [param:Boolean recu
[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 />
Expand Down
2 changes: 1 addition & 1 deletion docs/api/en/materials/ShaderMaterial.html
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ <h3>[property:Object defaultAttributeValues]</h3>
this.defaultAttributeValues = {
'color': [ 1, 1, 1 ],
'uv': [ 0, 0 ],
'uv2': [ 0, 0 ]
'uv1': [ 0, 0 ]
};
</code>
</p>
Expand Down
4 changes: 2 additions & 2 deletions docs/api/en/textures/Texture.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ <h3>[property:number mapping]</h3>

<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>
Expand Down
2 changes: 1 addition & 1 deletion docs/api/fr/materials/ShaderMaterial.html
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ <h3>[property:Object defaultAttributeValues]</h3>
this.defaultAttributeValues = {
'color': [ 1, 1, 1 ],
'uv': [ 0, 0 ],
'uv2': [ 0, 0 ]
'uv1': [ 0, 0 ]
};
</code>

Expand Down
2 changes: 1 addition & 1 deletion docs/api/it/core/Raycaster.html
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ <h3>[method:Array intersectObject]( [param:Object3D object], [param:Boolean recu
[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>
Expand Down
2 changes: 1 addition & 1 deletion docs/api/it/materials/ShaderMaterial.html
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ <h3>[property:Object defaultAttributeValues]</h3>
this.defaultAttributeValues = {
'color': [ 1, 1, 1 ],
'uv': [ 0, 0 ],
'uv2': [ 0, 0 ]
'uv1': [ 0, 0 ]
};
</code>

Expand Down
2 changes: 1 addition & 1 deletion docs/api/it/textures/Texture.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ <h3>[property:number mapping]</h3>

<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>
Expand Down
2 changes: 1 addition & 1 deletion docs/api/ko/core/Raycaster.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ <h3>[method:Array intersectObject]( [param:Object3D object], [param:Boolean recu
[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>
Expand Down
2 changes: 1 addition & 1 deletion docs/api/zh/core/Raycaster.html
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ <h3>[method:Array intersectObject]( [param:Object3D object], [param:Boolean recu
[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>
Expand Down
2 changes: 1 addition & 1 deletion docs/api/zh/materials/ShaderMaterial.html
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ <h3>[property:Object defaultAttributeValues]</h3>
this.defaultAttributeValues = {
'color': [ 1, 1, 1 ],
'uv': [ 0, 0 ],
'uv2': [ 0, 0 ]
'uv1': [ 0, 0 ]
};
</code>

Expand Down
2 changes: 1 addition & 1 deletion docs/api/zh/textures/Texture.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ <h3>[property:number mapping]</h3>

<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>
Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/exporters/ColladaExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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" />`;

}
Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/exporters/GLTFExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/lines/LineSegments2.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function raycastWorldUnits( lineSegments, intersects ) {
face: null,
faceIndex: i,
uv: null,
uv2: null,
uv1: null,
} );

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

}
Expand Down
10 changes: 5 additions & 5 deletions examples/jsm/loaders/ColladaLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;

}
Expand All @@ -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 ) );
Expand Down
10 changes: 1 addition & 9 deletions examples/jsm/loaders/FBXLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );

Expand Down
6 changes: 3 additions & 3 deletions examples/jsm/loaders/GLTFLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
28 changes: 0 additions & 28 deletions examples/jsm/loaders/LWOLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import {
AddOperation,
BackSide,
BufferAttribute,
BufferGeometry,
ClampToEdgeWrapping,
Color,
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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 {
Expand Down
16 changes: 8 additions & 8 deletions examples/jsm/misc/ProgressiveLightMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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); }';

Expand Down Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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;

} );

Expand Down
Loading