Skip to content

Commit

Permalink
avoid error when trying to cull an array with no meshes
Browse files Browse the repository at this point in the history
  • Loading branch information
memelotsqui committed Dec 10, 2023
1 parent ba3d9ed commit 0485167
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/library/cull-mesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,21 @@ const createCloneCullMesh = (mesh) => {
}

export const CullHiddenFaces = async(meshes) => {
if (meshes == null){
console.warn("Null parameter for meshes was provided. Skipping mesh culling.");
return;
}
if(!Array.isArray(meshes)){
console.warn("No valid mesh array was provided. Skipping mesh culling.");
return;
}
if (meshes.length == 0){
console.warn("No mesh array with elements was provided. Skipping mesh culling.");
return;
}
// make a 2 dimensional array that will hold the layers
const meshData = [];

mainScene = meshes[0].parent;

if (mainScene.lines != null){
Expand Down

0 comments on commit 0485167

Please sign in to comment.