瀏覽代碼

Merge pull request #17666 from Mugen87/dev9

BufferGeometry: Introduce .setAttribute() and .deleteAttribute().
Mr.doob 5 年之前
父節點
當前提交
219e3c1bc2
共有 100 個文件被更改,包括 362 次插入362 次删除
  1. 6 6
      docs/api/en/core/BufferGeometry.html
  2. 2 2
      docs/api/en/objects/SkinnedMesh.html
  3. 4 4
      docs/api/zh/core/BufferGeometry.html
  4. 2 2
      docs/api/zh/objects/SkinnedMesh.html
  5. 1 1
      docs/manual/en/introduction/How-to-update-things.html
  6. 1 1
      docs/manual/zh/introduction/How-to-update-things.html
  7. 2 2
      docs/scenes/bones-browser.html
  8. 1 1
      docs/scenes/geometry-browser.html
  9. 1 1
      docs/scenes/material-browser.html
  10. 0 0
      editor/js/libs/tern-threejs/threejs.js
  11. 1 1
      examples/js/animation/CCDIKSolver.js
  12. 3 3
      examples/js/controls/TransformControls.js
  13. 2 2
      examples/js/exporters/GLTFExporter.js
  14. 1 1
      examples/js/geometries/BoxLineGeometry.js
  15. 2 2
      examples/js/geometries/ConvexGeometry.js
  16. 3 3
      examples/js/geometries/DecalGeometry.js
  17. 2 2
      examples/js/geometries/LightningStrike.js
  18. 3 3
      examples/js/geometries/TeapotBufferGeometry.js
  19. 2 2
      examples/js/lines/LineSegments2.js
  20. 6 6
      examples/js/lines/LineSegmentsGeometry.js
  21. 2 2
      examples/js/lines/Wireframe.js
  22. 1 1
      examples/js/loaders/3MFLoader.js
  23. 2 2
      examples/js/loaders/AMFLoader.js
  24. 4 4
      examples/js/loaders/AssimpJSONLoader.js
  25. 9 9
      examples/js/loaders/AssimpLoader.js
  26. 8 8
      examples/js/loaders/ColladaLoader.js
  27. 1 1
      examples/js/loaders/DRACOLoader.js
  28. 7 7
      examples/js/loaders/FBXLoader.js
  29. 1 1
      examples/js/loaders/GCodeLoader.js
  30. 2 2
      examples/js/loaders/GLTFLoader.js
  31. 5 5
      examples/js/loaders/LDrawLoader.js
  32. 3 3
      examples/js/loaders/LWOLoader.js
  33. 3 3
      examples/js/loaders/MD2Loader.js
  34. 5 5
      examples/js/loaders/MMDLoader.js
  35. 4 4
      examples/js/loaders/OBJLoader.js
  36. 3 3
      examples/js/loaders/PCDLoader.js
  37. 3 3
      examples/js/loaders/PDBLoader.js
  38. 5 5
      examples/js/loaders/PLYLoader.js
  39. 1 1
      examples/js/loaders/PRWMLoader.js
  40. 5 5
      examples/js/loaders/STLLoader.js
  41. 3 3
      examples/js/loaders/SVGLoader.js
  42. 2 2
      examples/js/loaders/TDSLoader.js
  43. 9 9
      examples/js/loaders/VRMLLoader.js
  44. 8 8
      examples/js/loaders/VTKLoader.js
  45. 5 5
      examples/js/loaders/XLoader.js
  46. 10 10
      examples/js/loaders/deprecated/LegacyGLTFLoader.js
  47. 9 9
      examples/js/misc/RollerCoaster.js
  48. 1 1
      examples/js/modifiers/SimplifyModifier.js
  49. 2 2
      examples/js/objects/Lensflare.js
  50. 4 4
      examples/js/objects/MarchingCubes.js
  51. 3 3
      examples/js/utils/BufferGeometryUtils.js
  52. 1 1
      examples/jsm/animation/CCDIKSolver.js
  53. 3 3
      examples/jsm/controls/TransformControls.js
  54. 2 2
      examples/jsm/exporters/GLTFExporter.js
  55. 1 1
      examples/jsm/geometries/BoxLineGeometry.js
  56. 2 2
      examples/jsm/geometries/ConvexGeometry.js
  57. 3 3
      examples/jsm/geometries/DecalGeometry.js
  58. 2 2
      examples/jsm/geometries/LightningStrike.js
  59. 3 3
      examples/jsm/geometries/TeapotBufferGeometry.js
  60. 2 2
      examples/jsm/lines/LineSegments2.js
  61. 6 6
      examples/jsm/lines/LineSegmentsGeometry.js
  62. 2 2
      examples/jsm/lines/Wireframe.js
  63. 1 1
      examples/jsm/loaders/3MFLoader.js
  64. 2 2
      examples/jsm/loaders/AMFLoader.js
  65. 4 4
      examples/jsm/loaders/AWDLoader.js
  66. 4 4
      examples/jsm/loaders/AssimpJSONLoader.js
  67. 9 9
      examples/jsm/loaders/AssimpLoader.js
  68. 8 8
      examples/jsm/loaders/ColladaLoader.js
  69. 1 1
      examples/jsm/loaders/DRACOLoader.js
  70. 7 7
      examples/jsm/loaders/FBXLoader.js
  71. 1 1
      examples/jsm/loaders/GCodeLoader.js
  72. 2 2
      examples/jsm/loaders/GLTFLoader.js
  73. 5 5
      examples/jsm/loaders/LDrawLoader.js
  74. 3 3
      examples/jsm/loaders/LWOLoader.js
  75. 3 3
      examples/jsm/loaders/MD2Loader.js
  76. 5 5
      examples/jsm/loaders/MMDLoader.js
  77. 4 4
      examples/jsm/loaders/OBJLoader.js
  78. 3 3
      examples/jsm/loaders/PCDLoader.js
  79. 3 3
      examples/jsm/loaders/PDBLoader.js
  80. 5 5
      examples/jsm/loaders/PLYLoader.js
  81. 1 1
      examples/jsm/loaders/PRWMLoader.js
  82. 5 5
      examples/jsm/loaders/STLLoader.js
  83. 3 3
      examples/jsm/loaders/SVGLoader.js
  84. 2 2
      examples/jsm/loaders/TDSLoader.js
  85. 9 9
      examples/jsm/loaders/VRMLLoader.js
  86. 8 8
      examples/jsm/loaders/VTKLoader.js
  87. 5 5
      examples/jsm/loaders/XLoader.js
  88. 10 10
      examples/jsm/loaders/deprecated/LegacyGLTFLoader.js
  89. 6 6
      examples/jsm/loaders/obj2/shared/MeshReceiver.js
  90. 9 9
      examples/jsm/misc/RollerCoaster.js
  91. 1 1
      examples/jsm/modifiers/SimplifyModifier.js
  92. 2 2
      examples/jsm/objects/Lensflare.js
  93. 4 4
      examples/jsm/objects/MarchingCubes.js
  94. 3 3
      examples/jsm/utils/BufferGeometryUtils.js
  95. 2 2
      examples/misc_controls_fly.html
  96. 2 2
      examples/misc_controls_pointerlock.html
  97. 7 7
      examples/misc_exporter_gltf.html
  98. 1 1
      examples/misc_exporter_obj.html
  99. 6 6
      examples/software_lines_splines.html
  100. 4 4
      examples/software_sandbox.html

+ 6 - 6
docs/api/en/core/BufferGeometry.html

@@ -38,7 +38,7 @@
 		] );
 
 		// itemSize = 3 because there are 3 values (components) per vertex
-		geometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
+		geometry.setAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
 		var material = new THREE.MeshBasicMaterial( { color: 0xff0000 } );
 		var mesh = new THREE.Mesh( geometry, material );
 		</code>
@@ -65,7 +65,7 @@
 		<h3>[property:Object attributes]</h3>
 		<p>
 		This hashmap has as id the name of the attribute to be set and as value the [page:BufferAttribute buffer] to set it to.
-		Rather than accessing this property directly, use [page:.addAttribute] and [page:.getAttribute] to access attributes of this geometry.
+		Rather than accessing this property directly, use [page:.setAttribute] and [page:.getAttribute] to access attributes of this geometry.
 		</p>
 
 		<h3>[property:Box3 boundingBox]</h3>
@@ -165,9 +165,9 @@
 
 		<h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
 
-		<h3>[method:BufferGeometry addAttribute]( [param:String name], [param:BufferAttribute attribute] )</h3>
+		<h3>[method:BufferGeometry setAttribute]( [param:String name], [param:BufferAttribute attribute] )</h3>
 		<p>
-		Adds an attribute to this geometry. Use this rather than the attributes property,
+		Sets an attribute to this geometry. Use this rather than the attributes property,
 		because an internal hashmap of [page:.attributes] is maintained to speed up iterating over
 		attributes.
 		</p>
@@ -249,8 +249,8 @@
 		This will correct lighting on the geometry surfaces.
 		</p>
 
-		<h3>[method:BufferAttribute removeAttribute]( [param:String name] )</h3>
-		<p>Removes the [page:BufferAttribute attribute] with the specified name.</p>
+		<h3>[method:BufferAttribute deleteAttribute]( [param:String name] )</h3>
+		<p>Deletes the [page:BufferAttribute attribute] with the specified name.</p>
 
 		<h3>[method:BufferGeometry rotateX] ( [param:Float radians] )</h3>
 		<p>

+ 2 - 2
docs/api/en/objects/SkinnedMesh.html

@@ -65,8 +65,8 @@
 
 		}
 
-		geometry.addAttribute( 'skinIndex', new THREE.Uint16BufferAttribute( skinIndices, 4 ) );
-		geometry.addAttribute( 'skinWeight', new THREE.Float32BufferAttribute( skinWeights, 4 ) );
+		geometry.setAttribute( 'skinIndex', new THREE.Uint16BufferAttribute( skinIndices, 4 ) );
+		geometry.setAttribute( 'skinWeight', new THREE.Float32BufferAttribute( skinWeights, 4 ) );
 
 		// create skinned mesh and skeleton
 

+ 4 - 4
docs/api/zh/core/BufferGeometry.html

@@ -37,7 +37,7 @@
 		] );
 
 		// itemSize = 3 因为每个顶点都是一个三元组。
-		geometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
+		geometry.setAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
 		var material = new THREE.MeshBasicMaterial( { color: 0xff0000 } );
 		var mesh = new THREE.Mesh( geometry, material );
 		</code>
@@ -64,7 +64,7 @@
 		<h3>[property:Object attributes]</h3>
 		<p>
 			通过 hashmap 存储该几何体相关的属性,hashmap 的 id 是当前 attribute 的名称,值是相应的 [page:BufferAttribute buffer]。
-			你可以通过 [page:.addAttribute] 和 [page:.getAttribute] 添加和访问与当前几何体有关的 attribute。
+			你可以通过 [page:.setAttribute] 和 [page:.getAttribute] 添加和访问与当前几何体有关的 attribute。
 		</p>
 
 		<h3>[property:Box3 boundingBox]</h3>
@@ -156,7 +156,7 @@
 
 		<h3>[page:EventDispatcher EventDispatcher] 在该类上可用的所有方法。</h3>
 
-		<h3>[method:BufferGeometry addAttribute]( [param:String name], [param:BufferAttribute attribute] )</h3>
+		<h3>[method:BufferGeometry setAttribute]( [param:String name], [param:BufferAttribute attribute] )</h3>
 		<p>
 			为当前几何体增加一个 attribute。 的属性,在类的内部,有一个存储 [page:.attributes] 的 hashmap,
 			通过该 hashmap,遍历 attributes 的速度会更快。而使用该方法,可以向 hashmap 内部增加 attribute。
@@ -236,7 +236,7 @@
 			几何体中的每个法向量长度将会为 1。这样操作会更正光线在表面的效果。
 		</p>
 
-		<h3>[method:BufferAttribute removeAttribute]( [param:String name] )</h3>
+		<h3>[method:BufferAttribute deleteAttribute]( [param:String name] )</h3>
 		<p>删除具有指定名称的 [page:BufferAttribute attribute]。</p>
 
 		<h3>[method:BufferGeometry rotateX] ( [param:Float radians] )</h3>

+ 2 - 2
docs/api/zh/objects/SkinnedMesh.html

@@ -65,8 +65,8 @@
 
 		}
 
-		geometry.addAttribute( 'skinIndex', new THREE.Uint16BufferAttribute( skinIndices, 4 ) );
-		geometry.addAttribute( 'skinWeight', new THREE.Float32BufferAttribute( skinWeights, 4 ) );
+		geometry.setAttribute( 'skinIndex', new THREE.Uint16BufferAttribute( skinIndices, 4 ) );
+		geometry.setAttribute( 'skinWeight', new THREE.Float32BufferAttribute( skinWeights, 4 ) );
 
 		// create skinned mesh and skeleton
 

+ 1 - 1
docs/manual/en/introduction/How-to-update-things.html

@@ -66,7 +66,7 @@ var geometry = new THREE.BufferGeometry();
 
 // attributes
 var positions = new Float32Array( MAX_POINTS * 3 ); // 3 vertices per point
-geometry.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
+geometry.setAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
 
 // draw range
 var drawCount = 2; // draw the first 2 points, only

+ 1 - 1
docs/manual/zh/introduction/How-to-update-things.html

@@ -62,7 +62,7 @@ var geometry = new THREE.BufferGeometry();
 
 // attributes
 var positions = new Float32Array( MAX_POINTS * 3 ); // 3 vertices per point
-geometry.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
+geometry.setAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
 
 // draw range
 var drawCount = 2; // draw the first 2 points, only

+ 2 - 2
docs/scenes/bones-browser.html

@@ -131,8 +131,8 @@
 
 				}
 
-				geometry.addAttribute( 'skinIndex', new Uint16BufferAttribute( skinIndices, 4 ) );
-				geometry.addAttribute( 'skinWeight', new Float32BufferAttribute( skinWeights, 4 ) );
+				geometry.setAttribute( 'skinIndex', new Uint16BufferAttribute( skinIndices, 4 ) );
+				geometry.setAttribute( 'skinWeight', new Float32BufferAttribute( skinWeights, 4 ) );
 
 				return geometry;
 

