Browse Source

Merge branch 'dev' into animation-mixer-set-time-method

Bug-Reaper 5 years ago
parent
commit
4c854e8c40

+ 40 - 34
build/three.js

@@ -8869,21 +8869,6 @@
 
 
 		onUploadCallback: function () {},
 		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 ) {
 		setDynamic: function ( value ) {
 
 
 			this.dynamic = value;
 			this.dynamic = value;
@@ -9635,9 +9620,7 @@
 
 
 			}
 			}
 
 
-			this.attributes[ name ] = attribute;
-
-			return this;
+			return this.setAttribute( name, attribute );
 
 
 		},
 		},
 
 
@@ -9647,6 +9630,14 @@
 
 
 		},
 		},
 
 
+		setAttribute: function ( name, attribute ) {
+
+			this.attributes[ name ] = attribute;
+
+			return this;
+
+		},
+
 		removeAttribute: function ( name ) {
 		removeAttribute: function ( name ) {
 
 
 			delete this.attributes[ name ];
 			delete this.attributes[ name ];
@@ -25993,21 +25984,6 @@
 
 
 		onUploadCallback: function () {},
 		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 ) {
 		setDynamic: function ( value ) {
 
 
 			this.dynamic = value;
 			this.dynamic = value;
@@ -48169,11 +48145,26 @@
 				return this.array.length;
 				return this.array.length;
 
 
 			}
 			}
-		},
+		}
+
+	} );
+
+	Object.assign( BufferAttribute.prototype, {
+
 		copyIndicesArray: function ( /* indices */ ) {
 		copyIndicesArray: function ( /* indices */ ) {
 
 
 			console.error( 'THREE.BufferAttribute: .copyIndicesArray() has been removed.' );
 			console.error( 'THREE.BufferAttribute: .copyIndicesArray() has been removed.' );
 
 
+		},
+		setArray: function ( array ) {
+
+			console.warn( 'THREE.BufferAttribute: .setArray has been deprecated. Use BufferGeometry .setAttribute to replace/resize attribute buffers' );
+
+			this.count = array !== undefined ? array.length / this.itemSize : 0;
+			this.array = array;
+
+			return this;
+
 		}
 		}
 
 
 	} );
 	} );
@@ -48237,6 +48228,21 @@
 
 
 	} );
 	} );
 
 
+	Object.assign( InterleavedBuffer.prototype, {
+
+		setArray: function ( array ) {
+
+			console.warn( 'THREE.InterleavedBuffer: .setArray has been deprecated. 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, {
 	Object.assign( ExtrudeBufferGeometry.prototype, {

File diff suppressed because it is too large
+ 105 - 105
build/three.min.js


+ 40 - 34
build/three.module.js

@@ -8863,21 +8863,6 @@ Object.assign( BufferAttribute.prototype, {
 
 
 	onUploadCallback: function () {},
 	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 ) {
 	setDynamic: function ( value ) {
 
 
 		this.dynamic = value;
 		this.dynamic = value;
@@ -9629,9 +9614,7 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
 
 
 		}
 		}
 
 
-		this.attributes[ name ] = attribute;
-
-		return this;
+		return this.setAttribute( name, attribute );
 
 
 	},
 	},
 
 
@@ -9641,6 +9624,14 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
 
 
 	},
 	},
 
 
+	setAttribute: function ( name, attribute ) {
+
+		this.attributes[ name ] = attribute;
+
+		return this;
+
+	},
+
 	removeAttribute: function ( name ) {
 	removeAttribute: function ( name ) {
 
 
 		delete this.attributes[ name ];
 		delete this.attributes[ name ];
@@ -25982,21 +25973,6 @@ Object.assign( InterleavedBuffer.prototype, {
 
 
 	onUploadCallback: function () {},
 	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 ) {
 	setDynamic: function ( value ) {
 
 
 		this.dynamic = value;
 		this.dynamic = value;
@@ -48160,11 +48136,26 @@ Object.defineProperties( BufferAttribute.prototype, {
 			return this.array.length;
 			return this.array.length;
 
 
 		}
 		}
-	},
+	}
+
+} );
+
+Object.assign( BufferAttribute.prototype, {
+
 	copyIndicesArray: function ( /* indices */ ) {
 	copyIndicesArray: function ( /* indices */ ) {
 
 
 		console.error( 'THREE.BufferAttribute: .copyIndicesArray() has been removed.' );
 		console.error( 'THREE.BufferAttribute: .copyIndicesArray() has been removed.' );
 
 
+	},
+	setArray: function ( array ) {
+
+		console.warn( 'THREE.BufferAttribute: .setArray has been deprecated. Use BufferGeometry .setAttribute to replace/resize attribute buffers' );
+
+		this.count = array !== undefined ? array.length / this.itemSize : 0;
+		this.array = array;
+
+		return this;
+
 	}
 	}
 
 
 } );
 } );
@@ -48228,6 +48219,21 @@ Object.defineProperties( BufferGeometry.prototype, {
 
 
 } );
 } );
 
 
