Explorar o código

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

Justin Manley %!s(int64=4) %!d(string=hai) anos
pai
achega
a4fc135778
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  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 );
 
 					}