From c45970dc7ae0ebfee39e373617ae15a8f75af13d Mon Sep 17 00:00:00 2001 From: WestLangley Date: Mon, 20 Jul 2026 11:47:27 -0400 Subject: [PATCH 1/2] Matrix4: Improve inline documentation (#34067) --- src/math/Matrix4.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/math/Matrix4.js b/src/math/Matrix4.js index fdac88099c0c24..4528507b70d381 100644 --- a/src/math/Matrix4.js +++ b/src/math/Matrix4.js @@ -229,7 +229,7 @@ class Matrix4 { } /** - * Extracts the basis of this matrix into the three axis vectors provided. + * Extracts the basis vectors of this matrix into the three vectors provided. * * @param {Vector3} xAxis - The basis's x axis. * @param {Vector3} yAxis - The basis's y axis. @@ -788,7 +788,7 @@ class Matrix4 { } /** - * Multiplies the columns of this matrix by the given vector. + * Scales each of the first three columns of this matrix by the corresponding component of the given vector. * * @param {Vector3} v - The scale vector. * @return {Matrix4} A reference to this matrix. From 780115ef651404a9caf0399757f345392d0d72a0 Mon Sep 17 00:00:00 2001 From: Michael Herzog Date: Mon, 20 Jul 2026 18:03:01 +0200 Subject: [PATCH 2/2] Object3D: Add `intersectsFrustum()`. (#34065) --- src/core/Object3D.js | 11 +++++++++++ src/objects/Line.js | 12 ++++++++++++ src/objects/Mesh.js | 12 ++++++++++++ src/objects/Points.js | 12 ++++++++++++ src/objects/Sprite.js | 12 ++++++++++++ src/renderers/WebGLRenderer.js | 4 ++-- src/renderers/common/Renderer.js | 4 ++-- src/renderers/webgl/WebGLShadowMap.js | 2 +- 8 files changed, 64 insertions(+), 5 deletions(-) diff --git a/src/core/Object3D.js b/src/core/Object3D.js index a71aed581e2966..556ee3f4ac5848 100644 --- a/src/core/Object3D.js +++ b/src/core/Object3D.js @@ -1060,6 +1060,17 @@ class Object3D extends EventDispatcher { */ raycast( /* raycaster, intersects */ ) {} + /** + * Abstract method to test whether this 3D object intersects the given frustum. + * Renderable 3D objects such as {@link Mesh}, {@link Line} or {@link Points} + * implement this method in order to use frustum culling. + * + * @abstract + * @param {Frustum|FrustumArray} frustum - The frustum to test. + * @return {boolean|undefined} Whether this 3D object intersects the given frustum or not. + */ + intersectsFrustum( /* frustum */ ) {} + /** * Executes the callback on this 3D object and all descendants. * diff --git a/src/objects/Line.js b/src/objects/Line.js index cb5df00e4779b4..c2f120c882c900 100644 --- a/src/objects/Line.js +++ b/src/objects/Line.js @@ -151,6 +151,18 @@ class Line extends Object3D { } + /** + * Returns `true` if this line intersects the given frustum. + * + * @param {Frustum|FrustumArray} frustum - The frustum to test. + * @return {boolean} Whether this line intersects the given frustum or not. + */ + intersectsFrustum( frustum ) { + + return frustum.intersectsObject( this ); + + } + /** * Computes intersection points between a casted ray and this line. * diff --git a/src/objects/Mesh.js b/src/objects/Mesh.js index 2f5f105ac58a44..b80d3de8f403a6 100644 --- a/src/objects/Mesh.js +++ b/src/objects/Mesh.js @@ -217,6 +217,18 @@ class Mesh extends Object3D { } + /** + * Returns `true` if this mesh intersects the given frustum. + * + * @param {Frustum|FrustumArray} frustum - The frustum to test. + * @return {boolean} Whether this mesh intersects the given frustum or not. + */ + intersectsFrustum( frustum ) { + + return frustum.intersectsObject( this ); + + } + /** * Computes intersection points between a casted ray and this line. * diff --git a/src/objects/Points.js b/src/objects/Points.js index 3ebc0852e6c415..1ab25da930fbd6 100644 --- a/src/objects/Points.js +++ b/src/objects/Points.js @@ -89,6 +89,18 @@ class Points extends Object3D { } + /** + * Returns `true` if this point cloud intersects the given frustum. + * + * @param {Frustum|FrustumArray} frustum - The frustum to test. + * @return {boolean} Whether this point cloud intersects the given frustum or not. + */ + intersectsFrustum( frustum ) { + + return frustum.intersectsObject( this ); + + } + /** * Computes intersection points between a casted ray and this point cloud. * diff --git a/src/objects/Sprite.js b/src/objects/Sprite.js index 8134b093253e6b..23b6644228abb9 100644 --- a/src/objects/Sprite.js +++ b/src/objects/Sprite.js @@ -120,6 +120,18 @@ class Sprite extends Object3D { } + /** + * Returns `true` if this sprite intersects the given frustum. + * + * @param {Frustum|FrustumArray} frustum - The frustum to test. + * @return {boolean} Whether this sprite intersects the given frustum or not. + */ + intersectsFrustum( frustum ) { + + return frustum.intersectsSprite( this ); + + } + /** * Computes intersection points between a casted ray and this sprite. * diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index b3c14b136900cf..57fa6c3e8d308e 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -1868,7 +1868,7 @@ class WebGLRenderer { } else if ( object.isSprite ) { - if ( ! object.frustumCulled || _frustum.intersectsSprite( object ) ) { + if ( ! object.frustumCulled || object.intersectsFrustum( _frustum ) ) { if ( sortObjects ) { @@ -1890,7 +1890,7 @@ class WebGLRenderer { } else if ( object.isMesh || object.isLine || object.isPoints ) { - if ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) { + if ( ! object.frustumCulled || object.intersectsFrustum( _frustum ) ) { const geometry = objects.update( object ); const material = object.material; diff --git a/src/renderers/common/Renderer.js b/src/renderers/common/Renderer.js index a6dfd09ba69929..d6362374c1fca6 100644 --- a/src/renderers/common/Renderer.js +++ b/src/renderers/common/Renderer.js @@ -3159,7 +3159,7 @@ class Renderer { const frustum = camera.isArrayCamera ? _frustumArray : _frustum; - if ( ! object.frustumCulled || frustum.intersectsSprite( object ) ) { + if ( ! object.frustumCulled || object.intersectsFrustum( frustum ) ) { if ( this.sortObjects === true ) { @@ -3185,7 +3185,7 @@ class Renderer { const frustum = camera.isArrayCamera ? _frustumArray : _frustum; - if ( ! object.frustumCulled || frustum.intersectsObject( object ) ) { + if ( ! object.frustumCulled || object.intersectsFrustum( frustum ) ) { const { geometry, material } = object; diff --git a/src/renderers/webgl/WebGLShadowMap.js b/src/renderers/webgl/WebGLShadowMap.js index c2640be29827a5..aabef88fadc2f6 100644 --- a/src/renderers/webgl/WebGLShadowMap.js +++ b/src/renderers/webgl/WebGLShadowMap.js @@ -512,7 +512,7 @@ function WebGLShadowMap( renderer, objects, capabilities ) { if ( visible && ( object.isMesh || object.isLine || object.isPoints ) ) { - if ( ( object.castShadow || ( object.receiveShadow && type === VSMShadowMap ) ) && ( ! object.frustumCulled || _frustum.intersectsObject( object ) ) ) { + if ( ( object.castShadow || ( object.receiveShadow && type === VSMShadowMap ) ) && ( ! object.frustumCulled || object.intersectsFrustum( _frustum ) ) ) { object.modelViewMatrix.multiplyMatrices( shadowCamera.matrixWorldInverse, object.matrixWorld );