Skip to content

Commit

Permalink
BatchedMesh: Add sorting and frustum culling for shadows (mrdoob#27258)
Browse files Browse the repository at this point in the history
  • Loading branch information
gkjohnson authored and AdaRoseCannon committed Jan 15, 2024
1 parent 84e7751 commit 571b85e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/objects/BatchedMesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ class BatchedMesh extends Mesh {

}

onBeforeRender( _renderer, _scene, camera, geometry, material/*, _group*/ ) {
onBeforeRender( renderer, scene, camera, geometry, material/*, _group*/ ) {

// if visibility has not changed and frustum culling and object sorting is not required
// then skip iterating over all items
Expand Down Expand Up @@ -908,7 +908,7 @@ class BatchedMesh extends Mesh {
.multiply( this.matrixWorld );
_frustum.setFromProjectionMatrix(
_projScreenMatrix,
_renderer.isWebGPURenderer ? WebGPUCoordinateSystem : WebGLCoordinateSystem
renderer.isWebGPURenderer ? WebGPUCoordinateSystem : WebGLCoordinateSystem
);

}
Expand Down Expand Up @@ -1009,6 +1009,12 @@ class BatchedMesh extends Mesh {

}

onBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial/* , group */ ) {

this.onBeforeRender( renderer, null, shadowCamera, geometry, depthMaterial );

}

}

export { BatchedMesh };

0 comments on commit 571b85e

Please sign in to comment.