+ 1 - 1
docs/scenes/geometry-browser.html

@@ -1492,7 +1492,7 @@
 			var group = new Group();
 
 			var geometry = new BufferGeometry();
-			geometry.addAttribute( 'position', new Float32BufferAttribute( [], 3 ) );
+			geometry.setAttribute( 'position', new Float32BufferAttribute( [], 3 ) );
 
 			var lineMaterial = new LineBasicMaterial( { color: 0xffffff, transparent: true, opacity: 0.5 } );
 			var meshMaterial = new MeshPhongMaterial( { color: 0x156289, emissive: 0x072534, side: DoubleSide, flatShading: true } );

+ 1 - 1
docs/scenes/material-browser.html

@@ -270,7 +270,7 @@
 
 				}
 
-				geometry.addAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );
+				geometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );
 
 			}
 

文件差異過大導致無法顯示
+ 0 - 0
editor/js/libs/tern-threejs/threejs.js


+ 1 - 1
examples/js/animation/CCDIKSolver.js

@@ -399,7 +399,7 @@ THREE.CCDIKSolver = ( function () {
 
 				var geometry = new THREE.BufferGeometry();
 				var vertices = new Float32Array( ( 2 + ik.links.length ) * 3 );
-				geometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
+				geometry.setAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
 
 				return geometry;
 

+ 3 - 3
examples/js/controls/TransformControls.js

@@ -751,7 +751,7 @@ THREE.TransformControlsGizmo = function () {
 	var scaleHandleGeometry = new THREE.BoxBufferGeometry( 0.125, 0.125, 0.125 );
 
 	var lineGeometry = new THREE.BufferGeometry( );
-	lineGeometry.addAttribute( 'position', new THREE.Float32BufferAttribute( [ 0, 0, 0,	1, 0, 0 ], 3 ) );
+	lineGeometry.setAttribute( 'position', new THREE.Float32BufferAttribute( [ 0, 0, 0,	1, 0, 0 ], 3 ) );
 
 	var CircleGeometry = function ( radius, arc ) {
 
@@ -764,7 +764,7 @@ THREE.TransformControlsGizmo = function () {
 
 		}
 
-		geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
+		geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
 
 		return geometry;
 
@@ -776,7 +776,7 @@ THREE.TransformControlsGizmo = function () {
 
 		var geometry = new THREE.BufferGeometry();
 
-		geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( [ 0, 0, 0, 1, 1, 1 ], 3 ) );
+		geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( [ 0, 0, 0, 1, 1, 1 ], 3 ) );
 
 		return geometry;
 

+ 2 - 2
examples/js/exporters/GLTFExporter.js

@@ -1215,7 +1215,7 @@ THREE.GLTFExporter.prototype = {
 
 				console.warn( 'THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one.' );
 
-				geometry.addAttribute( 'normal', createNormalizedNormalAttribute( originalNormal ) );
+				geometry.setAttribute( 'normal', createNormalizedNormalAttribute( originalNormal ) );
 
 			}
 
@@ -1269,7 +1269,7 @@ THREE.GLTFExporter.prototype = {
 
 			}
 
-			if ( originalNormal !== undefined ) geometry.addAttribute( 'normal', originalNormal );
+			if ( originalNormal !== undefined ) geometry.setAttribute( 'normal', originalNormal );
 
 			// Skip if no exportable attributes found
 			if ( Object.keys( attributes ).length === 0 ) {

+ 1 - 1
examples/js/geometries/BoxLineGeometry.js

@@ -59,7 +59,7 @@ THREE.BoxLineGeometry = function ( width, height, depth, widthSegments, heightSe
 
 	}
 
-	this.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
+	this.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
 
 };
 

+ 2 - 2
examples/js/geometries/ConvexGeometry.js

@@ -61,8 +61,8 @@ THREE.ConvexBufferGeometry = function ( points ) {
 
 	// build geometry
 
-	this.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
-	this.addAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
+	this.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
+	this.setAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
 
 };
 

+ 3 - 3
examples/js/geometries/DecalGeometry.js

@@ -44,9 +44,9 @@ THREE.DecalGeometry = function ( mesh, position, orientation, size ) {
 
 	// build geometry
 
-	this.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
-	this.addAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
-	this.addAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
+	this.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
+	this.setAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
+	this.setAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
 
 	function generate() {
 

+ 2 - 2
examples/js/geometries/LightningStrike.js

@@ -419,12 +419,12 @@ THREE.LightningStrike.prototype.createMesh = function () {
 	this.setIndex( new THREE.Uint32BufferAttribute( this.indices, 1 ) );
 
 	this.positionAttribute = new THREE.Float32BufferAttribute( this.vertices, 3 );
-	this.addAttribute( 'position', this.positionAttribute );
+	this.setAttribute( 'position', this.positionAttribute );
 
 	if ( this.generateUVs ) {
 
 		this.uvsAttribute = new THREE.Float32BufferAttribute( new Float32Array( this.uvs ), 2 );
-		this.addAttribute( 'uv', this.uvsAttribute );
+		this.setAttribute( 'uv', this.uvsAttribute );
 
 	}
 

+ 3 - 3
examples/js/geometries/TeapotBufferGeometry.js

@@ -702,9 +702,9 @@ THREE.TeapotBufferGeometry = function ( size, segments, bottom, lid, body, fitLi
 	}
 
 	this.setIndex( new THREE.BufferAttribute( indices, 1 ) );
-	this.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
-	this.addAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) );
-	this.addAttribute( 'uv', new THREE.BufferAttribute( uvs, 2 ) );
+	this.setAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
+	this.setAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) );
+	this.setAttribute( 'uv', new THREE.BufferAttribute( uvs, 2 ) );
 
 	this.computeBoundingSphere();
 

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

@@ -45,8 +45,8 @@ THREE.LineSegments2.prototype = Object.assign( Object.create( THREE.Mesh.prototy
 
 			var instanceDistanceBuffer = new THREE.InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1
 
-			geometry.addAttribute( 'instanceDistanceStart', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0
-			geometry.addAttribute( 'instanceDistanceEnd', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1
+			geometry.setAttribute( 'instanceDistanceStart', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0
+			geometry.setAttribute( 'instanceDistanceEnd', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1
 
 			return this;
 

+ 6 - 6
examples/js/lines/LineSegmentsGeometry.js

@@ -14,8 +14,8 @@ THREE.LineSegmentsGeometry = function () {
 	var index = [ 0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5 ];
 
 	this.setIndex( index );
-	this.addAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) );
-	this.addAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
+	this.setAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) );
+	this.setAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
 
 };
 
@@ -72,8 +72,8 @@ THREE.LineSegmentsGeometry.prototype = Object.assign( Object.create( THREE.Insta
 
 		var instanceBuffer = new THREE.InstancedInterleavedBuffer( lineSegments, 6, 1 ); // xyz, xyz
 
-		this.addAttribute( 'instanceStart', new THREE.InterleavedBufferAttribute( instanceBuffer, 3, 0 ) ); // xyz
-		this.addAttribute( 'instanceEnd', new THREE.InterleavedBufferAttribute( instanceBuffer, 3, 3 ) ); // xyz
+		this.setAttribute( 'instanceStart', new THREE.InterleavedBufferAttribute( instanceBuffer, 3, 0 ) ); // xyz
+		this.setAttribute( 'instanceEnd', new THREE.InterleavedBufferAttribute( instanceBuffer, 3, 3 ) ); // xyz
 
 		//
 
@@ -100,8 +100,8 @@ THREE.LineSegmentsGeometry.prototype = Object.assign( Object.create( THREE.Insta
 
 		var instanceColorBuffer = new THREE.InstancedInterleavedBuffer( colors, 6, 1 ); // rgb, rgb
 
-		this.addAttribute( 'instanceColorStart', new THREE.InterleavedBufferAttribute( instanceColorBuffer, 3, 0 ) ); // rgb
-		this.addAttribute( 'instanceColorEnd', new THREE.InterleavedBufferAttribute( instanceColorBuffer, 3, 3 ) ); // rgb
+		this.setAttribute( 'instanceColorStart', new THREE.InterleavedBufferAttribute( instanceColorBuffer, 3, 0 ) ); // rgb
+		this.setAttribute( 'instanceColorEnd', new THREE.InterleavedBufferAttribute( instanceColorBuffer, 3, 3 ) ); // rgb
 
 		return this;
 

+ 2 - 2
examples/js/lines/Wireframe.js

@@ -45,8 +45,8 @@ THREE.Wireframe.prototype = Object.assign( Object.create( THREE.Mesh.prototype )
 
 			var instanceDistanceBuffer = new THREE.InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1
 
-			geometry.addAttribute( 'instanceDistanceStart', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0
-			geometry.addAttribute( 'instanceDistanceEnd', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1
+			geometry.setAttribute( 'instanceDistanceStart', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0
+			geometry.setAttribute( 'instanceDistanceEnd', new THREE.InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1
 
 			return this;
 

+ 1 - 1
examples/js/loaders/3MFLoader.js

@@ -554,7 +554,7 @@ THREE.ThreeMFLoader.prototype = Object.assign( Object.create( THREE.Loader.proto
 
 			var geometry = new THREE.BufferGeometry();
 			geometry.setIndex( new THREE.BufferAttribute( meshData[ 'triangles' ], 1 ) );
-			geometry.addAttribute( 'position', new THREE.BufferAttribute( meshData[ 'vertices' ], 3 ) );
+			geometry.setAttribute( 'position', new THREE.BufferAttribute( meshData[ 'vertices' ], 3 ) );
 
 			// groups
 

+ 2 - 2
examples/js/loaders/AMFLoader.js

@@ -456,11 +456,11 @@ THREE.AMFLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 					var material = objDefaultMaterial;
 
 					newGeometry.setIndex( volume.triangles );
-					newGeometry.addAttribute( 'position', vertices.clone() );
+					newGeometry.setAttribute( 'position', vertices.clone() );
 
 					if ( normals ) {
 
-						newGeometry.addAttribute( 'normal', normals.clone() );
+						newGeometry.setAttribute( 'normal', normals.clone() );
 
 					}
 

+ 4 - 4
examples/js/loaders/AssimpJSONLoader.js

@@ -102,23 +102,23 @@ THREE.AssimpJSONLoader.prototype = Object.assign( Object.create( THREE.Loader.pr
 			}
 
 			geometry.setIndex( indices );
-			geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
+			geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
 
 			if ( normals.length > 0 ) {
 
-				geometry.addAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
+				geometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
 
 			}
 
 			if ( uvs.length > 0 ) {
 
-				geometry.addAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
+				geometry.setAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
 
 			}
 
 			if ( colors.length > 0 ) {
 
-				geometry.addAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
+				geometry.setAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
 
 			}
 

+ 9 - 9
examples/js/loaders/AssimpLoader.js

@@ -672,19 +672,19 @@ THREE.AssimpLoader.prototype = Object.assign( Object.create( THREE.Loader.protot
 				else
 					mat = new THREE.MeshLambertMaterial();
 				geometry.setIndex( new THREE.BufferAttribute( new Uint32Array( this.mIndexArray ), 1 ) );
-				geometry.addAttribute( 'position', new THREE.BufferAttribute( this.mVertexBuffer, 3 ) );
+				geometry.setAttribute( 'position', new THREE.BufferAttribute( this.mVertexBuffer, 3 ) );
 				if ( this.mNormalBuffer && this.mNormalBuffer.length > 0 )
-					geometry.addAttribute( 'normal', new THREE.BufferAttribute( this.mNormalBuffer, 3 ) );
+					geometry.setAttribute( 'normal', new THREE.BufferAttribute( this.mNormalBuffer, 3 ) );
 				if ( this.mColorBuffer && this.mColorBuffer.length > 0 )
-					geometry.addAttribute( 'color', new THREE.BufferAttribute( this.mColorBuffer, 4 ) );
+					geometry.setAttribute( 'color', new THREE.BufferAttribute( this.mColorBuffer, 4 ) );
 				if ( this.mTexCoordsBuffers[ 0 ] && this.mTexCoordsBuffers[ 0 ].length > 0 )
-					geometry.addAttribute( 'uv', new THREE.BufferAttribute( new Float32Array( this.mTexCoordsBuffers[ 0 ] ), 2 ) );
+					geometry.setAttribute( 'uv', new THREE.BufferAttribute( new Float32Array( this.mTexCoordsBuffers[ 0 ] ), 2 ) );
 				if ( this.mTexCoordsBuffers[ 1 ] && this.mTexCoordsBuffers[ 1 ].length > 0 )
-					geometry.addAttribute( 'uv1', new THREE.BufferAttribute( new Float32Array( this.mTexCoordsBuffers[ 1 ] ), 2 ) );
+					geometry.setAttribute( 'uv1', new THREE.BufferAttribute( new Float32Array( this.mTexCoordsBuffers[ 1 ] ), 2 ) );
 				if ( this.mTangentBuffer && this.mTangentBuffer.length > 0 )
-					geometry.addAttribute( 'tangents', new THREE.BufferAttribute( this.mTangentBuffer, 3 ) );
+					geometry.setAttribute( 'tangents', new THREE.BufferAttribute( this.mTangentBuffer, 3 ) );
 				if ( this.mBitangentBuffer && this.mBitangentBuffer.length > 0 )
-					geometry.addAttribute( 'bitangents', new THREE.BufferAttribute( this.mBitangentBuffer, 3 ) );
+					geometry.setAttribute( 'bitangents', new THREE.BufferAttribute( this.mBitangentBuffer, 3 ) );
 				if ( this.mBones.length > 0 ) {
 
 					var weights = [];
@@ -737,8 +737,8 @@ THREE.AssimpLoader.prototype = Object.assign( Object.create( THREE.Loader.protot
 
 					}
 
-					geometry.addAttribute( 'skinWeight', new THREE.BufferAttribute( new Float32Array( _weights ), BONESPERVERT ) );
-					geometry.addAttribute( 'skinIndex', new THREE.BufferAttribute( new Float32Array( _bones ), BONESPERVERT ) );
+					geometry.setAttribute( 'skinWeight', new THREE.BufferAttribute( new Float32Array( _weights ), BONESPERVERT ) );
+					geometry.setAttribute( 'skinIndex', new THREE.BufferAttribute( new Float32Array( _bones ), BONESPERVERT ) );
 
 				}
 

+ 8 - 8
examples/js/loaders/ColladaLoader.js

@@ -2386,14 +2386,14 @@ THREE.ColladaLoader.prototype = Object.assign( Object.create( THREE.Loader.proto
 
 			// build geometry
 
-			if ( position.array.length > 0 ) geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( position.array, position.stride ) );
-			if ( normal.array.length > 0 ) geometry.addAttribute( 'normal', new THREE.Float32BufferAttribute( normal.array, normal.stride ) );
-			if ( color.array.length > 0 ) geometry.addAttribute( 'color', new THREE.Float32BufferAttribute( color.array, color.stride ) );
-			if ( uv.array.length > 0 ) geometry.addAttribute( 'uv', new THREE.Float32BufferAttribute( uv.array, uv.stride ) );
-			if ( uv2.array.length > 0 ) geometry.addAttribute( 'uv2', new THREE.Float32BufferAttribute( uv2.array, uv2.stride ) );
-
-			if ( skinIndex.array.length > 0 ) geometry.addAttribute( 'skinIndex', new THREE.Float32BufferAttribute( skinIndex.array, skinIndex.stride ) );
-			if ( skinWeight.array.length > 0 ) geometry.addAttribute( 'skinWeight', new THREE.Float32BufferAttribute( skinWeight.array, skinWeight.stride ) );
+			if ( position.array.length > 0 ) geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( position.array, position.stride ) );
+			if ( normal.array.length > 0 ) geometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( normal.array, normal.stride ) );
+			if ( color.array.length > 0 ) geometry.setAttribute( 'color', new THREE.Float32BufferAttribute( color.array, color.stride ) );
+			if ( uv.array.length > 0 ) geometry.setAttribute( 'uv', new THREE.Float32BufferAttribute( uv.array, uv.stride ) );
+			if ( uv2.array.length > 0 ) geometry.setAttribute( 'uv2', new THREE.Float32BufferAttribute( uv2.array, uv2.stride ) );
+
+			if ( skinIndex.array.length > 0 ) geometry.setAttribute( 'skinIndex', new THREE.Float32BufferAttribute( skinIndex.array, skinIndex.stride ) );
+			if ( skinWeight.array.length > 0 ) geometry.setAttribute( 'skinWeight', new THREE.Float32BufferAttribute( skinWeight.array, skinWeight.stride ) );
 
 			build.data = geometry;
 			build.type = primitives[ 0 ].type;

+ 1 - 1
examples/js/loaders/DRACOLoader.js

@@ -198,7 +198,7 @@ THREE.DRACOLoader.prototype = Object.assign( Object.create( THREE.Loader.prototy
 			var array = attribute.array;
 			var itemSize = attribute.itemSize;
 
-			geometry.addAttribute( name, new THREE.BufferAttribute( array, itemSize ) );
+			geometry.setAttribute( name, new THREE.BufferAttribute( array, itemSize ) );
 
 		}
 

+ 7 - 7
examples/js/loaders/FBXLoader.js

@@ -1592,19 +1592,19 @@ THREE.FBXLoader = ( function () {
 
 			preTransform.applyToBufferAttribute( positionAttribute );
 
-			geo.addAttribute( 'position', positionAttribute );
+			geo.setAttribute( 'position', positionAttribute );
 
 			if ( buffers.colors.length > 0 ) {
 
-				geo.addAttribute( 'color', new THREE.Float32BufferAttribute( buffers.colors, 3 ) );
+				geo.setAttribute( 'color', new THREE.Float32BufferAttribute( buffers.colors, 3 ) );
 
 			}
 
 			if ( skeleton ) {
 
-				geo.addAttribute( 'skinIndex', new THREE.Uint16BufferAttribute( buffers.weightsIndices, 4 ) );
+				geo.setAttribute( 'skinIndex', new THREE.Uint16BufferAttribute( buffers.weightsIndices, 4 ) );
 
-				geo.addAttribute( 'skinWeight', new THREE.Float32BufferAttribute( buffers.vertexWeights, 4 ) );
+				geo.setAttribute( 'skinWeight', new THREE.Float32BufferAttribute( buffers.vertexWeights, 4 ) );
 
 				// used later to bind the skeleton to the model
 				geo.FBX_Deformer = skeleton;
@@ -1618,7 +1618,7 @@ THREE.FBXLoader = ( function () {
 				var normalMatrix = new THREE.Matrix3().getNormalMatrix( preTransform );
 				normalMatrix.applyToBufferAttribute( normalAttribute );
 
-				geo.addAttribute( 'normal', normalAttribute );
+				geo.setAttribute( 'normal', normalAttribute );
 
 			}
 
@@ -1634,7 +1634,7 @@ THREE.FBXLoader = ( function () {
 
 				}
 
-				geo.addAttribute( name, new THREE.Float32BufferAttribute( buffers.uvs[ i ], 2 ) );
+				geo.setAttribute( name, new THREE.Float32BufferAttribute( buffers.uvs[ i ], 2 ) );
 
 			} );
 
@@ -2306,7 +2306,7 @@ THREE.FBXLoader = ( function () {
 			} );
 
 			var geometry = new THREE.BufferGeometry();
-			geometry.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
+			geometry.setAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
 
 			return geometry;
 

+ 1 - 1
examples/js/loaders/GCodeLoader.js

@@ -175,7 +175,7 @@ THREE.GCodeLoader.prototype = Object.assign( Object.create( THREE.Loader.prototy
 		function addObject( vertex, extruding ) {
 
 			var geometry = new THREE.BufferGeometry();
-			geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( vertex, 3 ) );
+			geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( vertex, 3 ) );
 
 			var segments = new THREE.LineSegments( geometry, extruding ? extrudingMaterial : pathMaterial );
 			segments.name = 'layer' + i;

+ 2 - 2
examples/js/loaders/GLTFLoader.js

@@ -2185,7 +2185,7 @@ THREE.GLTFLoader = ( function () {
 		if ( material.aoMap && geometry.attributes.uv2 === undefined && geometry.attributes.uv !== undefined ) {
 
 			console.log( 'THREE.GLTFLoader: Duplicating UVs to support aoMap.' );
-			geometry.addAttribute( 'uv2', new THREE.BufferAttribute( geometry.attributes.uv.array, 2 ) );
+			geometry.setAttribute( 'uv2', new THREE.BufferAttribute( geometry.attributes.uv.array, 2 ) );
 
 		}
 
@@ -2379,7 +2379,7 @@ THREE.GLTFLoader = ( function () {
 			return parser.getDependency( 'accessor', accessorIndex )
 				.then( function ( accessor ) {
 
-					geometry.addAttribute( attributeName, accessor );
+					geometry.setAttribute( attributeName, accessor );
 
 				} );
 

+ 5 - 5
examples/js/loaders/LDrawLoader.js

@@ -450,11 +450,11 @@ THREE.LDrawLoader = ( function () {
 
 		}
 
-		bufferGeometry.addAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) );
+		bufferGeometry.setAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) );
 
 		if ( elementSize === 3 ) {
 
-			bufferGeometry.addAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
+			bufferGeometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
 
 		}
 
@@ -508,9 +508,9 @@ THREE.LDrawLoader = ( function () {
 
 			}
 
-			bufferGeometry.addAttribute( 'control0', new THREE.BufferAttribute( controlArray0, 3, false ) );
-			bufferGeometry.addAttribute( 'control1', new THREE.BufferAttribute( controlArray1, 3, false ) );
-			bufferGeometry.addAttribute( 'direction', new THREE.BufferAttribute( directionArray, 3, false ) );
+			bufferGeometry.setAttribute( 'control0', new THREE.BufferAttribute( controlArray0, 3, false ) );
+			bufferGeometry.setAttribute( 'control1', new THREE.BufferAttribute( controlArray1, 3, false ) );
+			bufferGeometry.setAttribute( 'direction', new THREE.BufferAttribute( directionArray, 3, false ) );
 
 		}
 

+ 3 - 3
examples/js/loaders/LWOLoader.js

@@ -2253,7 +2253,7 @@ LWOTreeParser.prototype = {
 
 		if ( ! duplicateUVs ) return;
 
-		geometry.addAttribute( 'uv2', new THREE.BufferAttribute( geometry.attributes.uv.array, 2 ) );
+		geometry.setAttribute( 'uv2', new THREE.BufferAttribute( geometry.attributes.uv.array, 2 ) );
 
 	},
 
@@ -2758,7 +2758,7 @@ GeometryParser.prototype = {
 
 		var geometry = new THREE.BufferGeometry();
 
-		geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( geoData.points, 3 ) );
+		geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( geoData.points, 3 ) );
 
 		var indices = this.splitIndices( geoData.vertexIndices, geoData.polygonDimensions );
 		geometry.setIndex( indices );
@@ -2971,7 +2971,7 @@ GeometryParser.prototype = {
 
 		}
 
-		geometry.addAttribute( 'uv', new THREE.Float32BufferAttribute( remappedUVs, 2 ) );
+		geometry.setAttribute( 'uv', new THREE.Float32BufferAttribute( remappedUVs, 2 ) );
 
 	},
 

+ 3 - 3
examples/js/loaders/MD2Loader.js

@@ -300,9 +300,9 @@ THREE.MD2Loader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 
 			}
 
-			geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) );
-			geometry.addAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
-			geometry.addAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
+			geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) );
+			geometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
+			geometry.setAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
 
 			// animation
 

+ 5 - 5
examples/js/loaders/MMDLoader.js

@@ -905,11 +905,11 @@ THREE.MMDLoader = ( function () {
 
 			var geometry = new THREE.BufferGeometry();
 
-			geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) );
-			geometry.addAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
-			geometry.addAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
-			geometry.addAttribute( 'skinIndex', new THREE.Uint16BufferAttribute( skinIndices, 4 ) );
-			geometry.addAttribute( 'skinWeight', new THREE.Float32BufferAttribute( skinWeights, 4 ) );
+			geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) );
+			geometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
+			geometry.setAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
+			geometry.setAttribute( 'skinIndex', new THREE.Uint16BufferAttribute( skinIndices, 4 ) );
+			geometry.setAttribute( 'skinWeight', new THREE.Float32BufferAttribute( skinWeights, 4 ) );
 			geometry.setIndex( indices );
 
 			for ( var i = 0, il = groups.length; i < il; i ++ ) {

+ 4 - 4
examples/js/loaders/OBJLoader.js

@@ -638,11 +638,11 @@ THREE.OBJLoader = ( function () {
 
 				var buffergeometry = new THREE.BufferGeometry();
 
-				buffergeometry.addAttribute( 'position', new THREE.Float32BufferAttribute( geometry.vertices, 3 ) );
+				buffergeometry.setAttribute( 'position', new THREE.Float32BufferAttribute( geometry.vertices, 3 ) );
 
 				if ( geometry.normals.length > 0 ) {
 
-					buffergeometry.addAttribute( 'normal', new THREE.Float32BufferAttribute( geometry.normals, 3 ) );
+					buffergeometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( geometry.normals, 3 ) );
 
 				} else {
 
@@ -653,13 +653,13 @@ THREE.OBJLoader = ( function () {
 				if ( geometry.colors.length > 0 ) {
 
 					hasVertexColors = true;
-					buffergeometry.addAttribute( 'color', new THREE.Float32BufferAttribute( geometry.colors, 3 ) );
+					buffergeometry.setAttribute( 'color', new THREE.Float32BufferAttribute( geometry.colors, 3 ) );
 
 				}
 
 				if ( geometry.uvs.length > 0 ) {
 
-					buffergeometry.addAttribute( 'uv', new THREE.Float32BufferAttribute( geometry.uvs, 2 ) );
+					buffergeometry.setAttribute( 'uv', new THREE.Float32BufferAttribute( geometry.uvs, 2 ) );
 
 				}
 

+ 3 - 3
examples/js/loaders/PCDLoader.js

@@ -267,9 +267,9 @@ THREE.PCDLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 
 		var geometry = new THREE.BufferGeometry();
 
-		if ( position.length > 0 ) geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( position, 3 ) );
-		if ( normal.length > 0 ) geometry.addAttribute( 'normal', new THREE.Float32BufferAttribute( normal, 3 ) );
-		if ( color.length > 0 ) geometry.addAttribute( 'color', new THREE.Float32BufferAttribute( color, 3 ) );
+		if ( position.length > 0 ) geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( position, 3 ) );
+		if ( normal.length > 0 ) geometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( normal, 3 ) );
+		if ( color.length > 0 ) geometry.setAttribute( 'color', new THREE.Float32BufferAttribute( color, 3 ) );
 
 		geometry.computeBoundingSphere();
 

+ 3 - 3
examples/js/loaders/PDBLoader.js

@@ -136,10 +136,10 @@ THREE.PDBLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 
 			// build geometry
 
-			geometryAtoms.addAttribute( 'position', new THREE.Float32BufferAttribute( verticesAtoms, 3 ) );
-			geometryAtoms.addAttribute( 'color', new THREE.Float32BufferAttribute( colorsAtoms, 3 ) );
+			geometryAtoms.setAttribute( 'position', new THREE.Float32BufferAttribute( verticesAtoms, 3 ) );
+			geometryAtoms.setAttribute( 'color', new THREE.Float32BufferAttribute( colorsAtoms, 3 ) );
 
-			geometryBonds.addAttribute( 'position', new THREE.Float32BufferAttribute( verticesBonds, 3 ) );
+			geometryBonds.setAttribute( 'position', new THREE.Float32BufferAttribute( verticesBonds, 3 ) );
 
 			return build;
 

+ 5 - 5
examples/js/loaders/PLYLoader.js

@@ -296,32 +296,32 @@ THREE.PLYLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 
 			}
 
-			geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( buffer.vertices, 3 ) );
+			geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( buffer.vertices, 3 ) );
 
 			// optional buffer data
 
 			if ( buffer.normals.length > 0 ) {
 
-				geometry.addAttribute( 'normal', new THREE.Float32BufferAttribute( buffer.normals, 3 ) );
+				geometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( buffer.normals, 3 ) );
 
 			}
 
 			if ( buffer.uvs.length > 0 ) {
 
-				geometry.addAttribute( 'uv', new THREE.Float32BufferAttribute( buffer.uvs, 2 ) );
+				geometry.setAttribute( 'uv', new THREE.Float32BufferAttribute( buffer.uvs, 2 ) );
 
 			}
 
 			if ( buffer.colors.length > 0 ) {
 
-				geometry.addAttribute( 'color', new THREE.Float32BufferAttribute( buffer.colors, 3 ) );
+				geometry.setAttribute( 'color', new THREE.Float32BufferAttribute( buffer.colors, 3 ) );
 
 			}
 
 			if ( buffer.faceVertexUvs.length > 0 ) {
 
 				geometry = geometry.toNonIndexed();
-				geometry.addAttribute( 'uv', new THREE.Float32BufferAttribute( buffer.faceVertexUvs, 2 ) );
+				geometry.setAttribute( 'uv', new THREE.Float32BufferAttribute( buffer.faceVertexUvs, 2 ) );
 
 			}
 

+ 1 - 1
examples/js/loaders/PRWMLoader.js

@@ -261,7 +261,7 @@ THREE.PRWMLoader = ( function () {
 			for ( i = 0; i < attributesKey.length; i ++ ) {
 
 				attribute = data.attributes[ attributesKey[ i ] ];
-				bufferGeometry.addAttribute( attributesKey[ i ], new THREE.BufferAttribute( attribute.values, attribute.cardinality, attribute.normalized ) );
+				bufferGeometry.setAttribute( attributesKey[ i ], new THREE.BufferAttribute( attribute.values, attribute.cardinality, attribute.normalized ) );
 
 			}
 

+ 5 - 5
examples/js/loaders/STLLoader.js

@@ -240,12 +240,12 @@ THREE.STLLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 
 			}
 
-			geometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
-			geometry.addAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) );
+			geometry.setAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
+			geometry.setAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) );
 
 			if ( hasColors ) {
 
-				geometry.addAttribute( 'color', new THREE.BufferAttribute( colors, 3 ) );
+				geometry.setAttribute( 'color', new THREE.BufferAttribute( colors, 3 ) );
 				geometry.hasColors = true;
 				geometry.alpha = alpha;
 
@@ -334,8 +334,8 @@ THREE.STLLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 
 			}
 
-			geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
-			geometry.addAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
+			geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
+			geometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
 
 			if ( groupCount > 0 ) {
 

+ 3 - 3
examples/js/loaders/SVGLoader.js

@@ -1213,9 +1213,9 @@ THREE.SVGLoader.pointsToStroke = function ( points, style, arcDivisions, minDist
 	}
 
 	var geometry = new THREE.BufferGeometry();
-	geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
-	geometry.addAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
-	geometry.addAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
+	geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
+	geometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
+	geometry.setAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
 
 	return geometry;
 

+ 2 - 2
examples/js/loaders/TDSLoader.js

@@ -358,7 +358,7 @@ THREE.TDSLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 
 				}
 
-				geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
+				geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
 
 			} else if ( next === FACE_ARRAY ) {
 
@@ -382,7 +382,7 @@ THREE.TDSLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 
 				}
 
-				geometry.addAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
+				geometry.setAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
 
 
 			} else if ( next === MESH_MATRIX ) {

+ 9 - 9
examples/js/loaders/VRMLLoader.js

@@ -1465,13 +1465,13 @@ THREE.VRMLLoader = ( function () {
 				var geometry = new THREE.BufferGeometry();
 				positionAttribute = toNonIndexedAttribute( triangulatedCoordIndex, new THREE.Float32BufferAttribute( coord, 3 ) );
 
-				geometry.addAttribute( 'position', positionAttribute );
-				geometry.addAttribute( 'normal', normalAttribute );
+				geometry.setAttribute( 'position', positionAttribute );
+				geometry.setAttribute( 'normal', normalAttribute );
 
 				// optional attributes
 
-				if ( colorAttribute ) geometry.addAttribute( 'color', colorAttribute );
-				if ( uvAttribute ) geometry.addAttribute( 'uv', uvAttribute );
+				if ( colorAttribute ) geometry.setAttribute( 'color', colorAttribute );
+				if ( uvAttribute ) geometry.setAttribute( 'uv', uvAttribute );
 
 				// "solid" influences the material so let's store it for later use
 
@@ -1592,9 +1592,9 @@ THREE.VRMLLoader = ( function () {
 				var geometry = new THREE.BufferGeometry();
 
 				var positionAttribute = toNonIndexedAttribute( expandedLineIndex, new THREE.Float32BufferAttribute( coord, 3 ) );
-				geometry.addAttribute( 'position', positionAttribute );
+				geometry.setAttribute( 'position', positionAttribute );
 
-				if ( colorAttribute ) geometry.addAttribute( 'color', colorAttribute );
+				if ( colorAttribute ) geometry.setAttribute( 'color', colorAttribute );
 
 				geometry._type = 'line';
 
@@ -1648,8 +1648,8 @@ THREE.VRMLLoader = ( function () {
 
 				var geometry = new THREE.BufferGeometry();
 
-				geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( coord, 3 ) );
-				if ( color ) geometry.addAttribute( 'color', new THREE.Float32BufferAttribute( color, 3 ) );
+				geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( coord, 3 ) );
+				if ( color ) geometry.setAttribute( 'color', new THREE.Float32BufferAttribute( color, 3 ) );
 
 				geometry._type = 'points';
 
@@ -2309,7 +2309,7 @@ THREE.VRMLLoader = ( function () {
 
 				}
 
-				geometry.addAttribute( 'color', colorAttribute );
+				geometry.setAttribute( 'color', colorAttribute );
 
 			}
 

+ 8 - 8
examples/js/loaders/VTKLoader.js

@@ -261,11 +261,11 @@ THREE.VTKLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 
 			var geometry = new THREE.BufferGeometry();
 			geometry.setIndex( indices );
-			geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) );
+			geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) );
 
 			if ( normals.length === positions.length ) {
 
-				geometry.addAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
+				geometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
 
 			}
 
@@ -275,7 +275,7 @@ THREE.VTKLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 
 				if ( colors.length === positions.length ) {
 
-					geometry.addAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
+					geometry.setAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
 
 				}
 
@@ -302,7 +302,7 @@ THREE.VTKLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 
 					}
 
-					geometry.addAttribute( 'color', new THREE.Float32BufferAttribute( newColors, 3 ) );
+					geometry.setAttribute( 'color', new THREE.Float32BufferAttribute( newColors, 3 ) );
 
 				}
 
@@ -508,11 +508,11 @@ THREE.VTKLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 
 			var geometry = new THREE.BufferGeometry();
 			geometry.setIndex( new THREE.BufferAttribute( indices, 1 ) );
-			geometry.addAttribute( 'position', new THREE.BufferAttribute( points, 3 ) );
+			geometry.setAttribute( 'position', new THREE.BufferAttribute( points, 3 ) );
 
 			if ( normals.length === points.length ) {
 
-				geometry.addAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) );
+				geometry.setAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) );
 
 			}
 
@@ -1112,11 +1112,11 @@ THREE.VTKLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 
 				var geometry = new THREE.BufferGeometry();
 				geometry.setIndex( new THREE.BufferAttribute( indices, 1 ) );
-				geometry.addAttribute( 'position', new THREE.BufferAttribute( points, 3 ) );
+				geometry.setAttribute( 'position', new THREE.BufferAttribute( points, 3 ) );
 
 				if ( normals.length === points.length ) {
 
-					geometry.addAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) );
+					geometry.setAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) );
 
 				}
 

