Browse Source

Fix particlesystem missing property

David Catuhe 7 years ago
parent
commit
73314d97f3

File diff suppressed because it is too large
+ 17069 - 17065
Playground/babylon.d.txt


File diff suppressed because it is too large
+ 13933 - 13929
dist/preview release/babylon.d.ts


File diff suppressed because it is too large
+ 6 - 6
dist/preview release/babylon.js


+ 10 - 0
dist/preview release/babylon.max.js

@@ -50835,6 +50835,16 @@ var BABYLON;
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
         });
         });
+        Object.defineProperty(ParticleSystem.prototype, "particles", {
+            /**
+             * Gets the current list of active particles
+             */
+            get: function () {
+                return this._particles;
+            },
+            enumerable: true,
+            configurable: true
+        });
         /**
         /**
          * Returns the string "ParticleSystem"
          * Returns the string "ParticleSystem"
          * @returns a string containing the class name
          * @returns a string containing the class name

File diff suppressed because it is too large
+ 6 - 6
dist/preview release/babylon.worker.js


File diff suppressed because it is too large
+ 6346 - 6342
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


File diff suppressed because it is too large
+ 8 - 8
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 10 - 0
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -50835,6 +50835,16 @@ var BABYLON;
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
         });
         });
+        Object.defineProperty(ParticleSystem.prototype, "particles", {
+            /**
+             * Gets the current list of active particles
+             */
+            get: function () {
+                return this._particles;
+            },
+            enumerable: true,
+            configurable: true
+        });
         /**
         /**
          * Returns the string "ParticleSystem"
          * Returns the string "ParticleSystem"
          * @returns a string containing the class name
          * @returns a string containing the class name

+ 10 - 0
dist/preview release/customConfigurations/minimalGLTFViewer/es6.js

@@ -50821,6 +50821,16 @@ var BABYLON;
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
         });
         });
+        Object.defineProperty(ParticleSystem.prototype, "particles", {
+            /**
+             * Gets the current list of active particles
+             */
+            get: function () {
+                return this._particles;
+            },
+            enumerable: true,
+            configurable: true
+        });
         /**
         /**
          * Returns the string "ParticleSystem"
          * Returns the string "ParticleSystem"
          * @returns a string containing the class name
          * @returns a string containing the class name

+ 10 - 0
dist/preview release/es6.js

@@ -50821,6 +50821,16 @@ var BABYLON;
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
         });
         });
+        Object.defineProperty(ParticleSystem.prototype, "particles", {
+            /**
+             * Gets the current list of active particles
+             */
+            get: function () {
+                return this._particles;
+            },
+            enumerable: true,
+            configurable: true
+        });
         /**
         /**
          * Returns the string "ParticleSystem"
          * Returns the string "ParticleSystem"
          * @returns a string containing the class name
          * @returns a string containing the class name

File diff suppressed because it is too large
+ 6 - 6
dist/preview release/viewer/babylon.viewer.js


+ 37 - 9
dist/preview release/viewer/babylon.viewer.max.js

@@ -50905,6 +50905,16 @@ var BABYLON;
             enumerable: true,
             enumerable: true,
             configurable: true
             configurable: true
         });
         });
+        Object.defineProperty(ParticleSystem.prototype, "particles", {
+            /**
+             * Gets the current list of active particles
+             */
+            get: function () {
+                return this._particles;
+            },
+            enumerable: true,
+            configurable: true
+        });
         /**
         /**
          * Returns the string "ParticleSystem"
          * Returns the string "ParticleSystem"
          * @returns a string containing the class name
          * @returns a string containing the class name
@@ -110277,6 +110287,9 @@ var BABYLON;
                 delete this._gltf;
                 delete this._gltf;
                 delete this._babylonScene;
                 delete this._babylonScene;
                 this._completePromises.length = 0;
                 this._completePromises.length = 0;
+                for (var name_3 in this._extensions) {
+                    this._extensions[name_3].dispose();
+                }
                 this._extensions = {};
                 this._extensions = {};
                 delete this._rootBabylonMesh;
                 delete this._rootBabylonMesh;
                 delete this._progressCallback;
                 delete this._progressCallback;
@@ -110286,8 +110299,8 @@ var BABYLON;
             };
             };
             GLTFLoader.prototype._applyExtensions = function (actionAsync) {
             GLTFLoader.prototype._applyExtensions = function (actionAsync) {
                 for (var _i = 0, _a = GLTFLoader._Names; _i < _a.length; _i++) {
                 for (var _i = 0, _a = GLTFLoader._Names; _i < _a.length; _i++) {
-                    var name_3 = _a[_i];
-                    var extension = this._extensions[name_3];
+                    var name_4 = _a[_i];
+                    var extension = this._extensions[name_4];
                     if (extension.enabled) {
                     if (extension.enabled) {
                         var promise = actionAsync(extension);
                         var promise = actionAsync(extension);
                         if (promise) {
                         if (promise) {
@@ -110318,6 +110331,9 @@ var BABYLON;
                 this.enabled = true;
                 this.enabled = true;
                 this._loader = loader;
                 this._loader = loader;
             }
             }
+            GLTFLoaderExtension.prototype.dispose = function () {
+                delete this._loader;
+            };
             // #region Overridable Methods
             // #region Overridable Methods
             /** Override this method to modify the default behavior for loading scenes. */
             /** Override this method to modify the default behavior for loading scenes. */
             GLTFLoaderExtension.prototype._loadSceneAsync = function (context, node) { return null; };
             GLTFLoaderExtension.prototype._loadSceneAsync = function (context, node) { return null; };
