Просмотр исходного кода

Matrix4: Renamed .makeFrustum() to .makePerspective()

Mugen87 8 лет назад
Родитель
Сommit
53ae111d45

+ 14 - 12
docs/api/deprecated/DeprecatedList.html

@@ -306,7 +306,7 @@
 
 		<h3>[page:Matrix4]</h3>
 		<div>
-			Matrix4.flattenToArrayOffset is deprecated. Use [page:Matrix4.toArray]() instead.<br /><br />
+			Matrix4.flattenToArrayOffset() is deprecated. Use [page:Matrix4.toArray]() instead.<br /><br />
 
 			Matrix4.extractPosition() has been renamed to [page:Matrix4.copyPosition]( matrix ).<br /><br />
 
@@ -314,28 +314,30 @@
 
 			Matrix4.setRotationFromQuaternion() has been renamed to [page:Matrix4.makeRotationFromQuaternion]( quaternion ).<br /><br />
 
-			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.<br /><br />
 
-			Matrix4.multiplyVector4 has been removed. Use vector.applyMatrix4( matrix ) instead.<br /><br />
+			Matrix4.multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead.<br /><br />
 
-			Matrix4.multiplyVector3Array has been renamed to [page:Matrix4.applyToVector3Array] (array ).<br /><br />
+			Matrix4.multiplyVector3Array() has been renamed to [page:Matrix4.applyToVector3Array] ( array ).<br /><br />
 
-			Matrix4.rotateAxis has been removed. Use [page:Matrix4.transformDirection]( matrix ) instead.<br /><br />
+			Matrix4.rotateAxis() has been removed. Use [page:Matrix4.transformDirection]( matrix ) instead.<br /><br />
 
-			Matrix4.crossVector has been removed. Use vector.applyMatrix4( matrix ) instead.<br /><br />
+			Matrix4.crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead.<br /><br />
 
-			Matrix4.rotateX has been removed.<br /><br />
+			Matrix4.rotateX() has been removed.<br /><br />
 
-			Matrix4.rotateY has been removed.<br /><br />
+			Matrix4.rotateY() has been removed.<br /><br />
 
-			Matrix4.rotateZ has been removed.<br /><br />
+			Matrix4.rotateZ() has been removed.<br /><br />
 
-			Matrix4.rotateByAxis has been removed.<br /><br />
+			Matrix4.rotateByAxis() has been removed.<br /><br />
 
-			Matrix4.applyToBuffer has been removed. Use matrix.applyToBufferAttribute( attribute ) instead.<br /><br />
+			Matrix4.applyToBuffer() has been removed. Use matrix.applyToBufferAttribute() instead.<br /><br />
 
-			Matrix4.applyToVector3Array has been removed.
+			Matrix4.applyToVector3Array() has been removed.<br /><br />
+
+			Matrix4.makeFrustum() has been renamed to [page:Matrix4.makePerspective]().
 		</div>
 
 

+ 3 - 12
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].
 		</div>
-		
+
 
 		<h3>[method:Matrix4 clone]()</h3>
 		<div>Creates a new Matrix4 with identical [page:.elements elements] to this one.</div>
@@ -236,9 +236,9 @@ xAxis.z, yAxis.z, zAxis.z, 0,
 		</code>
 		</div>
 
-		<h3>[method:Matrix4 makeFrustum]( [page:Float left], [page:Float right], [page:Float bottom], [page:Float top], [page:Float near], [page:Float far] )</h3>
+		<h3>[method:Matrix4 makePerspective]( [page:Float left], [page:Float right], [page:Float bottom], [page:Float top], [page:Float near], [page:Float far] )</h3>
 		<div>
-			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]()
 		</div>
 
@@ -248,15 +248,6 @@ xAxis.z, yAxis.z, zAxis.z, 0,
 		This is used internally by [page:OrthographicCamera.updateProjectionMatrix]().
 		</div>
 
-		<h3>[method:Matrix4 makePerspective]( [page:Float fov], [page:Float aspect], [page:Float near], [page:Float far] )</h3>
-		<div>
-		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].
-
-		</div>
-
 		<h3>[method:Matrix4 makeRotationFromEuler]( [page:Euler euler] )</h3>
 		<div>
 		Sets the rotation component (the upper left 3x3 matrix) of this matrix to the rotation specified by the given [page:Euler Euler Angle].

+ 1 - 5
editor/js/libs/tern-threejs/threejs.js

@@ -3921,12 +3921,8 @@
           "!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, bottom: number, top: number, near: number, far: number) -> +THREE.Matrix4",
           "!doc": "Creates a perspective projection matrix."
         },
         "makeOrthographic": {

+ 5 - 0
src/Three.Legacy.js

@@ -466,6 +466,11 @@ Object.assign( Matrix4.prototype, {
 
 		console.error( 'THREE.Matrix4: .applyToVector3Array() has been removed.' );
 
+	},
+	makeFrustum: function( left, right, bottom, top, near, far ) {
+
+		console.error( 'THREE.Matrix4: .makeFrustum() has been renamed to .makePerspective().' );
+
 	}
 
 } );

+ 1 - 2
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 - height, top, near, this.far );
 
 	},
 

+ 1 - 12
src/math/Matrix4.js

@@ -833,7 +833,7 @@ Matrix4.prototype = {
 
 	}(),
 
-	makeFrustum: function ( left, right, bottom, top, near, far ) {
+	makePerspective: function ( left, right, bottom, top, near, far ) {
 
 		var te = this.elements;
 		var x = 2 * near / ( right - left );
@@ -853,17 +853,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;

+ 4 - 4
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!" );

+ 2 - 2
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 )
 		];