+ 5 - 5
examples/js/loaders/XLoader.js

@@ -972,11 +972,11 @@ THREE.XLoader = ( function () {
 
 				//
 
-				bufferGeometry.addAttribute( 'position', new THREE.Float32BufferAttribute( position, 3 ) );
-				bufferGeometry.addAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
-				bufferGeometry.addAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
-				bufferGeometry.addAttribute( 'skinIndex', new THREE.Uint16BufferAttribute( skinIndices, 4 ) );
-				bufferGeometry.addAttribute( 'skinWeight', new THREE.Float32BufferAttribute( skinWeights, 4 ) );
+				bufferGeometry.setAttribute( 'position', new THREE.Float32BufferAttribute( position, 3 ) );
+				bufferGeometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
+				bufferGeometry.setAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
+				bufferGeometry.setAttribute( 'skinIndex', new THREE.Uint16BufferAttribute( skinIndices, 4 ) );
+				bufferGeometry.setAttribute( 'skinWeight', new THREE.Float32BufferAttribute( skinWeights, 4 ) );
 
 				this._computeGroups( bufferGeometry, data.materialIndices );
 

+ 10 - 10
examples/js/loaders/deprecated/LegacyGLTFLoader.js

@@ -1608,35 +1608,35 @@ THREE.LegacyGLTFLoader = ( function () {
 							switch ( attributeId ) {
 
 								case 'POSITION':
-									geometry.addAttribute( 'position', bufferAttribute );
+									geometry.setAttribute( 'position', bufferAttribute );
 									break;
 
 								case 'NORMAL':
-									geometry.addAttribute( 'normal', bufferAttribute );
+									geometry.setAttribute( 'normal', bufferAttribute );
 									break;
 
 								case 'TEXCOORD_0':
 								case 'TEXCOORD0':
 								case 'TEXCOORD':
-									geometry.addAttribute( 'uv', bufferAttribute );
+									geometry.setAttribute( 'uv', bufferAttribute );
 									break;
 
 								case 'TEXCOORD_1':
-									geometry.addAttribute( 'uv2', bufferAttribute );
+									geometry.setAttribute( 'uv2', bufferAttribute );
 									break;
 
 								case 'COLOR_0':
 								case 'COLOR0':
 								case 'COLOR':
-									geometry.addAttribute( 'color', bufferAttribute );
+									geometry.setAttribute( 'color', bufferAttribute );
 									break;
 
 								case 'WEIGHT':
-									geometry.addAttribute( 'skinWeight', bufferAttribute );
+									geometry.setAttribute( 'skinWeight', bufferAttribute );
 									break;
 
 								case 'JOINT':
-									geometry.addAttribute( 'skinIndex', bufferAttribute );
+									geometry.setAttribute( 'skinIndex', bufferAttribute );
 									break;
 
 								default:
@@ -1653,7 +1653,7 @@ THREE.LegacyGLTFLoader = ( function () {
 
 										if ( parameters[ attributeName ][ 'semantic' ] === attributeId ) {
 
-											geometry.addAttribute( attributeName, bufferAttribute );
+											geometry.setAttribute( attributeName, bufferAttribute );
 
 										}
 
@@ -1696,13 +1696,13 @@ THREE.LegacyGLTFLoader = ( function () {
 							switch ( attributeId ) {
 
 								case 'POSITION':
-									geometry.addAttribute( 'position', bufferAttribute );
+									geometry.setAttribute( 'position', bufferAttribute );
 									break;
 
 								case 'COLOR_0':
 								case 'COLOR0':
 								case 'COLOR':
-									geometry.addAttribute( 'color', bufferAttribute );
+									geometry.setAttribute( 'color', bufferAttribute );
 									break;
 
 							}

+ 9 - 9
examples/js/misc/RollerCoaster.js

@@ -206,9 +206,9 @@ THREE.RollerCoasterGeometry = function ( curve, divisions ) {
 
 	// console.log( vertices.length );
 
-	this.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( vertices ), 3 ) );
-	this.addAttribute( 'normal', new THREE.BufferAttribute( new Float32Array( normals ), 3 ) );
-	this.addAttribute( 'color', new THREE.BufferAttribute( new Float32Array( colors ), 3 ) );
+	this.setAttribute( 'position', new THREE.BufferAttribute( new Float32Array( vertices ), 3 ) );
+	this.setAttribute( 'normal', new THREE.BufferAttribute( new Float32Array( normals ), 3 ) );
+	this.setAttribute( 'color', new THREE.BufferAttribute( new Float32Array( colors ), 3 ) );
 
 };
 
@@ -381,8 +381,8 @@ THREE.RollerCoasterLiftersGeometry = function ( curve, divisions ) {
 
 	}
 
-	this.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( vertices ), 3 ) );
-	this.addAttribute( 'normal', new THREE.BufferAttribute( new Float32Array( normals ), 3 ) );
+	this.setAttribute( 'position', new THREE.BufferAttribute( new Float32Array( vertices ), 3 ) );
+	this.setAttribute( 'normal', new THREE.BufferAttribute( new Float32Array( normals ), 3 ) );
 
 };
 
@@ -452,7 +452,7 @@ THREE.RollerCoasterShadowGeometry = function ( curve, divisions ) {
 
 	}
 
-	this.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( vertices ), 3 ) );
+	this.setAttribute( 'position', new THREE.BufferAttribute( new Float32Array( vertices ), 3 ) );
 
 };
 
@@ -483,7 +483,7 @@ THREE.SkyGeometry = function () {
 	}
 
 
-	this.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( vertices ), 3 ) );
+	this.setAttribute( 'position', new THREE.BufferAttribute( new Float32Array( vertices ), 3 ) );
 
 };
 
