Ver código fonte

add box to frustum check

George Madges 3 anos atrás
pai
commit
a92d10ea94
1 arquivos alterados com 7 adições e 2 exclusões
  1. 7 2
      src/three/TilesRenderer.js

+ 7 - 2
src/three/TilesRenderer.js

@@ -941,8 +941,9 @@ export class TilesRenderer extends TilesRendererBase {
 
 		const cached = tile.cached;
 		const sphere = cached.sphere;
+		const box = cached.box;
 		const inFrustum = cached.inFrustum;
-		if ( sphere ) {
+		if ( sphere || box ) {
 
 			const cameraInfo = this.cameraInfo;
 			let inView = false;
@@ -951,7 +952,11 @@ 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;
-				if ( frustum.intersectsSphere( sphere ) ) {
+
+				const intersectsSphere = sphere && frustum.intersectsSphere( sphere );
+				const intersectsBox = box && frustum.intersectsBox( box );
+
+				if ( intersectsSphere || intersectsBox ) {
 
 					inView = true;
 					inFrustum[ i ] = true;