Browse Source

Clip the distance between bounding sphere and the camera at a minimum of zero to mimic the behavior for bounding boxes.

Justin Manley 4 năm trước cách đây
mục cha
commit
a4fc135778
1 tập tin đã thay đổi với 4 bổ sung1 xóa
  1. 4 1
      src/three/TilesRenderer.js

+ 4 - 1
src/three/TilesRenderer.js

@@ -842,7 +842,10 @@ export class TilesRenderer extends TilesRendererBase {
 					} else {
 
 						tempVector.applyMatrix4( transformInverse );
-						distance = boundingSphere.distanceToPoint( tempVector );
+						// Sphere#distanceToPoint is negative inside the sphere, whereas Box3#distanceToPoint is
+						// zero inside the box. Clipping the distance to a minimum of zero ensures that both
+						// types of bounding volume behave the same way.
+						distance = Math.max( boundingSphere.distanceToPoint( tempVector ), 0 );
 
 					}