Skip to content

Commit

Permalink
Merge pull request #268 from NASA-AMMOS/revert-264-frustum-check-boxes
Browse files Browse the repository at this point in the history
Revert "support boxes as part of frustum check"
  • Loading branch information
gkjohnson authored Jun 29, 2022
2 parents 3d85397 + f79bfbc commit c2bccc4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/three/DebugTilesRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
17 changes: 10 additions & 7 deletions src/three/TilesRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit c2bccc4

Please sign in to comment.