+Object.assign( InterleavedBuffer.prototype, {
+
+	setArray: function ( array ) {
+
+		console.warn( 'THREE.InterleavedBuffer: .setArray has been deprecated. 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, {
 Object.assign( ExtrudeBufferGeometry.prototype, {

+ 0 - 7
docs/api/en/core/BufferAttribute.html

@@ -178,13 +178,6 @@
 		being a [page:TypedArray].
 		being a [page:TypedArray].
 		</p>
 		</p>
 
 
-		<h3>[method:BufferAttribute setArray] ( [param:TypedArray array] ) </h3>
-		<p>
-		[page:BufferAttribute.array array] to the TypedArray passed in here.<br /><br />
-
-		After setting the array, [page:BufferAttribute.needsUpdate needsUpdate] should be set to true.
-		</p>
-
 		<h3>[method:BufferAttribute setDynamic] ( [param:Boolean value] ) </h3>
 		<h3>[method:BufferAttribute setDynamic] ( [param:Boolean value] ) </h3>
 		<p>Set [page:BufferAttribute.dynamic dynamic] to value.</p>
 		<p>Set [page:BufferAttribute.dynamic dynamic] to value.</p>
 
 

+ 0 - 5
docs/api/en/core/InterleavedBuffer.html

@@ -81,11 +81,6 @@
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
-		<h3>[method:InterleavedBuffer setArray] ( [param:TypedArray array] ) </h3>
-		<p>
-		 array - must be  a Typed Array.
-		</p>
-
 		<h3>[method:InterleavedBuffer setDynamic] ( [param:Boolean value] ) </h3>
 		<h3>[method:InterleavedBuffer setDynamic] ( [param:Boolean value] ) </h3>
 		<p>
 		<p>
 			Set [page:InterleavedBuffer.dynamic dynamic] to value.
 			Set [page:InterleavedBuffer.dynamic dynamic] to value.

+ 0 - 7
docs/api/zh/core/BufferAttribute.html

@@ -158,13 +158,6 @@
 		特别的, 对将 [page:Array value] 转为  [page:TypedArray] 的要求详见上述链接。
 		特别的, 对将 [page:Array value] 转为  [page:TypedArray] 的要求详见上述链接。
 		</p>
 		</p>
 
 
-		<h3>[method:BufferAttribute setArray] ( [param:TypedArray array] ) </h3>
-		<p>
-		[page:BufferAttribute.array array] 被赋值的 TypedArray 队列。<br /><br />
-
-		队列被复制后,[page:BufferAttribute.needsUpdate needsUpdate] 应当被设置为 true。
-		</p>
-
 		<h3>[method:BufferAttribute setDynamic] ( [param:Boolean value] ) </h3>
 		<h3>[method:BufferAttribute setDynamic] ( [param:Boolean value] ) </h3>
 		<p>将 [page:BufferAttribute.dynamic dynamic] 设置为 value.</p>
 		<p>将 [page:BufferAttribute.dynamic dynamic] 设置为 value.</p>
 
 

+ 0 - 5
docs/api/zh/core/InterleavedBuffer.html

@@ -81,11 +81,6 @@
 
 
 		<h2>方法</h2>
 		<h2>方法</h2>
 
 
-		<h3>[method:InterleavedBuffer setArray] ( [param:TypedArray array] ) </h3>
-		<p>
-		 array - 必须是一个类型化的队列。
-		</p>
-
 		<h3>[method:InterleavedBuffer setDynamic] ( [param:Boolean value] ) </h3>
 		<h3>[method:InterleavedBuffer setDynamic] ( [param:Boolean value] ) </h3>
 		<p>
 		<p>
 			根据输入参数设置 [page:InterleavedBuffer.dynamic dynamic] 的值。
 			根据输入参数设置 [page:InterleavedBuffer.dynamic dynamic] 的值。

+ 6 - 0
package-lock.json

@@ -48,6 +48,12 @@
       "integrity": "sha512-dyYO+f6ihZEtNPDcWNR1fkoTDf3zAK3lAABDze3mz6POyIercH0lEUawUFXlG8xaQZmm1yEBON/4TsYv/laDYg==",
       "integrity": "sha512-dyYO+f6ihZEtNPDcWNR1fkoTDf3zAK3lAABDze3mz6POyIercH0lEUawUFXlG8xaQZmm1yEBON/4TsYv/laDYg==",
       "dev": true
       "dev": true
     },
     },
+    "@types/webgl2": {
+      "version": "0.0.5",
+      "resolved": "https://registry.npmjs.org/@types/webgl2/-/webgl2-0.0.5.tgz",
+      "integrity": "sha512-oGaKsBbxQOY5+aJFV3KECDhGaXt+yZJt2y/OZsnQGLRkH6Fvr7rv4pCt3SRH1somIHfej/c4u7NSpCyd9x+1Ow==",
+      "dev": true
+    },
     "@typescript-eslint/eslint-plugin": {
     "@typescript-eslint/eslint-plugin": {
       "version": "2.0.0",
       "version": "2.0.0",
       "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.0.0.tgz",
       "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.0.0.tgz",

+ 2 - 1
package.json

@@ -52,7 +52,7 @@
     "dev": "concurrently --names \"ROLLUP,HTTP\" -c \"bgBlue.bold,bgGreen.bold\" \"rollup -c utils/build/rollup.config.js -w -m inline\" \"http-server -c-1 -p 8080\"",
     "dev": "concurrently --names \"ROLLUP,HTTP\" -c \"bgBlue.bold,bgGreen.bold\" \"rollup -c utils/build/rollup.config.js -w -m inline\" \"http-server -c-1 -p 8080\"",
     "dev-test": "concurrently --names \"ROLLUP,ROLLUPTEST,HTTP\" -c \"bgBlue.bold,bgRed.bold,bgGreen.bold\" \"rollup -c utils/build/rollup.config.js -w -m inline\" \"rollup -c test/rollup.unit.config.js -w -m inline\" \"http-server -p 8080\"",
     "dev-test": "concurrently --names \"ROLLUP,ROLLUPTEST,HTTP\" -c \"bgBlue.bold,bgRed.bold,bgGreen.bold\" \"rollup -c utils/build/rollup.config.js -w -m inline\" \"rollup -c test/rollup.unit.config.js -w -m inline\" \"http-server -p 8080\"",
     "start": "npm run dev",
     "start": "npm run dev",
-    "lint": "eslint src --ext js --ext ts && tsc src/Three.d.ts --noEmit",
+    "lint": "eslint src --ext js --ext ts && tsc -p utils/build/tsconfig.lint.json",
     "test": "npm run build-test && qunit -r failonlyreporter test/unit/three.source.unit.js",
     "test": "npm run build-test && qunit -r failonlyreporter test/unit/three.source.unit.js",
     "travis": "npm run lint && npm test"
     "travis": "npm run lint && npm test"
   },
   },
@@ -73,6 +73,7 @@
   "devDependencies": {
   "devDependencies": {
     "@typescript-eslint/eslint-plugin": "^2.0.0",
     "@typescript-eslint/eslint-plugin": "^2.0.0",
     "@typescript-eslint/parser": "^2.0.0",
     "@typescript-eslint/parser": "^2.0.0",
+    "@types/webgl2": "0.0.5",
     "concurrently": "^4.1.2",
     "concurrently": "^4.1.2",
     "eslint": "^6.2.1",
     "eslint": "^6.2.1",
     "eslint-config-mdcs": "^4.2.3",
     "eslint-config-mdcs": "^4.2.3",

+ 32 - 1
src/Three.Legacy.js

@@ -19,6 +19,7 @@ import {
 	BufferAttribute
 	BufferAttribute
 } from './core/BufferAttribute.js';
 } from './core/BufferAttribute.js';
 import { BufferGeometry } from './core/BufferGeometry.js';
 import { BufferGeometry } from './core/BufferGeometry.js';
+import { InterleavedBuffer } from './core/InterleavedBuffer.js';
 import { Face3 } from './core/Face3.js';
 import { Face3 } from './core/Face3.js';
 import { Geometry } from './core/Geometry.js';
 import { Geometry } from './core/Geometry.js';
 import { Object3D } from './core/Object3D.js';
 import { Object3D } from './core/Object3D.js';
@@ -1163,11 +1164,26 @@ Object.defineProperties( BufferAttribute.prototype, {
 			return this.array.length;
 			return this.array.length;
 
 
 		}
 		}
-	},
+	}
+
+} );
+
+Object.assign( BufferAttribute.prototype, {
+
 	copyIndicesArray: function ( /* indices */ ) {
 	copyIndicesArray: function ( /* indices */ ) {
 
 
 		console.error( 'THREE.BufferAttribute: .copyIndicesArray() has been removed.' );
 		console.error( 'THREE.BufferAttribute: .copyIndicesArray() has been removed.' );
 
 
+	},
+	setArray: function ( array ) {
+
+		console.warn( 'THREE.BufferAttribute: .setArray has been deprecated. Use BufferGeometry .setAttribute to replace/resize attribute buffers' );
+
+		this.count = array !== undefined ? array.length / this.itemSize : 0;
+		this.array = array;
+
+		return this;
+
 	}
 	}
 
 
 } );
 } );
