Selaa lähdekoodia

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

Justin Manley 4 vuotta sitten
vanhempi
commit
a4fc135778
1 muutettua tiedostoa jossa 4 lisäystä ja 1 poistoa
  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 );
 
 					}