diff --git a/docs/api/deprecated/DeprecatedList.html b/docs/api/deprecated/DeprecatedList.html index ecbc44698b9ed183a3dbd0c9629322803ccf38b9..0a8f79bc127aed99c273fe36d6f0b9f0b78e1569 100644 --- a/docs/api/deprecated/DeprecatedList.html +++ b/docs/api/deprecated/DeprecatedList.html @@ -306,7 +306,7 @@

[page:Matrix4]

- Matrix4.flattenToArrayOffset is deprecated. Use [page:Matrix4.toArray]() instead.

+ Matrix4.flattenToArrayOffset() is deprecated. Use [page:Matrix4.toArray]() instead.

Matrix4.extractPosition() has been renamed to [page:Matrix4.copyPosition]( matrix ).

@@ -314,28 +314,30 @@ Matrix4.setRotationFromQuaternion() has been renamed to [page:Matrix4.makeRotationFromQuaternion]( quaternion ).

- Matrix4.multiplyVector3 has been has been removed. Use vector.applyMatrix4( matrix ) + Matrix4.multiplyVector3() has been has been removed. Use vector.applyMatrix4( matrix ) or vector.applyProjection( matrix ) instead.

- Matrix4.multiplyVector4 has been removed. Use vector.applyMatrix4( matrix ) instead.

+ Matrix4.multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.

- Matrix4.multiplyVector3Array has been renamed to [page:Matrix4.applyToVector3Array] (array ).

+ Matrix4.multiplyVector3Array() has been renamed to [page:Matrix4.applyToVector3Array] ( array ).

- Matrix4.rotateAxis has been removed. Use [page:Matrix4.transformDirection]( matrix ) instead.

+ Matrix4.rotateAxis() has been removed. Use [page:Matrix4.transformDirection]( matrix ) instead.

- Matrix4.crossVector has been removed. Use vector.applyMatrix4( matrix ) instead.

+ Matrix4.crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.

- Matrix4.rotateX has been removed.

+ Matrix4.rotateX() has been removed.

- Matrix4.rotateY has been removed.

+ Matrix4.rotateY() has been removed.

- Matrix4.rotateZ has been removed.

+ Matrix4.rotateZ() has been removed.

- Matrix4.rotateByAxis has been removed.

+ Matrix4.rotateByAxis() has been removed.

- Matrix4.applyToBuffer has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.

+ Matrix4.applyToBuffer() has been removed. Use matrix.applyToBufferAttribute() instead.

- Matrix4.applyToVector3Array has been removed. + Matrix4.applyToVector3Array() has been removed.