@@ -110527,15 +110543,26 @@ var BABYLON;
     (function (GLTF2) {
     (function (GLTF2) {
         var Extensions;
         var Extensions;
         (function (Extensions) {
         (function (Extensions) {
-            // https://github.com/KhronosGroup/glTF/pull/874
+            // https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_draco_mesh_compression
             var NAME = "KHR_draco_mesh_compression";
             var NAME = "KHR_draco_mesh_compression";
             var KHR_draco_mesh_compression = /** @class */ (function (_super) {
             var KHR_draco_mesh_compression = /** @class */ (function (_super) {
                 __extends(KHR_draco_mesh_compression, _super);
                 __extends(KHR_draco_mesh_compression, _super);
-                function KHR_draco_mesh_compression() {
-                    var _this = _super !== null && _super.apply(this, arguments) || this;
+                function KHR_draco_mesh_compression(loader) {
+                    var _this = _super.call(this, loader) || this;
                     _this.name = NAME;
                     _this.name = NAME;
+                    _this._dracoCompression = null;
+                    // Disable extension if decoder is not available.
+                    if (!BABYLON.DracoCompression.DecoderUrl) {
+                        _this.enabled = false;
+                    }
                     return _this;
                     return _this;
                 }
                 }
+                KHR_draco_mesh_compression.prototype.dispose = function () {
+                    if (this._dracoCompression) {
+                        this._dracoCompression.dispose();
+                    }
+                    _super.prototype.dispose.call(this);
+                };
                 KHR_draco_mesh_compression.prototype._loadVertexDataAsync = function (context, primitive, babylonMesh) {
                 KHR_draco_mesh_compression.prototype._loadVertexDataAsync = function (context, primitive, babylonMesh) {
                     var _this = this;
                     var _this = this;
                     return this._loadExtensionAsync(context, primitive, function (extensionContext, extension) {
                     return this._loadExtensionAsync(context, primitive, function (extensionContext, extension) {
@@ -110572,7 +110599,10 @@ var BABYLON;
                         var bufferView = GLTF2.GLTFLoader._GetProperty(extensionContext, _this._loader._gltf.bufferViews, extension.bufferView);
                         var bufferView = GLTF2.GLTFLoader._GetProperty(extensionContext, _this._loader._gltf.bufferViews, extension.bufferView);
                         return _this._loader._loadBufferViewAsync("#/bufferViews/" + bufferView._index, bufferView).then(function (data) {
                         return _this._loader._loadBufferViewAsync("#/bufferViews/" + bufferView._index, bufferView).then(function (data) {
                             try {
                             try {
-                                return BABYLON.DracoCompression.Decode(data, attributes);
+                                if (!_this._dracoCompression) {
+                                    _this._dracoCompression = new BABYLON.DracoCompression();
+                                }
+                                return _this._dracoCompression.decodeMeshAsync(data, attributes);
                             }
                             }
                             catch (e) {
                             catch (e) {
                                 throw new Error(context + ": " + e.message);
                                 throw new Error(context + ": " + e.message);
@@ -110583,9 +110613,7 @@ var BABYLON;
                 return KHR_draco_mesh_compression;
                 return KHR_draco_mesh_compression;
             }(GLTF2.GLTFLoaderExtension));
             }(GLTF2.GLTFLoaderExtension));
             Extensions.KHR_draco_mesh_compression = KHR_draco_mesh_compression;
             Extensions.KHR_draco_mesh_compression = KHR_draco_mesh_compression;
-            if (BABYLON.DracoCompression.IsSupported) {
-                GLTF2.GLTFLoader._Register(NAME, function (loader) { return new KHR_draco_mesh_compression(loader); });
-            }
+            GLTF2.GLTFLoader._Register(NAME, function (loader) { return new KHR_draco_mesh_compression(loader); });
         })(Extensions = GLTF2.Extensions || (GLTF2.Extensions = {}));
         })(Extensions = GLTF2.Extensions || (GLTF2.Extensions = {}));
     })(GLTF2 = BABYLON.GLTF2 || (BABYLON.GLTF2 = {}));
     })(GLTF2 = BABYLON.GLTF2 || (BABYLON.GLTF2 = {}));
 })(BABYLON || (BABYLON = {}));
 })(BABYLON || (BABYLON = {}));

+ 7 - 0
src/Particles/babylon.particleSystem.ts

@@ -333,6 +333,13 @@
         private _isAnimationSheetEnabled: boolean;
         private _isAnimationSheetEnabled: boolean;
 
 
         /**
         /**
+         * Gets the current list of active particles
+         */
+        public get particles(): Particle[] {
+            return this._particles;
+        }
+
+        /**
          * Returns the string "ParticleSystem"
          * Returns the string "ParticleSystem"
          * @returns a string containing the class name
          * @returns a string containing the class name
          */
          */