Skip to content

Commit e828fd0

Browse files
committed
Introduce intersectsFrustum so that objects can override it
1 parent 202bbb7 commit e828fd0

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

examples/jsm/renderers/Projector.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ class Projector {
365365
} else if ( object.isMesh || object.isLine || object.isPoints ) {
366366

367367
if ( object.material.visible === false ) return;
368-
if ( object.frustumCulled === true && _frustum.intersectsObject( object ) === false ) return;
368+
if ( object.frustumCulled === true && object.intersectsFrustum( _frustum ) === false ) return;
369369

370370
addObject( object );
371371

examples/jsm/renderers/webgpu/WebGPURenderer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ class WebGPURenderer {
727727

728728
} else if ( object.isMesh || object.isLine || object.isPoints ) {
729729

730-
if ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) {
730+
if ( ! object.frustumCulled || object.intersectsFrustum( _frustum ) ) {
731731

732732
if ( this.sortObjects === true ) {
733733

src/core/Object3D.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,12 @@ class Object3D extends EventDispatcher {
532532

533533
raycast( /* raycaster, intersects */ ) {}
534534

535+
intersectsFrustum( frustum ) {
536+
537+
return frustum.intersectsObject( this );
538+
539+
}
540+
535541
traverse( callback ) {
536542

537543
callback( this );

src/renderers/WebGLRenderer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,7 @@ function WebGLRenderer( parameters = {} ) {
11491149

11501150
}
11511151

1152-
if ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) {
1152+
if ( ! object.frustumCulled || object.intersectsFrustum( _frustum ) ) {
11531153

11541154
if ( sortObjects ) {
11551155

src/renderers/webgl/WebGLShadowMap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
322322

323323
if ( visible && ( object.isMesh || object.isLine || object.isPoints ) ) {
324324

325-
if ( ( object.castShadow || ( object.receiveShadow && type === VSMShadowMap ) ) && ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) ) {
325+
if ( ( object.castShadow || ( object.receiveShadow && type === VSMShadowMap ) ) && ( ! object.frustumCulled || object.intersectsFrustum( _frustum ) ) ) {
326326

327327
object.modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld );
328328

0 commit comments

Comments
 (0)