Skip to content

Commit

Permalink
Merge pull request #14464 from carolhmj/fixSPSAddMeshWithoutVertexNormal
Browse files Browse the repository at this point in the history
Add mesh without vertex normals to SPS
  • Loading branch information
sebavan committed Oct 25, 2023
2 parents 353fffd + 925220f commit 9c2993e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/dev/core/src/Particles/solidParticleSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ export class SolidParticleSystem implements IDisposable {
/**
* Adds some particles to the SPS from the model shape. Returns the shape id.
* Please read the doc : https://doc.babylonjs.com/features/featuresDeepDive/particles/solid_particle_system/immutable_sps
* @param mesh is any Mesh object that will be used as a model for the solid particles.
* @param mesh is any Mesh object that will be used as a model for the solid particles. If the mesh does not have vertex normals, it will turn on the recomputeNormals attribute.
* @param nb (positive integer) the number of particles to be created from this model
* @param options {positionFunction} is an optional javascript function to called for each particle on SPS creation.
* {vertexFunction} is an optional javascript function to called for each vertex of each particle on SPS creation
Expand All @@ -777,7 +777,7 @@ export class SolidParticleSystem implements IDisposable {
const meshNor = <FloatArray>mesh.getVerticesData(VertexBuffer.NormalKind);
this.recomputeNormals = meshNor ? false : true;
const indices = Array.from(meshInd);
const shapeNormals = Array.from(meshNor);
const shapeNormals = meshNor ? Array.from(meshNor) : [];
const shapeColors = meshCol ? Array.from(meshCol) : [];
const storage = options && options.storage ? options.storage : null;
let bbInfo: Nullable<BoundingInfo> = null;
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions packages/tools/tests/test/visualization/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1768,6 +1768,11 @@
"title": "Child overriding parent font properties",
"playgroundId": "#QFK9K4#25",
"referenceImage": "Childoverridingparentfontproperties.png"
},
{
"title": "Add mesh without vertex normals to SPS",
"playgroundId": "#H1SEDF#1",
"referenceImage": "AddmeshwithoutvertexnormalstoSPS.png"
}
]
}

0 comments on commit 9c2993e

Please sign in to comment.