Browse Source

Merge pull request #772 from jbousquie/fix.SPS

fix : positionFunction and vertexFunction must be null by default in …
Raanan Weber 9 years ago
parent
commit
acd0980cf5
1 changed files with 5 additions and 2 deletions
  1. 5 2
      src/Particles/babylon.solidParticleSystem.ts

+ 5 - 2
src/Particles/babylon.solidParticleSystem.ts

@@ -224,8 +224,11 @@ module BABYLON {
 
             var shape = this._posToShape(meshPos);
             var shapeUV = this._uvsToShapeUV(meshUV);
+
+            var posfunc = options ? options.positionFunction : null;
+            var vtxfunc = options ? options.vertexFunction : null;
  
-            var modelShape = new ModelShape(this._shapeCounter, shape, shapeUV, options.positionFunction, options.vertexFunction);
+            var modelShape = new ModelShape(this._shapeCounter, shape, shapeUV, posfunc, vtxfunc);
 
             // particles
             for (var i = 0; i < nb; i++) {
@@ -265,7 +268,7 @@ module BABYLON {
                 this._vertex.z = this._shape[pt].z;
 
                 if (particle._model._vertexFunction) {
-                    particle._model._vertexFunction(this._copy, this._vertex, pt);
+                    particle._model._vertexFunction(this._copy, this._vertex, pt); // recall to stored vertexFunction
                 }
 
                 this._vertex.x *= this._copy.scale.x;