|
@@ -13741,35 +13741,6 @@ var BABYLON;
|
|
return effect;
|
|
return effect;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
- * Create an effect to use with particle systems.
|
|
|
|
- * Please note that some parameters like animation sheets or not being billboard are not supported in this configuration
|
|
|
|
- * @param fragmentName defines the base name of the effect (The name of file without .fragment.fx)
|
|
|
|
- * @param uniformsNames defines a list of attribute names
|
|
|
|
- * @param samplers defines an array of string used to represent textures
|
|
|
|
- * @param defines defines the string containing the defines to use to compile the shaders
|
|
|
|
- * @param fallbacks defines the list of potential fallbacks to use if shader conmpilation fails
|
|
|
|
- * @param onCompiled defines a function to call when the effect creation is successful
|
|
|
|
- * @param onError defines a function to call when the effect creation has failed
|
|
|
|
- * @returns the new Effect
|
|
|
|
- */
|
|
|
|
- Engine.prototype.createEffectForParticles = function (fragmentName, uniformsNames, samplers, defines, fallbacks, onCompiled, onError) {
|
|
|
|
- if (uniformsNames === void 0) { uniformsNames = []; }
|
|
|
|
- if (samplers === void 0) { samplers = []; }
|
|
|
|
- if (defines === void 0) { defines = ""; }
|
|
|
|
- var attributesNamesOrOptions = BABYLON.ParticleSystem._GetAttributeNamesOrOptions();
|
|
|
|
- var effectCreationOption = BABYLON.ParticleSystem._GetEffectCreationOptions();
|
|
|
|
- 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), samplers, defines, fallbacks, onCompiled, onError);
|
|
|
|
- };
|
|
|
|
- /**
|
|
|
|
* Directly creates a webGL program
|
|
* Directly creates a webGL program
|
|
* @param vertexCode defines the vertex shader code to use
|
|
* @param vertexCode defines the vertex shader code to use
|
|
* @param fragmentCode defines the fragment shader code to use
|
|
* @param fragmentCode defines the fragment shader code to use
|
|
@@ -23717,6 +23688,7 @@ var BABYLON;
|
|
SceneComponentConstants.NAME_LAYER = "Layer";
|
|
SceneComponentConstants.NAME_LAYER = "Layer";
|
|
SceneComponentConstants.NAME_LENSFLARESYSTEM = "LensFlareSystem";
|
|
SceneComponentConstants.NAME_LENSFLARESYSTEM = "LensFlareSystem";
|
|
SceneComponentConstants.NAME_BOUNDINGBOXRENDERER = "BoundingBoxRenderer";
|
|
SceneComponentConstants.NAME_BOUNDINGBOXRENDERER = "BoundingBoxRenderer";
|
|
|
|
+ SceneComponentConstants.NAME_PARTICLESYSTEM = "ParticleSystem";
|
|
SceneComponentConstants.STEP_ISREADYFORMESH_EFFECTLAYER = 0;
|
|
SceneComponentConstants.STEP_ISREADYFORMESH_EFFECTLAYER = 0;
|
|
SceneComponentConstants.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER = 0;
|
|
SceneComponentConstants.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER = 0;
|
|
SceneComponentConstants.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER = 0;
|
|
SceneComponentConstants.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER = 0;
|
|
@@ -23786,7 +23758,7 @@ var BABYLON;
|
|
/**
|
|
/**
|
|
* Base class of the scene acting as a container for the different elements composing a scene.
|
|
* Base class of the scene acting as a container for the different elements composing a scene.
|
|
* This class is dynamically extended by the different components of the scene increasing
|
|
* This class is dynamically extended by the different components of the scene increasing
|
|
- * flexibility and reducing coupling.
|
|
|
|
|
|
+ * flexibility and reducing coupling
|
|
*/
|
|
*/
|
|
var AbstractScene = /** @class */ (function () {
|
|
var AbstractScene = /** @class */ (function () {
|
|
function AbstractScene() {
|
|
function AbstractScene() {
|
|
@@ -23860,7 +23832,7 @@ var BABYLON;
|
|
this.textures = new Array();
|
|
this.textures = new Array();
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
- * Adds a parser in the list of availables ones.
|
|
|
|
|
|
+ * Adds a parser in the list of available ones
|
|
* @param name Defines the name of the parser
|
|
* @param name Defines the name of the parser
|
|
* @param parser Defines the parser to add
|
|
* @param parser Defines the parser to add
|
|
*/
|
|
*/
|
|
@@ -23868,6 +23840,36 @@ var BABYLON;
|
|
this._BabylonFileParsers[name] = parser;
|
|
this._BabylonFileParsers[name] = parser;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
|
|
+ * Gets a general parser from the list of avaialble ones
|
|
|
|
+ * @param name Defines the name of the parser
|
|
|
|
+ * @returns the requested parser or null
|
|
|
|
+ */
|
|
|
|
+ AbstractScene.GetParser = function (name) {
|
|
|
|
+ if (this._BabylonFileParsers[name]) {
|
|
|
|
+ return this._BabylonFileParsers[name];
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
|
|
+ * Adds n individual parser in the list of available ones
|
|
|
|
+ * @param name Defines the name of the parser
|
|
|
|
+ * @param parser Defines the parser to add
|
|
|
|
+ */
|
|
|
|
+ AbstractScene.AddIndividualParser = function (name, parser) {
|
|
|
|
+ this._IndividualBabylonFileParsers[name] = parser;
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
|
|
+ * Gets an individual parser from the list of avaialble ones
|
|
|
|
+ * @param name Defines the name of the parser
|
|
|
|
+ * @returns the requested parser or null
|
|
|
|
+ */
|
|
|
|
+ AbstractScene.GetIndividualParser = function (name) {
|
|
|
|
+ if (this._IndividualBabylonFileParsers[name]) {
|
|
|
|
+ return this._IndividualBabylonFileParsers[name];
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
* Parser json data and populate both a scene and its associated container object
|
|
* Parser json data and populate both a scene and its associated container object
|
|
* @param jsonData Defines the data to parse
|
|
* @param jsonData Defines the data to parse
|
|
* @param scene Defines the scene to parse the data for
|
|
* @param scene Defines the scene to parse the data for
|
|
@@ -23885,6 +23887,10 @@ var BABYLON;
|
|
* Stores the list of available parsers in the application.
|
|
* Stores the list of available parsers in the application.
|
|
*/
|
|
*/
|
|
AbstractScene._BabylonFileParsers = {};
|
|
AbstractScene._BabylonFileParsers = {};
|
|
|
|
+ /**
|
|
|
|
+ * Stores the list of available individual parsers in the application.
|
|
|
|
+ */
|
|
|
|
+ AbstractScene._IndividualBabylonFileParsers = {};
|
|
return AbstractScene;
|
|
return AbstractScene;
|
|
}());
|
|
}());
|
|
BABYLON.AbstractScene = AbstractScene;
|
|
BABYLON.AbstractScene = AbstractScene;
|
|
@@ -29241,9 +29247,6 @@ var BABYLON;
|
|
this.skeletons.forEach(function (o) {
|
|
this.skeletons.forEach(function (o) {
|
|
_this.scene.addSkeleton(o);
|
|
_this.scene.addSkeleton(o);
|
|
});
|
|
});
|
|
- this.particleSystems.forEach(function (o) {
|
|
|
|
- _this.scene.addParticleSystem(o);
|
|
|
|
- });
|
|
|
|
this.animations.forEach(function (o) {
|
|
this.animations.forEach(function (o) {
|
|
_this.scene.addAnimation(o);
|
|
_this.scene.addAnimation(o);
|
|
});
|
|
});
|
|
@@ -29298,9 +29301,6 @@ var BABYLON;
|
|
this.skeletons.forEach(function (o) {
|
|
this.skeletons.forEach(function (o) {
|
|
_this.scene.removeSkeleton(o);
|
|
_this.scene.removeSkeleton(o);
|
|
});
|
|
});
|
|
- this.particleSystems.forEach(function (o) {
|
|
|
|
- _this.scene.removeParticleSystem(o);
|
|
|
|
- });
|
|
|
|
this.animations.forEach(function (o) {
|
|
this.animations.forEach(function (o) {
|
|
_this.scene.removeAnimation(o);
|
|
_this.scene.removeAnimation(o);
|
|
});
|
|
});
|
|
@@ -32551,7 +32551,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
- * Returns an array populated with ParticleSystem objects whose the mesh is the emitter.
|
|
|
|
|
|
+ * Returns an array populated with IParticleSystem objects whose the mesh is the emitter.
|
|
*/
|
|
*/
|
|
Mesh.prototype.getEmittedParticleSystems = function () {
|
|
Mesh.prototype.getEmittedParticleSystems = function () {
|
|
var results = new Array();
|
|
var results = new Array();
|
|
@@ -32564,7 +32564,7 @@ var BABYLON;
|
|
return results;
|
|
return results;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
- * Returns an array populated with ParticleSystem objects whose the mesh or its children are the emitter.
|
|
|
|
|
|
+ * Returns an array populated with IParticleSystem objects whose the mesh or its children are the emitter.
|
|
*/
|
|
*/
|
|
Mesh.prototype.getHierarchyEmittedParticleSystems = function () {
|
|
Mesh.prototype.getHierarchyEmittedParticleSystems = function () {
|
|
var results = new Array();
|
|
var results = new Array();
|
|
@@ -56716,10 +56716,6 @@ var BABYLON;
|
|
|
|
|
|
//# sourceMappingURL=babylon.particleSystem.js.map
|
|
//# sourceMappingURL=babylon.particleSystem.js.map
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-//# sourceMappingURL=babylon.IParticleEmitterType.js.map
|
|
|
|
-
|
|
|
|
var BABYLON;
|
|
var BABYLON;
|
|
(function (BABYLON) {
|
|
(function (BABYLON) {
|
|
/**
|
|
/**
|
|
@@ -57225,6 +57221,56 @@ var BABYLON;
|
|
|
|
|
|
//# sourceMappingURL=babylon.sphereParticleEmitter.js.map
|
|
//# sourceMappingURL=babylon.sphereParticleEmitter.js.map
|
|
|
|
|
|
|
|
+var BABYLON;
|
|
|
|
+(function (BABYLON) {
|
|
|
|
+ // Adds the parsers to the scene parsers.
|
|
|
|
+ BABYLON.AbstractScene.AddParser(BABYLON.SceneComponentConstants.NAME_PARTICLESYSTEM, function (parsedData, scene, container, rootUrl) {
|
|
|
|
+ // Particles Systems
|
|
|
|
+ if (parsedData.particleSystems !== undefined && parsedData.particleSystems !== null) {
|
|
|
|
+ for (var index = 0, cache = parsedData.particleSystems.length; index < cache; index++) {
|
|
|
|
+ var parsedParticleSystem = parsedData.particleSystems[index];
|
|
|
|
+ if (parsedParticleSystem.activeParticleCount) {
|
|
|
|
+ var ps = BABYLON.GPUParticleSystem.Parse(parsedParticleSystem, scene, rootUrl);
|
|
|
|
+ container.particleSystems.push(ps);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ var ps = BABYLON.ParticleSystem.Parse(parsedParticleSystem, scene, rootUrl);
|
|
|
|
+ container.particleSystems.push(ps);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ BABYLON.AbstractScene.AddIndividualParser(BABYLON.SceneComponentConstants.NAME_PARTICLESYSTEM, function (parsedParticleSystem, scene, rootUrl) {
|
|
|
|
+ if (parsedParticleSystem.activeParticleCount) {
|
|
|
|
+ var ps = BABYLON.GPUParticleSystem.Parse(parsedParticleSystem, scene, rootUrl);
|
|
|
|
+ return ps;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ var ps = BABYLON.ParticleSystem.Parse(parsedParticleSystem, scene, rootUrl);
|
|
|
|
+ return ps;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ BABYLON.Engine.prototype.createEffectForParticles = function (fragmentName, uniformsNames, samplers, defines, fallbacks, onCompiled, onError) {
|
|
|
|
+ if (uniformsNames === void 0) { uniformsNames = []; }
|
|
|
|
+ if (samplers === void 0) { samplers = []; }
|
|
|
|
+ if (defines === void 0) { defines = ""; }
|
|
|
|
+ var attributesNamesOrOptions = BABYLON.ParticleSystem._GetAttributeNamesOrOptions();
|
|
|
|
+ var effectCreationOption = BABYLON.ParticleSystem._GetEffectCreationOptions();
|
|
|
|
+ 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), samplers, defines, fallbacks, onCompiled, onError);
|
|
|
|
+ };
|
|
|
|
+})(BABYLON || (BABYLON = {}));
|
|
|
|
+
|
|
|
|
+//# sourceMappingURL=babylon.particleSystemComponent.js.map
|
|
|
|
+
|
|
var __assign = (this && this.__assign) || Object.assign || function(t) {
|
|
var __assign = (this && this.__assign) || Object.assign || function(t) {
|
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
s = arguments[i];
|
|
s = arguments[i];
|
|
@@ -68782,20 +68828,6 @@ var BABYLON;
|
|
currentMesh.computeWorldMatrix(true);
|
|
currentMesh.computeWorldMatrix(true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- // Particles Systems
|
|
|
|
- if (parsedData.particleSystems !== undefined && parsedData.particleSystems !== null) {
|
|
|
|
- for (index = 0, cache = parsedData.particleSystems.length; index < cache; index++) {
|
|
|
|
- var parsedParticleSystem = parsedData.particleSystems[index];
|
|
|
|
- if (parsedParticleSystem.activeParticleCount) {
|
|
|
|
- var ps = BABYLON.GPUParticleSystem.Parse(parsedParticleSystem, scene, rootUrl);
|
|
|
|
- container.particleSystems.push(ps);
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- var ps = BABYLON.ParticleSystem.Parse(parsedParticleSystem, scene, rootUrl);
|
|
|
|
- container.particleSystems.push(ps);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
// Shadows
|
|
// Shadows
|
|
if (parsedData.shadowGenerators !== undefined && parsedData.shadowGenerators !== null) {
|
|
if (parsedData.shadowGenerators !== undefined && parsedData.shadowGenerators !== null) {
|
|
for (index = 0, cache = parsedData.shadowGenerators.length; index < cache; index++) {
|
|
for (index = 0, cache = parsedData.shadowGenerators.length; index < cache; index++) {
|
|
@@ -69027,10 +69059,13 @@ var BABYLON;
|
|
}
|
|
}
|
|
// Particles
|
|
// Particles
|
|
if (parsedData.particleSystems !== undefined && parsedData.particleSystems !== null) {
|
|
if (parsedData.particleSystems !== undefined && parsedData.particleSystems !== null) {
|
|
- for (index = 0, cache = parsedData.particleSystems.length; index < cache; index++) {
|
|
|
|
- var parsedParticleSystem = parsedData.particleSystems[index];
|
|
|
|
- if (hierarchyIds.indexOf(parsedParticleSystem.emitterId) !== -1) {
|
|
|
|
- particleSystems.push(BABYLON.ParticleSystem.Parse(parsedParticleSystem, scene, rootUrl));
|
|
|
|
|
|
+ var parser = BABYLON.AbstractScene.GetIndividualParser(BABYLON.SceneComponentConstants.NAME_PARTICLESYSTEM);
|
|
|
|
+ if (parser) {
|
|
|
|
+ for (index = 0, cache = parsedData.particleSystems.length; index < cache; index++) {
|
|
|
|
+ var parsedParticleSystem = parsedData.particleSystems[index];
|
|
|
|
+ if (hierarchyIds.indexOf(parsedParticleSystem.emitterId) !== -1) {
|
|
|
|
+ particleSystems.push(parser(parsedParticleSystem, scene, rootUrl));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -84657,7 +84692,7 @@ var BABYLON;
|
|
this.lensFlareSystems.push(newLensFlareSystem);
|
|
this.lensFlareSystems.push(newLensFlareSystem);
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
- * Defines the layer scene component responsible to manage any layers
|
|
|
|
|
|
+ * Defines the lens flare scene component responsible to manage any lens flares
|
|
* in a given scene.
|
|
* in a given scene.
|
|
*/
|
|
*/
|
|
var LensFlareSystemSceneComponent = /** @class */ (function () {
|
|
var LensFlareSystemSceneComponent = /** @class */ (function () {
|
|
@@ -84671,7 +84706,7 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
this.name = BABYLON.SceneComponentConstants.NAME_LENSFLARESYSTEM;
|
|
this.name = BABYLON.SceneComponentConstants.NAME_LENSFLARESYSTEM;
|
|
this.scene = scene;
|
|
this.scene = scene;
|
|
- this._lensFlareSystems = scene.lensFlareSystems = new Array();
|
|
|
|
|
|
+ scene.lensFlareSystems = new Array();
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
* Registers the component in a given scene
|
|
* Registers the component in a given scene
|
|
@@ -84719,8 +84754,9 @@ var BABYLON;
|
|
LensFlareSystemSceneComponent.prototype.serialize = function (serializationObject) {
|
|
LensFlareSystemSceneComponent.prototype.serialize = function (serializationObject) {
|
|
// Lens flares
|
|
// Lens flares
|
|
serializationObject.lensFlareSystems = [];
|
|
serializationObject.lensFlareSystems = [];
|
|
- for (var _i = 0, _a = this._lensFlareSystems; _i < _a.length; _i++) {
|
|
|
|
- var lensFlareSystem = _a[_i];
|
|
|
|
|
|
+ var lensFlareSystems = this.scene.lensFlareSystems;
|
|
|
|
+ for (var _i = 0, lensFlareSystems_1 = lensFlareSystems; _i < lensFlareSystems_1.length; _i++) {
|
|
|
|
+ var lensFlareSystem = lensFlareSystems_1[_i];
|
|
serializationObject.lensFlareSystems.push(lensFlareSystem.serialize());
|
|
serializationObject.lensFlareSystems.push(lensFlareSystem.serialize());
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -84728,21 +84764,23 @@ var BABYLON;
|
|
* Disposes the component and the associated ressources.
|
|
* Disposes the component and the associated ressources.
|
|
*/
|
|
*/
|
|
LensFlareSystemSceneComponent.prototype.dispose = function () {
|
|
LensFlareSystemSceneComponent.prototype.dispose = function () {
|
|
- while (this._lensFlareSystems.length) {
|
|
|
|
- this._lensFlareSystems[0].dispose();
|
|
|
|
|
|
+ var lensFlareSystems = this.scene.lensFlareSystems;
|
|
|
|
+ while (lensFlareSystems.length) {
|
|
|
|
+ lensFlareSystems[0].dispose();
|
|
}
|
|
}
|
|
};
|
|
};
|
|
LensFlareSystemSceneComponent.prototype._draw = function (camera) {
|
|
LensFlareSystemSceneComponent.prototype._draw = function (camera) {
|
|
// Lens flares
|
|
// Lens flares
|
|
if (this.scene.lensFlaresEnabled) {
|
|
if (this.scene.lensFlaresEnabled) {
|
|
- BABYLON.Tools.StartPerformanceCounter("Lens flares", this._lensFlareSystems.length > 0);
|
|
|
|
- for (var _i = 0, _a = this._lensFlareSystems; _i < _a.length; _i++) {
|
|
|
|
- var lensFlareSystem = _a[_i];
|
|
|
|
|
|
+ var lensFlareSystems = this.scene.lensFlareSystems;
|
|
|
|
+ BABYLON.Tools.StartPerformanceCounter("Lens flares", lensFlareSystems.length > 0);
|
|
|
|
+ for (var _i = 0, lensFlareSystems_2 = lensFlareSystems; _i < lensFlareSystems_2.length; _i++) {
|
|
|
|
+ var lensFlareSystem = lensFlareSystems_2[_i];
|
|
if ((camera.layerMask & lensFlareSystem.layerMask) !== 0) {
|
|
if ((camera.layerMask & lensFlareSystem.layerMask) !== 0) {
|
|
lensFlareSystem.render();
|
|
lensFlareSystem.render();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- BABYLON.Tools.EndPerformanceCounter("Lens flares", this._lensFlareSystems.length > 0);
|
|
|
|
|
|
+ BABYLON.Tools.EndPerformanceCounter("Lens flares", lensFlareSystems.length > 0);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
return LensFlareSystemSceneComponent;
|
|
return LensFlareSystemSceneComponent;
|
|
@@ -96836,7 +96874,7 @@ var BABYLON;
|
|
this._previousStencilState = false;
|
|
this._previousStencilState = false;
|
|
this.scene = scene;
|
|
this.scene = scene;
|
|
this._engine = scene.getEngine();
|
|
this._engine = scene.getEngine();
|
|
- this._effectLayers = scene.effectLayers = new Array();
|
|
|
|
|
|
+ scene.effectLayers = new Array();
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
* Registers the component in a given scene
|
|
* Registers the component in a given scene
|
|
@@ -96854,8 +96892,9 @@ var BABYLON;
|
|
* context lost for instance.
|
|
* context lost for instance.
|
|
*/
|
|
*/
|
|
EffectLayerSceneComponent.prototype.rebuild = function () {
|
|
EffectLayerSceneComponent.prototype.rebuild = function () {
|
|
- for (var _i = 0, _a = this._effectLayers; _i < _a.length; _i++) {
|
|
|
|
- var effectLayer = _a[_i];
|
|
|
|
|
|
+ var layers = this.scene.effectLayers;
|
|
|
|
+ for (var _i = 0, layers_1 = layers; _i < layers_1.length; _i++) {
|
|
|
|
+ var effectLayer = layers_1[_i];
|
|
effectLayer._rebuild();
|
|
effectLayer._rebuild();
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -96866,8 +96905,9 @@ var BABYLON;
|
|
EffectLayerSceneComponent.prototype.serialize = function (serializationObject) {
|
|
EffectLayerSceneComponent.prototype.serialize = function (serializationObject) {
|
|
// Effect layers
|
|
// Effect layers
|
|
serializationObject.effectLayers = [];
|
|
serializationObject.effectLayers = [];
|
|
- for (var _i = 0, _a = this._effectLayers; _i < _a.length; _i++) {
|
|
|
|
- var effectLayer = _a[_i];
|
|
|
|
|
|
+ var layers = this.scene.effectLayers;
|
|
|
|
+ for (var _i = 0, layers_2 = layers; _i < layers_2.length; _i++) {
|
|
|
|
+ var effectLayer = layers_2[_i];
|
|
if (effectLayer.serialize) {
|
|
if (effectLayer.serialize) {
|
|
serializationObject.effectLayers.push(effectLayer.serialize());
|
|
serializationObject.effectLayers.push(effectLayer.serialize());
|
|
}
|
|
}
|
|
@@ -96903,18 +96943,20 @@ var BABYLON;
|
|
* Disposes the component and the associated ressources.
|
|
* Disposes the component and the associated ressources.
|
|
*/
|
|
*/
|
|
EffectLayerSceneComponent.prototype.dispose = function () {
|
|
EffectLayerSceneComponent.prototype.dispose = function () {
|
|
- while (this._effectLayers.length) {
|
|
|
|
- this._effectLayers[0].dispose();
|
|
|
|
|
|
+ var layers = this.scene.effectLayers;
|
|
|
|
+ while (layers.length) {
|
|
|
|
+ layers[0].dispose();
|
|
}
|
|
}
|
|
};
|
|
};
|
|
EffectLayerSceneComponent.prototype._isReadyForMesh = function (mesh, hardwareInstancedRendering) {
|
|
EffectLayerSceneComponent.prototype._isReadyForMesh = function (mesh, hardwareInstancedRendering) {
|
|
- for (var _i = 0, _a = this._effectLayers; _i < _a.length; _i++) {
|
|
|
|
- var layer = _a[_i];
|
|
|
|
|
|
+ var layers = this.scene.effectLayers;
|
|
|
|
+ for (var _i = 0, layers_3 = layers; _i < layers_3.length; _i++) {
|
|
|
|
+ var layer = layers_3[_i];
|
|
if (!layer.hasMesh(mesh)) {
|
|
if (!layer.hasMesh(mesh)) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- for (var _b = 0, _c = mesh.subMeshes; _b < _c.length; _b++) {
|
|
|
|
- var subMesh = _c[_b];
|
|
|
|
|
|
+ for (var _a = 0, _b = mesh.subMeshes; _a < _b.length; _a++) {
|
|
|
|
+ var subMesh = _b[_a];
|
|
if (!layer.isReady(subMesh, hardwareInstancedRendering)) {
|
|
if (!layer.isReady(subMesh, hardwareInstancedRendering)) {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
@@ -96925,10 +96967,11 @@ var BABYLON;
|
|
EffectLayerSceneComponent.prototype._renderMainTexture = function (camera) {
|
|
EffectLayerSceneComponent.prototype._renderMainTexture = function (camera) {
|
|
this._renderEffects = false;
|
|
this._renderEffects = false;
|
|
this._needStencil = false;
|
|
this._needStencil = false;
|
|
- if (this._effectLayers && this._effectLayers.length > 0) {
|
|
|
|
|
|
+ var layers = this.scene.effectLayers;
|
|
|
|
+ if (layers && layers.length > 0) {
|
|
this._previousStencilState = this._engine.getStencilBuffer();
|
|
this._previousStencilState = this._engine.getStencilBuffer();
|
|
- for (var _i = 0, _a = this._effectLayers; _i < _a.length; _i++) {
|
|
|
|
- var effectLayer = _a[_i];
|
|
|
|
|
|
+ for (var _i = 0, layers_4 = layers; _i < layers_4.length; _i++) {
|
|
|
|
+ var effectLayer = layers_4[_i];
|
|
if (effectLayer.shouldRender() &&
|
|
if (effectLayer.shouldRender() &&
|
|
(!effectLayer.camera ||
|
|
(!effectLayer.camera ||
|
|
(effectLayer.camera.cameraRigMode === BABYLON.Camera.RIG_MODE_NONE && camera === effectLayer.camera) ||
|
|
(effectLayer.camera.cameraRigMode === BABYLON.Camera.RIG_MODE_NONE && camera === effectLayer.camera) ||
|
|
@@ -96960,8 +97003,9 @@ var BABYLON;
|
|
EffectLayerSceneComponent.prototype._draw = function (renderingGroupId) {
|
|
EffectLayerSceneComponent.prototype._draw = function (renderingGroupId) {
|
|
if (this._renderEffects) {
|
|
if (this._renderEffects) {
|
|
this._engine.setDepthBuffer(false);
|
|
this._engine.setDepthBuffer(false);
|
|
- for (var i = 0; i < this._effectLayers.length; i++) {
|
|
|
|
- var effectLayer = this._effectLayers[i];
|
|
|
|
|
|
+ var layers = this.scene.effectLayers;
|
|
|
|
+ for (var i = 0; i < layers.length; i++) {
|
|
|
|
+ var effectLayer = layers[i];
|
|
if (effectLayer.renderingGroupId === renderingGroupId) {
|
|
if (effectLayer.renderingGroupId === renderingGroupId) {
|
|
if (effectLayer.shouldRender()) {
|
|
if (effectLayer.shouldRender()) {
|
|
effectLayer.render();
|
|
effectLayer.render();
|
|
@@ -99771,7 +99815,7 @@ var BABYLON;
|
|
this.name = BABYLON.SceneComponentConstants.NAME_LAYER;
|
|
this.name = BABYLON.SceneComponentConstants.NAME_LAYER;
|
|
this.scene = scene;
|
|
this.scene = scene;
|
|
this._engine = scene.getEngine();
|
|
this._engine = scene.getEngine();
|
|
- this._layers = scene.layers = new Array();
|
|
|
|
|
|
+ scene.layers = new Array();
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
* Registers the component in a given scene
|
|
* Registers the component in a given scene
|
|
@@ -99785,8 +99829,9 @@ var BABYLON;
|
|
* context lost for instance.
|
|
* context lost for instance.
|
|
*/
|
|
*/
|
|
LayerSceneComponent.prototype.rebuild = function () {
|
|
LayerSceneComponent.prototype.rebuild = function () {
|
|
- for (var _i = 0, _a = this._layers; _i < _a.length; _i++) {
|
|
|
|
- var layer = _a[_i];
|
|
|
|
|
|
+ var layers = this.scene.layers;
|
|
|
|
+ for (var _i = 0, layers_1 = layers; _i < layers_1.length; _i++) {
|
|
|
|
+ var layer = layers_1[_i];
|
|
layer._rebuild();
|
|
layer._rebuild();
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -99794,16 +99839,18 @@ var BABYLON;
|
|
* Disposes the component and the associated ressources.
|
|
* Disposes the component and the associated ressources.
|
|
*/
|
|
*/
|
|
LayerSceneComponent.prototype.dispose = function () {
|
|
LayerSceneComponent.prototype.dispose = function () {
|
|
- while (this._layers.length) {
|
|
|
|
- this._layers[0].dispose();
|
|
|
|
|
|
+ var layers = this.scene.layers;
|
|
|
|
+ while (layers.length) {
|
|
|
|
+ layers[0].dispose();
|
|
}
|
|
}
|
|
};
|
|
};
|
|
LayerSceneComponent.prototype._draw = function (camera, isBackground) {
|
|
LayerSceneComponent.prototype._draw = function (camera, isBackground) {
|
|
- if (this._layers.length) {
|
|
|
|
|
|
+ var layers = this.scene.layers;
|
|
|
|
+ if (layers.length) {
|
|
this._engine.setDepthBuffer(false);
|
|
this._engine.setDepthBuffer(false);
|
|
var cameraLayerMask = camera.layerMask;
|
|
var cameraLayerMask = camera.layerMask;
|
|
- for (var _i = 0, _a = this._layers; _i < _a.length; _i++) {
|
|
|
|
- var layer = _a[_i];
|
|
|
|
|
|
+ for (var _i = 0, layers_2 = layers; _i < layers_2.length; _i++) {
|
|
|
|
+ var layer = layers_2[_i];
|
|
if (layer.isBackground === isBackground && ((layer.layerMask & cameraLayerMask) !== 0)) {
|
|
if (layer.isBackground === isBackground && ((layer.layerMask & cameraLayerMask) !== 0)) {
|
|
layer.render();
|
|
layer.render();
|
|
}
|
|
}
|