@@ -536,8 +536,8 @@ THREE.TreesGeometry = function ( landscape ) {
 
 	}
 
-	this.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( vertices ), 3 ) );
-	this.addAttribute( 'color', new THREE.BufferAttribute( new Float32Array( colors ), 3 ) );
+	this.setAttribute( 'position', new THREE.BufferAttribute( new Float32Array( vertices ), 3 ) );
+	this.setAttribute( 'color', new THREE.BufferAttribute( new Float32Array( colors ), 3 ) );
 
 };
 

+ 1 - 1
examples/js/modifiers/SimplifyModifier.js

@@ -484,7 +484,7 @@ THREE.SimplifyModifier = function () {};
 
 		//
 
-		simplifiedGeometry.addAttribute( 'position', new THREE.Float32BufferAttribute( position, 3 ) );
+		simplifiedGeometry.setAttribute( 'position', new THREE.Float32BufferAttribute( position, 3 ) );
 		simplifiedGeometry.setIndex( index );
 
 		return simplifiedGeometry;

+ 2 - 2
examples/js/objects/Lensflare.js

@@ -369,8 +369,8 @@ THREE.Lensflare.Geometry = ( function () {
 	var interleavedBuffer = new THREE.InterleavedBuffer( float32Array, 5 );
 
 	geometry.setIndex( [ 0, 1, 2,	0, 2, 3 ] );
-	geometry.addAttribute( 'position', new THREE.InterleavedBufferAttribute( interleavedBuffer, 3, 0, false ) );
-	geometry.addAttribute( 'uv', new THREE.InterleavedBufferAttribute( interleavedBuffer, 2, 3, false ) );
+	geometry.setAttribute( 'position', new THREE.InterleavedBufferAttribute( interleavedBuffer, 3, 0, false ) );
+	geometry.setAttribute( 'uv', new THREE.InterleavedBufferAttribute( interleavedBuffer, 2, 3, false ) );
 
 	return geometry;
 

+ 4 - 4
examples/js/objects/MarchingCubes.js

@@ -954,13 +954,13 @@ THREE.MarchingCubes = function ( resolution, material, enableUvs, enableColors )
 		this.render( geo_callback );
 
 		if ( this.hasPositions )
-			geo.addAttribute( "position", new THREE.BufferAttribute( posArray, 3 ) );
+			geo.setAttribute( "position", new THREE.BufferAttribute( posArray, 3 ) );
 		if ( this.hasNormals )
-			geo.addAttribute( "normal", new THREE.BufferAttribute( normArray, 3 ) );
+			geo.setAttribute( "normal", new THREE.BufferAttribute( normArray, 3 ) );
 		if ( this.hasColors )
-			geo.addAttribute( "color", new THREE.BufferAttribute( colorArray, 3 ) );
+			geo.setAttribute( "color", new THREE.BufferAttribute( colorArray, 3 ) );
 		if ( this.hasUvs )
-			geo.addAttribute( "uv", new THREE.BufferAttribute( uvArray, 2 ) );
+			geo.setAttribute( "uv", new THREE.BufferAttribute( uvArray, 2 ) );
 
 		return geo;
 

+ 3 - 3
examples/js/utils/BufferGeometryUtils.js

@@ -31,7 +31,7 @@ THREE.BufferGeometryUtils = {
 
 		if ( attributes.tangent === undefined ) {
 
-			geometry.addAttribute( 'tangent', new THREE.BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) );
+			geometry.setAttribute( 'tangent', new THREE.BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) );
 
 		}
 
@@ -299,7 +299,7 @@ THREE.BufferGeometryUtils = {
 
 			if ( ! mergedAttribute ) return null;
 
-			mergedGeometry.addAttribute( name, mergedAttribute );
+			mergedGeometry.setAttribute( name, mergedAttribute );
 
 		}
 
@@ -593,7 +593,7 @@ THREE.BufferGeometryUtils = {
 			var buffer = new oldAttribute.array.constructor( attrArrays[ name ] );
 			var attribute = new THREE.BufferAttribute( buffer, oldAttribute.itemSize, oldAttribute.normalized );
 
-			result.addAttribute( name, attribute );
+			result.setAttribute( name, attribute );
 
 			// Update the attribute arrays
 			if ( name in morphAttrsArrays ) {

+ 1 - 1
examples/jsm/animation/CCDIKSolver.js

@@ -414,7 +414,7 @@ var CCDIKSolver = ( function () {
 
 				var geometry = new BufferGeometry();
 				var vertices = new Float32Array( ( 2 + ik.links.length ) * 3 );
-				geometry.addAttribute( 'position', new BufferAttribute( vertices, 3 ) );
+				geometry.setAttribute( 'position', new BufferAttribute( vertices, 3 ) );
 
 				return geometry;
 

+ 3 - 3
examples/jsm/controls/TransformControls.js

@@ -774,7 +774,7 @@ var TransformControlsGizmo = function () {
 	var scaleHandleGeometry = new BoxBufferGeometry( 0.125, 0.125, 0.125 );
 
 	var lineGeometry = new BufferGeometry( );
-	lineGeometry.addAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0,	1, 0, 0 ], 3 ) );
+	lineGeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0,	1, 0, 0 ], 3 ) );
 
 	var CircleGeometry = function ( radius, arc ) {
 
@@ -787,7 +787,7 @@ var TransformControlsGizmo = function () {
 
 		}
 
-		geometry.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+		geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
 
 		return geometry;
 
@@ -799,7 +799,7 @@ var TransformControlsGizmo = function () {
 
 		var geometry = new BufferGeometry();
 
-		geometry.addAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 1, 1, 1 ], 3 ) );
+		geometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 1, 1, 1 ], 3 ) );
 
 		return geometry;
 

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

