瀏覽代碼

Revert "support boxes as part of frustum check"

Garrett Johnson 3 年之前
父節點
當前提交
f79bfbc444
共有 2 個文件被更改,包括 11 次插入8 次删除
  1. 1 1
      src/three/DebugTilesRenderer.js
  2. 10 7
      src/three/TilesRenderer.js

+ 1 - 1
src/three/DebugTilesRenderer.js

@@ -191,7 +191,7 @@ export class DebugTilesRenderer extends TilesRenderer {
 		}
 
 		let maxDistance = - 1;
-		if ( this.maxDebugDistance === - 1 && this.root.cached.sphere ) {
+		if ( this.maxDebugDistance === - 1 ) {
 
 			maxDistance = this.root.cached.sphere.radius;
 

+ 10 - 7
src/three/TilesRenderer.js

@@ -525,6 +525,14 @@ export class TilesRenderer extends TilesRendererBase {
 			sphere.radius = data[ 3 ];
 			sphere.applyMatrix4( transform );
 
+		} else if ( 'box' in tile.boundingVolume ) {
+
+			const data = tile.boundingVolume.box;
+			sphere = new Sphere();
+			box.getBoundingSphere( sphere );
+			sphere.center.set( data[ 0 ], data[ 1 ], data[ 2 ] );
+			sphere.applyMatrix4( transform );
+
 		}
 
 		const region = null;
@@ -933,9 +941,8 @@ export class TilesRenderer extends TilesRendererBase {
 
 		const cached = tile.cached;
 		const sphere = cached.sphere;
-		const box = cached.box;
 		const inFrustum = cached.inFrustum;
-		if ( sphere || box ) {
+		if ( sphere ) {
 
 			const cameraInfo = this.cameraInfo;
 			let inView = false;
@@ -944,11 +951,7 @@ export class TilesRenderer extends TilesRendererBase {
 				// Track which camera frustums this tile is in so we can use it
 				// to ignore the error calculations for cameras that can't see it
 				const frustum = cameraInfo[ i ].frustum;
-
-				const intersectsSphere = sphere && frustum.intersectsSphere( sphere );
-				const intersectsBox = box && frustum.intersectsBox( box );
-
-				if ( intersectsSphere || intersectsBox ) {
+				if ( frustum.intersectsSphere( sphere ) ) {
 
 					inView = true;
 					inFrustum[ i ] = true;