瀏覽代碼

deprecate InterleavedBuffer .setArray

aardgoose 5 年之前
父節點
當前提交
accb3eb7bf
共有 2 個文件被更改,包括 22 次插入15 次删除
  1. 22 0
      src/Three.Legacy.js
  2. 0 15
      src/core/InterleavedBuffer.js

+ 22 - 0
src/Three.Legacy.js

@@ -19,6 +19,7 @@ import {
 	BufferAttribute
 } from './core/BufferAttribute.js';
 import { BufferGeometry } from './core/BufferGeometry.js';
+import { InterleavedBuffer } from './core/InterleavedBuffer.js';
 import { Face3 } from './core/Face3.js';
 import { Geometry } from './core/Geometry.js';
 import { Object3D } from './core/Object3D.js';
@@ -1231,6 +1232,27 @@ Object.defineProperties( BufferGeometry.prototype, {
 
 } );
 
+Object.assign( InterleavedBuffer.prototype, {
+
+	setArray: function ( array ) {
+
+		if ( Array.isArray( array ) ) {
+
+			throw new TypeError( 'THREE.BufferAttribute: array should be a Typed Array.' );
+
+		}
+
+		console.warn( 'THREE.InterleavedBuffer: .setArray has been deprecatted. Use BufferGeometry.setAttribute to replace/resize attribute buffers' );
+
+		this.count = array !== undefined ? array.length / this.stride : 0;
+		this.array = array;
+
+		return this;
+
+	},
+
+} );
+
 //
 
 Object.assign( ExtrudeBufferGeometry.prototype, {

+ 0 - 15
src/core/InterleavedBuffer.js

@@ -32,21 +32,6 @@ Object.assign( InterleavedBuffer.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.stride : 0;
-		this.array = array;
-
-		return this;
-
-	},
-
 	setDynamic: function ( value ) {
 
 		this.dynamic = value;