@@ -1239,7 +1239,7 @@ GLTFExporter.prototype = {
 
 				console.warn( 'THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one.' );
 
-				geometry.addAttribute( 'normal', createNormalizedNormalAttribute( originalNormal ) );
+				geometry.setAttribute( 'normal', createNormalizedNormalAttribute( originalNormal ) );
 
 			}
 
@@ -1293,7 +1293,7 @@ GLTFExporter.prototype = {
 
 			}
 
-			if ( originalNormal !== undefined ) geometry.addAttribute( 'normal', originalNormal );
+			if ( originalNormal !== undefined ) geometry.setAttribute( 'normal', originalNormal );
 
 			// Skip if no exportable attributes found
 			if ( Object.keys( attributes ).length === 0 ) {

+ 1 - 1
examples/jsm/geometries/BoxLineGeometry.js

@@ -64,7 +64,7 @@ var BoxLineGeometry = function ( width, height, depth, widthSegments, heightSegm
 
 	}
 
-	this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+	this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
 
 };
 

+ 2 - 2
examples/jsm/geometries/ConvexGeometry.js

@@ -68,8 +68,8 @@ var ConvexBufferGeometry = function ( points ) {
 
 	// build geometry
 
-	this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
-	this.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+	this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+	this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
 
 };
 

+ 3 - 3
examples/jsm/geometries/DecalGeometry.js

