|
@@ -10975,7 +10975,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
// Alpha equation
|
|
// Alpha equation
|
|
if (this._isBlendEquationParametersDirty) {
|
|
if (this._isBlendEquationParametersDirty) {
|
|
- gl.blendEquationSeparate(this._isBlendEquationParametersDirty[0], this._isBlendEquationParametersDirty[1]);
|
|
|
|
|
|
+ gl.blendEquationSeparate(this._blendEquationParameters[0], this._blendEquationParameters[1]);
|
|
this._isBlendEquationParametersDirty = false;
|
|
this._isBlendEquationParametersDirty = false;
|
|
}
|
|
}
|
|
// Constants
|
|
// Constants
|
|
@@ -12709,7 +12709,6 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
Engine.prototype.clear = function (color, backBuffer, depth, stencil) {
|
|
Engine.prototype.clear = function (color, backBuffer, depth, stencil) {
|
|
if (stencil === void 0) { stencil = false; }
|
|
if (stencil === void 0) { stencil = false; }
|
|
- this.applyStates();
|
|
|
|
var mode = 0;
|
|
var mode = 0;
|
|
if (backBuffer && color) {
|
|
if (backBuffer && color) {
|
|
this._gl.clearColor(color.r, color.g, color.b, color.a !== undefined ? color.a : 1.0);
|
|
this._gl.clearColor(color.r, color.g, color.b, color.a !== undefined ? color.a : 1.0);
|
|
@@ -56999,9 +56998,9 @@ var BABYLON;
|
|
this.textureMask = new BABYLON.Color4(1.0, 1.0, 1.0, 1.0);
|
|
this.textureMask = new BABYLON.Color4(1.0, 1.0, 1.0, 1.0);
|
|
/**
|
|
/**
|
|
* Gets or sets the billboard mode to use when isBillboardBased = true.
|
|
* Gets or sets the billboard mode to use when isBillboardBased = true.
|
|
- * Only BABYLON.AbstractMesh.BILLBOARDMODE_ALL and AbstractMesh.BILLBOARDMODE_Y are supported so far
|
|
|
|
|
|
+ * Value can be: ParticleSystem.BILLBOARDMODE_ALL, ParticleSystem.BILLBOARDMODE_Y, ParticleSystem.BILLBOARDMODE_STRETCHED
|
|
*/
|
|
*/
|
|
- this.billboardMode = BABYLON.AbstractMesh.BILLBOARDMODE_ALL;
|
|
|
|
|
|
+ this.billboardMode = BABYLON.ParticleSystem.BILLBOARDMODE_ALL;
|
|
this._isBillboardBased = true;
|
|
this._isBillboardBased = true;
|
|
/**
|
|
/**
|
|
* Local cache of defines for image processing.
|
|
* Local cache of defines for image processing.
|
|
@@ -58264,23 +58263,8 @@ var BABYLON;
|
|
ParticleSystem.prototype.isStarted = function () {
|
|
ParticleSystem.prototype.isStarted = function () {
|
|
return this._started;
|
|
return this._started;
|
|
};
|
|
};
|
|
- /**
|
|
|
|
- * Starts the particle system and begins to emit
|
|
|
|
- * @param delay defines the delay in milliseconds before starting the system (this.startDelay by default)
|
|
|
|
- */
|
|
|
|
- ParticleSystem.prototype.start = function (delay) {
|
|
|
|
|
|
+ ParticleSystem.prototype._prepareSubEmitterInternalArray = function () {
|
|
var _this = this;
|
|
var _this = this;
|
|
- if (delay === void 0) { delay = this.startDelay; }
|
|
|
|
- if (!this.targetStopDuration && this._hasTargetStopDurationDependantGradient()) {
|
|
|
|
- throw "Particle system started with a targetStopDuration dependant gradient (eg. startSizeGradients) but no targetStopDuration set";
|
|
|
|
- }
|
|
|
|
- if (delay) {
|
|
|
|
- setTimeout(function () {
|
|
|
|
- _this.start(0);
|
|
|
|
- }, delay);
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- // Convert the subEmitters field to the constant type field _subEmitters
|
|
|
|
this._subEmitters = new Array();
|
|
this._subEmitters = new Array();
|
|
if (this.subEmitters) {
|
|
if (this.subEmitters) {
|
|
this.subEmitters.forEach(function (subEmitter) {
|
|
this.subEmitters.forEach(function (subEmitter) {
|
|
@@ -58300,6 +58284,25 @@ var BABYLON;
|
|
});
|
|
});
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
|
|
+ * Starts the particle system and begins to emit
|
|
|
|
+ * @param delay defines the delay in milliseconds before starting the system (this.startDelay by default)
|
|
|
|
+ */
|
|
|
|
+ ParticleSystem.prototype.start = function (delay) {
|
|
|
|
+ var _this = this;
|
|
|
|
+ if (delay === void 0) { delay = this.startDelay; }
|
|
|
|
+ if (!this.targetStopDuration && this._hasTargetStopDurationDependantGradient()) {
|
|
|
|
+ throw "Particle system started with a targetStopDuration dependant gradient (eg. startSizeGradients) but no targetStopDuration set";
|
|
|
|
+ }
|
|
|
|
+ if (delay) {
|
|
|
|
+ setTimeout(function () {
|
|
|
|
+ _this.start(0);
|
|
|
|
+ }, delay);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // Convert the subEmitters field to the constant type field _subEmitters
|
|
|
|
+ this._prepareSubEmitterInternalArray();
|
|
this._started = true;
|
|
this._started = true;
|
|
this._stopped = false;
|
|
this._stopped = false;
|
|
this._actualFrame = 0;
|
|
this._actualFrame = 0;
|
|
@@ -59062,7 +59065,22 @@ var BABYLON;
|
|
serializationObject.textureMask = this.textureMask.asArray();
|
|
serializationObject.textureMask = this.textureMask.asArray();
|
|
serializationObject.customShader = this.customShader;
|
|
serializationObject.customShader = this.customShader;
|
|
serializationObject.preventAutoStart = this.preventAutoStart;
|
|
serializationObject.preventAutoStart = this.preventAutoStart;
|
|
- serializationObject.isAnimationSheetEnabled = this._isAnimationSheetEnabled;
|
|
|
|
|
|
+ // SubEmitters
|
|
|
|
+ if (this.subEmitters) {
|
|
|
|
+ serializationObject.subEmitters = [];
|
|
|
|
+ if (!this._subEmitters) {
|
|
|
|
+ this._prepareSubEmitterInternalArray();
|
|
|
|
+ }
|
|
|
|
+ for (var _i = 0, _a = this._subEmitters; _i < _a.length; _i++) {
|
|
|
|
+ var subs = _a[_i];
|
|
|
|
+ var cell = [];
|
|
|
|
+ for (var _b = 0, subs_1 = subs; _b < subs_1.length; _b++) {
|
|
|
|
+ var sub = subs_1[_b];
|
|
|
|
+ cell.push(sub.serialize());
|
|
|
|
+ }
|
|
|
|
+ serializationObject.subEmitters.push(cell);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
return serializationObject;
|
|
return serializationObject;
|
|
};
|
|
};
|
|
/** @hidden */
|
|
/** @hidden */
|
|
@@ -59092,6 +59110,7 @@ var BABYLON;
|
|
serializationObject.startDelay = particleSystem.startDelay;
|
|
serializationObject.startDelay = particleSystem.startDelay;
|
|
serializationObject.renderingGroupId = particleSystem.renderingGroupId;
|
|
serializationObject.renderingGroupId = particleSystem.renderingGroupId;
|
|
serializationObject.isBillboardBased = particleSystem.isBillboardBased;
|
|
serializationObject.isBillboardBased = particleSystem.isBillboardBased;
|
|
|
|
+ serializationObject.billboardMode = particleSystem.billboardMode;
|
|
serializationObject.minAngularSpeed = particleSystem.minAngularSpeed;
|
|
serializationObject.minAngularSpeed = particleSystem.minAngularSpeed;
|
|
serializationObject.maxAngularSpeed = particleSystem.maxAngularSpeed;
|
|
serializationObject.maxAngularSpeed = particleSystem.maxAngularSpeed;
|
|
serializationObject.minSize = particleSystem.minSize;
|
|
serializationObject.minSize = particleSystem.minSize;
|
|
@@ -59123,6 +59142,7 @@ var BABYLON;
|
|
serializationObject.spriteCellWidth = particleSystem.spriteCellWidth;
|
|
serializationObject.spriteCellWidth = particleSystem.spriteCellWidth;
|
|
serializationObject.spriteCellHeight = particleSystem.spriteCellHeight;
|
|
serializationObject.spriteCellHeight = particleSystem.spriteCellHeight;
|
|
serializationObject.spriteRandomStartCell = particleSystem.spriteRandomStartCell;
|
|
serializationObject.spriteRandomStartCell = particleSystem.spriteRandomStartCell;
|
|
|
|
+ serializationObject.isAnimationSheetEnabled = particleSystem.isAnimationSheetEnabled;
|
|
var colorGradients = particleSystem.getColorGradients();
|
|
var colorGradients = particleSystem.getColorGradients();
|
|
if (colorGradients) {
|
|
if (colorGradients) {
|
|
serializationObject.colorGradients = [];
|
|
serializationObject.colorGradients = [];
|
|
@@ -59298,7 +59318,7 @@ var BABYLON;
|
|
particleSystem.particleTexture.name = parsedParticleSystem.textureName;
|
|
particleSystem.particleTexture.name = parsedParticleSystem.textureName;
|
|
}
|
|
}
|
|
// Emitter
|
|
// Emitter
|
|
- if (parsedParticleSystem.emitterId === undefined) {
|
|
|
|
|
|
+ if (!parsedParticleSystem.emitterId && parsedParticleSystem.emitterId !== 0 && parsedParticleSystem.emitter === undefined) {
|
|
particleSystem.emitter = BABYLON.Vector3.Zero();
|
|
particleSystem.emitter = BABYLON.Vector3.Zero();
|
|
}
|
|
}
|
|
else if (parsedParticleSystem.emitterId) {
|
|
else if (parsedParticleSystem.emitterId) {
|
|
@@ -59314,6 +59334,9 @@ var BABYLON;
|
|
if (parsedParticleSystem.isBillboardBased !== undefined) {
|
|
if (parsedParticleSystem.isBillboardBased !== undefined) {
|
|
particleSystem.isBillboardBased = parsedParticleSystem.isBillboardBased;
|
|
particleSystem.isBillboardBased = parsedParticleSystem.isBillboardBased;
|
|
}
|
|
}
|
|
|
|
+ if (parsedParticleSystem.billboardMode !== undefined) {
|
|
|
|
+ particleSystem.billboardMode = parsedParticleSystem.billboardMode;
|
|
|
|
+ }
|
|
// Animations
|
|
// Animations
|
|
if (parsedParticleSystem.animations) {
|
|
if (parsedParticleSystem.animations) {
|
|
for (var animationIndex = 0; animationIndex < parsedParticleSystem.animations.length; animationIndex++) {
|
|
for (var animationIndex = 0; animationIndex < parsedParticleSystem.animations.length; animationIndex++) {
|
|
@@ -59491,6 +59514,19 @@ var BABYLON;
|
|
if (parsedParticleSystem.id) {
|
|
if (parsedParticleSystem.id) {
|
|
particleSystem.id = parsedParticleSystem.id;
|
|
particleSystem.id = parsedParticleSystem.id;
|
|
}
|
|
}
|
|
|
|
+ // SubEmitters
|
|
|
|
+ if (parsedParticleSystem.subEmitters) {
|
|
|
|
+ particleSystem.subEmitters = [];
|
|
|
|
+ for (var _i = 0, _a = parsedParticleSystem.subEmitters; _i < _a.length; _i++) {
|
|
|
|
+ var cell = _a[_i];
|
|
|
|
+ var cellArray = [];
|
|
|
|
+ for (var _b = 0, cell_1 = cell; _b < cell_1.length; _b++) {
|
|
|
|
+ var sub = cell_1[_b];
|
|
|
|
+ cellArray.push(BABYLON.SubEmitter.Parse(sub, scene, rootUrl));
|
|
|
|
+ }
|
|
|
|
+ particleSystem.subEmitters.push(cellArray);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
// Auto start
|
|
// Auto start
|
|
if (parsedParticleSystem.preventAutoStart) {
|
|
if (parsedParticleSystem.preventAutoStart) {
|
|
particleSystem.preventAutoStart = parsedParticleSystem.preventAutoStart;
|
|
particleSystem.preventAutoStart = parsedParticleSystem.preventAutoStart;
|
|
@@ -60645,6 +60681,33 @@ var BABYLON;
|
|
clone.particleSystem.disposeOnStop = true;
|
|
clone.particleSystem.disposeOnStop = true;
|
|
return clone;
|
|
return clone;
|
|
};
|
|
};
|
|
|
|
+ /**
|
|
|
|
+ * Serialize current object to a JSON object
|
|
|
|
+ * @returns the serialized object
|
|
|
|
+ */
|
|
|
|
+ SubEmitter.prototype.serialize = function () {
|
|
|
|
+ var serializationObject = {};
|
|
|
|
+ serializationObject.type = this.type;
|
|
|
|
+ serializationObject.inheritDirection = this.inheritDirection;
|
|
|
|
+ serializationObject.inheritedVelocityAmount = this.inheritedVelocityAmount;
|
|
|
|
+ serializationObject.particleSystem = this.particleSystem.serialize();
|
|
|
|
+ return serializationObject;
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
|
|
+ * Creates a new SubEmitter from a serialized JSON version
|
|
|
|
+ * @param serializationObject defines the JSON object to read from
|
|
|
|
+ * @param scene defines the hosting scene
|
|
|
|
+ * @param rootUrl defines the rootUrl for data loading
|
|
|
|
+ * @returns a new SubEmitter
|
|
|
|
+ */
|
|
|
|
+ SubEmitter.Parse = function (serializationObject, scene, rootUrl) {
|
|
|
|
+ var system = serializationObject.particleSystem;
|
|
|
|
+ var subEmitter = new SubEmitter(BABYLON.ParticleSystem.Parse(system, scene, rootUrl));
|
|
|
|
+ subEmitter.type = serializationObject.type;
|
|
|
|
+ subEmitter.inheritDirection = serializationObject.inheritDirection;
|
|
|
|
+ subEmitter.inheritedVelocityAmount = serializationObject.inheritedVelocityAmount;
|
|
|
|
+ return subEmitter;
|
|
|
|
+ };
|
|
/** Release associated resources */
|
|
/** Release associated resources */
|
|
SubEmitter.prototype.dispose = function () {
|
|
SubEmitter.prototype.dispose = function () {
|
|
this.particleSystem.dispose();
|
|
this.particleSystem.dispose();
|
|
@@ -74393,10 +74456,6 @@ var BABYLON;
|
|
mesh.parent = scene.getLastEntryByID(mesh._waitingParentId);
|
|
mesh.parent = scene.getLastEntryByID(mesh._waitingParentId);
|
|
mesh._waitingParentId = null;
|
|
mesh._waitingParentId = null;
|
|
}
|
|
}
|
|
- if (mesh._waitingActions) {
|
|
|
|
- BABYLON.ActionManager.Parse(mesh._waitingActions, mesh, scene);
|
|
|
|
- mesh._waitingActions = null;
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
// freeze world matrix application
|
|
// freeze world matrix application
|
|
for (index = 0, cache = scene.meshes.length; index < cache; index++) {
|
|
for (index = 0, cache = scene.meshes.length; index < cache; index++) {
|
|
@@ -74434,7 +74493,14 @@ var BABYLON;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
BABYLON.AbstractScene.Parse(parsedData, scene, container, rootUrl);
|
|
BABYLON.AbstractScene.Parse(parsedData, scene, container, rootUrl);
|
|
- // Actions (scene)
|
|
|
|
|
|
+ // Actions (scene) Done last as it can access other objects.
|
|
|
|
+ for (index = 0, cache = scene.meshes.length; index < cache; index++) {
|
|
|
|
+ var mesh = scene.meshes[index];
|
|
|
|
+ if (mesh._waitingActions) {
|
|
|
|
+ BABYLON.ActionManager.Parse(mesh._waitingActions, mesh, scene);
|
|
|
|
+ mesh._waitingActions = null;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if (parsedData.actions !== undefined && parsedData.actions !== null) {
|
|
if (parsedData.actions !== undefined && parsedData.actions !== null) {
|
|
BABYLON.ActionManager.Parse(parsedData.actions, null, scene);
|
|
BABYLON.ActionManager.Parse(parsedData.actions, null, scene);
|
|
}
|
|
}
|