2
0
ide user ide_gero3 13 жил өмнө
parent
commit
19578522e5

+ 1 - 2
src/core/Frustum.js

@@ -44,8 +44,7 @@ THREE.Frustum.prototype.contains = function ( object ) {
 	var distance,
 	var distance,
 	planes = this.planes,
 	planes = this.planes,
 	matrix = object.matrixWorld,
 	matrix = object.matrixWorld,
-	scale = THREE.Frustum.__v1.set( matrix.getColumnX().length(), matrix.getColumnY().length(), matrix.getColumnZ().length() ),
-	radius = - object.geometry.boundingSphere.radius * Math.max( scale.x, Math.max( scale.y, scale.z ) );
+	radius = - object.geometry.boundingSphere.radius * matrix.getMaxScaleOnAxis();
 
 
 	for ( var i = 0; i < 6; i ++ ) {
 	for ( var i = 0; i < 6; i ++ ) {
 
 

+ 10 - 0
src/core/Matrix4.js

@@ -805,6 +805,16 @@ THREE.Matrix4.prototype = {
 		return this;
 		return this;
 
 
 	},
 	},
+    
+    getMaxScaleOnAxis : function () {
+
+        var scaleXSq =  this.n11 * this.n11 + this.n21 * this.n21 + this.n31 * this.n31;
+        var scaleYSq =  this.n12 * this.n12 + this.n22 * this.n22 + this.n32 * this.n32;
+        var scaleZSq =  this.n13 * this.n13 + this.n23 * this.n23 + this.n33 * this.n33;
+        
+        return Math.sqrt(Math.max( scaleXSq , Math.max( scaleYSq , scaleZSq )));
+
+    },
 
 
 	//
 	//