瀏覽代碼

Merge branch 'master' of https://github.com/BabylonJS/Babylon.js

Guide 5 年之前
父節點
當前提交
ac5aeee36d

+ 8 - 0
Playground/babylon.d.txt

@@ -24822,6 +24822,7 @@ declare module BABYLON {
         private _isVisibilityBoxLocked;
         private _alwaysVisible;
         private _depthSort;
+        private _expandable;
         private _shapeCounter;
         private _copy;
         private _color;
@@ -24843,6 +24844,7 @@ declare module BABYLON {
          * * updatable (optional boolean, default true) : if the SPS must be updatable or immutable.
          * * isPickable (optional boolean, default false) : if the solid particles must be pickable.
          * * enableDepthSort (optional boolean, default false) : if the solid particles must be sorted in the geometry according to their distance to the camera.
+         * * expandable (optional boolean, default false) : if particles can still be added after the initial SPS mesh creation.
          * * particleIntersection (optional boolean, default false) : if the solid particle intersections must be computed.
          * * boundingSphereOnly (optional boolean, default false) : if the particle intersection must be computed only with the bounding sphere (no bounding box computation, so faster).
          * * bSphereRadiusFactor (optional float, default 1.0) : a number to multiply the boundind sphere radius by in order to reduce it for instance.
@@ -24855,6 +24857,7 @@ declare module BABYLON {
             particleIntersection?: boolean;
             boundingSphereOnly?: boolean;
             bSphereRadiusFactor?: number;
+            expandable?: boolean;
         });
         /**
          * Builds the SPS underlying mesh. Returns a standard Mesh.
@@ -25005,6 +25008,11 @@ declare module BABYLON {
         */
         depthSortParticles: boolean;
         /**
+         * Gets if the SPS is created as expandable at construction time.
+         * Default : `false`
+         */
+        readonly expandable: boolean;
+        /**
          * This function does nothing. It may be overwritten to set all the particle first values.
          * The SPS doesn't call this function, you may have to call it by your own.
          * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#particle-management

+ 8 - 0
dist/preview release/babylon.d.ts

@@ -25208,6 +25208,7 @@ declare module BABYLON {
         private _isVisibilityBoxLocked;
         private _alwaysVisible;
         private _depthSort;
+        private _expandable;
         private _shapeCounter;
         private _copy;
         private _color;
@@ -25229,6 +25230,7 @@ declare module BABYLON {
          * * updatable (optional boolean, default true) : if the SPS must be updatable or immutable.
          * * isPickable (optional boolean, default false) : if the solid particles must be pickable.
          * * enableDepthSort (optional boolean, default false) : if the solid particles must be sorted in the geometry according to their distance to the camera.
+         * * expandable (optional boolean, default false) : if particles can still be added after the initial SPS mesh creation.
          * * particleIntersection (optional boolean, default false) : if the solid particle intersections must be computed.
          * * boundingSphereOnly (optional boolean, default false) : if the particle intersection must be computed only with the bounding sphere (no bounding box computation, so faster).
          * * bSphereRadiusFactor (optional float, default 1.0) : a number to multiply the boundind sphere radius by in order to reduce it for instance.
@@ -25241,6 +25243,7 @@ declare module BABYLON {
             particleIntersection?: boolean;
             boundingSphereOnly?: boolean;
             bSphereRadiusFactor?: number;
+            expandable?: boolean;
         });
         /**
          * Builds the SPS underlying mesh. Returns a standard Mesh.
@@ -25391,6 +25394,11 @@ declare module BABYLON {
         */
         depthSortParticles: boolean;
         /**
+         * Gets if the SPS is created as expandable at construction time.
+         * Default : `false`
+         */
+        readonly expandable: boolean;
+        /**
          * This function does nothing. It may be overwritten to set all the particle first values.
          * The SPS doesn't call this function, you may have to call it by your own.
          * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#particle-management

文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/babylon.js


+ 34 - 14
dist/preview release/babylon.max.js

@@ -17677,6 +17677,8 @@ var VRExperienceHelper = /** @class */ (function () {
                 if (!_this._useCustomVRButton && _this._btnVR) {
                     _this._btnVR.style.top = _this._canvas.offsetTop + _this._canvas.offsetHeight - 70 + "px";
                     _this._btnVR.style.left = _this._canvas.offsetLeft + _this._canvas.offsetWidth - 100 + "px";
+                    // make sure the button is visible after setting its position
+                    _this.updateButtonVisibility();
                 }
             }
         };
@@ -139075,6 +139077,7 @@ var SolidParticleSystem = /** @class */ (function () {
      * * updatable (optional boolean, default true) : if the SPS must be updatable or immutable.
      * * isPickable (optional boolean, default false) : if the solid particles must be pickable.
      * * enableDepthSort (optional boolean, default false) : if the solid particles must be sorted in the geometry according to their distance to the camera.
+     * * expandable (optional boolean, default false) : if particles can still be added after the initial SPS mesh creation.
      * * particleIntersection (optional boolean, default false) : if the solid particle intersections must be computed.
      * * boundingSphereOnly (optional boolean, default false) : if the particle intersection must be computed only with the bounding sphere (no bounding box computation, so faster).
      * * bSphereRadiusFactor (optional float, default 1.0) : a number to multiply the boundind sphere radius by in order to reduce it for instance.
@@ -139128,6 +139131,7 @@ var SolidParticleSystem = /** @class */ (function () {
         this._isVisibilityBoxLocked = false;
         this._alwaysVisible = false;
         this._depthSort = false;
+        this._expandable = false;
         this._shapeCounter = 0;
         this._copy = new _solidParticle__WEBPACK_IMPORTED_MODULE_7__["SolidParticle"](0, 0, 0, null, 0, 0, this);
         this._color = new _Maths_math_color__WEBPACK_IMPORTED_MODULE_1__["Color4"](0, 0, 0, 0);
@@ -139145,6 +139149,7 @@ var SolidParticleSystem = /** @class */ (function () {
         this._camera = scene.activeCamera;
         this._pickable = options ? options.isPickable : false;
         this._depthSort = options ? options.enableDepthSort : false;
+        this._expandable = options ? options.expandable : false;
         this._particlesIntersect = options ? options.particleIntersection : false;
         this._bSphereOnly = options ? options.boundingSphereOnly : false;
         this._bSphereRadiusFactor = (options && options.bSphereRadiusFactor) ? options.bSphereRadiusFactor : 1.0;
@@ -139194,22 +139199,26 @@ var SolidParticleSystem = /** @class */ (function () {
         if (this._colors32.length > 0) {
             vertexData.set(this._colors32, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_2__["VertexBuffer"].ColorKind);
         }
-        var mesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__["Mesh"](this.name, this._scene);
-        vertexData.applyToMesh(mesh, this._updatable);
-        this.mesh = mesh;
-        this.mesh.isPickable = this._pickable;
-        // free memory
-        if (!this._depthSort) {
-            this._indices = null;
+        if (!this.mesh) { // in case it's already expanded
+            var mesh = new _Meshes_mesh__WEBPACK_IMPORTED_MODULE_4__["Mesh"](this.name, this._scene);
+            this.mesh = mesh;
         }
-        this._positions = null;
-        this._normals = null;
-        this._uvs = null;
-        this._colors = null;
-        if (!this._updatable) {
-            this.particles.length = 0;
+        vertexData.applyToMesh(this.mesh, this._updatable);
+        this.mesh.isPickable = this._pickable;
+        if (!this._expandable) {
+            // free memory
+            if (!this._depthSort) {
+                this._indices = null;
+            }
+            this._positions = null;
+            this._normals = null;
+            this._uvs = null;
+            this._colors = null;
+            if (!this._updatable) {
+                this.particles.length = 0;
+            }
         }
-        return mesh;
+        return this.mesh;
     };
     /**
      * Digests the mesh and generates as many solid particles in the system as wanted. Returns the SPS.
@@ -140096,6 +140105,17 @@ var SolidParticleSystem = /** @class */ (function () {
         enumerable: true,
         configurable: true
     });
+    Object.defineProperty(SolidParticleSystem.prototype, "expandable", {
+        /**
+         * Gets if the SPS is created as expandable at construction time.
+         * Default : `false`
+         */
+        get: function () {
+            return this._expandable;
+        },
+        enumerable: true,
+        configurable: true
+    });
     // =======================================================================
     // Particle behavior logic
     // these following methods may be overwritten by the user to fit his needs

文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/babylon.max.js.map


+ 16 - 0
dist/preview release/babylon.module.d.ts

@@ -25948,6 +25948,7 @@ declare module "babylonjs/Particles/solidParticleSystem" {
         private _isVisibilityBoxLocked;
         private _alwaysVisible;
         private _depthSort;
+        private _expandable;
         private _shapeCounter;
         private _copy;
         private _color;
@@ -25969,6 +25970,7 @@ declare module "babylonjs/Particles/solidParticleSystem" {
          * * updatable (optional boolean, default true) : if the SPS must be updatable or immutable.
          * * isPickable (optional boolean, default false) : if the solid particles must be pickable.
          * * enableDepthSort (optional boolean, default false) : if the solid particles must be sorted in the geometry according to their distance to the camera.
+         * * expandable (optional boolean, default false) : if particles can still be added after the initial SPS mesh creation.
          * * particleIntersection (optional boolean, default false) : if the solid particle intersections must be computed.
          * * boundingSphereOnly (optional boolean, default false) : if the particle intersection must be computed only with the bounding sphere (no bounding box computation, so faster).
          * * bSphereRadiusFactor (optional float, default 1.0) : a number to multiply the boundind sphere radius by in order to reduce it for instance.
@@ -25981,6 +25983,7 @@ declare module "babylonjs/Particles/solidParticleSystem" {
             particleIntersection?: boolean;
             boundingSphereOnly?: boolean;
             bSphereRadiusFactor?: number;
+            expandable?: boolean;
         });
         /**
          * Builds the SPS underlying mesh. Returns a standard Mesh.
@@ -26131,6 +26134,11 @@ declare module "babylonjs/Particles/solidParticleSystem" {
         */
         depthSortParticles: boolean;
         /**
+         * Gets if the SPS is created as expandable at construction time.
+         * Default : `false`
+         */
+        readonly expandable: boolean;
+        /**
          * This function does nothing. It may be overwritten to set all the particle first values.
          * The SPS doesn't call this function, you may have to call it by your own.
          * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#particle-management
@@ -92024,6 +92032,7 @@ declare module BABYLON {
         private _isVisibilityBoxLocked;
         private _alwaysVisible;
         private _depthSort;
+        private _expandable;
         private _shapeCounter;
         private _copy;
         private _color;
@@ -92045,6 +92054,7 @@ declare module BABYLON {
          * * updatable (optional boolean, default true) : if the SPS must be updatable or immutable.
          * * isPickable (optional boolean, default false) : if the solid particles must be pickable.
          * * enableDepthSort (optional boolean, default false) : if the solid particles must be sorted in the geometry according to their distance to the camera.
+         * * expandable (optional boolean, default false) : if particles can still be added after the initial SPS mesh creation.
          * * particleIntersection (optional boolean, default false) : if the solid particle intersections must be computed.
          * * boundingSphereOnly (optional boolean, default false) : if the particle intersection must be computed only with the bounding sphere (no bounding box computation, so faster).
          * * bSphereRadiusFactor (optional float, default 1.0) : a number to multiply the boundind sphere radius by in order to reduce it for instance.
@@ -92057,6 +92067,7 @@ declare module BABYLON {
             particleIntersection?: boolean;
             boundingSphereOnly?: boolean;
             bSphereRadiusFactor?: number;
+            expandable?: boolean;
         });
         /**
          * Builds the SPS underlying mesh. Returns a standard Mesh.
@@ -92207,6 +92218,11 @@ declare module BABYLON {
         */
         depthSortParticles: boolean;
         /**
+         * Gets if the SPS is created as expandable at construction time.
+         * Default : `false`
+         */
+        readonly expandable: boolean;
+        /**
          * This function does nothing. It may be overwritten to set all the particle first values.
          * The SPS doesn't call this function, you may have to call it by your own.
          * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#particle-management

+ 8 - 0
dist/preview release/documentation.d.ts

@@ -25208,6 +25208,7 @@ declare module BABYLON {
         private _isVisibilityBoxLocked;
         private _alwaysVisible;
         private _depthSort;
+        private _expandable;
         private _shapeCounter;
         private _copy;
         private _color;
@@ -25229,6 +25230,7 @@ declare module BABYLON {
          * * updatable (optional boolean, default true) : if the SPS must be updatable or immutable.
          * * isPickable (optional boolean, default false) : if the solid particles must be pickable.
          * * enableDepthSort (optional boolean, default false) : if the solid particles must be sorted in the geometry according to their distance to the camera.
+         * * expandable (optional boolean, default false) : if particles can still be added after the initial SPS mesh creation.
          * * particleIntersection (optional boolean, default false) : if the solid particle intersections must be computed.
          * * boundingSphereOnly (optional boolean, default false) : if the particle intersection must be computed only with the bounding sphere (no bounding box computation, so faster).
          * * bSphereRadiusFactor (optional float, default 1.0) : a number to multiply the boundind sphere radius by in order to reduce it for instance.
@@ -25241,6 +25243,7 @@ declare module BABYLON {
             particleIntersection?: boolean;
             boundingSphereOnly?: boolean;
             bSphereRadiusFactor?: number;
+            expandable?: boolean;
         });
         /**
          * Builds the SPS underlying mesh. Returns a standard Mesh.
@@ -25391,6 +25394,11 @@ declare module BABYLON {
         */
         depthSortParticles: boolean;
         /**
+         * Gets if the SPS is created as expandable at construction time.
+         * Default : `false`
+         */
+        readonly expandable: boolean;
+        /**
          * This function does nothing. It may be overwritten to set all the particle first values.
          * The SPS doesn't call this function, you may have to call it by your own.
          * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#particle-management

+ 8 - 6
dist/preview release/loaders/babylon.glTF2FileLoader.js

@@ -2134,10 +2134,12 @@ var GLTFLoader = /** @class */ (function () {
         else if (primitive.targets.length !== node._numMorphTargets) {
             throw new Error(context + ": Primitives do not have the same number of targets");
         }
+        var targetNames = mesh.extras ? mesh.extras.targetNames : null;
         babylonMesh.morphTargetManager = new babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["MorphTargetManager"](babylonMesh.getScene());
         for (var index = 0; index < primitive.targets.length; index++) {
             var weight = node.weights ? node.weights[index] : mesh.weights ? mesh.weights[index] : 0;
-            babylonMesh.morphTargetManager.addTarget(new babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["MorphTarget"]("morphTarget" + index, weight, babylonMesh.getScene()));
+            var name_4 = targetNames ? targetNames[index] : "morphTarget" + index;
+            babylonMesh.morphTargetManager.addTarget(new babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["MorphTarget"](name_4, weight, babylonMesh.getScene()));
             // TODO: tell the target whether it has positions, normals, tangents
         }
     };
@@ -3283,8 +3285,8 @@ var GLTFLoader = /** @class */ (function () {
     };
     GLTFLoader.prototype._forEachExtensions = function (action) {
         for (var _i = 0, _a = GLTFLoader._ExtensionNames; _i < _a.length; _i++) {
-            var name_4 = _a[_i];
-            var extension = this._extensions[name_4];
+            var name_5 = _a[_i];
+            var extension = this._extensions[name_5];
             if (extension.enabled) {
                 action(extension);
             }
@@ -3292,10 +3294,10 @@ var GLTFLoader = /** @class */ (function () {
     };
     GLTFLoader.prototype._applyExtensions = function (property, functionName, actionAsync) {
         for (var _i = 0, _a = GLTFLoader._ExtensionNames; _i < _a.length; _i++) {
-            var name_5 = _a[_i];
-            var extension = this._extensions[name_5];
+            var name_6 = _a[_i];
+            var extension = this._extensions[name_6];
             if (extension.enabled) {
-                var id = name_5 + "." + functionName;
+                var id = name_6 + "." + functionName;
                 var loaderProperty = property;
                 loaderProperty._activeLoaderExtensionFunctions = loaderProperty._activeLoaderExtensionFunctions || {};
                 var activeLoaderExtensionFunctions = loaderProperty._activeLoaderExtensionFunctions;

文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.js.map


文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


+ 8 - 6
dist/preview release/loaders/babylon.glTFFileLoader.js

@@ -4694,10 +4694,12 @@ var GLTFLoader = /** @class */ (function () {
         else if (primitive.targets.length !== node._numMorphTargets) {
             throw new Error(context + ": Primitives do not have the same number of targets");
         }
+        var targetNames = mesh.extras ? mesh.extras.targetNames : null;
         babylonMesh.morphTargetManager = new babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["MorphTargetManager"](babylonMesh.getScene());
         for (var index = 0; index < primitive.targets.length; index++) {
             var weight = node.weights ? node.weights[index] : mesh.weights ? mesh.weights[index] : 0;
-            babylonMesh.morphTargetManager.addTarget(new babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["MorphTarget"]("morphTarget" + index, weight, babylonMesh.getScene()));
+            var name_4 = targetNames ? targetNames[index] : "morphTarget" + index;
+            babylonMesh.morphTargetManager.addTarget(new babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["MorphTarget"](name_4, weight, babylonMesh.getScene()));
             // TODO: tell the target whether it has positions, normals, tangents
         }
     };
@@ -5843,8 +5845,8 @@ var GLTFLoader = /** @class */ (function () {
     };
     GLTFLoader.prototype._forEachExtensions = function (action) {
         for (var _i = 0, _a = GLTFLoader._ExtensionNames; _i < _a.length; _i++) {
-            var name_4 = _a[_i];
-            var extension = this._extensions[name_4];
+            var name_5 = _a[_i];
+            var extension = this._extensions[name_5];
             if (extension.enabled) {
                 action(extension);
             }
@@ -5852,10 +5854,10 @@ var GLTFLoader = /** @class */ (function () {
     };
     GLTFLoader.prototype._applyExtensions = function (property, functionName, actionAsync) {
         for (var _i = 0, _a = GLTFLoader._ExtensionNames; _i < _a.length; _i++) {
-            var name_5 = _a[_i];
-            var extension = this._extensions[name_5];
+            var name_6 = _a[_i];
+            var extension = this._extensions[name_6];
             if (extension.enabled) {
-                var id = name_5 + "." + functionName;
+                var id = name_6 + "." + functionName;
                 var loaderProperty = property;
                 loaderProperty._activeLoaderExtensionFunctions = loaderProperty._activeLoaderExtensionFunctions || {};
                 var activeLoaderExtensionFunctions = loaderProperty._activeLoaderExtensionFunctions;

文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/loaders/babylon.glTFFileLoader.js.map


文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/loaders/babylon.glTFFileLoader.min.js


+ 8 - 6
dist/preview release/loaders/babylonjs.loaders.js

@@ -6032,10 +6032,12 @@ var GLTFLoader = /** @class */ (function () {
         else if (primitive.targets.length !== node._numMorphTargets) {
             throw new Error(context + ": Primitives do not have the same number of targets");
         }
+        var targetNames = mesh.extras ? mesh.extras.targetNames : null;
         babylonMesh.morphTargetManager = new babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["MorphTargetManager"](babylonMesh.getScene());
         for (var index = 0; index < primitive.targets.length; index++) {
             var weight = node.weights ? node.weights[index] : mesh.weights ? mesh.weights[index] : 0;
-            babylonMesh.morphTargetManager.addTarget(new babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["MorphTarget"]("morphTarget" + index, weight, babylonMesh.getScene()));
+            var name_4 = targetNames ? targetNames[index] : "morphTarget" + index;
+            babylonMesh.morphTargetManager.addTarget(new babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["MorphTarget"](name_4, weight, babylonMesh.getScene()));
             // TODO: tell the target whether it has positions, normals, tangents
         }
     };
@@ -7181,8 +7183,8 @@ var GLTFLoader = /** @class */ (function () {
     };
     GLTFLoader.prototype._forEachExtensions = function (action) {
         for (var _i = 0, _a = GLTFLoader._ExtensionNames; _i < _a.length; _i++) {
-            var name_4 = _a[_i];
-            var extension = this._extensions[name_4];
+            var name_5 = _a[_i];
+            var extension = this._extensions[name_5];
             if (extension.enabled) {
                 action(extension);
             }
@@ -7190,10 +7192,10 @@ var GLTFLoader = /** @class */ (function () {
     };
     GLTFLoader.prototype._applyExtensions = function (property, functionName, actionAsync) {
         for (var _i = 0, _a = GLTFLoader._ExtensionNames; _i < _a.length; _i++) {
-            var name_5 = _a[_i];
-            var extension = this._extensions[name_5];
+            var name_6 = _a[_i];
+            var extension = this._extensions[name_6];
             if (extension.enabled) {
-                var id = name_5 + "." + functionName;
+                var id = name_6 + "." + functionName;
                 var loaderProperty = property;
                 loaderProperty._activeLoaderExtensionFunctions = loaderProperty._activeLoaderExtensionFunctions || {};
                 var activeLoaderExtensionFunctions = loaderProperty._activeLoaderExtensionFunctions;

文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/loaders/babylonjs.loaders.js.map


文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/loaders/babylonjs.loaders.min.js


+ 16 - 0
dist/preview release/viewer/babylon.module.d.ts

@@ -25948,6 +25948,7 @@ declare module "babylonjs/Particles/solidParticleSystem" {
         private _isVisibilityBoxLocked;
         private _alwaysVisible;
         private _depthSort;
+        private _expandable;
         private _shapeCounter;
         private _copy;
         private _color;
@@ -25969,6 +25970,7 @@ declare module "babylonjs/Particles/solidParticleSystem" {
          * * updatable (optional boolean, default true) : if the SPS must be updatable or immutable.
          * * isPickable (optional boolean, default false) : if the solid particles must be pickable.
          * * enableDepthSort (optional boolean, default false) : if the solid particles must be sorted in the geometry according to their distance to the camera.
+         * * expandable (optional boolean, default false) : if particles can still be added after the initial SPS mesh creation.
          * * particleIntersection (optional boolean, default false) : if the solid particle intersections must be computed.
          * * boundingSphereOnly (optional boolean, default false) : if the particle intersection must be computed only with the bounding sphere (no bounding box computation, so faster).
          * * bSphereRadiusFactor (optional float, default 1.0) : a number to multiply the boundind sphere radius by in order to reduce it for instance.
@@ -25981,6 +25983,7 @@ declare module "babylonjs/Particles/solidParticleSystem" {
             particleIntersection?: boolean;
             boundingSphereOnly?: boolean;
             bSphereRadiusFactor?: number;
+            expandable?: boolean;
         });
         /**
          * Builds the SPS underlying mesh. Returns a standard Mesh.
@@ -26131,6 +26134,11 @@ declare module "babylonjs/Particles/solidParticleSystem" {
         */
         depthSortParticles: boolean;
         /**
+         * Gets if the SPS is created as expandable at construction time.
+         * Default : `false`
+         */
+        readonly expandable: boolean;
+        /**
          * This function does nothing. It may be overwritten to set all the particle first values.
          * The SPS doesn't call this function, you may have to call it by your own.
          * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#particle-management
@@ -92024,6 +92032,7 @@ declare module BABYLON {
         private _isVisibilityBoxLocked;
         private _alwaysVisible;
         private _depthSort;
+        private _expandable;
         private _shapeCounter;
         private _copy;
         private _color;
@@ -92045,6 +92054,7 @@ declare module BABYLON {
          * * updatable (optional boolean, default true) : if the SPS must be updatable or immutable.
          * * isPickable (optional boolean, default false) : if the solid particles must be pickable.
          * * enableDepthSort (optional boolean, default false) : if the solid particles must be sorted in the geometry according to their distance to the camera.
+         * * expandable (optional boolean, default false) : if particles can still be added after the initial SPS mesh creation.
          * * particleIntersection (optional boolean, default false) : if the solid particle intersections must be computed.
          * * boundingSphereOnly (optional boolean, default false) : if the particle intersection must be computed only with the bounding sphere (no bounding box computation, so faster).
          * * bSphereRadiusFactor (optional float, default 1.0) : a number to multiply the boundind sphere radius by in order to reduce it for instance.
@@ -92057,6 +92067,7 @@ declare module BABYLON {
             particleIntersection?: boolean;
             boundingSphereOnly?: boolean;
             bSphereRadiusFactor?: number;
+            expandable?: boolean;
         });
         /**
          * Builds the SPS underlying mesh. Returns a standard Mesh.
@@ -92207,6 +92218,11 @@ declare module BABYLON {
         */
         depthSortParticles: boolean;
         /**
+         * Gets if the SPS is created as expandable at construction time.
+         * Default : `false`
+         */
+        readonly expandable: boolean;
+        /**
          * This function does nothing. It may be overwritten to set all the particle first values.
          * The SPS doesn't call this function, you may have to call it by your own.
          * doc : http://doc.babylonjs.com/how_to/Solid_Particle_System#particle-management

文件差異過大導致無法顯示
+ 3 - 3
dist/preview release/viewer/babylon.viewer.js


文件差異過大導致無法顯示
+ 2 - 2
dist/preview release/viewer/babylon.viewer.max.js


+ 2 - 1
dist/preview release/what's new.md

@@ -112,7 +112,8 @@
 - Added `StackPanel.ignoreLayoutWarnings` to disable console warnings when controls with percentage size are added to a StackPanel ([Deltakosh](https://github.com/deltakosh/))
 - Added `_getSVGAttribs` functionality for loading multiple svg icons from an external svg file via icon id.([lockphase](https://github.com/lockphase/))
 
-
+### Particles
+- Added the feature `expandable` to the Solid Particle System ([jerome](https://github.com/jbousquie/))
 
 ### Navigation Mesh
 - Added moveAlong function to cast a segment on mavmesh ([CedricGuillemet](https://github.com/CedricGuillemet/))

+ 4 - 1
loaders/src/glTF/2.0/glTFLoader.ts

@@ -866,10 +866,13 @@ export class GLTFLoader implements IGLTFLoader {
             throw new Error(`${context}: Primitives do not have the same number of targets`);
         }
 
+        const targetNames = mesh.extras ? mesh.extras.targetNames : null;
+
         babylonMesh.morphTargetManager = new MorphTargetManager(babylonMesh.getScene());
         for (let index = 0; index < primitive.targets.length; index++) {
             const weight = node.weights ? node.weights[index] : mesh.weights ? mesh.weights[index] : 0;
-            babylonMesh.morphTargetManager.addTarget(new MorphTarget(`morphTarget${index}`, weight, babylonMesh.getScene()));
+            const name = targetNames ? targetNames[index] : `morphTarget${index}`;
+            babylonMesh.morphTargetManager.addTarget(new MorphTarget(name, weight, babylonMesh.getScene()));
             // TODO: tell the target whether it has positions, normals, tangents
         }
     }

+ 2 - 0
src/Cameras/VR/vrExperienceHelper.ts

@@ -916,6 +916,8 @@ export class VRExperienceHelper {
             if (!this._useCustomVRButton && this._btnVR) {
                 this._btnVR.style.top = this._canvas.offsetTop + this._canvas.offsetHeight - 70 + "px";
                 this._btnVR.style.left = this._canvas.offsetLeft + this._canvas.offsetWidth - 100 + "px";
+                // make sure the button is visible after setting its position
+                this.updateButtonVisibility();
             }
         }
     }

+ 29 - 16
src/Particles/solidParticleSystem.ts

@@ -102,6 +102,7 @@ export class SolidParticleSystem implements IDisposable {
     private _isVisibilityBoxLocked = false;
     private _alwaysVisible: boolean = false;
     private _depthSort: boolean = false;
+    private _expandable: boolean = false;
     private _shapeCounter: number = 0;
     private _copy: SolidParticle = new SolidParticle(0, 0, 0, null, 0, 0, this);
     private _color: Color4 = new Color4(0, 0, 0, 0);
@@ -124,17 +125,19 @@ export class SolidParticleSystem implements IDisposable {
      * * updatable (optional boolean, default true) : if the SPS must be updatable or immutable.
      * * isPickable (optional boolean, default false) : if the solid particles must be pickable.
      * * enableDepthSort (optional boolean, default false) : if the solid particles must be sorted in the geometry according to their distance to the camera.
+     * * expandable (optional boolean, default false) : if particles can still be added after the initial SPS mesh creation.
      * * particleIntersection (optional boolean, default false) : if the solid particle intersections must be computed.
      * * boundingSphereOnly (optional boolean, default false) : if the particle intersection must be computed only with the bounding sphere (no bounding box computation, so faster).
      * * bSphereRadiusFactor (optional float, default 1.0) : a number to multiply the boundind sphere radius by in order to reduce it for instance.
      * @example bSphereRadiusFactor = 1.0 / Math.sqrt(3.0) => the bounding sphere exactly matches a spherical mesh.
      */
-    constructor(name: string, scene: Scene, options?: { updatable?: boolean; isPickable?: boolean; enableDepthSort?: boolean; particleIntersection?: boolean; boundingSphereOnly?: boolean; bSphereRadiusFactor?: number }) {
+    constructor(name: string, scene: Scene, options?: { updatable?: boolean; isPickable?: boolean; enableDepthSort?: boolean; particleIntersection?: boolean; boundingSphereOnly?: boolean; bSphereRadiusFactor?: number; expandable?: boolean }) {
         this.name = name;
         this._scene = scene || EngineStore.LastCreatedScene;
         this._camera = <TargetCamera>scene.activeCamera;
         this._pickable = options ? <boolean>options.isPickable : false;
         this._depthSort = options ? <boolean>options.enableDepthSort : false;
+        this._expandable = options ? <boolean>options.expandable : false;
         this._particlesIntersect = options ? <boolean>options.particleIntersection : false;
         this._bSphereOnly = options ? <boolean>options.boundingSphereOnly : false;
         this._bSphereRadiusFactor = (options && options.bSphereRadiusFactor) ? options.bSphereRadiusFactor : 1.0;
@@ -186,25 +189,28 @@ export class SolidParticleSystem implements IDisposable {
         if (this._colors32.length > 0) {
             vertexData.set(this._colors32, VertexBuffer.ColorKind);
         }
-        var mesh = new Mesh(this.name, this._scene);
-        vertexData.applyToMesh(mesh, this._updatable);
-        this.mesh = mesh;
+        if (!this.mesh) {       // in case it's already expanded
+            var mesh = new Mesh(this.name, this._scene);
+            this.mesh = mesh;
+        }
+        vertexData.applyToMesh(this.mesh, this._updatable);
         this.mesh.isPickable = this._pickable;
 
-        // free memory
-        if (!this._depthSort) {
-            (<any>this._indices) = null;
-        }
-        (<any>this._positions) = null;
-        (<any>this._normals) = null;
-        (<any>this._uvs) = null;
-        (<any>this._colors) = null;
+        if (!this._expandable) {
+            // free memory
+            if (!this._depthSort) {
+                (<any>this._indices) = null;
+            }
+            (<any>this._positions) = null;
+            (<any>this._normals) = null;
+            (<any>this._uvs) = null;
+            (<any>this._colors) = null;
 
-        if (!this._updatable) {
-            this.particles.length = 0;
+            if (!this._updatable) {
+                this.particles.length = 0;
+            }
         }
-
-        return mesh;
+        return this.mesh;
     }
 
     /**
@@ -1153,6 +1159,13 @@ export class SolidParticleSystem implements IDisposable {
     public get depthSortParticles(): boolean {
         return this._depthSortParticles;
     }
+    /**
+     * Gets if the SPS is created as expandable at construction time.
+     * Default : `false`
+     */
+    public get expandable(): boolean {
+        return this._expandable;
+    }
 
     // =======================================================================
     // Particle behavior logic

+ 1 - 0
what's new.md

@@ -147,6 +147,7 @@
 - Added support for custom loader extensions ([bghgary](http://www.github.com/bghgary))
 - Added support for validating assets using [glTF-Validator](https://github.com/KhronosGroup/glTF-Validator) ([bghgary](http://www.github.com/bghgary))
 - Added automatically renormalizes skinweights when loading geometry. Calls core mesh functions to do this ([Bolloxim](https://github.com/Bolloxim))
+- Added support for morph target names via `mesh.extras.targetNames` ([zeux](https://github.com/zeux))
 
 ### glTF Serializer
 - Added support for exporting the scale, rotation and offset texture properties ([kcoley](http://www.github.com/kcoley))