@@ -51,9 +51,9 @@ var DecalGeometry = function ( mesh, position, orientation, size ) {
 
 	// build geometry
 
-	this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
-	this.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
-	this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
+	this.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+	this.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+	this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
 
 	function generate() {
 

+ 2 - 2
examples/jsm/geometries/LightningStrike.js

@@ -429,12 +429,12 @@ LightningStrike.prototype.createMesh = function () {
 	this.setIndex( new Uint32BufferAttribute( this.indices, 1 ) );
 
 	this.positionAttribute = new Float32BufferAttribute( this.vertices, 3 );
-	this.addAttribute( 'position', this.positionAttribute );
+	this.setAttribute( 'position', this.positionAttribute );
 
 	if ( this.generateUVs ) {
 
 		this.uvsAttribute = new Float32BufferAttribute( new Float32Array( this.uvs ), 2 );
-		this.addAttribute( 'uv', this.uvsAttribute );
+		this.setAttribute( 'uv', this.uvsAttribute );
 
 	}
 

+ 3 - 3
examples/jsm/geometries/TeapotBufferGeometry.js

@@ -710,9 +710,9 @@ var TeapotBufferGeometry = function ( size, segments, bottom, lid, body, fitLid,
 	}
 
 	this.setIndex( new BufferAttribute( indices, 1 ) );
-	this.addAttribute( 'position', new BufferAttribute( vertices, 3 ) );
-	this.addAttribute( 'normal', new BufferAttribute( normals, 3 ) );
-	this.addAttribute( 'uv', new BufferAttribute( uvs, 2 ) );
+	this.setAttribute( 'position', new BufferAttribute( vertices, 3 ) );
+	this.setAttribute( 'normal', new BufferAttribute( normals, 3 ) );
+	this.setAttribute( 'uv', new BufferAttribute( uvs, 2 ) );
 
 	this.computeBoundingSphere();
 

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

@@ -54,8 +54,8 @@ LineSegments2.prototype = Object.assign( Object.create( Mesh.prototype ), {
 
 			var instanceDistanceBuffer = new InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1
 
-			geometry.addAttribute( 'instanceDistanceStart', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0
-			geometry.addAttribute( 'instanceDistanceEnd', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1
+			geometry.setAttribute( 'instanceDistanceStart', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0
+			geometry.setAttribute( 'instanceDistanceEnd', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1
 
 			return this;
 

+ 6 - 6
examples/jsm/lines/LineSegmentsGeometry.js

@@ -25,8 +25,8 @@ var LineSegmentsGeometry = function () {
 	var index = [ 0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5 ];
 
 	this.setIndex( index );
-	this.addAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );
-	this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
+	this.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );
+	this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
 
 };
 
@@ -83,8 +83,8 @@ LineSegmentsGeometry.prototype = Object.assign( Object.create( InstancedBufferGe
 
 		var instanceBuffer = new InstancedInterleavedBuffer( lineSegments, 6, 1 ); // xyz, xyz
 
-		this.addAttribute( 'instanceStart', new InterleavedBufferAttribute( instanceBuffer, 3, 0 ) ); // xyz
-		this.addAttribute( 'instanceEnd', new InterleavedBufferAttribute( instanceBuffer, 3, 3 ) ); // xyz
+		this.setAttribute( 'instanceStart', new InterleavedBufferAttribute( instanceBuffer, 3, 0 ) ); // xyz
+		this.setAttribute( 'instanceEnd', new InterleavedBufferAttribute( instanceBuffer, 3, 3 ) ); // xyz
 
 		//
 
@@ -111,8 +111,8 @@ LineSegmentsGeometry.prototype = Object.assign( Object.create( InstancedBufferGe
 
 		var instanceColorBuffer = new InstancedInterleavedBuffer( colors, 6, 1 ); // rgb, rgb
 
-		this.addAttribute( 'instanceColorStart', new InterleavedBufferAttribute( instanceColorBuffer, 3, 0 ) ); // rgb
-		this.addAttribute( 'instanceColorEnd', new InterleavedBufferAttribute( instanceColorBuffer, 3, 3 ) ); // rgb
+		this.setAttribute( 'instanceColorStart', new InterleavedBufferAttribute( instanceColorBuffer, 3, 0 ) ); // rgb
+		this.setAttribute( 'instanceColorEnd', new InterleavedBufferAttribute( instanceColorBuffer, 3, 3 ) ); // rgb
 
 		return this;
 

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

@@ -54,8 +54,8 @@ Wireframe.prototype = Object.assign( Object.create( Mesh.prototype ), {
 
 			var instanceDistanceBuffer = new InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1
 
-			geometry.addAttribute( 'instanceDistanceStart', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0
-			geometry.addAttribute( 'instanceDistanceEnd', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1
+			geometry.setAttribute( 'instanceDistanceStart', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0
+			geometry.setAttribute( 'instanceDistanceEnd', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1
 
 			return this;
 

+ 1 - 1
examples/jsm/loaders/3MFLoader.js

@@ -566,7 +566,7 @@ ThreeMFLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 			var geometry = new BufferGeometry();
 			geometry.setIndex( new BufferAttribute( meshData[ 'triangles' ], 1 ) );
-			geometry.addAttribute( 'position', new BufferAttribute( meshData[ 'vertices' ], 3 ) );
+			geometry.setAttribute( 'position', new BufferAttribute( meshData[ 'vertices' ], 3 ) );
 
 			// groups
 

+ 2 - 2
examples/jsm/loaders/AMFLoader.js

@@ -468,11 +468,11 @@ AMFLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 					var material = objDefaultMaterial;
 
 					newGeometry.setIndex( volume.triangles );
-					newGeometry.addAttribute( 'position', vertices.clone() );
+					newGeometry.setAttribute( 'position', vertices.clone() );
 
 					if ( normals ) {
 
-						newGeometry.addAttribute( 'normal', normals.clone() );
+						newGeometry.setAttribute( 'normal', normals.clone() );
 
 					}
 

+ 4 - 4
examples/jsm/loaders/AWDLoader.js

@@ -755,7 +755,7 @@ var AWDLoader = ( function () {
 						buffer = new Float32Array( ( str_len / 12 ) * 3 );
 						attrib = new BufferAttribute( buffer, 3 );
 
-						geom.addAttribute( 'position', attrib );
+						geom.setAttribute( 'position', attrib );
 						idx = 0;
 
 						while ( this._ptr < str_end ) {
@@ -793,7 +793,7 @@ var AWDLoader = ( function () {
 						buffer = new Float32Array( ( str_len / 8 ) * 2 );
 						attrib = new BufferAttribute( buffer, 2 );
 
-						geom.addAttribute( 'uv', attrib );
+						geom.setAttribute( 'uv', attrib );
 						idx = 0;
 
 						while ( this._ptr < str_end ) {
@@ -810,7 +810,7 @@ var AWDLoader = ( function () {
 
 						buffer = new Float32Array( ( str_len / 12 ) * 3 );
 						attrib = new BufferAttribute( buffer, 3 );
-						geom.addAttribute( 'normal', attrib );
+						geom.setAttribute( 'normal', attrib );
 						idx = 0;
 
 						while ( this._ptr < str_end ) {
@@ -917,7 +917,7 @@ var AWDLoader = ( function () {
 
 						if ( streamtypes[ streamsParsed ] === 1 ) {
 
-							//geom.addAttribute( 'morphTarget'+frames_parsed, Float32Array, str_len/12, 3 );
+							//geom.setAttribute( 'morphTarget'+frames_parsed, Float32Array, str_len/12, 3 );
 							var buffer = new Float32Array( str_len / 4 );
 							geom.morphTargets.push( {
 								array: buffer

+ 4 - 4
examples/jsm/loaders/AssimpJSONLoader.js

@@ -116,23 +116,23 @@ AssimpJSONLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 			}
 
 			geometry.setIndex( indices );
-			geometry.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+			geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
 
 			if ( normals.length > 0 ) {
 
-				geometry.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+				geometry.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
 
 			}
 
 			if ( uvs.length > 0 ) {
 
-				geometry.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
+				geometry.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
 
 			}
 
 			if ( colors.length > 0 ) {
 
-				geometry.addAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );
+				geometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );
 
 			}
 

+ 9 - 9
examples/jsm/loaders/AssimpLoader.js

@@ -692,19 +692,19 @@ AssimpLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 				else
 					mat = new MeshLambertMaterial();
 				geometry.setIndex( new BufferAttribute( new Uint32Array( this.mIndexArray ), 1 ) );
-				geometry.addAttribute( 'position', new BufferAttribute( this.mVertexBuffer, 3 ) );
+				geometry.setAttribute( 'position', new BufferAttribute( this.mVertexBuffer, 3 ) );
 				if ( this.mNormalBuffer && this.mNormalBuffer.length > 0 )
-					geometry.addAttribute( 'normal', new BufferAttribute( this.mNormalBuffer, 3 ) );
+					geometry.setAttribute( 'normal', new BufferAttribute( this.mNormalBuffer, 3 ) );
 				if ( this.mColorBuffer && this.mColorBuffer.length > 0 )
-					geometry.addAttribute( 'color', new BufferAttribute( this.mColorBuffer, 4 ) );
+					geometry.setAttribute( 'color', new BufferAttribute( this.mColorBuffer, 4 ) );
 				if ( this.mTexCoordsBuffers[ 0 ] && this.mTexCoordsBuffers[ 0 ].length > 0 )
-					geometry.addAttribute( 'uv', new BufferAttribute( new Float32Array( this.mTexCoordsBuffers[ 0 ] ), 2 ) );
+					geometry.setAttribute( 'uv', new BufferAttribute( new Float32Array( this.mTexCoordsBuffers[ 0 ] ), 2 ) );
 				if ( this.mTexCoordsBuffers[ 1 ] && this.mTexCoordsBuffers[ 1 ].length > 0 )
-					geometry.addAttribute( 'uv1', new BufferAttribute( new Float32Array( this.mTexCoordsBuffers[ 1 ] ), 2 ) );
+					geometry.setAttribute( 'uv1', new BufferAttribute( new Float32Array( this.mTexCoordsBuffers[ 1 ] ), 2 ) );
 				if ( this.mTangentBuffer && this.mTangentBuffer.length > 0 )
-					geometry.addAttribute( 'tangents', new BufferAttribute( this.mTangentBuffer, 3 ) );
+					geometry.setAttribute( 'tangents', new BufferAttribute( this.mTangentBuffer, 3 ) );
 				if ( this.mBitangentBuffer && this.mBitangentBuffer.length > 0 )
-					geometry.addAttribute( 'bitangents', new BufferAttribute( this.mBitangentBuffer, 3 ) );
+					geometry.setAttribute( 'bitangents', new BufferAttribute( this.mBitangentBuffer, 3 ) );
 				if ( this.mBones.length > 0 ) {
 
 					var weights = [];
@@ -757,8 +757,8 @@ AssimpLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 					}
 
-					geometry.addAttribute( 'skinWeight', new BufferAttribute( new Float32Array( _weights ), BONESPERVERT ) );
-					geometry.addAttribute( 'skinIndex', new BufferAttribute( new Float32Array( _bones ), BONESPERVERT ) );
+					geometry.setAttribute( 'skinWeight', new BufferAttribute( new Float32Array( _weights ), BONESPERVERT ) );
+					geometry.setAttribute( 'skinIndex', new BufferAttribute( new Float32Array( _bones ), BONESPERVERT ) );
 
 				}
 

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

@@ -2426,14 +2426,14 @@ ColladaLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 			// build geometry
 
-			if ( position.array.length > 0 ) geometry.addAttribute( 'position', new Float32BufferAttribute( position.array, position.stride ) );
-			if ( normal.array.length > 0 ) geometry.addAttribute( 'normal', new Float32BufferAttribute( normal.array, normal.stride ) );
-			if ( color.array.length > 0 ) geometry.addAttribute( 'color', new Float32BufferAttribute( color.array, color.stride ) );
-			if ( uv.array.length > 0 ) geometry.addAttribute( 'uv', new Float32BufferAttribute( uv.array, uv.stride ) );
-			if ( uv2.array.length > 0 ) geometry.addAttribute( 'uv2', new Float32BufferAttribute( uv2.array, uv2.stride ) );
-
-			if ( skinIndex.array.length > 0 ) geometry.addAttribute( 'skinIndex', new Float32BufferAttribute( skinIndex.array, skinIndex.stride ) );
-			if ( skinWeight.array.length > 0 ) geometry.addAttribute( 'skinWeight', new Float32BufferAttribute( skinWeight.array, skinWeight.stride ) );
+			if ( position.array.length > 0 ) geometry.setAttribute( 'position', new Float32BufferAttribute( position.array, position.stride ) );
+			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 ( 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 ) );
 
 			build.data = geometry;
 			build.type = primitives[ 0 ].type;

+ 1 - 1
examples/jsm/loaders/DRACOLoader.js

@@ -205,7 +205,7 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 			var array = attribute.array;
 			var itemSize = attribute.itemSize;
 
-			geometry.addAttribute( name, new BufferAttribute( array, itemSize ) );
+			geometry.setAttribute( name, new BufferAttribute( array, itemSize ) );
 
 		}
 

+ 7 - 7
examples/jsm/loaders/FBXLoader.js

@@ -1640,19 +1640,19 @@ var FBXLoader = ( function () {
 
 			preTransform.applyToBufferAttribute( positionAttribute );
 
-			geo.addAttribute( 'position', positionAttribute );
+			geo.setAttribute( 'position', positionAttribute );
 
 			if ( buffers.colors.length > 0 ) {
 
-				geo.addAttribute( 'color', new Float32BufferAttribute( buffers.colors, 3 ) );
+				geo.setAttribute( 'color', new Float32BufferAttribute( buffers.colors, 3 ) );
 
 			}
 
 			if ( skeleton ) {
 
-				geo.addAttribute( 'skinIndex', new Uint16BufferAttribute( buffers.weightsIndices, 4 ) );
+				geo.setAttribute( 'skinIndex', new Uint16BufferAttribute( buffers.weightsIndices, 4 ) );
 
-				geo.addAttribute( 'skinWeight', new Float32BufferAttribute( buffers.vertexWeights, 4 ) );
+				geo.setAttribute( 'skinWeight', new Float32BufferAttribute( buffers.vertexWeights, 4 ) );
 
 				// used later to bind the skeleton to the model
 				geo.FBX_Deformer = skeleton;
@@ -1666,7 +1666,7 @@ var FBXLoader = ( function () {
 				var normalMatrix = new Matrix3().getNormalMatrix( preTransform );
 				normalMatrix.applyToBufferAttribute( normalAttribute );
 
-				geo.addAttribute( 'normal', normalAttribute );
+				geo.setAttribute( 'normal', normalAttribute );
 
 			}
 
@@ -1682,7 +1682,7 @@ var FBXLoader = ( function () {
 
 				}
 
-				geo.addAttribute( name, new Float32BufferAttribute( buffers.uvs[ i ], 2 ) );
+				geo.setAttribute( name, new Float32BufferAttribute( buffers.uvs[ i ], 2 ) );
 
 			} );
 
@@ -2354,7 +2354,7 @@ var FBXLoader = ( function () {
 			} );
 
 			var geometry = new BufferGeometry();
-			geometry.addAttribute( 'position', new BufferAttribute( positions, 3 ) );
+			geometry.setAttribute( 'position', new BufferAttribute( positions, 3 ) );
 
 			return geometry;
 

+ 1 - 1
examples/jsm/loaders/GCodeLoader.js

@@ -186,7 +186,7 @@ GCodeLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 		function addObject( vertex, extruding ) {
 
 			var geometry = new BufferGeometry();
-			geometry.addAttribute( 'position', new Float32BufferAttribute( vertex, 3 ) );
+			geometry.setAttribute( 'position', new Float32BufferAttribute( vertex, 3 ) );
 
 			var segments = new LineSegments( geometry, extruding ? extrudingMaterial : pathMaterial );
 			segments.name = 'layer' + i;

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

@@ -2249,7 +2249,7 @@ var GLTFLoader = ( function () {
 		if ( material.aoMap && geometry.attributes.uv2 === undefined && geometry.attributes.uv !== undefined ) {
 
 			console.log( 'THREE.GLTFLoader: Duplicating UVs to support aoMap.' );
-			geometry.addAttribute( 'uv2', new BufferAttribute( geometry.attributes.uv.array, 2 ) );
+			geometry.setAttribute( 'uv2', new BufferAttribute( geometry.attributes.uv.array, 2 ) );
 
 		}
 
@@ -2443,7 +2443,7 @@ var GLTFLoader = ( function () {
 			return parser.getDependency( 'accessor', accessorIndex )
 				.then( function ( accessor ) {
 
-					geometry.addAttribute( attributeName, accessor );
+					geometry.setAttribute( attributeName, accessor );
 
 				} );
 

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

@@ -468,11 +468,11 @@ var LDrawLoader = ( function () {
 
 		}
 
-		bufferGeometry.addAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );
+		bufferGeometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );
 
 		if ( elementSize === 3 ) {
 
-			bufferGeometry.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+			bufferGeometry.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
 
 		}
 
@@ -526,9 +526,9 @@ var LDrawLoader = ( function () {
 
 			}
 
-			bufferGeometry.addAttribute( 'control0', new BufferAttribute( controlArray0, 3, false ) );
-			bufferGeometry.addAttribute( 'control1', new BufferAttribute( controlArray1, 3, false ) );
-			bufferGeometry.addAttribute( 'direction', new BufferAttribute( directionArray, 3, false ) );
+			bufferGeometry.setAttribute( 'control0', new BufferAttribute( controlArray0, 3, false ) );
+			bufferGeometry.setAttribute( 'control1', new BufferAttribute( controlArray1, 3, false ) );
+			bufferGeometry.setAttribute( 'direction', new BufferAttribute( directionArray, 3, false ) );
 
 		}
 

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

@@ -2282,7 +2282,7 @@ LWOTreeParser.prototype = {
 
 		if ( ! duplicateUVs ) return;
 
-		geometry.addAttribute( 'uv2', new BufferAttribute( geometry.attributes.uv.array, 2 ) );
+		geometry.setAttribute( 'uv2', new BufferAttribute( geometry.attributes.uv.array, 2 ) );
 
 	},
 
@@ -2787,7 +2787,7 @@ GeometryParser.prototype = {
 
 		var geometry = new BufferGeometry();
 
-		geometry.addAttribute( 'position', new Float32BufferAttribute( geoData.points, 3 ) );
+		geometry.setAttribute( 'position', new Float32BufferAttribute( geoData.points, 3 ) );
 
 		var indices = this.splitIndices( geoData.vertexIndices, geoData.polygonDimensions );
 		geometry.setIndex( indices );
@@ -3000,7 +3000,7 @@ GeometryParser.prototype = {
 
 		}
 
-		geometry.addAttribute( 'uv', new Float32BufferAttribute( remappedUVs, 2 ) );
+		geometry.setAttribute( 'uv', new Float32BufferAttribute( remappedUVs, 2 ) );
 
 	},
 

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

@@ -309,9 +309,9 @@ MD2Loader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 			}
 
-			geometry.addAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );
-			geometry.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
-			geometry.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
+			geometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );
+			geometry.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+			geometry.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
 
 			// animation
 

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

@@ -941,11 +941,11 @@ var MMDLoader = ( function () {
 
 			var geometry = new BufferGeometry();
 
-			geometry.addAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );
-			geometry.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
-			geometry.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
-			geometry.addAttribute( 'skinIndex', new Uint16BufferAttribute( skinIndices, 4 ) );
-			geometry.addAttribute( 'skinWeight', new Float32BufferAttribute( skinWeights, 4 ) );
+			geometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );
+			geometry.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+			geometry.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
+			geometry.setAttribute( 'skinIndex', new Uint16BufferAttribute( skinIndices, 4 ) );
+			geometry.setAttribute( 'skinWeight', new Float32BufferAttribute( skinWeights, 4 ) );
 			geometry.setIndex( indices );
 
 			for ( var i = 0, il = groups.length; i < il; i ++ ) {

+ 4 - 4
examples/jsm/loaders/OBJLoader.js

@@ -655,11 +655,11 @@ var OBJLoader = ( function () {
 
 				var buffergeometry = new BufferGeometry();
 
-				buffergeometry.addAttribute( 'position', new Float32BufferAttribute( geometry.vertices, 3 ) );
+				buffergeometry.setAttribute( 'position', new Float32BufferAttribute( geometry.vertices, 3 ) );
 
 				if ( geometry.normals.length > 0 ) {
 
-					buffergeometry.addAttribute( 'normal', new Float32BufferAttribute( geometry.normals, 3 ) );
+					buffergeometry.setAttribute( 'normal', new Float32BufferAttribute( geometry.normals, 3 ) );
 
 				} else {
 
@@ -670,13 +670,13 @@ var OBJLoader = ( function () {
 				if ( geometry.colors.length > 0 ) {
 
 					hasVertexColors = true;
-					buffergeometry.addAttribute( 'color', new Float32BufferAttribute( geometry.colors, 3 ) );
+					buffergeometry.setAttribute( 'color', new Float32BufferAttribute( geometry.colors, 3 ) );
 
 				}
 
 				if ( geometry.uvs.length > 0 ) {
 
-					buffergeometry.addAttribute( 'uv', new Float32BufferAttribute( geometry.uvs, 2 ) );
+					buffergeometry.setAttribute( 'uv', new Float32BufferAttribute( geometry.uvs, 2 ) );
 
 				}
 

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

@@ -278,9 +278,9 @@ PCDLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 		var geometry = new BufferGeometry();
 
-		if ( position.length > 0 ) geometry.addAttribute( 'position', new Float32BufferAttribute( position, 3 ) );
-		if ( normal.length > 0 ) geometry.addAttribute( 'normal', new Float32BufferAttribute( normal, 3 ) );
-		if ( color.length > 0 ) geometry.addAttribute( 'color', new Float32BufferAttribute( color, 3 ) );
+		if ( position.length > 0 ) geometry.setAttribute( 'position', new Float32BufferAttribute( position, 3 ) );
+		if ( normal.length > 0 ) geometry.setAttribute( 'normal', new Float32BufferAttribute( normal, 3 ) );
+		if ( color.length > 0 ) geometry.setAttribute( 'color', new Float32BufferAttribute( color, 3 ) );
 
 		geometry.computeBoundingSphere();
 

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

@@ -143,10 +143,10 @@ PDBLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 			// build geometry
 
-			geometryAtoms.addAttribute( 'position', new Float32BufferAttribute( verticesAtoms, 3 ) );
-			geometryAtoms.addAttribute( 'color', new Float32BufferAttribute( colorsAtoms, 3 ) );
+			geometryAtoms.setAttribute( 'position', new Float32BufferAttribute( verticesAtoms, 3 ) );
+			geometryAtoms.setAttribute( 'color', new Float32BufferAttribute( colorsAtoms, 3 ) );
 
-			geometryBonds.addAttribute( 'position', new Float32BufferAttribute( verticesBonds, 3 ) );
+			geometryBonds.setAttribute( 'position', new Float32BufferAttribute( verticesBonds, 3 ) );
 
 			return build;
 

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

@@ -304,32 +304,32 @@ PLYLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 			}
 
-			geometry.addAttribute( 'position', new Float32BufferAttribute( buffer.vertices, 3 ) );
+			geometry.setAttribute( 'position', new Float32BufferAttribute( buffer.vertices, 3 ) );
 
 			// optional buffer data
 
 			if ( buffer.normals.length > 0 ) {
 
-				geometry.addAttribute( 'normal', new Float32BufferAttribute( buffer.normals, 3 ) );
+				geometry.setAttribute( 'normal', new Float32BufferAttribute( buffer.normals, 3 ) );
 
 			}
 
 			if ( buffer.uvs.length > 0 ) {
 
-				geometry.addAttribute( 'uv', new Float32BufferAttribute( buffer.uvs, 2 ) );
+				geometry.setAttribute( 'uv', new Float32BufferAttribute( buffer.uvs, 2 ) );
 
 			}
 
 			if ( buffer.colors.length > 0 ) {
 
-				geometry.addAttribute( 'color', new Float32BufferAttribute( buffer.colors, 3 ) );
+				geometry.setAttribute( 'color', new Float32BufferAttribute( buffer.colors, 3 ) );
 
 			}
 
 			if ( buffer.faceVertexUvs.length > 0 ) {
 
 				geometry = geometry.toNonIndexed();
-				geometry.addAttribute( 'uv', new Float32BufferAttribute( buffer.faceVertexUvs, 2 ) );
+				geometry.setAttribute( 'uv', new Float32BufferAttribute( buffer.faceVertexUvs, 2 ) );
 
 			}
 

+ 1 - 1
examples/jsm/loaders/PRWMLoader.js

@@ -268,7 +268,7 @@ var PRWMLoader = ( function () {
 			for ( i = 0; i < attributesKey.length; i ++ ) {
 
 				attribute = data.attributes[ attributesKey[ i ] ];
-				bufferGeometry.addAttribute( attributesKey[ i ], new BufferAttribute( attribute.values, attribute.cardinality, attribute.normalized ) );
+				bufferGeometry.setAttribute( attributesKey[ i ], new BufferAttribute( attribute.values, attribute.cardinality, attribute.normalized ) );
 
 			}
 

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

@@ -250,12 +250,12 @@ STLLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 			}
 
-			geometry.addAttribute( 'position', new BufferAttribute( vertices, 3 ) );
-			geometry.addAttribute( 'normal', new BufferAttribute( normals, 3 ) );
+			geometry.setAttribute( 'position', new BufferAttribute( vertices, 3 ) );
+			geometry.setAttribute( 'normal', new BufferAttribute( normals, 3 ) );
 
 			if ( hasColors ) {
 
-				geometry.addAttribute( 'color', new BufferAttribute( colors, 3 ) );
+				geometry.setAttribute( 'color', new BufferAttribute( colors, 3 ) );
 				geometry.hasColors = true;
 				geometry.alpha = alpha;
 
@@ -344,8 +344,8 @@ STLLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 			}
 
-			geometry.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
-			geometry.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+			geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+			geometry.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
 
 			if ( groupCount > 0 ) {
 

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

@@ -1226,9 +1226,9 @@ SVGLoader.pointsToStroke = function ( points, style, arcDivisions, minDistance )
 	}
 
 	var geometry = new BufferGeometry();
-	geometry.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
-	geometry.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
-	geometry.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
+	geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+	geometry.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+	geometry.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
 
 	return geometry;
 

+ 2 - 2
examples/jsm/loaders/TDSLoader.js

@@ -374,7 +374,7 @@ TDSLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 				}
 
-				geometry.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+				geometry.setAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
 
 			} else if ( next === FACE_ARRAY ) {
 
@@ -398,7 +398,7 @@ TDSLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 				}
 
-				geometry.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
+				geometry.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
 
 
 			} else if ( next === MESH_MATRIX ) {

+ 9 - 9
examples/jsm/loaders/VRMLLoader.js

@@ -1499,13 +1499,13 @@ var VRMLLoader = ( function () {
 				var geometry = new BufferGeometry();
 				positionAttribute = toNonIndexedAttribute( triangulatedCoordIndex, new Float32BufferAttribute( coord, 3 ) );
 
-				geometry.addAttribute( 'position', positionAttribute );
-				geometry.addAttribute( 'normal', normalAttribute );
+				geometry.setAttribute( 'position', positionAttribute );
+				geometry.setAttribute( 'normal', normalAttribute );
 
 				// optional attributes
 
-				if ( colorAttribute ) geometry.addAttribute( 'color', colorAttribute );
-				if ( uvAttribute ) geometry.addAttribute( 'uv', uvAttribute );
+				if ( colorAttribute ) geometry.setAttribute( 'color', colorAttribute );
+				if ( uvAttribute ) geometry.setAttribute( 'uv', uvAttribute );
 
 				// "solid" influences the material so let's store it for later use
 
@@ -1626,9 +1626,9 @@ var VRMLLoader = ( function () {
 				var geometry = new BufferGeometry();
 
 				var positionAttribute = toNonIndexedAttribute( expandedLineIndex, new Float32BufferAttribute( coord, 3 ) );
-				geometry.addAttribute( 'position', positionAttribute );
+				geometry.setAttribute( 'position', positionAttribute );
 
-				if ( colorAttribute ) geometry.addAttribute( 'color', colorAttribute );
+				if ( colorAttribute ) geometry.setAttribute( 'color', colorAttribute );
 
 				geometry._type = 'line';
 
@@ -1682,8 +1682,8 @@ var VRMLLoader = ( function () {
 
 				var geometry = new BufferGeometry();
 
-				geometry.addAttribute( 'position', new Float32BufferAttribute( coord, 3 ) );
-				if ( color ) geometry.addAttribute( 'color', new Float32BufferAttribute( color, 3 ) );
+				geometry.setAttribute( 'position', new Float32BufferAttribute( coord, 3 ) );
+				if ( color ) geometry.setAttribute( 'color', new Float32BufferAttribute( color, 3 ) );
 
 				geometry._type = 'points';
 
@@ -2343,7 +2343,7 @@ var VRMLLoader = ( function () {
 
 				}
 
-				geometry.addAttribute( 'color', colorAttribute );
+				geometry.setAttribute( 'color', colorAttribute );
 
 			}
 

+ 8 - 8
examples/jsm/loaders/VTKLoader.js

@@ -271,11 +271,11 @@ VTKLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 			var geometry = new BufferGeometry();
 			geometry.setIndex( indices );
-			geometry.addAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );
+			geometry.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );
 
 			if ( normals.length === positions.length ) {
 
-				geometry.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+				geometry.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
 
 			}
 
@@ -285,7 +285,7 @@ VTKLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 				if ( colors.length === positions.length ) {
 
-					geometry.addAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );
+					geometry.setAttribute( 'color', new Float32BufferAttribute( colors, 3 ) );
 
 				}
 
@@ -312,7 +312,7 @@ VTKLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 					}
 
-					geometry.addAttribute( 'color', new Float32BufferAttribute( newColors, 3 ) );
+					geometry.setAttribute( 'color', new Float32BufferAttribute( newColors, 3 ) );
 
 				}
 
@@ -518,11 +518,11 @@ VTKLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 			var geometry = new BufferGeometry();
 			geometry.setIndex( new BufferAttribute( indices, 1 ) );
-			geometry.addAttribute( 'position', new BufferAttribute( points, 3 ) );
+			geometry.setAttribute( 'position', new BufferAttribute( points, 3 ) );
 
 			if ( normals.length === points.length ) {
 
-				geometry.addAttribute( 'normal', new BufferAttribute( normals, 3 ) );
+				geometry.setAttribute( 'normal', new BufferAttribute( normals, 3 ) );
 
 			}
 
@@ -1122,11 +1122,11 @@ VTKLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 				var geometry = new BufferGeometry();
 				geometry.setIndex( new BufferAttribute( indices, 1 ) );
-				geometry.addAttribute( 'position', new BufferAttribute( points, 3 ) );
+				geometry.setAttribute( 'position', new BufferAttribute( points, 3 ) );
 
 				if ( normals.length === points.length ) {
 
-					geometry.addAttribute( 'normal', new BufferAttribute( normals, 3 ) );
+					geometry.setAttribute( 'normal', new BufferAttribute( normals, 3 ) );
 
 				}
 

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

@@ -994,11 +994,11 @@ var XLoader = ( function () {
 
 				//
 
-				bufferGeometry.addAttribute( 'position', new Float32BufferAttribute( position, 3 ) );
-				bufferGeometry.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
-				bufferGeometry.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
-				bufferGeometry.addAttribute( 'skinIndex', new Uint16BufferAttribute( skinIndices, 4 ) );
-				bufferGeometry.addAttribute( 'skinWeight', new Float32BufferAttribute( skinWeights, 4 ) );
+				bufferGeometry.setAttribute( 'position', new Float32BufferAttribute( position, 3 ) );
+				bufferGeometry.setAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+				bufferGeometry.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
+				bufferGeometry.setAttribute( 'skinIndex', new Uint16BufferAttribute( skinIndices, 4 ) );
+				bufferGeometry.setAttribute( 'skinWeight', new Float32BufferAttribute( skinWeights, 4 ) );
 
 				this._computeGroups( bufferGeometry, data.materialIndices );
 

+ 10 - 10
examples/jsm/loaders/deprecated/LegacyGLTFLoader.js

@@ -1698,35 +1698,35 @@ var LegacyGLTFLoader = ( function () {
 							switch ( attributeId ) {
 
 								case 'POSITION':
-									geometry.addAttribute( 'position', bufferAttribute );
+									geometry.setAttribute( 'position', bufferAttribute );
 									break;
 
 								case 'NORMAL':
-									geometry.addAttribute( 'normal', bufferAttribute );
+									geometry.setAttribute( 'normal', bufferAttribute );
 									break;
 
 								case 'TEXCOORD_0':
 								case 'TEXCOORD0':
 								case 'TEXCOORD':
-									geometry.addAttribute( 'uv', bufferAttribute );
+									geometry.setAttribute( 'uv', bufferAttribute );
 									break;
 
 								case 'TEXCOORD_1':
-									geometry.addAttribute( 'uv2', bufferAttribute );
+									geometry.setAttribute( 'uv2', bufferAttribute );
 									break;
 
 								case 'COLOR_0':
 								case 'COLOR0':
 								case 'COLOR':
-									geometry.addAttribute( 'color', bufferAttribute );
+									geometry.setAttribute( 'color', bufferAttribute );
 									break;
 
 								case 'WEIGHT':
-									geometry.addAttribute( 'skinWeight', bufferAttribute );
+									geometry.setAttribute( 'skinWeight', bufferAttribute );
 									break;
 
 								case 'JOINT':
-									geometry.addAttribute( 'skinIndex', bufferAttribute );
+									geometry.setAttribute( 'skinIndex', bufferAttribute );
 									break;
 
 								default:
@@ -1743,7 +1743,7 @@ var LegacyGLTFLoader = ( function () {
 
 										if ( parameters[ attributeName ][ 'semantic' ] === attributeId ) {
 
-											geometry.addAttribute( attributeName, bufferAttribute );
+											geometry.setAttribute( attributeName, bufferAttribute );
 
 										}
 
@@ -1786,13 +1786,13 @@ var LegacyGLTFLoader = ( function () {
 							switch ( attributeId ) {
 
 								case 'POSITION':
-									geometry.addAttribute( 'position', bufferAttribute );
+									geometry.setAttribute( 'position', bufferAttribute );
 									break;
 
 								case 'COLOR_0':
 								case 'COLOR0':
 								case 'COLOR':
-									geometry.addAttribute( 'color', bufferAttribute );
+									geometry.setAttribute( 'color', bufferAttribute );
 									break;
 
 							}

+ 6 - 6
examples/jsm/loaders/obj2/shared/MeshReceiver.js

@@ -84,7 +84,7 @@ MeshReceiver.prototype = {
 		let bufferGeometry = new BufferGeometry();
 		if ( buffers.vertices !== undefined && buffers.vertices !== null ) {
 
-			bufferGeometry.addAttribute( 'position', new BufferAttribute( new Float32Array( buffers.vertices ), 3 ) );
+			bufferGeometry.setAttribute( 'position', new BufferAttribute( new Float32Array( buffers.vertices ), 3 ) );
 
 		}
 		if ( buffers.indices !== undefined && buffers.indices !== null ) {
@@ -94,12 +94,12 @@ MeshReceiver.prototype = {
 		}
 		if ( buffers.colors !== undefined && buffers.colors !== null ) {
 
-			bufferGeometry.addAttribute( 'color', new BufferAttribute( new Float32Array( buffers.colors ), 3 ) );
+			bufferGeometry.setAttribute( 'color', new BufferAttribute( new Float32Array( buffers.colors ), 3 ) );
 
 		}
 		if ( buffers.normals !== undefined && buffers.normals !== null ) {
 
-			bufferGeometry.addAttribute( 'normal', new BufferAttribute( new Float32Array( buffers.normals ), 3 ) );
+			bufferGeometry.setAttribute( 'normal', new BufferAttribute( new Float32Array( buffers.normals ), 3 ) );
 
 		} else {
 
@@ -108,17 +108,17 @@ MeshReceiver.prototype = {
 		}
 		if ( buffers.uvs !== undefined && buffers.uvs !== null ) {
 
-			bufferGeometry.addAttribute( 'uv', new BufferAttribute( new Float32Array( buffers.uvs ), 2 ) );
+			bufferGeometry.setAttribute( 'uv', new BufferAttribute( new Float32Array( buffers.uvs ), 2 ) );
 
 		}
 		if ( buffers.skinIndex !== undefined && buffers.skinIndex !== null ) {
 
-			bufferGeometry.addAttribute( 'skinIndex', new BufferAttribute( new Uint16Array( buffers.skinIndex ), 4 ) );
+			bufferGeometry.setAttribute( 'skinIndex', new BufferAttribute( new Uint16Array( buffers.skinIndex ), 4 ) );
 
 		}
 		if ( buffers.skinWeight !== undefined && buffers.skinWeight !== null ) {
 
-			bufferGeometry.addAttribute( 'skinWeight', new BufferAttribute( new Float32Array( buffers.skinWeight ), 4 ) );
+			bufferGeometry.setAttribute( 'skinWeight', new BufferAttribute( new Float32Array( buffers.skinWeight ), 4 ) );
 
 		}
 

+ 9 - 9
examples/jsm/misc/RollerCoaster.js

@@ -214,9 +214,9 @@ var RollerCoasterGeometry = function ( curve, divisions ) {
 
 	// console.log( vertices.length );
 
-	this.addAttribute( 'position', new BufferAttribute( new Float32Array( vertices ), 3 ) );
-	this.addAttribute( 'normal', new BufferAttribute( new Float32Array( normals ), 3 ) );
-	this.addAttribute( 'color', new BufferAttribute( new Float32Array( colors ), 3 ) );
+	this.setAttribute( 'position', new BufferAttribute( new Float32Array( vertices ), 3 ) );
+	this.setAttribute( 'normal', new BufferAttribute( new Float32Array( normals ), 3 ) );
+	this.setAttribute( 'color', new BufferAttribute( new Float32Array( colors ), 3 ) );
 
 };
 
@@ -389,8 +389,8 @@ var RollerCoasterLiftersGeometry = function ( curve, divisions ) {
 
 	}
 
-	this.addAttribute( 'position', new BufferAttribute( new Float32Array( vertices ), 3 ) );
-	this.addAttribute( 'normal', new BufferAttribute( new Float32Array( normals ), 3 ) );
+	this.setAttribute( 'position', new BufferAttribute( new Float32Array( vertices ), 3 ) );
+	this.setAttribute( 'normal', new BufferAttribute( new Float32Array( normals ), 3 ) );
 
 };
 
@@ -460,7 +460,7 @@ var RollerCoasterShadowGeometry = function ( curve, divisions ) {
 
 	}
 
-	this.addAttribute( 'position', new BufferAttribute( new Float32Array( vertices ), 3 ) );
+	this.setAttribute( 'position', new BufferAttribute( new Float32Array( vertices ), 3 ) );
 
 };
 
@@ -491,7 +491,7 @@ var SkyGeometry = function () {
 	}
 
 
-	this.addAttribute( 'position', new BufferAttribute( new Float32Array( vertices ), 3 ) );
+	this.setAttribute( 'position', new BufferAttribute( new Float32Array( vertices ), 3 ) );
 
 };
 
@@ -544,8 +544,8 @@ var TreesGeometry = function ( landscape ) {
 
 	}
 
-	this.addAttribute( 'position', new BufferAttribute( new Float32Array( vertices ), 3 ) );
-	this.addAttribute( 'color', new BufferAttribute( new Float32Array( colors ), 3 ) );
+	this.setAttribute( 'position', new BufferAttribute( new Float32Array( vertices ), 3 ) );
+	this.setAttribute( 'color', new BufferAttribute( new Float32Array( colors ), 3 ) );
 
 };
 

+ 1 - 1
examples/jsm/modifiers/SimplifyModifier.js

@@ -491,7 +491,7 @@ var SimplifyModifier = function () {};
 
 		//
 
-		simplifiedGeometry.addAttribute( 'position', new Float32BufferAttribute( position, 3 ) );
+		simplifiedGeometry.setAttribute( 'position', new Float32BufferAttribute( position, 3 ) );
 		simplifiedGeometry.setIndex( index );
 
 		return simplifiedGeometry;

+ 2 - 2
examples/jsm/objects/Lensflare.js

@@ -388,8 +388,8 @@ Lensflare.Geometry = ( function () {
 	var interleavedBuffer = new InterleavedBuffer( float32Array, 5 );
 
 	geometry.setIndex( [ 0, 1, 2,	0, 2, 3 ] );
-	geometry.addAttribute( 'position', new InterleavedBufferAttribute( interleavedBuffer, 3, 0, false ) );
-	geometry.addAttribute( 'uv', new InterleavedBufferAttribute( interleavedBuffer, 2, 3, false ) );
+	geometry.setAttribute( 'position', new InterleavedBufferAttribute( interleavedBuffer, 3, 0, false ) );
+	geometry.setAttribute( 'uv', new InterleavedBufferAttribute( interleavedBuffer, 2, 3, false ) );
 
 	return geometry;
 

+ 4 - 4
examples/jsm/objects/MarchingCubes.js

@@ -962,13 +962,13 @@ var MarchingCubes = function ( resolution, material, enableUvs, enableColors ) {
 		this.render( geo_callback );
 
 		if ( this.hasPositions )
-			geo.addAttribute( "position", new BufferAttribute( posArray, 3 ) );
+			geo.setAttribute( "position", new BufferAttribute( posArray, 3 ) );
 		if ( this.hasNormals )
-			geo.addAttribute( "normal", new BufferAttribute( normArray, 3 ) );
+			geo.setAttribute( "normal", new BufferAttribute( normArray, 3 ) );
 		if ( this.hasColors )
-			geo.addAttribute( "color", new BufferAttribute( colorArray, 3 ) );
+			geo.setAttribute( "color", new BufferAttribute( colorArray, 3 ) );
 		if ( this.hasUvs )
-			geo.addAttribute( "uv", new BufferAttribute( uvArray, 2 ) );
+			geo.setAttribute( "uv", new BufferAttribute( uvArray, 2 ) );
 
 		return geo;
 

+ 3 - 3
examples/jsm/utils/BufferGeometryUtils.js

@@ -40,7 +40,7 @@ var BufferGeometryUtils = {
 
 		if ( attributes.tangent === undefined ) {
 
-			geometry.addAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) );
+			geometry.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) );
 
 		}
 
@@ -308,7 +308,7 @@ var BufferGeometryUtils = {
 
 			if ( ! mergedAttribute ) return null;
 
-			mergedGeometry.addAttribute( name, mergedAttribute );
+			mergedGeometry.setAttribute( name, mergedAttribute );
 
 		}
 
@@ -602,7 +602,7 @@ var BufferGeometryUtils = {
 			var buffer = new oldAttribute.array.constructor( attrArrays[ name ] );
 			var attribute = new BufferAttribute( buffer, oldAttribute.itemSize, oldAttribute.normalized );
 
-			result.addAttribute( name, attribute );
+			result.setAttribute( name, attribute );
 
 			// Update the attribute arrays
 			if ( name in morphAttrsArrays ) {

+ 2 - 2
examples/misc_controls_fly.html

@@ -154,8 +154,8 @@
 
 				}
 
-				starsGeometry[ 0 ].addAttribute( 'position', new THREE.Float32BufferAttribute( vertices1, 3 ) );
-				starsGeometry[ 1 ].addAttribute( 'position', new THREE.Float32BufferAttribute( vertices2, 3 ) );
+				starsGeometry[ 0 ].setAttribute( 'position', new THREE.Float32BufferAttribute( vertices1, 3 ) );
+				starsGeometry[ 1 ].setAttribute( 'position', new THREE.Float32BufferAttribute( vertices2, 3 ) );
 
 				var stars;
 				var starsMaterials = [

+ 2 - 2
examples/misc_controls_pointerlock.html

@@ -222,7 +222,7 @@
 
 				}
 
-				floorGeometry.addAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
+				floorGeometry.setAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
 
 				var floorMaterial = new THREE.MeshBasicMaterial( { vertexColors: THREE.VertexColors } );
 
@@ -244,7 +244,7 @@
 
 				}
 
-				boxGeometry.addAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
+				boxGeometry.setAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
 
 				for ( var i = 0; i < 500; i ++ ) {
 

+ 7 - 7
examples/misc_exporter_gltf.html

@@ -315,8 +315,8 @@
 					0, 0, 1,
 				] );
 
-				geometry.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
-				geometry.addAttribute( 'color', new THREE.BufferAttribute( colors, 3 ) );
+				geometry.setAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
+				geometry.setAttribute( 'color', new THREE.BufferAttribute( colors, 3 ) );
 				object = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { side: THREE.DoubleSide, vertexColors: THREE.VertexColors } ) );
 				object.position.set( 140, - 40, - 250 );
 				object.setDrawMode( THREE.TriangleStripDrawMode );
@@ -341,7 +341,7 @@
 
 				}
 
-				geometry.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
+				geometry.setAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
 				object = new THREE.Line( geometry, new THREE.LineBasicMaterial( { color: 0xffff00 } ) );
 				object.position.set( - 50, 0, - 200 );
 				scene1.add( object );
@@ -364,7 +364,7 @@
 
 				}
 
-				geometry.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
+				geometry.setAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
 				object = new THREE.LineLoop( geometry, new THREE.LineBasicMaterial( { color: 0xffff00 } ) );
 				object.position.set( 0, 0, - 200 );
 
@@ -398,8 +398,8 @@
 					0, 0, 1,
 				] );
 
-				geometry.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
-				geometry.addAttribute( 'color', new THREE.BufferAttribute( colors, 3 ) );
+				geometry.setAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
+				geometry.setAttribute( 'color', new THREE.BufferAttribute( colors, 3 ) );
 				geometry.setDrawRange( 0, numElements );
 
 				object = new THREE.Mesh( geometry, new THREE.MeshBasicMaterial( { side: THREE.DoubleSide, vertexColors: THREE.VertexColors } ) );
@@ -422,7 +422,7 @@
 				}
 
 				var pointsGeo = new THREE.BufferGeometry();
-				pointsGeo.addAttribute( 'position', new THREE.BufferAttribute( pointsArray, 3 ) );
+				pointsGeo.setAttribute( 'position', new THREE.BufferAttribute( pointsArray, 3 ) );
 
 				var pointsMaterial = new THREE.PointsMaterial( { color: 0xffff00, size: 5 } );
 				var points = new THREE.Points( pointsGeo, pointsMaterial );

+ 1 - 1
examples/misc_exporter_obj.html

@@ -245,7 +245,7 @@
 				vertices.push( 50, - 50, 0 );
 				vertices.push( 50, 50, 0 );
 
-				geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
+				geometry.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
 				geometry.computeVertexNormals();
 
 				return geometry;

+ 6 - 6
examples/software_lines_splines.html

@@ -83,13 +83,13 @@
 
 				}
 
-				geometry1.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
-				geometry2.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
-				geometry3.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
+				geometry1.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
+				geometry2.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
+				geometry3.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
 
-				geometry1.addAttribute( 'color', new THREE.Float32BufferAttribute( colors1, 3 ) );
-				geometry2.addAttribute( 'color', new THREE.Float32BufferAttribute( colors2, 3 ) );
-				geometry3.addAttribute( 'color', new THREE.Float32BufferAttribute( colors3, 3 ) );
+				geometry1.setAttribute( 'color', new THREE.Float32BufferAttribute( colors1, 3 ) );
+				geometry2.setAttribute( 'color', new THREE.Float32BufferAttribute( colors2, 3 ) );
+				geometry3.setAttribute( 'color', new THREE.Float32BufferAttribute( colors3, 3 ) );
 
 				// lines
 

+ 4 - 4
examples/software_sandbox.html

@@ -56,7 +56,7 @@
 
 				}
 
-				torusGeometry.addAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
+				torusGeometry.setAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
 
 				torus = new THREE.Mesh( torusGeometry, new THREE.MeshBasicMaterial( { color: 0x0000ff, vertexColors: THREE.VertexColors } ) );
 				scene.add( torus );
@@ -74,7 +74,7 @@
 
 				}
 
-				boxGeometry.addAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
+				boxGeometry.setAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
 
 				cube = new THREE.Mesh( boxGeometry, new THREE.MeshBasicMaterial( { color: 0x00ff00, vertexColors: THREE.VertexColors } ) );
 				scene.position.set( 100, 0, 0 );
@@ -125,8 +125,8 @@
 
 				}
 
-				lineGeometry.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
-				lineGeometry.addAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
+				lineGeometry.setAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
+				lineGeometry.setAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
 
 				var material = new THREE.LineBasicMaterial( { opacity: 1, linewidth: 3, vertexColors: THREE.VertexColors } );
 				var line = new THREE.Line( lineGeometry, material );

部分文件因文件數量過多而無法顯示