Kaynağa Gözat

deprecate BufferAttribute .setArray

aardgoose 5 yıl önce
ebeveyn
işleme
ffb9838cfa
2 değiştirilmiş dosya ile 19 ekleme ve 17 silme
  1. 19 2
      src/Three.Legacy.js
  2. 0 15
      src/core/BufferAttribute.js

+ 19 - 2
src/Three.Legacy.js

@@ -1164,13 +1164,30 @@ Object.defineProperties( BufferAttribute.prototype, {
 			return this.array.length;
 
 		}
-	},
+	}
+
+} );
+
+Object.assign( BufferAttribute.prototype, {
 	copyIndicesArray: function ( /* indices */ ) {
 
 		console.error( 'THREE.BufferAttribute: .copyIndicesArray() has been removed.' );
 
-	}
+	},
+	setArray: function ( array ) {
+
+		if ( Array.isArray( array ) ) {
 
+			throw new TypeError( 'THREE.BufferAttribute: array should be a Typed Array.' );
+
+		}
+
+		this.count = array !== undefined ? array.length / this.itemSize : 0;
+		this.array = array;
+
+		return this;
+
+	},
 } );
 
 Object.assign( BufferGeometry.prototype, {

+ 0 - 15
src/core/BufferAttribute.js

@@ -45,21 +45,6 @@ Object.assign( BufferAttribute.prototype, {
 
 	onUploadCallback: function () {},
 
-	setArray: function ( array ) {
-
-		if ( Array.isArray( array ) ) {
-
-			throw new TypeError( 'THREE.BufferAttribute: array should be a Typed Array.' );
-
-		}
-
-		this.count = array !== undefined ? array.length / this.itemSize : 0;
-		this.array = array;
-
-		return this;
-
-	},
-
 	setDynamic: function ( value ) {
 
 		this.dynamic = value;