@@ -1231,6 +1247,21 @@ Object.defineProperties( BufferGeometry.prototype, {
 
 
 } );
 } );
 
 
+Object.assign( InterleavedBuffer.prototype, {
+
+	setArray: function ( array ) {
+
+		console.warn( 'THREE.InterleavedBuffer: .setArray has been deprecated. 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, {
 Object.assign( ExtrudeBufferGeometry.prototype, {

+ 0 - 1
src/core/BufferAttribute.d.ts

@@ -16,7 +16,6 @@ export class BufferAttribute {
 	count: number;
 	count: number;
 	onUpload: Function;
 	onUpload: Function;
 
 
-	setArray( array?: ArrayBufferView ): void;
 	setDynamic( dynamic: boolean ): BufferAttribute;
 	setDynamic( dynamic: boolean ): BufferAttribute;
 	clone(): this;
 	clone(): this;
 	copy( source: BufferAttribute ): this;
 	copy( source: BufferAttribute ): this;

+ 0 - 15
src/core/BufferAttribute.js

@@ -45,21 +45,6 @@ Object.assign( BufferAttribute.prototype, {
 
 
 	onUploadCallback: function () {},
 	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 ) {
 	setDynamic: function ( value ) {
 
 
 		this.dynamic = value;
 		this.dynamic = value;

+ 9 - 3
src/core/BufferGeometry.js

@@ -94,9 +94,7 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
 
 
 		}
 		}
 
 
-		this.attributes[ name ] = attribute;
-
-		return this;
+		return this.setAttribute( name, attribute );
 
 
 	},
 	},
 
 
@@ -106,6 +104,14 @@ BufferGeometry.prototype = Object.assign( Object.create( EventDispatcher.prototy
 
 
 	},
 	},
 
 
+	setAttribute: function ( name, attribute ) {
+
+		this.attributes[ name ] = attribute;
+
+		return this;
+
+	},
+
 	removeAttribute: function ( name ) {
 	removeAttribute: function ( name ) {
 
 
 		delete this.attributes[ name ];
 		delete this.attributes[ name ];

+ 0 - 1
src/core/InterleavedBuffer.d.ts

@@ -16,7 +16,6 @@ export class InterleavedBuffer {
 	count: number;
 	count: number;
 	needsUpdate: boolean;
 	needsUpdate: boolean;
 
 
-	setArray( array?: ArrayBufferView ): void;
 	setDynamic( dynamic: boolean ): InterleavedBuffer;
 	setDynamic( dynamic: boolean ): InterleavedBuffer;
 	clone(): this;
 	clone(): this;
 	copy( source: InterleavedBuffer ): this;
 	copy( source: InterleavedBuffer ): this;

+ 0 - 15
src/core/InterleavedBuffer.js

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

+ 0 - 22
test/unit/src/core/BufferAttribute.tests.js

@@ -42,28 +42,6 @@ export default QUnit.module( 'Core', () => {
 
 
 		} );
 		} );
 
 
-		QUnit.test( "setArray", ( assert ) => {
-
-			var f32a = new Float32Array( [ 1, 2, 3, 4 ] );
-			var a = new BufferAttribute( f32a, 2, false );
-
-			a.setArray( f32a, 2 );
-
-			assert.strictEqual( a.count, 2, "Check item count" );
-			assert.strictEqual( a.array, f32a, "Check array" );
-
-			assert.throws(
-				function () {
-
-					a.setArray( [ 1, 2, 3, 4 ] );
-
-				},
-				/array should be a Typed Array/,
-				"Calling setArray with a simple array throws Error"
-			);
-
-		} );
-
 		QUnit.todo( "setDynamic", ( assert ) => {
 		QUnit.todo( "setDynamic", ( assert ) => {
 
 
 			assert.ok( false, "everything's gonna be alright" );
 			assert.ok( false, "everything's gonna be alright" );

+ 0 - 28
test/unit/src/core/InterleavedBuffer.tests.js

@@ -49,34 +49,6 @@ export default QUnit.module( 'Core', () => {
 
 
 		} );
 		} );
 
 
-		QUnit.test( "setArray", ( assert ) => {
-
-			var f32a = new Float32Array( [ 1, 2, 3, 4 ] );
-			var f32b = new Float32Array( [] );
-			var a = new InterleavedBuffer( f32a, 2, false );
-
-			a.setArray( f32a );
-
-			assert.strictEqual( a.count, 2, "Check item count for non-empty array" );
-			assert.strictEqual( a.array, f32a, "Check array itself" );
-
-			a.setArray( f32b );
-
-			assert.strictEqual( a.count, 0, "Check item count for empty array" );
-			assert.strictEqual( a.array, f32b, "Check array itself" );
-
-			assert.throws(
-				function () {
-
-					a.setArray( [ 1, 2, 3, 4 ] );
-
-				},
-				/array should be a Typed Array/,
-				"Calling setArray with a non-typed array throws Error"
-			);
-
-		} );
-
 		QUnit.todo( "setDynamic", ( assert ) => {
 		QUnit.todo( "setDynamic", ( assert ) => {
 
 
 			assert.ok( false, "everything's gonna be alright" );
 			assert.ok( false, "everything's gonna be alright" );

+ 8 - 0
utils/build/tsconfig.lint.json

@@ -0,0 +1,8 @@
+{
+  "compilerOptions": {
+    "noEmit": true,
+  },
+  "include": [
+    "../../**/*.ts"
+  ]
+}

Some files were not shown because too many files changed in this diff