David Catuhe 6 jaren geleden
bovenliggende
commit
5baef5a06d

+ 25 - 25
Playground/babylon.d.txt

@@ -34845,7 +34845,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             updatable?: boolean;
             sourcePlane?: Plane;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module BABYLON {
@@ -38544,7 +38544,7 @@ declare module BABYLON {
                 h: number;
             };
             updatable?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a ground mesh from a height map
          * * The parameter `url` sets the URL of the height map image resource.
@@ -38574,7 +38574,7 @@ declare module BABYLON {
             alphaFilter?: number;
             updatable?: boolean;
             onReady?: (mesh: GroundMesh) => void;
-        }, scene: Scene): GroundMesh;
+        }, scene?: Nullable<Scene>): GroundMesh;
     }
 }
 declare module BABYLON {
@@ -41783,7 +41783,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module BABYLON {
@@ -47432,7 +47432,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             instance?: Mesh;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         private static _ExtrudeShapeGeneric;
     }
 }
@@ -48962,7 +48962,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene, earcutInjection?: any): Mesh;
+        }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh;
         /**
          * Creates an extruded polygon mesh, with depth in the Y direction.
          * * You can set different colors and different images to the top, bottom and extruded side by using the parameters `faceColors` (an array of 3 Color3 elements) and `faceUV` (an array of 3 Vector4 elements)
@@ -48983,7 +48983,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene, earcutInjection?: any): Mesh;
+        }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh;
     }
 }
 declare module BABYLON {
@@ -49024,7 +49024,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             cap?: number;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module BABYLON {
@@ -49069,7 +49069,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             instance?: Mesh;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module BABYLON {
@@ -49103,7 +49103,7 @@ declare module BABYLON {
             frontUVs?: Vector4;
             backUVs?: Vector4;
             updatable?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module BABYLON {
@@ -49193,7 +49193,7 @@ declare module BABYLON {
             frontUVs?: Vector4;
             backUVs?: Vector4;
             updatable?: boolean;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a plane polygonal mesh.  By default, this is a disc
          * * The parameter `radius` sets the radius size (float) of the polygon (default 0.5)
@@ -49243,7 +49243,7 @@ declare module BABYLON {
             frontUVs?: Vector4;
             backUVs?: Vector4;
             updatable?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a ribbon mesh. The ribbon is a parametric shape.  It has no predefined shape. Its final shape will depend on the input parameters
          * * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry
@@ -49324,7 +49324,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a torus mesh
          * * The parameter `diameter` sets the diameter size (float) of the torus (default 1)
@@ -49347,7 +49347,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a torus knot mesh
          * * The parameter `radius` sets the global radius size (float) of the torus knot (default 2)
@@ -49374,7 +49374,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a line system mesh. A line system is a pool of many lines gathered in a single mesh
          * * A line system mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of lines as an input parameter
@@ -49520,7 +49520,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             instance?: Mesh;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates lathe mesh.
          * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe
@@ -49554,7 +49554,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             cap?: number;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a plane mesh
          * * The parameter `size` sets the size (float) of both sides of the plane at once (default 1)
@@ -49578,7 +49578,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             updatable?: boolean;
             sourcePlane?: Plane;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a ground mesh
          * * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground
@@ -49597,7 +49597,7 @@ declare module BABYLON {
             subdivisionsX?: number;
             subdivisionsY?: number;
             updatable?: boolean;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a tiled ground mesh
          * * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates
@@ -49625,7 +49625,7 @@ declare module BABYLON {
                 h: number;
             };
             updatable?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a ground mesh from a height map
          * * The parameter `url` sets the URL of the height map image resource.
@@ -49655,7 +49655,7 @@ declare module BABYLON {
             alphaFilter?: number;
             updatable?: boolean;
             onReady?: (mesh: GroundMesh) => void;
-        }, scene: Scene): GroundMesh;
+        }, scene?: Nullable<Scene>): GroundMesh;
         /**
          * Creates a polygon mesh
          * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh
@@ -49680,7 +49680,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene, earcutInjection?: any): Mesh;
+        }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh;
         /**
          * Creates an extruded polygon mesh, with depth in the Y direction.
          * * You can set different colors and different images to the top, bottom and extruded side by using the parameters `faceColors` (an array of 3 Color3 elements) and `faceUV` (an array of 3 Vector4 elements)
@@ -49701,7 +49701,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene, earcutInjection?: any): Mesh;
+        }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh;
         /**
          * Creates a tube mesh.
          * The tube is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters
@@ -49739,7 +49739,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             instance?: Mesh;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a polyhedron mesh
          * * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial to choose the wanted type
@@ -49773,7 +49773,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a decal mesh.
          * A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter `sourceMesh` depicting the decal

+ 25 - 25
dist/preview release/babylon.d.ts

@@ -35453,7 +35453,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             updatable?: boolean;
             sourcePlane?: Plane;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module BABYLON {
@@ -39169,7 +39169,7 @@ declare module BABYLON {
                 h: number;
             };
             updatable?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a ground mesh from a height map
          * * The parameter `url` sets the URL of the height map image resource.
@@ -39199,7 +39199,7 @@ declare module BABYLON {
             alphaFilter?: number;
             updatable?: boolean;
             onReady?: (mesh: GroundMesh) => void;
-        }, scene: Scene): GroundMesh;
+        }, scene?: Nullable<Scene>): GroundMesh;
     }
 }
 declare module BABYLON {
@@ -42445,7 +42445,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module BABYLON {
@@ -48114,7 +48114,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             instance?: Mesh;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         private static _ExtrudeShapeGeneric;
     }
 }
@@ -49651,7 +49651,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene, earcutInjection?: any): Mesh;
+        }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh;
         /**
          * Creates an extruded polygon mesh, with depth in the Y direction.
          * * You can set different colors and different images to the top, bottom and extruded side by using the parameters `faceColors` (an array of 3 Color3 elements) and `faceUV` (an array of 3 Vector4 elements)
@@ -49672,7 +49672,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene, earcutInjection?: any): Mesh;
+        }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh;
     }
 }
 declare module BABYLON {
@@ -49713,7 +49713,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             cap?: number;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module BABYLON {
@@ -49758,7 +49758,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             instance?: Mesh;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module BABYLON {
@@ -49792,7 +49792,7 @@ declare module BABYLON {
             frontUVs?: Vector4;
             backUVs?: Vector4;
             updatable?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module BABYLON {
@@ -49882,7 +49882,7 @@ declare module BABYLON {
             frontUVs?: Vector4;
             backUVs?: Vector4;
             updatable?: boolean;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a plane polygonal mesh.  By default, this is a disc
          * * The parameter `radius` sets the radius size (float) of the polygon (default 0.5)
@@ -49932,7 +49932,7 @@ declare module BABYLON {
             frontUVs?: Vector4;
             backUVs?: Vector4;
             updatable?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a ribbon mesh. The ribbon is a parametric shape.  It has no predefined shape. Its final shape will depend on the input parameters
          * * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry
@@ -50013,7 +50013,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a torus mesh
          * * The parameter `diameter` sets the diameter size (float) of the torus (default 1)
@@ -50036,7 +50036,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a torus knot mesh
          * * The parameter `radius` sets the global radius size (float) of the torus knot (default 2)
@@ -50063,7 +50063,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a line system mesh. A line system is a pool of many lines gathered in a single mesh
          * * A line system mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of lines as an input parameter
@@ -50209,7 +50209,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             instance?: Mesh;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates lathe mesh.
          * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe
@@ -50243,7 +50243,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             cap?: number;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a plane mesh
          * * The parameter `size` sets the size (float) of both sides of the plane at once (default 1)
@@ -50267,7 +50267,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             updatable?: boolean;
             sourcePlane?: Plane;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a ground mesh
          * * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground
@@ -50286,7 +50286,7 @@ declare module BABYLON {
             subdivisionsX?: number;
             subdivisionsY?: number;
             updatable?: boolean;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a tiled ground mesh
          * * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates
@@ -50314,7 +50314,7 @@ declare module BABYLON {
                 h: number;
             };
             updatable?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a ground mesh from a height map
          * * The parameter `url` sets the URL of the height map image resource.
@@ -50344,7 +50344,7 @@ declare module BABYLON {
             alphaFilter?: number;
             updatable?: boolean;
             onReady?: (mesh: GroundMesh) => void;
-        }, scene: Scene): GroundMesh;
+        }, scene?: Nullable<Scene>): GroundMesh;
         /**
          * Creates a polygon mesh
          * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh
@@ -50369,7 +50369,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene, earcutInjection?: any): Mesh;
+        }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh;
         /**
          * Creates an extruded polygon mesh, with depth in the Y direction.
          * * You can set different colors and different images to the top, bottom and extruded side by using the parameters `faceColors` (an array of 3 Color3 elements) and `faceUV` (an array of 3 Vector4 elements)
@@ -50390,7 +50390,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene, earcutInjection?: any): Mesh;
+        }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh;
         /**
          * Creates a tube mesh.
          * The tube is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters
@@ -50428,7 +50428,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             instance?: Mesh;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a polyhedron mesh
          * * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial to choose the wanted type
@@ -50462,7 +50462,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a decal mesh.
          * A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter `sourceMesh` depicting the decal

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


+ 48 - 3
dist/preview release/babylon.max.js

@@ -699,7 +699,7 @@ var ActionEvent = /** @class */ (function () {
      */
     ActionEvent.CreateNew = function (source, evt, additionalData) {
         var scene = source.getScene();
-        return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt, additionalData);
+        return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer || source, evt, additionalData);
     };
     /**
      * Helper function to auto-create an ActionEvent from a source sprite
@@ -28347,9 +28347,14 @@ var PhysicsViewer = /** @class */ (function () {
         return wireframeOver;
     };
     PhysicsViewer.prototype._getDebugMesh = function (impostor, targetMesh) {
+        var _this = this;
         if (!this._utilityLayer) {
             return null;
         }
+        // Only create child impostor debug meshes when evaluating the parent
+        if (targetMesh && targetMesh.parent && targetMesh.parent.physicsImpostor) {
+            return null;
+        }
         var mesh = null;
         var utilityLayerScene = this._utilityLayer.utilityLayerScene;
         switch (impostor.type) {
@@ -28369,6 +28374,16 @@ var PhysicsViewer = /** @class */ (function () {
                     mesh = this._getDebugMeshMesh(targetMesh, utilityLayerScene);
                 }
                 break;
+            case _Physics_physicsImpostor__WEBPACK_IMPORTED_MODULE_6__["PhysicsImpostor"].NoImpostor:
+                if (targetMesh) {
+                    // Handle compound impostors
+                    var childMeshes = targetMesh.getChildMeshes().filter(function (c) { return c.physicsImpostor ? 1 : 0; });
+                    childMeshes.forEach(function (m) {
+                        var a = _this._getDebugBoxMesh(utilityLayerScene);
+                        a.parent = m;
+                    });
+                }
+                break;
         }
         return mesh;
     };
@@ -82534,6 +82549,8 @@ __webpack_require__.r(__webpack_exports__);
 /* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mesh.vertexData */ "./Meshes/mesh.vertexData.ts");
 /* harmony import */ var _groundMesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../groundMesh */ "./Meshes/groundMesh.ts");
 /* harmony import */ var _Misc_tools__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Misc/tools */ "./Misc/tools.ts");
