Skip to content

Commit 231773f

Browse files
committed
Updated examples to use new setVector & setColor convenience methods
1 parent a32870b commit 231773f

15 files changed

+25
-33
lines changed

examples/jsm/exporters/GLTFExporter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ class GLTFWriter {
884884

885885
}
886886

887-
attribute.setXYZ( i, v.x, v.y, v.z );
887+
attribute.setVector3( i, v );
888888

889889
}
890890

examples/jsm/helpers/TextureHelper.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,7 @@ function createCubeGeometry( width, height, depth ) {
203203

204204
_direction.fromBufferAttribute( position, j ).normalize();
205205

206-
const u = _direction.x;
207-
const v = _direction.y;
208-
const w = _direction.z;
209-
210-
uvw.setXYZ( j, u, v, w );
206+
uvw.setVector3( j, _direction );
211207

212208
}
213209

examples/jsm/helpers/TextureHelperGPU.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,7 @@ function createCubeGeometry( width, height, depth ) {
152152

153153
_direction.fromBufferAttribute( position, j ).normalize();
154154

155-
const u = _direction.x;
156-
const v = _direction.y;
157-
const w = _direction.z;
158-
159-
uvw.setXYZ( j, u, v, w );
155+
uvw.setVector3( j, _direction );
160156

161157
}
162158

examples/jsm/helpers/VertexNormalsHelper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ class VertexNormalsHelper extends LineSegments {
123123

124124
_v2.applyMatrix3( _normalMatrix ).normalize().multiplyScalar( this.size ).add( _v1 );
125125

126-
position.setXYZ( idx, _v1.x, _v1.y, _v1.z );
126+
position.setVector3( idx, _v1 );
127127

128128
idx = idx + 1;
129129

130-
position.setXYZ( idx, _v2.x, _v2.y, _v2.z );
130+
position.setVector3( idx, _v2 );
131131

132132
idx = idx + 1;
133133

examples/jsm/helpers/VertexTangentsHelper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ class VertexTangentsHelper extends LineSegments {
103103

104104
_v2.transformDirection( matrixWorld ).multiplyScalar( this.size ).add( _v1 );
105105

106-
position.setXYZ( idx, _v1.x, _v1.y, _v1.z );
106+
position.setVector3( idx, _v1 );
107107

108108
idx = idx + 1;
109109

110-
position.setXYZ( idx, _v2.x, _v2.y, _v2.z );
110+
position.setVector3( idx, _v2 );
111111

112112
idx = idx + 1;
113113

examples/jsm/loaders/DRACOLoader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ class DRACOLoader extends Loader {
322322

323323
_color.fromBufferAttribute( attribute, i );
324324
ColorManagement.colorSpaceToWorking( _color, SRGBColorSpace );
325-
attribute.setXYZ( i, _color.r, _color.g, _color.b );
325+
attribute.setColor( i, _color );
326326

327327
}
328328

examples/jsm/loaders/VRMLLoader.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3220,7 +3220,7 @@ class VRMLLoader extends Loader {
32203220

32213221
ColorManagement.colorSpaceToWorking( color, SRGBColorSpace );
32223222

3223-
attribute.setXYZ( i, color.r, color.g, color.b );
3223+
attribute.setColor( i, color );
32243224

32253225
}
32263226

@@ -3327,7 +3327,7 @@ class VRMLLoader extends Loader {
33273327

33283328
ColorManagement.colorSpaceToWorking( color, SRGBColorSpace );
33293329

3330-
colorAttribute.setXYZ( index, color.r, color.g, color.b );
3330+
colorAttribute.setColor( index, color );
33313331

33323332
}
33333333

examples/jsm/utils/BufferGeometryUtils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1406,7 +1406,7 @@ function toCreasedNormals( geometry, creaseAngle = Math.PI / 3 /* 60 degrees */
14061406
}
14071407

14081408
tempNorm2.normalize();
1409-
normAttr.setXYZ( i3 + n, tempNorm2.x, tempNorm2.y, tempNorm2.z );
1409+
normAttr.setVector3( i3 + n, tempNorm2 );
14101410

14111411
}
14121412

examples/misc_controls_pointerlock.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@
200200
vertex.y += Math.random() * 2;
201201
vertex.z += Math.random() * 20 - 10;
202202

203-
position.setXYZ( i, vertex.x, vertex.y, vertex.z );
203+
position.setVector3( i, vertex );
204204

205205
}
206206

examples/webgl_decals.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@
198198
mouseHelper.lookAt( n );
199199

200200
const positions = line.geometry.attributes.position;
201-
positions.setXYZ( 0, p.x, p.y, p.z );
202-
positions.setXYZ( 1, n.x, n.y, n.z );
201+
positions.setVector3( 0, p );
202+
positions.setVector3( 1, n );
203203
positions.needsUpdate = true;
204204

205205
intersection.intersects = true;

0 commit comments

Comments
 (0)