From 9d25b0419d9595cbe88b05f52ea89c824bffe053 Mon Sep 17 00:00:00 2001 From: David Asmuth Date: Fri, 3 Mar 2017 13:57:56 +0100 Subject: [PATCH 01/10] three update r84 #10393: BinaryTextureLoader deprecated in favour of DataTextureLoader #10393 --- three/index.d.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/three/index.d.ts b/three/index.d.ts index 7b76100c17..bc77b24045 100644 --- a/three/index.d.ts +++ b/three/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for three.js 0.83 // Project: http://mrdoob.github.com/three.js/ -// Definitions by: Kon , Satoru Kimura , Florent Poujol , SereznoKot , HouChunlei +// Definitions by: Kon , Satoru Kimura , Florent Poujol , SereznoKot , HouChunlei , David Asmuth // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -2161,14 +2161,18 @@ declare namespace THREE { setPath(path: string): CubeTextureLoader; } - export class BinaryTextureLoader { + export class DataTextureLoader { constructor(manager?: LoadingManager); manager: LoadingManager; load(url: string, onLoad: (dataTexture: DataTexture) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void; } - export class DataTextureLoader extends BinaryTextureLoader {} + + /** + * @deprecated since 0.84.0. Use DataTextureLoader (renamed) + */ + export class BinaryTextureLoader extends DataTextureLoader {} export class CompressedTextureLoader { constructor(manager?: LoadingManager); From f67572a862b24b08644e725adda4b972c18286c7 Mon Sep 17 00:00:00 2001 From: David Asmuth Date: Fri, 3 Mar 2017 14:03:07 +0100 Subject: [PATCH 02/10] three update to r84 #10474: Box3 added expandByObject(). #10474 --- three/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/three/index.d.ts b/three/index.d.ts index bc77b24045..153dff8ae9 100644 --- a/three/index.d.ts +++ b/three/index.d.ts @@ -2851,6 +2851,7 @@ declare namespace THREE { expandByPoint(point: Vector3): Box3; expandByVector(vector: Vector3): Box3; expandByScalar(scalar: number): Box3; + expandByObject(object: Object3D): Box3; containsPoint(point: Vector3): boolean; containsBox(box: Box3): boolean; getParameter(point: Vector3): Vector3; From 5a592b859577df5a8324806be7e9460f48999c3b Mon Sep 17 00:00:00 2001 From: David Asmuth Date: Fri, 3 Mar 2017 14:12:19 +0100 Subject: [PATCH 03/10] three update to r84 c8265b9: Curve deprecated create(). c8265b9 --- three/index.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/three/index.d.ts b/three/index.d.ts index 153dff8ae9..f205e51f90 100644 --- a/three/index.d.ts +++ b/three/index.d.ts @@ -5953,6 +5953,9 @@ declare namespace THREE { */ getTangentAt(u: number): T; + /** + * @deprecated since r84. + */ static create(constructorFunc: Function, getPointFunc: Function): Function; } From 2257d472b8bac74d34aaff84919630629c1d67ea Mon Sep 17 00:00:00 2001 From: David Asmuth Date: Fri, 3 Mar 2017 16:09:22 +0100 Subject: [PATCH 04/10] three update to r84 fe98988: CurveUtils removed. fe98988 --- three/index.d.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/three/index.d.ts b/three/index.d.ts index f205e51f90..361f4d786c 100644 --- a/three/index.d.ts +++ b/three/index.d.ts @@ -5766,12 +5766,6 @@ declare namespace THREE { } // Extras ///////////////////////////////////////////////////////////////////// - export namespace CurveUtils { - export function tangentQuadraticBezier(t: number, p0: number, p1: number, p2: number): number; - export function tangentCubicBezier(t: number, p0: number, p1: number, p2: number, p3: number): number; - export function tangentSpline(t: number, p0: number, p1: number, p2: number, p3: number): number; - export function interpolate(p0: number, p1: number, p2: number, p3: number, t: number): number; - } export namespace ImageUtils { // deprecated export let crossOrigin: string; From 3b020cdedc0bd2c0559919c5c0044ae71f043211 Mon Sep 17 00:00:00 2001 From: David Asmuth Date: Fri, 3 Mar 2017 16:11:25 +0100 Subject: [PATCH 05/10] three update to r84 #9597: EventDispatcher removed apply(). #9597 --- three/index.d.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/three/index.d.ts b/three/index.d.ts index 361f4d786c..a57f257ccb 100644 --- a/three/index.d.ts +++ b/three/index.d.ts @@ -1027,9 +1027,6 @@ declare namespace THREE { * @param type The type of event that gets fired. */ dispatchEvent(event: { type: string; [attachment: string]: any; }): void; - - // deprecated - apply(target: any): void; } export interface Event { @@ -5785,8 +5782,6 @@ declare namespace THREE { export function triangulate(contour: number[], indices: boolean): number[]; export function triangulateShape(contour: number[], holes: any[]): number[]; export function isClockWise(pts: number[]): boolean; - export function b2(t: number, p0: number, p1: number, p2: number): number; - export function b3(t: number, p0: number, p1: number, p2: number, p3: number): number; } // Extras / Audio ///////////////////////////////////////////////////////////////////// @@ -6041,6 +6036,13 @@ declare namespace THREE { } // Extras / Curves ///////////////////////////////////////////////////////////////////// + export namespace CurveUtils { + export function tangentQuadraticBezier(t: number, p0: number, p1: number, p2: number): number; + export function tangentCubicBezier(t: number, p0: number, p1: number, p2: number, p3: number): number; + export function tangentSpline(t: number, p0: number, p1: number, p2: number, p3: number): number; + export function interpolate(p0: number, p1: number, p2: number, p3: number, t: number): number; + } + export class CatmullRomCurve3 extends Curve { constructor(points?: Vector3[]); From 7c89a027f88211f842fb02dee0d60ae17aefd52f Mon Sep 17 00:00:00 2001 From: David Asmuth Date: Fri, 3 Mar 2017 16:16:42 +0100 Subject: [PATCH 06/10] three update to r84 #10367, #10375: Matrix3 removed applyToVector3Array(). #10367 Matrix4 removed applyToVector3Array(). #10367 Matrix4 changed makeFrustum() to makePerspective(). #10375 --- three/index.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/three/index.d.ts b/three/index.d.ts index a57f257ccb..158810b0ac 100644 --- a/three/index.d.ts +++ b/three/index.d.ts @@ -3345,7 +3345,6 @@ declare namespace THREE { clone(): this; copy(m: this): this; setFromMatrix4(m: Matrix4): Matrix3; - applyToVector3Array(array: ArrayLike, offset?: number, length?: number): ArrayLike; applyToBuffer(buffer: BufferAttribute, offset?: number, length?: number): BufferAttribute; multiplyScalar(s: number): Matrix3; determinant(): number; @@ -3445,7 +3444,6 @@ declare namespace THREE { * Multiplies this matrix by s. */ multiplyScalar(s: number): Matrix4; - applyToVector3Array(array: ArrayLike, offset?: number, length?: number): ArrayLike; applyToBuffer( buffer: BufferAttribute, offset?: number, length?: number): BufferAttribute; /** * Computes determinant of this matrix. @@ -3532,7 +3530,7 @@ declare namespace THREE { /** * Creates a frustum matrix. */ - makeFrustum(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix4; + makePerspective(left: number, right: number, bottom: number, top: number, near: number, far: number): Matrix4; /** * Creates a perspective projection matrix. From 3a74ffa8b1477b921bbcf1b46461c6f0c03d1176 Mon Sep 17 00:00:00 2001 From: David Asmuth Date: Fri, 3 Mar 2017 16:28:28 +0100 Subject: [PATCH 07/10] three update to r84 #10415, #10397 : Spline deprecated in favour of CatmullRomCurve3. #10415 SplineCurve3 deprecated in favour of CatmullRomCurve3. #10397 --- three/index.d.ts | 50 ------------------------------------------------ 1 file changed, 50 deletions(-) diff --git a/three/index.d.ts b/three/index.d.ts index 158810b0ac..352f9e1cdb 100644 --- a/three/index.d.ts +++ b/three/index.d.ts @@ -3771,53 +3771,6 @@ declare namespace THREE { z: number; } - /** - * Represents a spline. - * - * @see src/math/Spline.js - */ - export class Spline { - /** - * Initialises the spline with points, which are the places through which the spline will go. - */ - constructor(points: SplineControlPoint[]); - - points: SplineControlPoint[]; - - /** - * Initialises using the data in the array as a series of points. Each value in a must be another array with three values, where a[n] is v, the value for the nth point, and v[0], v[1] and v[2] are the x, y and z coordinates of that point n, respectively. - * - * @param a array of triplets containing x, y, z coordinates - */ - initFromArray(a: number[][]): void; - - /** - * Return the interpolated point at k. - * - * @param k point index - */ - getPoint(k: number): SplineControlPoint; - - /** - * Returns an array with triplets of x, y, z coordinates that correspond to the current control points. - */ - getControlPointsArray(): number[][]; - - /** - * Returns the length of the spline when using nSubDivisions. - * @param nSubDivisions number of subdivisions between control points. Default is 100. - */ - getLength(nSubDivisions?: number): { chunks: number[]; total: number; }; - - /** - * Modifies the spline so that it looks similar to the original but has its points distributed in such way that moving along the spline it's done at a more or less constant speed. The points should also appear more uniformly spread along the curve. - * This is done by resampling the original spline, with the density of sampling controlled by samplingCoef. Here it's interesting to note that denser sampling is not necessarily better: if sampling is too high, you may get weird kinks in curvature. - * - * @param samplingCoef how many intermediate values to use between spline points - */ - reparametrizeByArcLength(samplingCoef: number): void; - } - class Triangle { constructor(a?: Vector3, b?: Vector3, c?: Vector3); @@ -6049,9 +6002,6 @@ declare namespace THREE { getPoint(t: number): Vector3; } - export class ClosedSplineCurve3 extends CatmullRomCurve3 {} // deprecated, use CatmullRomCurve3 - export class SplineCurve3 extends CatmullRomCurve3 {} // will be deprecated, use CatmullRomCurve3 - export class CubicBezierCurve extends Curve { constructor(v0: Vector2, v1: Vector2, v2: Vector2, v3: Vector2); From 45e57c68f1e4c0d7fb4ab381b8cbe59bd671a0b3 Mon Sep 17 00:00:00 2001 From: David Asmuth Date: Fri, 3 Mar 2017 16:34:00 +0100 Subject: [PATCH 08/10] three update to r84 #10405, #10412: Vector2 renamed fromAttribute() to fromBufferAttribute(). #10412 Vector3 renamed fromAttribute() to fromBufferAttribute(). #10412 Vector3 combined applyProjection() into applyMatrix4(). #10405 Vector4 renamed fromAttribute() to fromBufferAttribute(). #10412 --- three/index.d.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/three/index.d.ts b/three/index.d.ts index 352f9e1cdb..2d742b1053 100644 --- a/three/index.d.ts +++ b/three/index.d.ts @@ -4060,7 +4060,7 @@ declare namespace THREE { toArray(xy?: number[], offset?: number): number[]; - fromAttribute( attribute: BufferAttribute, index: number, offset?: number): Vector2; + fromBufferAttribute( attribute: BufferAttribute, index: number, offset?: number): Vector2; rotateAround( center: Vector2, angle: number ): Vector2; } @@ -4155,7 +4155,6 @@ declare namespace THREE { applyAxisAngle(axis: Vector3, angle: number): Vector3; applyMatrix3(m: Matrix3): Vector3; applyMatrix4(m: Matrix4): Vector3; - applyProjection(m: Matrix4): Vector3; applyQuaternion(q: Quaternion): Vector3; project(camrea: Camera): Vector3; unproject(camera: Camera): Vector3; @@ -4253,7 +4252,7 @@ declare namespace THREE { fromArray(xyz: number[], offset?: number): Vector3; toArray(xyz?: number[], offset?: number): number[]; - fromAttribute( attribute: BufferAttribute, index: number, offset?: number): Vector3; + fromBufferAttribute( attribute: BufferAttribute, index: number, offset?: number): Vector3; // deprecated getPositionFromMatrix(m: Matrix4): Vector3; @@ -4419,7 +4418,7 @@ declare namespace THREE { toArray(xyzw?: number[], offset?: number): number[]; - fromAttribute( attribute: BufferAttribute, index: number, offset?: number): Vector4; + fromBufferAttribute( attribute: BufferAttribute, index: number, offset?: number): Vector4; } export abstract class Interpolant { From cdf6fea21c5b1ab3f4d73a728b98a23fab5ce493 Mon Sep 17 00:00:00 2001 From: David Asmuth Date: Fri, 3 Mar 2017 17:04:03 +0100 Subject: [PATCH 09/10] three update to r84: Updated d.ts version to 0.84.0 --- three/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/three/index.d.ts b/three/index.d.ts index 2d742b1053..60d8fb8752 100644 --- a/three/index.d.ts +++ b/three/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for three.js 0.83 +// Type definitions for three.js 0.84 // Project: http://mrdoob.github.com/three.js/ // Definitions by: Kon , Satoru Kimura , Florent Poujol , SereznoKot , HouChunlei , David Asmuth // Definitions: https://github.com/borisyankov/DefinitelyTyped From c8e66a28cf04040e6194953ed24cc7bba03c36a1 Mon Sep 17 00:00:00 2001 From: David Asmuth Date: Fri, 3 Mar 2017 17:17:47 +0100 Subject: [PATCH 10/10] three update to r84: API changes to test_unit_math --- three/test/math/test_unit_math.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/three/test/math/test_unit_math.ts b/three/test/math/test_unit_math.ts index 91f656b8e5..b824aa3f30 100644 --- a/three/test/math/test_unit_math.ts +++ b/three/test/math/test_unit_math.ts @@ -981,7 +981,7 @@ declare function equal(a: T, b: T, desc?: string): void; }); test( "setFromMatrix/makeFrustum/containsPoint", function() { - var m = new THREE.Matrix4().makeFrustum( -1, 1, -1, 1, 1, 100 ) + var m = new THREE.Matrix4().makePerspective( -1, 1, -1, 1, 1, 100 ) var a = new THREE.Frustum().setFromMatrix( m ); ok( ! a.containsPoint( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" ); @@ -1000,7 +1000,7 @@ declare function equal(a: T, b: T, desc?: string): void; }); test( "setFromMatrix/makeFrustum/intersectsSphere", function() { - var m = new THREE.Matrix4().makeFrustum( -1, 1, -1, 1, 1, 100 ) + var m = new THREE.Matrix4().makePerspective( -1, 1, -1, 1, 1, 100 ) var a = new THREE.Frustum().setFromMatrix( m ); ok( ! a.intersectsSphere( new THREE.Sphere( new THREE.Vector3( 0, 0, 0 ), 0 ) ), "Passed!" ); @@ -1514,8 +1514,8 @@ declare function equal(a: T, b: T, desc?: string): void; new THREE.Matrix4().makeRotationZ( -0.3 ), new THREE.Matrix4().makeScale( 1, 2, 3 ), new THREE.Matrix4().makeScale( 1/8, 1/2, 1/3 ), - new THREE.Matrix4().makeFrustum( -1, 1, -1, 1, 1, 1000 ), - new THREE.Matrix4().makeFrustum( -16, 16, -9, 9, 0.1, 10000 ), + new THREE.Matrix4().makePerspective( -1, 1, -1, 1, 1, 1000 ), + new THREE.Matrix4().makePerspective( -16, 16, -9, 9, 0.1, 10000 ), new THREE.Matrix4().makeTranslation( 1, 2, 3 ) ];