+ + Matrix4.makeFrustum() has been removed. Use [page:Matrix4.makePerspective]( left, right, top, bottom, near, far ) instead.
diff --git a/docs/api/math/Matrix4.html b/docs/api/math/Matrix4.html index 472b5efe91bc85abb041a37cac58a06b9371d213..b80db03c09180e9c0b1f5b09d8c7941e5080180e 100644 --- a/docs/api/math/Matrix4.html +++ b/docs/api/math/Matrix4.html @@ -116,7 +116,7 @@ m.elements = [ 11, 21, 31, 41, Multiplies (applies) this matrix to every 3D vector in the [page:BufferAttribute attribute]. - +

[method:Matrix4 clone]()

Creates a new Matrix4 with identical [page:.elements elements] to this one.
@@ -236,9 +236,9 @@ xAxis.z, yAxis.z, zAxis.z, 0, -

[method:Matrix4 makeFrustum]( [page:Float left], [page:Float right], [page:Float bottom], [page:Float top], [page:Float near], [page:Float far] )

+

[method:Matrix4 makePerspective]( [page:Float left], [page:Float right], [page:Float top], [page:Float bottom], [page:Float near], [page:Float far] )

- Creates a matrix representing a [link:https://en.wikipedia.org/wiki/Frustum frustum]. + Creates a [link:https://en.wikipedia.org/wiki/3D_projection#Perspective_projection perspective projection] matrix. This is used internally by [page:PerspectiveCamera.updateProjectionMatrix]()
@@ -248,15 +248,6 @@ xAxis.z, yAxis.z, zAxis.z, 0, This is used internally by [page:OrthographicCamera.updateProjectionMatrix](). -

[method:Matrix4 makePerspective]( [page:Float fov], [page:Float aspect], [page:Float near], [page:Float far] )

-
- Creates a [link:https://en.wikipedia.org/wiki/3D_projection#Perspective_projection perspective projection] matrix. - - Internally this calculates the values of [page:Float left], [page:Float right], [page:Float bottom] and [page:Float top], - and calls [page:.makeFrustum makeFrustum]. - -
-

[method:Matrix4 makeRotationFromEuler]( [page:Euler euler] )

Sets the rotation component (the upper left 3x3 matrix) of this matrix to the rotation specified by the given [page:Euler Euler Angle]. diff --git a/editor/js/libs/tern-threejs/threejs.js b/editor/js/libs/tern-threejs/threejs.js index 1fed0b6854fe55f28466c963db9aa85b2c3c9d4c..32e72eece07707b11eebeee1b868457d989754f4 100644 --- a/editor/js/libs/tern-threejs/threejs.js +++ b/editor/js/libs/tern-threejs/threejs.js @@ -3921,16 +3921,12 @@ "!type": "fn(x: number, y: number, z: number) -> +THREE.Matrix4", "!doc": "Sets this matrix as scale transform." }, - "makeFrustum": { - "!type": "fn(left: number, right: number, bottom: number, top: number, near: number, far: number) -> +THREE.Matrix4", - "!doc": "Creates a [page:Frustum frustum] matrix." - }, "makePerspective": { - "!type": "fn(fov: number, aspect: number, near: number, far: number) -> +THREE.Matrix4", + "!type": "fn(left: number, right: number, top: number, bottom: number, near: number, far: number) -> +THREE.Matrix4", "!doc": "Creates a perspective projection matrix." }, "makeOrthographic": { - "!type": "fn(left: number, right: number, bottom: number, top: number, near: number, far: number) -> +THREE.Matrix4", + "!type": "fn(left: number, right: number, top: number, bottom: number, near: number, far: number) -> +THREE.Matrix4", "!doc": "Creates an orthographic projection matrix." }, "clone": { diff --git a/src/Three.Legacy.js b/src/Three.Legacy.js index 9be5b028bf8a12d96eacc485dd8389ada939a1b5..1667562b1d2f3d72af9c6aa5232be20663b70acd 100644 --- a/src/Three.Legacy.js +++ b/src/Three.Legacy.js @@ -465,6 +465,12 @@ Object.assign( Matrix4.prototype, { console.error( 'THREE.Matrix4: .applyToVector3Array() has been removed.' ); + }, + makeFrustum: function( left, right, bottom, top, near, far ) { + + console.warn( 'THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead.' ); + return this.makePerspective( left, right, top, bottom, near, far ); + } } ); diff --git a/src/cameras/PerspectiveCamera.js b/src/cameras/PerspectiveCamera.js index 92dac064ce147340ed213de8af83b5365396c609..ec0bdfdd36681c0986c5662d09e17545be10f663 100644 --- a/src/cameras/PerspectiveCamera.js +++ b/src/cameras/PerspectiveCamera.js @@ -193,8 +193,7 @@ PerspectiveCamera.prototype = Object.assign( Object.create( Camera.prototype ), var skew = this.filmOffset; if ( skew !== 0 ) left += near * skew / this.getFilmWidth(); - this.projectionMatrix.makeFrustum( - left, left + width, top - height, top, near, this.far ); + this.projectionMatrix.makePerspective( left, left + width, top, top - height, near, this.far ); }, diff --git a/src/math/Matrix4.js b/src/math/Matrix4.js index bc2cd10d9f3ac978cd71d88f03814080e48e4a83..8ea0968729f5fdb97b0ec3454f5333da54b02905 100644 --- a/src/math/Matrix4.js +++ b/src/math/Matrix4.js @@ -833,7 +833,13 @@ Matrix4.prototype = { }(), - makeFrustum: function ( left, right, bottom, top, near, far ) { + makePerspective: function ( left, right, top, bottom, near, far ) { + + if ( far === undefined ) { + + console.warn( 'THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.' ); + + } var te = this.elements; var x = 2 * near / ( right - left ); @@ -853,17 +859,6 @@ Matrix4.prototype = { }, - makePerspective: function ( fov, aspect, near, far ) { - - var ymax = near * Math.tan( _Math.DEG2RAD * fov * 0.5 ); - var ymin = - ymax; - var xmin = ymin * aspect; - var xmax = ymax * aspect; - - return this.makeFrustum( xmin, xmax, ymin, ymax, near, far ); - - }, - makeOrthographic: function ( left, right, top, bottom, near, far ) { var te = this.elements; diff --git a/test/unit/math/Frustum.js b/test/unit/math/Frustum.js index 0b93986fdfc923a89415d013a3b43da7187b8655..a12678b1234b86851d02570e277c4c9dc35d1699 100644 --- a/test/unit/math/Frustum.js +++ b/test/unit/math/Frustum.js @@ -87,8 +87,8 @@ test( "setFromMatrix/makeOrthographic/containsPoint", function() { }); -test( "setFromMatrix/makeFrustum/containsPoint", function() { - var m = new THREE.Matrix4().makeFrustum( -1, 1, -1, 1, 1, 100 ); +test( "setFromMatrix/makePerspective/containsPoint", function() { + 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!" ); @@ -106,8 +106,8 @@ test( "setFromMatrix/makeFrustum/containsPoint", function() { ok( ! a.containsPoint( new THREE.Vector3( 0, 0, -101 ) ), "Passed!" ); }); -test( "setFromMatrix/makeFrustum/intersectsSphere", function() { - var m = new THREE.Matrix4().makeFrustum( -1, 1, -1, 1, 1, 100 ); +test( "setFromMatrix/makePerspective/intersectsSphere", function() { + 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!" ); diff --git a/test/unit/math/Matrix4.js b/test/unit/math/Matrix4.js index f616b41a4c3c16e065fb1e31bd5baffccad718f0..6bb045a20ef55df51739487d8c8a9959918013ff 100644 --- a/test/unit/math/Matrix4.js +++ b/test/unit/math/Matrix4.js @@ -184,8 +184,8 @@ test( "getInverse", function() { 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 ) ];