+/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Engines/engineStore */ "./Engines/engineStore.ts");
+
 
 
 
@@ -82808,6 +82825,7 @@ var GroundBuilder = /** @class */ (function () {
      * @see https://doc.babylonjs.com/how_to/set_shapes#tiled-ground
      */
     GroundBuilder.CreateTiledGround = function (name, options, scene) {
+        if (scene === void 0) { scene = null; }
         var tiledGround = new _mesh__WEBPACK_IMPORTED_MODULE_1__["Mesh"](name, scene);
         var vertexData = _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__["VertexData"].CreateTiledGround(options);
         vertexData.applyToMesh(tiledGround, options.updatable);
@@ -82833,6 +82851,7 @@ var GroundBuilder = /** @class */ (function () {
      * @see https://doc.babylonjs.com/how_to/set_shapes#ground-from-a-height-map
      */
     GroundBuilder.CreateGroundFromHeightMap = function (name, url, options, scene) {
+        if (scene === void 0) { scene = null; }
         var width = options.width || 10.0;
         var height = options.height || 10.0;
         var subdivisions = options.subdivisions || 1 | 0;
@@ -82842,6 +82861,7 @@ var GroundBuilder = /** @class */ (function () {
         var alphaFilter = options.alphaFilter || 0.0;
         var updatable = options.updatable;
         var onReady = options.onReady;
+        scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__["EngineStore"].LastCreatedScene;
         var ground = new _groundMesh__WEBPACK_IMPORTED_MODULE_3__["GroundMesh"](name, scene);
         ground._subdivisionsX = subdivisions;
         ground._subdivisionsY = subdivisions;
@@ -83228,6 +83248,7 @@ var IcoSphereBuilder = /** @class */ (function () {
      * @see https://doc.babylonjs.com/how_to/polyhedra_shapes#icosphere
      */
     IcoSphereBuilder.CreateIcoSphere = function (name, options, scene) {
+        if (scene === void 0) { scene = null; }
         var sphere = new _mesh__WEBPACK_IMPORTED_MODULE_1__["Mesh"](name, scene);
         options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_1__["Mesh"]._GetDefaultSideOrientation(options.sideOrientation);
         sphere._originalBuilderSideOrientation = options.sideOrientation;
@@ -83380,6 +83401,7 @@ var LatheBuilder = /** @class */ (function () {
      * @see https://doc.babylonjs.com/how_to/parametric_shapes#lathe
      */
     LatheBuilder.CreateLathe = function (name, options, scene) {
+        if (scene === void 0) { scene = null; }
         var arc = options.arc ? ((options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc) : 1.0;
         var closed = (options.closed === undefined) ? true : options.closed;
         var shape = options.shape;
@@ -83795,6 +83817,7 @@ var PlaneBuilder = /** @class */ (function () {
      * @see https://doc.babylonjs.com/how_to/set_shapes#plane
      */
     PlaneBuilder.CreatePlane = function (name, options, scene) {
+        if (scene === void 0) { scene = null; }
         var plane = new _mesh__WEBPACK_IMPORTED_MODULE_0__["Mesh"](name, scene);
         options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_0__["Mesh"]._GetDefaultSideOrientation(options.sideOrientation);
         plane._originalBuilderSideOrientation = options.sideOrientation;
@@ -83828,6 +83851,8 @@ __webpack_require__.r(__webpack_exports__);
 /* harmony import */ var _mesh_vertexData__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mesh.vertexData */ "./Meshes/mesh.vertexData.ts");
 /* harmony import */ var _polygonMesh__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../polygonMesh */ "./Meshes/polygonMesh.ts");
 /* harmony import */ var _Meshes_buffer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../Meshes/buffer */ "./Meshes/buffer.ts");
+/* harmony import */ var _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../Engines/engineStore */ "./Engines/engineStore.ts");
+
 
 
 
@@ -83929,6 +83954,7 @@ var PolygonBuilder = /** @class */ (function () {
      * @returns the polygon mesh
      */
     PolygonBuilder.CreatePolygon = function (name, options, scene, earcutInjection) {
+        if (scene === void 0) { scene = null; }
         if (earcutInjection === void 0) { earcutInjection = earcut; }
         options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_1__["Mesh"]._GetDefaultSideOrientation(options.sideOrientation);
         var shape = options.shape;
@@ -83943,7 +83969,7 @@ var PolygonBuilder = /** @class */ (function () {
         if (contours[0].equalsWithEpsilon(contours[contours.length - 1], epsilon)) {
             contours.pop();
         }
-        var polygonTriangulation = new _polygonMesh__WEBPACK_IMPORTED_MODULE_3__["PolygonMeshBuilder"](name, contours, scene, earcutInjection);
+        var polygonTriangulation = new _polygonMesh__WEBPACK_IMPORTED_MODULE_3__["PolygonMeshBuilder"](name, contours, scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_5__["EngineStore"].LastCreatedScene, earcutInjection);
         for (var hNb = 0; hNb < holes.length; hNb++) {
             hole = [];
             for (var hPoint = 0; hPoint < holes[hNb].length; hPoint++) {
@@ -83968,6 +83994,7 @@ var PolygonBuilder = /** @class */ (function () {
      * @returns the polygon mesh
      */
     PolygonBuilder.ExtrudePolygon = function (name, options, scene, earcutInjection) {
+        if (scene === void 0) { scene = null; }
         if (earcutInjection === void 0) { earcutInjection = earcut; }
         return PolygonBuilder.CreatePolygon(name, options, scene, earcutInjection);
     };
@@ -84142,6 +84169,7 @@ var PolyhedronBuilder = /** @class */ (function () {
      * @see https://doc.babylonjs.com/how_to/polyhedra_shapes
      */
     PolyhedronBuilder.CreatePolyhedron = function (name, options, scene) {
+        if (scene === void 0) { scene = null; }
         var polyhedron = new _mesh__WEBPACK_IMPORTED_MODULE_1__["Mesh"](name, scene);
         options.sideOrientation = _mesh__WEBPACK_IMPORTED_MODULE_1__["Mesh"]._GetDefaultSideOrientation(options.sideOrientation);
         polyhedron._originalBuilderSideOrientation = options.sideOrientation;
@@ -84659,6 +84687,7 @@ var ShapeBuilder = /** @class */ (function () {
      * @see https://doc.babylonjs.com/how_to/parametric_shapes#extruded-shapes
      */
     ShapeBuilder.ExtrudeShapeCustom = function (name, options, scene) {
+        if (scene === void 0) { scene = null; }
         var path = options.path;
         var shape = options.shape;
         var scaleFunction = options.scaleFunction || (function () { return 1; });
@@ -85192,6 +85221,7 @@ var TubeBuilder = /** @class */ (function () {
      * @see https://doc.babylonjs.com/how_to/set_shapes#tube
      */
     TubeBuilder.CreateTube = function (name, options, scene) {
+        if (scene === void 0) { scene = null; }
         var path = options.path;
         var instance = options.instance;
         var radius = 1.0;
@@ -95874,6 +95904,7 @@ var MeshBuilder = /** @class */ (function () {
      * @see https://doc.babylonjs.com/how_to/set_shapes#sphere
      */
     MeshBuilder.CreateSphere = function (name, options, scene) {
+        if (scene === void 0) { scene = null; }
         return _Builders_sphereBuilder__WEBPACK_IMPORTED_MODULE_3__["SphereBuilder"].CreateSphere(name, options, scene);
     };
     /**
@@ -95910,6 +95941,7 @@ var MeshBuilder = /** @class */ (function () {
      * @see https://doc.babylonjs.com/how_to/polyhedra_shapes#icosphere
      */
     MeshBuilder.CreateIcoSphere = function (name, options, scene) {
+        if (scene === void 0) { scene = null; }
         return _Builders_icoSphereBuilder__WEBPACK_IMPORTED_MODULE_15__["IcoSphereBuilder"].CreateIcoSphere(name, options, scene);
     };
     /**
@@ -95967,6 +95999,7 @@ var MeshBuilder = /** @class */ (function () {
      * @see https://doc.babylonjs.com/how_to/set_shapes#cylinder-or-cone
      */
     MeshBuilder.CreateCylinder = function (name, options, scene) {
+        if (scene === void 0) { scene = null; }
         return _Builders_cylinderBuilder__WEBPACK_IMPORTED_MODULE_4__["CylinderBuilder"].CreateCylinder(name, options, scene);
     };
     /**
@@ -95984,6 +96017,7 @@ var MeshBuilder = /** @class */ (function () {
      * @see https://doc.babylonjs.com/how_to/set_shapes#torus
      */
     MeshBuilder.CreateTorus = function (name, options, scene) {
+        if (scene === void 0) { scene = null; }
         return _Builders_torusBuilder__WEBPACK_IMPORTED_MODULE_5__["TorusBuilder"].CreateTorus(name, options, scene);
     };
     /**
@@ -96002,6 +96036,7 @@ var MeshBuilder = /** @class */ (function () {
      * @see  https://doc.babylonjs.com/how_to/set_shapes#torus-knot
      */
     MeshBuilder.CreateTorusKnot = function (name, options, scene) {
+        if (scene === void 0) { scene = null; }
         return _Builders_torusKnotBuilder__WEBPACK_IMPORTED_MODULE_6__["TorusKnotBuilder"].CreateTorusKnot(name, options, scene);
     };
     /**
@@ -96116,6 +96151,7 @@ var MeshBuilder = /** @class */ (function () {
      * @see https://doc.babylonjs.com/how_to/parametric_shapes#extruded-shapes
      */
     MeshBuilder.ExtrudeShapeCustom = function (name, options, scene) {
+        if (scene === void 0) { scene = null; }
         return _Builders_shapeBuilder__WEBPACK_IMPORTED_MODULE_9__["ShapeBuilder"].ExtrudeShapeCustom(name, options, scene);
     };
     /**
@@ -96139,6 +96175,7 @@ var MeshBuilder = /** @class */ (function () {
      * @see https://doc.babylonjs.com/how_to/parametric_shapes#lathe
      */
     MeshBuilder.CreateLathe = function (name, options, scene) {
+        if (scene === void 0) { scene = null; }
         return _Builders_latheBuilder__WEBPACK_IMPORTED_MODULE_10__["LatheBuilder"].CreateLathe(name, options, scene);
     };
     /**
@@ -96156,6 +96193,7 @@ var MeshBuilder = /** @class */ (function () {
      * @see https://doc.babylonjs.com/how_to/set_shapes#plane
      */
     MeshBuilder.CreatePlane = function (name, options, scene) {
+        if (scene === void 0) { scene = null; }
         return _Builders_planeBuilder__WEBPACK_IMPORTED_MODULE_11__["PlaneBuilder"].CreatePlane(name, options, scene);
     };
     /**
@@ -96170,6 +96208,7 @@ var MeshBuilder = /** @class */ (function () {
      * @see https://doc.babylonjs.com/how_to/set_shapes#ground
      */
     MeshBuilder.CreateGround = function (name, options, scene) {
+        if (scene === void 0) { scene = null; }
         return _Builders_groundBuilder__WEBPACK_IMPORTED_MODULE_12__["GroundBuilder"].CreateGround(name, options, scene);
     };
     /**
@@ -96186,6 +96225,7 @@ var MeshBuilder = /** @class */ (function () {
      * @see https://doc.babylonjs.com/how_to/set_shapes#tiled-ground
      */
     MeshBuilder.CreateTiledGround = function (name, options, scene) {
+        if (scene === void 0) { scene = null; }
         return _Builders_groundBuilder__WEBPACK_IMPORTED_MODULE_12__["GroundBuilder"].CreateTiledGround(name, options, scene);
     };
     /**
@@ -96208,6 +96248,7 @@ var MeshBuilder = /** @class */ (function () {
      * @see https://doc.babylonjs.com/how_to/set_shapes#ground-from-a-height-map
      */
     MeshBuilder.CreateGroundFromHeightMap = function (name, url, options, scene) {
+        if (scene === void 0) { scene = null; }
         return _Builders_groundBuilder__WEBPACK_IMPORTED_MODULE_12__["GroundBuilder"].CreateGroundFromHeightMap(name, url, options, scene);
     };
     /**
@@ -96225,6 +96266,7 @@ var MeshBuilder = /** @class */ (function () {
      * @returns the polygon mesh
      */
     MeshBuilder.CreatePolygon = function (name, options, scene, earcutInjection) {
+        if (scene === void 0) { scene = null; }
         if (earcutInjection === void 0) { earcutInjection = earcut; }
         return _Builders_polygonBuilder__WEBPACK_IMPORTED_MODULE_8__["PolygonBuilder"].CreatePolygon(name, options, scene, earcutInjection);
     };
@@ -96239,6 +96281,7 @@ var MeshBuilder = /** @class */ (function () {
      * @returns the polygon mesh
      */
     MeshBuilder.ExtrudePolygon = function (name, options, scene, earcutInjection) {
+        if (scene === void 0) { scene = null; }
         if (earcutInjection === void 0) { earcutInjection = earcut; }
         return _Builders_polygonBuilder__WEBPACK_IMPORTED_MODULE_8__["PolygonBuilder"].ExtrudePolygon(name, options, scene, earcutInjection);
     };
@@ -96265,6 +96308,7 @@ var MeshBuilder = /** @class */ (function () {
      * @see https://doc.babylonjs.com/how_to/set_shapes#tube
      */
     MeshBuilder.CreateTube = function (name, options, scene) {
+        if (scene === void 0) { scene = null; }
         return _Builders_tubeBuilder__WEBPACK_IMPORTED_MODULE_13__["TubeBuilder"].CreateTube(name, options, scene);
     };
     /**
@@ -96287,6 +96331,7 @@ var MeshBuilder = /** @class */ (function () {
      * @see https://doc.babylonjs.com/how_to/polyhedra_shapes
      */
     MeshBuilder.CreatePolyhedron = function (name, options, scene) {
+        if (scene === void 0) { scene = null; }
         return _Builders_polyhedronBuilder__WEBPACK_IMPORTED_MODULE_14__["PolyhedronBuilder"].CreatePolyhedron(name, options, scene);
     };
     /**
@@ -96784,7 +96829,7 @@ var QuadraticErrorSimplification = /** @class */ (function () {
                         newUVsData.push(uvs[(originalOffset * 2)]);
                         newUVsData.push(uvs[(originalOffset * 2) + 1]);
                     }
-                    else if (colorsData && colorsData.length) {
+                    if (colorsData && colorsData.length) {
                         newColorsData.push(colorsData[(originalOffset * 4)]);
                         newColorsData.push(colorsData[(originalOffset * 4) + 1]);
                         newColorsData.push(colorsData[(originalOffset * 4) + 2]);

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


+ 57 - 50
dist/preview release/babylon.module.d.ts

@@ -36374,6 +36374,7 @@ declare module "babylonjs/Meshes/Builders/planeBuilder" {
     import { Scene } from "babylonjs/scene";
     import { Vector4, Plane } from "babylonjs/Maths/math";
     import { Mesh } from "babylonjs/Meshes/mesh";
+    import { Nullable } from "babylonjs/types";
     /**
      * Class containing static functions to help procedurally build meshes
      */
@@ -36401,7 +36402,7 @@ declare module "babylonjs/Meshes/Builders/planeBuilder" {
             backUVs?: Vector4;
             updatable?: boolean;
             sourcePlane?: Plane;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module "babylonjs/Behaviors/Meshes/pointerDragBehavior" {
@@ -40363,6 +40364,7 @@ declare module "babylonjs/Meshes/Builders/groundBuilder" {
     import { Color3 } from "babylonjs/Maths/math";
     import { Mesh } from "babylonjs/Meshes/mesh";
     import { GroundMesh } from "babylonjs/Meshes/groundMesh";
+    import { Nullable } from "babylonjs/types";
     /**
      * Class containing static functions to help procedurally build meshes
      */
@@ -40413,7 +40415,7 @@ declare module "babylonjs/Meshes/Builders/groundBuilder" {
                 h: number;
             };
             updatable?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a ground mesh from a height map
          * * The parameter `url` sets the URL of the height map image resource.
@@ -40443,7 +40445,7 @@ declare module "babylonjs/Meshes/Builders/groundBuilder" {
             alphaFilter?: number;
             updatable?: boolean;
             onReady?: (mesh: GroundMesh) => void;
-        }, scene: Scene): GroundMesh;
+        }, scene?: Nullable<Scene>): GroundMesh;
     }
 }
 declare module "babylonjs/Meshes/Builders/torusBuilder" {
@@ -44002,6 +44004,7 @@ declare module "babylonjs/Meshes/Builders/polyhedronBuilder" {
     import { Scene } from "babylonjs/scene";
     import { Color4, Vector4 } from "babylonjs/Maths/math";
     import { Mesh } from "babylonjs/Meshes/mesh";
+    import { Nullable } from "babylonjs/types";
     /**
      * Class containing static functions to help procedurally build meshes
      */
@@ -44039,7 +44042,7 @@ declare module "babylonjs/Meshes/Builders/polyhedronBuilder" {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module "babylonjs/Gizmos/scaleGizmo" {
@@ -50131,7 +50134,7 @@ declare module "babylonjs/Meshes/Builders/shapeBuilder" {
             backUVs?: Vector4;
             instance?: Mesh;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         private static _ExtrudeShapeGeneric;
     }
 }
@@ -51793,6 +51796,7 @@ declare module "babylonjs/Meshes/Builders/polygonBuilder" {
     import { Scene } from "babylonjs/scene";
     import { Vector3, Color4, Vector4 } from "babylonjs/Maths/math";
     import { Mesh } from "babylonjs/Meshes/mesh";
+    import { Nullable } from "babylonjs/types";
     /**
      * Class containing static functions to help procedurally build meshes
      */
@@ -51821,7 +51825,7 @@ declare module "babylonjs/Meshes/Builders/polygonBuilder" {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene, earcutInjection?: any): Mesh;
+        }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh;
         /**
          * Creates an extruded polygon mesh, with depth in the Y direction.
          * * You can set different colors and different images to the top, bottom and extruded side by using the parameters `faceColors` (an array of 3 Color3 elements) and `faceUV` (an array of 3 Vector4 elements)
@@ -51842,13 +51846,14 @@ declare module "babylonjs/Meshes/Builders/polygonBuilder" {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene, earcutInjection?: any): Mesh;
+        }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh;
     }
 }
 declare module "babylonjs/Meshes/Builders/latheBuilder" {
     import { Scene } from "babylonjs/scene";
     import { Vector3, Vector4 } from "babylonjs/Maths/math";
     import { Mesh } from "babylonjs/Meshes/mesh";
+    import { Nullable } from "babylonjs/types";
     /**
      * Class containing static functions to help procedurally build meshes
      */
@@ -51886,10 +51891,11 @@ declare module "babylonjs/Meshes/Builders/latheBuilder" {
             backUVs?: Vector4;
             cap?: number;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module "babylonjs/Meshes/Builders/tubeBuilder" {
+    import { Nullable } from "babylonjs/types";
     import { Scene } from "babylonjs/scene";
     import { Vector3, Vector4 } from "babylonjs/Maths/math";
     import { Mesh } from "babylonjs/Meshes/mesh";
@@ -51934,13 +51940,14 @@ declare module "babylonjs/Meshes/Builders/tubeBuilder" {
             backUVs?: Vector4;
             instance?: Mesh;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module "babylonjs/Meshes/Builders/icoSphereBuilder" {
     import { Scene } from "babylonjs/scene";
     import { Vector4 } from "babylonjs/Maths/math";
     import { Mesh } from "babylonjs/Meshes/mesh";
+    import { Nullable } from "babylonjs/types";
     /**
      * Class containing static functions to help procedurally build meshes
      */
@@ -51971,7 +51978,7 @@ declare module "babylonjs/Meshes/Builders/icoSphereBuilder" {
             frontUVs?: Vector4;
             backUVs?: Vector4;
             updatable?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module "babylonjs/Meshes/Builders/decalBuilder" {
@@ -52071,7 +52078,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             frontUVs?: Vector4;
             backUVs?: Vector4;
             updatable?: boolean;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a plane polygonal mesh.  By default, this is a disc
          * * The parameter `radius` sets the radius size (float) of the polygon (default 0.5)
@@ -52121,7 +52128,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             frontUVs?: Vector4;
             backUVs?: Vector4;
             updatable?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a ribbon mesh. The ribbon is a parametric shape.  It has no predefined shape. Its final shape will depend on the input parameters
          * * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry
@@ -52202,7 +52209,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a torus mesh
          * * The parameter `diameter` sets the diameter size (float) of the torus (default 1)
@@ -52225,7 +52232,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a torus knot mesh
          * * The parameter `radius` sets the global radius size (float) of the torus knot (default 2)
@@ -52252,7 +52259,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a line system mesh. A line system is a pool of many lines gathered in a single mesh
          * * A line system mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of lines as an input parameter
@@ -52398,7 +52405,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             backUVs?: Vector4;
             instance?: Mesh;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates lathe mesh.
          * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe
@@ -52432,7 +52439,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             backUVs?: Vector4;
             cap?: number;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a plane mesh
          * * The parameter `size` sets the size (float) of both sides of the plane at once (default 1)
@@ -52456,7 +52463,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             backUVs?: Vector4;
             updatable?: boolean;
             sourcePlane?: Plane;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a ground mesh
          * * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground
@@ -52475,7 +52482,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             subdivisionsX?: number;
             subdivisionsY?: number;
             updatable?: boolean;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a tiled ground mesh
          * * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates
@@ -52503,7 +52510,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
                 h: number;
             };
             updatable?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a ground mesh from a height map
          * * The parameter `url` sets the URL of the height map image resource.
@@ -52533,7 +52540,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             alphaFilter?: number;
             updatable?: boolean;
             onReady?: (mesh: GroundMesh) => void;
-        }, scene: Scene): GroundMesh;
+        }, scene?: Nullable<Scene>): GroundMesh;
         /**
          * Creates a polygon mesh
          * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh
@@ -52558,7 +52565,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene, earcutInjection?: any): Mesh;
+        }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh;
         /**
          * Creates an extruded polygon mesh, with depth in the Y direction.
          * * You can set different colors and different images to the top, bottom and extruded side by using the parameters `faceColors` (an array of 3 Color3 elements) and `faceUV` (an array of 3 Vector4 elements)
@@ -52579,7 +52586,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene, earcutInjection?: any): Mesh;
+        }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh;
         /**
          * Creates a tube mesh.
          * The tube is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters
@@ -52617,7 +52624,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             backUVs?: Vector4;
             instance?: Mesh;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a polyhedron mesh
          * * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial to choose the wanted type
@@ -52651,7 +52658,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a decal mesh.
          * A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter `sourceMesh` depicting the decal
@@ -94885,7 +94892,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             updatable?: boolean;
             sourcePlane?: Plane;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module BABYLON {
@@ -98601,7 +98608,7 @@ declare module BABYLON {
                 h: number;
             };
             updatable?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a ground mesh from a height map
          * * The parameter `url` sets the URL of the height map image resource.
@@ -98631,7 +98638,7 @@ declare module BABYLON {
             alphaFilter?: number;
             updatable?: boolean;
             onReady?: (mesh: GroundMesh) => void;
-        }, scene: Scene): GroundMesh;
+        }, scene?: Nullable<Scene>): GroundMesh;
     }
 }
 declare module BABYLON {
@@ -101877,7 +101884,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module BABYLON {
@@ -107546,7 +107553,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             instance?: Mesh;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         private static _ExtrudeShapeGeneric;
     }
 }
@@ -109083,7 +109090,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene, earcutInjection?: any): Mesh;
+        }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh;
         /**
          * Creates an extruded polygon mesh, with depth in the Y direction.
          * * You can set different colors and different images to the top, bottom and extruded side by using the parameters `faceColors` (an array of 3 Color3 elements) and `faceUV` (an array of 3 Vector4 elements)
@@ -109104,7 +109111,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene, earcutInjection?: any): Mesh;
+        }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh;
     }
 }
 declare module BABYLON {
@@ -109145,7 +109152,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             cap?: number;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module BABYLON {
@@ -109190,7 +109197,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             instance?: Mesh;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module BABYLON {
@@ -109224,7 +109231,7 @@ declare module BABYLON {
             frontUVs?: Vector4;
             backUVs?: Vector4;
             updatable?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module BABYLON {
@@ -109314,7 +109321,7 @@ declare module BABYLON {
             frontUVs?: Vector4;
             backUVs?: Vector4;
             updatable?: boolean;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a plane polygonal mesh.  By default, this is a disc
          * * The parameter `radius` sets the radius size (float) of the polygon (default 0.5)
@@ -109364,7 +109371,7 @@ declare module BABYLON {
             frontUVs?: Vector4;
             backUVs?: Vector4;
             updatable?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a ribbon mesh. The ribbon is a parametric shape.  It has no predefined shape. Its final shape will depend on the input parameters
          * * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry
@@ -109445,7 +109452,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a torus mesh
          * * The parameter `diameter` sets the diameter size (float) of the torus (default 1)
@@ -109468,7 +109475,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a torus knot mesh
          * * The parameter `radius` sets the global radius size (float) of the torus knot (default 2)
@@ -109495,7 +109502,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a line system mesh. A line system is a pool of many lines gathered in a single mesh
          * * A line system mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of lines as an input parameter
@@ -109641,7 +109648,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             instance?: Mesh;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates lathe mesh.
          * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe
@@ -109675,7 +109682,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             cap?: number;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a plane mesh
          * * The parameter `size` sets the size (float) of both sides of the plane at once (default 1)
@@ -109699,7 +109706,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             updatable?: boolean;
             sourcePlane?: Plane;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a ground mesh
          * * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground
@@ -109718,7 +109725,7 @@ declare module BABYLON {
             subdivisionsX?: number;
             subdivisionsY?: number;
             updatable?: boolean;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a tiled ground mesh
          * * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates
@@ -109746,7 +109753,7 @@ declare module BABYLON {
                 h: number;
             };
             updatable?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a ground mesh from a height map
          * * The parameter `url` sets the URL of the height map image resource.
@@ -109776,7 +109783,7 @@ declare module BABYLON {
             alphaFilter?: number;
             updatable?: boolean;
             onReady?: (mesh: GroundMesh) => void;
-        }, scene: Scene): GroundMesh;
+        }, scene?: Nullable<Scene>): GroundMesh;
         /**
          * Creates a polygon mesh
          * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh
@@ -109801,7 +109808,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene, earcutInjection?: any): Mesh;
+        }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh;
         /**
          * Creates an extruded polygon mesh, with depth in the Y direction.
          * * You can set different colors and different images to the top, bottom and extruded side by using the parameters `faceColors` (an array of 3 Color3 elements) and `faceUV` (an array of 3 Vector4 elements)
@@ -109822,7 +109829,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene, earcutInjection?: any): Mesh;
+        }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh;
         /**
          * Creates a tube mesh.
          * The tube is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters
@@ -109860,7 +109867,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             instance?: Mesh;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a polyhedron mesh
          * * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial to choose the wanted type
@@ -109894,7 +109901,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a decal mesh.
          * A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter `sourceMesh` depicting the decal

+ 1 - 1
dist/preview release/packagesSizeBaseLine.json

@@ -1 +1 @@
-{"engineOnly":308951,"sceneOnly":510918,"minGridMaterial":634687,"minStandardMaterial":758506}
+{"engineOnly":308951,"sceneOnly":510921,"minGridMaterial":634690,"minStandardMaterial":758509}

+ 57 - 50
dist/preview release/viewer/babylon.module.d.ts

@@ -36374,6 +36374,7 @@ declare module "babylonjs/Meshes/Builders/planeBuilder" {
     import { Scene } from "babylonjs/scene";
     import { Vector4, Plane } from "babylonjs/Maths/math";
     import { Mesh } from "babylonjs/Meshes/mesh";
+    import { Nullable } from "babylonjs/types";
     /**
      * Class containing static functions to help procedurally build meshes
      */
@@ -36401,7 +36402,7 @@ declare module "babylonjs/Meshes/Builders/planeBuilder" {
             backUVs?: Vector4;
             updatable?: boolean;
             sourcePlane?: Plane;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module "babylonjs/Behaviors/Meshes/pointerDragBehavior" {
@@ -40363,6 +40364,7 @@ declare module "babylonjs/Meshes/Builders/groundBuilder" {
     import { Color3 } from "babylonjs/Maths/math";
     import { Mesh } from "babylonjs/Meshes/mesh";
     import { GroundMesh } from "babylonjs/Meshes/groundMesh";
+    import { Nullable } from "babylonjs/types";
     /**
      * Class containing static functions to help procedurally build meshes
      */
@@ -40413,7 +40415,7 @@ declare module "babylonjs/Meshes/Builders/groundBuilder" {
                 h: number;
             };
             updatable?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a ground mesh from a height map
          * * The parameter `url` sets the URL of the height map image resource.
@@ -40443,7 +40445,7 @@ declare module "babylonjs/Meshes/Builders/groundBuilder" {
             alphaFilter?: number;
             updatable?: boolean;
             onReady?: (mesh: GroundMesh) => void;
-        }, scene: Scene): GroundMesh;
+        }, scene?: Nullable<Scene>): GroundMesh;
     }
 }
 declare module "babylonjs/Meshes/Builders/torusBuilder" {
@@ -44002,6 +44004,7 @@ declare module "babylonjs/Meshes/Builders/polyhedronBuilder" {
     import { Scene } from "babylonjs/scene";
     import { Color4, Vector4 } from "babylonjs/Maths/math";
     import { Mesh } from "babylonjs/Meshes/mesh";
+    import { Nullable } from "babylonjs/types";
     /**
      * Class containing static functions to help procedurally build meshes
      */
@@ -44039,7 +44042,7 @@ declare module "babylonjs/Meshes/Builders/polyhedronBuilder" {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module "babylonjs/Gizmos/scaleGizmo" {
@@ -50131,7 +50134,7 @@ declare module "babylonjs/Meshes/Builders/shapeBuilder" {
             backUVs?: Vector4;
             instance?: Mesh;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         private static _ExtrudeShapeGeneric;
     }
 }
@@ -51793,6 +51796,7 @@ declare module "babylonjs/Meshes/Builders/polygonBuilder" {
     import { Scene } from "babylonjs/scene";
     import { Vector3, Color4, Vector4 } from "babylonjs/Maths/math";
     import { Mesh } from "babylonjs/Meshes/mesh";
+    import { Nullable } from "babylonjs/types";
     /**
      * Class containing static functions to help procedurally build meshes
      */
@@ -51821,7 +51825,7 @@ declare module "babylonjs/Meshes/Builders/polygonBuilder" {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene, earcutInjection?: any): Mesh;
+        }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh;
         /**
          * Creates an extruded polygon mesh, with depth in the Y direction.
          * * You can set different colors and different images to the top, bottom and extruded side by using the parameters `faceColors` (an array of 3 Color3 elements) and `faceUV` (an array of 3 Vector4 elements)
@@ -51842,13 +51846,14 @@ declare module "babylonjs/Meshes/Builders/polygonBuilder" {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene, earcutInjection?: any): Mesh;
+        }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh;
     }
 }
 declare module "babylonjs/Meshes/Builders/latheBuilder" {
     import { Scene } from "babylonjs/scene";
     import { Vector3, Vector4 } from "babylonjs/Maths/math";
     import { Mesh } from "babylonjs/Meshes/mesh";
+    import { Nullable } from "babylonjs/types";
     /**
      * Class containing static functions to help procedurally build meshes
      */
@@ -51886,10 +51891,11 @@ declare module "babylonjs/Meshes/Builders/latheBuilder" {
             backUVs?: Vector4;
             cap?: number;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module "babylonjs/Meshes/Builders/tubeBuilder" {
+    import { Nullable } from "babylonjs/types";
     import { Scene } from "babylonjs/scene";
     import { Vector3, Vector4 } from "babylonjs/Maths/math";
     import { Mesh } from "babylonjs/Meshes/mesh";
@@ -51934,13 +51940,14 @@ declare module "babylonjs/Meshes/Builders/tubeBuilder" {
             backUVs?: Vector4;
             instance?: Mesh;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module "babylonjs/Meshes/Builders/icoSphereBuilder" {
     import { Scene } from "babylonjs/scene";
     import { Vector4 } from "babylonjs/Maths/math";
     import { Mesh } from "babylonjs/Meshes/mesh";
+    import { Nullable } from "babylonjs/types";
     /**
      * Class containing static functions to help procedurally build meshes
      */
@@ -51971,7 +51978,7 @@ declare module "babylonjs/Meshes/Builders/icoSphereBuilder" {
             frontUVs?: Vector4;
             backUVs?: Vector4;
             updatable?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module "babylonjs/Meshes/Builders/decalBuilder" {
@@ -52071,7 +52078,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             frontUVs?: Vector4;
             backUVs?: Vector4;
             updatable?: boolean;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a plane polygonal mesh.  By default, this is a disc
          * * The parameter `radius` sets the radius size (float) of the polygon (default 0.5)
@@ -52121,7 +52128,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             frontUVs?: Vector4;
             backUVs?: Vector4;
             updatable?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a ribbon mesh. The ribbon is a parametric shape.  It has no predefined shape. Its final shape will depend on the input parameters
          * * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry
@@ -52202,7 +52209,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a torus mesh
          * * The parameter `diameter` sets the diameter size (float) of the torus (default 1)
@@ -52225,7 +52232,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a torus knot mesh
          * * The parameter `radius` sets the global radius size (float) of the torus knot (default 2)
@@ -52252,7 +52259,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a line system mesh. A line system is a pool of many lines gathered in a single mesh
          * * A line system mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of lines as an input parameter
@@ -52398,7 +52405,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             backUVs?: Vector4;
             instance?: Mesh;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates lathe mesh.
          * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe
@@ -52432,7 +52439,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             backUVs?: Vector4;
             cap?: number;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a plane mesh
          * * The parameter `size` sets the size (float) of both sides of the plane at once (default 1)
@@ -52456,7 +52463,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             backUVs?: Vector4;
             updatable?: boolean;
             sourcePlane?: Plane;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a ground mesh
          * * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground
@@ -52475,7 +52482,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             subdivisionsX?: number;
             subdivisionsY?: number;
             updatable?: boolean;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a tiled ground mesh
          * * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates
@@ -52503,7 +52510,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
                 h: number;
             };
             updatable?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a ground mesh from a height map
          * * The parameter `url` sets the URL of the height map image resource.
@@ -52533,7 +52540,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             alphaFilter?: number;
             updatable?: boolean;
             onReady?: (mesh: GroundMesh) => void;
-        }, scene: Scene): GroundMesh;
+        }, scene?: Nullable<Scene>): GroundMesh;
         /**
          * Creates a polygon mesh
          * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh
@@ -52558,7 +52565,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene, earcutInjection?: any): Mesh;
+        }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh;
         /**
          * Creates an extruded polygon mesh, with depth in the Y direction.
          * * You can set different colors and different images to the top, bottom and extruded side by using the parameters `faceColors` (an array of 3 Color3 elements) and `faceUV` (an array of 3 Vector4 elements)
@@ -52579,7 +52586,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene, earcutInjection?: any): Mesh;
+        }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh;
         /**
          * Creates a tube mesh.
          * The tube is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters
@@ -52617,7 +52624,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             backUVs?: Vector4;
             instance?: Mesh;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a polyhedron mesh
          * * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial to choose the wanted type
@@ -52651,7 +52658,7 @@ declare module "babylonjs/Meshes/meshBuilder" {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a decal mesh.
          * A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter `sourceMesh` depicting the decal
@@ -94885,7 +94892,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             updatable?: boolean;
             sourcePlane?: Plane;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module BABYLON {
@@ -98601,7 +98608,7 @@ declare module BABYLON {
                 h: number;
             };
             updatable?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a ground mesh from a height map
          * * The parameter `url` sets the URL of the height map image resource.
@@ -98631,7 +98638,7 @@ declare module BABYLON {
             alphaFilter?: number;
             updatable?: boolean;
             onReady?: (mesh: GroundMesh) => void;
-        }, scene: Scene): GroundMesh;
+        }, scene?: Nullable<Scene>): GroundMesh;
     }
 }
 declare module BABYLON {
@@ -101877,7 +101884,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module BABYLON {
@@ -107546,7 +107553,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             instance?: Mesh;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         private static _ExtrudeShapeGeneric;
     }
 }
@@ -109083,7 +109090,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene, earcutInjection?: any): Mesh;
+        }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh;
         /**
          * Creates an extruded polygon mesh, with depth in the Y direction.
          * * You can set different colors and different images to the top, bottom and extruded side by using the parameters `faceColors` (an array of 3 Color3 elements) and `faceUV` (an array of 3 Vector4 elements)
@@ -109104,7 +109111,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene, earcutInjection?: any): Mesh;
+        }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh;
     }
 }
 declare module BABYLON {
@@ -109145,7 +109152,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             cap?: number;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module BABYLON {
@@ -109190,7 +109197,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             instance?: Mesh;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module BABYLON {
@@ -109224,7 +109231,7 @@ declare module BABYLON {
             frontUVs?: Vector4;
             backUVs?: Vector4;
             updatable?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
     }
 }
 declare module BABYLON {
@@ -109314,7 +109321,7 @@ declare module BABYLON {
             frontUVs?: Vector4;
             backUVs?: Vector4;
             updatable?: boolean;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a plane polygonal mesh.  By default, this is a disc
          * * The parameter `radius` sets the radius size (float) of the polygon (default 0.5)
@@ -109364,7 +109371,7 @@ declare module BABYLON {
             frontUVs?: Vector4;
             backUVs?: Vector4;
             updatable?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a ribbon mesh. The ribbon is a parametric shape.  It has no predefined shape. Its final shape will depend on the input parameters
          * * The parameter `pathArray` is a required array of paths, what are each an array of successive Vector3. The pathArray parameter depicts the ribbon geometry
@@ -109445,7 +109452,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a torus mesh
          * * The parameter `diameter` sets the diameter size (float) of the torus (default 1)
@@ -109468,7 +109475,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a torus knot mesh
          * * The parameter `radius` sets the global radius size (float) of the torus knot (default 2)
@@ -109495,7 +109502,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a line system mesh. A line system is a pool of many lines gathered in a single mesh
          * * A line system mesh is considered as a parametric shape since it has no predefined original shape. Its shape is determined by the passed array of lines as an input parameter
@@ -109641,7 +109648,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             instance?: Mesh;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates lathe mesh.
          * The lathe is a shape with a symetry axis : a 2D model shape is rotated around this axis to design the lathe
@@ -109675,7 +109682,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             cap?: number;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a plane mesh
          * * The parameter `size` sets the size (float) of both sides of the plane at once (default 1)
@@ -109699,7 +109706,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             updatable?: boolean;
             sourcePlane?: Plane;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a ground mesh
          * * The parameters `width` and `height` (floats, default 1) set the width and height sizes of the ground
@@ -109718,7 +109725,7 @@ declare module BABYLON {
             subdivisionsX?: number;
             subdivisionsY?: number;
             updatable?: boolean;
-        }, scene: any): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a tiled ground mesh
          * * The parameters `xmin` and `xmax` (floats, default -1 and 1) set the ground minimum and maximum X coordinates
@@ -109746,7 +109753,7 @@ declare module BABYLON {
                 h: number;
             };
             updatable?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a ground mesh from a height map
          * * The parameter `url` sets the URL of the height map image resource.
@@ -109776,7 +109783,7 @@ declare module BABYLON {
             alphaFilter?: number;
             updatable?: boolean;
             onReady?: (mesh: GroundMesh) => void;
-        }, scene: Scene): GroundMesh;
+        }, scene?: Nullable<Scene>): GroundMesh;
         /**
          * Creates a polygon mesh
          * The polygon's shape will depend on the input parameters and is constructed parallel to a ground mesh
@@ -109801,7 +109808,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene, earcutInjection?: any): Mesh;
+        }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh;
         /**
          * Creates an extruded polygon mesh, with depth in the Y direction.
          * * You can set different colors and different images to the top, bottom and extruded side by using the parameters `faceColors` (an array of 3 Color3 elements) and `faceUV` (an array of 3 Vector4 elements)
@@ -109822,7 +109829,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene, earcutInjection?: any): Mesh;
+        }, scene?: Nullable<Scene>, earcutInjection?: any): Mesh;
         /**
          * Creates a tube mesh.
          * The tube is a parametric shape. It has no predefined shape. Its final shape will depend on the input parameters
@@ -109860,7 +109867,7 @@ declare module BABYLON {
             backUVs?: Vector4;
             instance?: Mesh;
             invertUV?: boolean;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a polyhedron mesh
          * * The parameter `type` (positive integer, max 14, default 0) sets the polyhedron type to build among the 15 embbeded types. Please refer to the type sheet in the tutorial to choose the wanted type
@@ -109894,7 +109901,7 @@ declare module BABYLON {
             sideOrientation?: number;
             frontUVs?: Vector4;
             backUVs?: Vector4;
-        }, scene: Scene): Mesh;
+        }, scene?: Nullable<Scene>): Mesh;
         /**
          * Creates a decal mesh.
          * A decal is a mesh usually applied as a model onto the surface of another mesh. So don't forget the parameter `sourceMesh` depicting the decal

+ 4 - 4
dist/preview release/viewer/babylon.viewer.d.ts

@@ -197,11 +197,11 @@ declare module BabylonViewer {
                 * Mainly used for help and errors
                 * @param subScreen the name of the subScreen. Those can be defined in the configuration object
                 */
-            showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
+            showOverlayScreen(subScreen: string): Promise<Template> | Promise<string>;
             /**
                 * Hide the overlay screen.
                 */
-            hideOverlayScreen(): Promise<string> | Promise<Template>;
+            hideOverlayScreen(): Promise<Template> | Promise<string>;
             /**
                 * show the viewer (in case it was hidden)
                 *
@@ -218,11 +218,11 @@ declare module BabylonViewer {
                 * Show the loading screen.
                 * The loading screen can be configured using the configuration object
                 */
-            showLoadingScreen(): Promise<string> | Promise<Template>;
+            showLoadingScreen(): Promise<Template> | Promise<string>;
             /**
                 * Hide the loading screen
                 */
-            hideLoadingScreen(): Promise<string> | Promise<Template>;
+            hideLoadingScreen(): Promise<Template> | Promise<string>;
             dispose(): void;
             protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
     }

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


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


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

@@ -230,11 +230,11 @@ declare module 'babylonjs-viewer/viewer/defaultViewer' {
                 * Mainly used for help and errors
                 * @param subScreen the name of the subScreen. Those can be defined in the configuration object
                 */
-            showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
+            showOverlayScreen(subScreen: string): Promise<Template> | Promise<string>;
             /**
                 * Hide the overlay screen.
                 */
-            hideOverlayScreen(): Promise<string> | Promise<Template>;
+            hideOverlayScreen(): Promise<Template> | Promise<string>;
             /**
                 * show the viewer (in case it was hidden)
                 *
@@ -251,11 +251,11 @@ declare module 'babylonjs-viewer/viewer/defaultViewer' {
                 * Show the loading screen.
                 * The loading screen can be configured using the configuration object
                 */
-            showLoadingScreen(): Promise<string> | Promise<Template>;
+            showLoadingScreen(): Promise<Template> | Promise<string>;
             /**
                 * Hide the loading screen
                 */
-            hideLoadingScreen(): Promise<string> | Promise<Template>;
+            hideLoadingScreen(): Promise<Template> | Promise<string>;
             dispose(): void;
             protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
     }

+ 1 - 1
package.json

@@ -106,4 +106,4 @@
         "xhr2": "^0.1.4",
         "xmlbuilder": "8.2.2"
     }
-}
+}

+ 1 - 1
src/Actions/actionEvent.ts

@@ -59,7 +59,7 @@ export class ActionEvent implements IActionEvent {
      */
     public static CreateNew(source: AbstractMesh, evt?: Event, additionalData?: any): ActionEvent {
         var scene = source.getScene();
-        return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer, evt, additionalData);
+        return new ActionEvent(source, scene.pointerX, scene.pointerY, scene.meshUnderPointer || source, evt, additionalData);
     }
 
     /**

+ 1 - 1
src/Meshes/Builders/polygonBuilder.ts

@@ -5,7 +5,7 @@ import { VertexData } from "../mesh.vertexData";
 import { PolygonMeshBuilder } from "../polygonMesh";
 import { FloatArray, IndicesArray, Nullable } from "../../types";
 import { VertexBuffer } from "../../Meshes/buffer";
-import { EngineStore } from '../../Engines';
+import { EngineStore } from '../../Engines/engineStore';
 
 declare var earcut: any;