|
@@ -14067,11 +14067,16 @@ var BABYLON;
|
|
|
if (defines === void 0) { defines = ""; }
|
|
|
var attributesNamesOrOptions = BABYLON.ParticleSystem._GetAttributeNamesOrOptions();
|
|
|
var effectCreationOption = BABYLON.ParticleSystem._GetEffectCreationOptions();
|
|
|
- defines += "\n#define BILLBOARD\n";
|
|
|
+ if (defines.indexOf(" BILLBOARD") === -1) {
|
|
|
+ defines += "\n#define BILLBOARD\n";
|
|
|
+ }
|
|
|
+ if (samplers.indexOf("diffuseSampler") === -1) {
|
|
|
+ samplers.push("diffuseSampler");
|
|
|
+ }
|
|
|
return this.createEffect({
|
|
|
vertex: "particles",
|
|
|
fragmentElement: fragmentName
|
|
|
- }, attributesNamesOrOptions, effectCreationOption.concat(uniformsNames), ["diffuseSampler"].concat(samplers), defines, fallbacks, onCompiled, onError);
|
|
|
+ }, attributesNamesOrOptions, effectCreationOption.concat(uniformsNames), samplers, defines, fallbacks, onCompiled, onError);
|
|
|
};
|
|
|
/**
|
|
|
* Directly creates a webGL program
|
|
@@ -36956,6 +36961,7 @@ var BABYLON;
|
|
|
* @returns the VertexData
|
|
|
*/
|
|
|
VertexData.prototype.transform = function (matrix) {
|
|
|
+ var flip = matrix.m[0] * matrix.m[5] * matrix.m[10] < 0;
|
|
|
var transformed = BABYLON.Vector3.Zero();
|
|
|
var index;
|
|
|
if (this.positions) {
|
|
@@ -36990,6 +36996,13 @@ var BABYLON;
|
|
|
this.tangents[index + 3] = tangentTransformed.w;
|
|
|
}
|
|
|
}
|
|
|
+ if (flip && this.indices) {
|
|
|
+ for (index = 0; index < this.indices.length; index += 3) {
|
|
|
+ var tmp = this.indices[index + 1];
|
|
|
+ this.indices[index + 1] = this.indices[index + 2];
|
|
|
+ this.indices[index + 2] = tmp;
|
|
|
+ }
|
|
|
+ }
|
|
|
return this;
|
|
|
};
|
|
|
/**
|
|
@@ -54136,9 +54149,19 @@ var BABYLON;
|
|
|
result = BABYLON.Vector3.Cross(p1p2, p3p2);
|
|
|
}
|
|
|
if (useWorldCoordinates) {
|
|
|
- result = BABYLON.Vector3.TransformNormal(result, this.pickedMesh.getWorldMatrix());
|
|
|
+ var wm = this.pickedMesh.getWorldMatrix();
|
|
|
+ if (this.pickedMesh.nonUniformScaling) {
|
|
|
+ BABYLON.Tmp.Matrix[0].copyFrom(wm);
|
|
|
+ wm = BABYLON.Tmp.Matrix[0];
|
|
|
+ wm.setTranslationFromFloats(0, 0, 0);
|
|
|
+ wm.invert();
|
|
|
+ wm.transposeToRef(BABYLON.Tmp.Matrix[1]);
|
|
|
+ wm = BABYLON.Tmp.Matrix[1];
|
|
|
+ }
|
|
|
+ result = BABYLON.Vector3.TransformNormal(result, wm);
|
|
|
}
|
|
|
- return BABYLON.Vector3.Normalize(result);
|
|
|
+ result.normalize();
|
|
|
+ return result;
|
|
|
};
|
|
|
/**
|
|
|
* Gets the texture coordinates of where the pick occured
|
|
@@ -56342,6 +56365,9 @@ var BABYLON;
|
|
|
var defines = (program.shaderOptions.defines.length > 0) ? program.shaderOptions.defines.join("\n") : "";
|
|
|
custom = this._scene.getEngine().createEffectForParticles(program.shaderPath.fragmentElement, program.shaderOptions.uniforms, program.shaderOptions.samplers, defines);
|
|
|
}
|
|
|
+ else if (this._customEffect) {
|
|
|
+ custom = this._customEffect;
|
|
|
+ }
|
|
|
var result = new ParticleSystem(name, this._capacity, this._scene, custom);
|
|
|
result.customShader = program;
|
|
|
BABYLON.Tools.DeepCopy(this, result, ["particles", "customShader"]);
|
|
@@ -56519,8 +56545,8 @@ var BABYLON;
|
|
|
}
|
|
|
}
|
|
|
// Emitter
|
|
|
+ var emitterType;
|
|
|
if (parsedParticleSystem.particleEmitterType) {
|
|
|
- var emitterType = void 0;
|
|
|
switch (parsedParticleSystem.particleEmitterType.type) {
|
|
|
case "SphereEmitter":
|
|
|
emitterType = new BABYLON.SphereParticleEmitter();
|
|
@@ -56537,8 +56563,12 @@ var BABYLON;
|
|
|
break;
|
|
|
}
|
|
|
emitterType.parse(parsedParticleSystem.particleEmitterType);
|
|
|
- particleSystem.particleEmitterType = emitterType;
|
|
|
}
|
|
|
+ else {
|
|
|
+ emitterType = new BABYLON.BoxParticleEmitter();
|
|
|
+ emitterType.parse(parsedParticleSystem);
|
|
|
+ }
|
|
|
+ particleSystem.particleEmitterType = emitterType;
|
|
|
};
|
|
|
/**
|
|
|
* Parses a JSON object to create a particle system.
|