Bladeren bron

Fix #4558 + nightly

David Catuhe 7 jaren geleden
bovenliggende
commit
f98111f8b0

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


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


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


+ 131 - 183
dist/preview release/babylon.max.js

@@ -15929,6 +15929,9 @@ var BABYLON;
                 }
                 else {
                     texture.generateMipMaps = !noMipmap;
+                    if (type === Engine.TEXTURETYPE_FLOAT && !_this._caps.textureFloatLinearFiltering) {
+                        texture.generateMipMaps = false;
+                    }
                     _this.updateRawCubeTexture(texture, faceDataArrays, format, type, invertY);
                 }
                 texture.isReady = true;
@@ -21544,135 +21547,6 @@ var BABYLON;
             _this._resyncMeshes();
             return _this;
         }
-        Object.defineProperty(Light, "LIGHTMAP_DEFAULT", {
-            /**
-             * If every light affecting the material is in this lightmapMode,
-             * material.lightmapTexture adds or multiplies
-             * (depends on material.useLightmapAsShadowmap)
-             * after every other light calculations.
-             */
-            get: function () {
-                return Light._LIGHTMAP_DEFAULT;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "LIGHTMAP_SPECULAR", {
-            /**
-             * material.lightmapTexture as only diffuse lighting from this light
-             * adds only specular lighting from this light
-             * adds dynamic shadows
-             */
-            get: function () {
-                return Light._LIGHTMAP_SPECULAR;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "LIGHTMAP_SHADOWSONLY", {
-            /**
-             * material.lightmapTexture as only lighting
-             * no light calculation from this light
-             * only adds dynamic shadows from this light
-             */
-            get: function () {
-                return Light._LIGHTMAP_SHADOWSONLY;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "INTENSITYMODE_AUTOMATIC", {
-            /**
-             * Each light type uses the default quantity according to its type:
-             *      point/spot lights use luminous intensity
-             *      directional lights use illuminance
-             */
-            get: function () {
-                return Light._INTENSITYMODE_AUTOMATIC;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "INTENSITYMODE_LUMINOUSPOWER", {
-            /**
-             * lumen (lm)
-             */
-            get: function () {
-                return Light._INTENSITYMODE_LUMINOUSPOWER;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "INTENSITYMODE_LUMINOUSINTENSITY", {
-            /**
-             * candela (lm/sr)
-             */
-            get: function () {
-                return Light._INTENSITYMODE_LUMINOUSINTENSITY;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "INTENSITYMODE_ILLUMINANCE", {
-            /**
-             * lux (lm/m^2)
-             */
-            get: function () {
-                return Light._INTENSITYMODE_ILLUMINANCE;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "INTENSITYMODE_LUMINANCE", {
-            /**
-             * nit (cd/m^2)
-             */
-            get: function () {
-                return Light._INTENSITYMODE_LUMINANCE;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "LIGHTTYPEID_POINTLIGHT", {
-            /**
-             * Light type const id of the point light.
-             */
-            get: function () {
-                return Light._LIGHTTYPEID_POINTLIGHT;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "LIGHTTYPEID_DIRECTIONALLIGHT", {
-            /**
-             * Light type const id of the directional light.
-             */
-            get: function () {
-                return Light._LIGHTTYPEID_DIRECTIONALLIGHT;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "LIGHTTYPEID_SPOTLIGHT", {
-            /**
-             * Light type const id of the spot light.
-             */
-            get: function () {
-                return Light._LIGHTTYPEID_SPOTLIGHT;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "LIGHTTYPEID_HEMISPHERICLIGHT", {
-            /**
-             * Light type const id of the hemispheric light.
-             */
-            get: function () {
-                return Light._LIGHTTYPEID_HEMISPHERICLIGHT;
-            },
-            enumerable: true,
-            configurable: true
-        });
         Object.defineProperty(Light.prototype, "intensityMode", {
             /**
              * Gets the photometric scale used to interpret the intensity.
@@ -22016,16 +21890,11 @@ var BABYLON;
          * @returns the constructor function
          */
         Light.GetConstructorFromName = function (type, name, scene) {
-            switch (type) {
-                case 0:
-                    return function () { return new BABYLON.PointLight(name, BABYLON.Vector3.Zero(), scene); };
-                case 1:
-                    return function () { return new BABYLON.DirectionalLight(name, BABYLON.Vector3.Zero(), scene); };
-                case 2:
-                    return function () { return new BABYLON.SpotLight(name, BABYLON.Vector3.Zero(), BABYLON.Vector3.Zero(), 0, 0, scene); };
-                case 3:
-                    return function () { return new BABYLON.HemisphericLight(name, BABYLON.Vector3.Zero(), scene); };
+            var constructorFunc = BABYLON.Node.Construct("Light_Type_" + type, name, scene);
+            if (constructorFunc) {
+                return constructorFunc;
             }
+            // Default to no light for none present once.
             return null;
         };
         /**
@@ -22205,20 +22074,65 @@ var BABYLON;
             this.getScene().sortLightsByPriority();
         };
         //lightmapMode Consts
-        Light._LIGHTMAP_DEFAULT = 0;
-        Light._LIGHTMAP_SPECULAR = 1;
-        Light._LIGHTMAP_SHADOWSONLY = 2;
+        /**
+         * If every light affecting the material is in this lightmapMode,
+         * material.lightmapTexture adds or multiplies
+         * (depends on material.useLightmapAsShadowmap)
+         * after every other light calculations.
+         */
+        Light.LIGHTMAP_DEFAULT = 0;
+        /**
+         * material.lightmapTexture as only diffuse lighting from this light
+         * adds only specular lighting from this light
+         * adds dynamic shadows
+         */
+        Light.LIGHTMAP_SPECULAR = 1;
+        /**
+         * material.lightmapTexture as only lighting
+         * no light calculation from this light
+         * only adds dynamic shadows from this light
+         */
+        Light.LIGHTMAP_SHADOWSONLY = 2;
         // Intensity Mode Consts
-        Light._INTENSITYMODE_AUTOMATIC = 0;
-        Light._INTENSITYMODE_LUMINOUSPOWER = 1;
-        Light._INTENSITYMODE_LUMINOUSINTENSITY = 2;
-        Light._INTENSITYMODE_ILLUMINANCE = 3;
-        Light._INTENSITYMODE_LUMINANCE = 4;
+        /**
+         * Each light type uses the default quantity according to its type:
+         *      point/spot lights use luminous intensity
+         *      directional lights use illuminance
+         */
+        Light.INTENSITYMODE_AUTOMATIC = 0;
+        /**
+         * lumen (lm)
+         */
+        Light.INTENSITYMODE_LUMINOUSPOWER = 1;
+        /**
+         * candela (lm/sr)
+         */
+        Light.INTENSITYMODE_LUMINOUSINTENSITY = 2;
+        /**
+         * lux (lm/m^2)
+         */
+        Light.INTENSITYMODE_ILLUMINANCE = 3;
+        /**
+         * nit (cd/m^2)
+         */
+        Light.INTENSITYMODE_LUMINANCE = 4;
         // Light types ids const.
-        Light._LIGHTTYPEID_POINTLIGHT = 0;
-        Light._LIGHTTYPEID_DIRECTIONALLIGHT = 1;
-        Light._LIGHTTYPEID_SPOTLIGHT = 2;
-        Light._LIGHTTYPEID_HEMISPHERICLIGHT = 3;
+        /**
+         * Light type const id of the point light.
+         */
+        Light.LIGHTTYPEID_POINTLIGHT = 0;
+        /**
+         * Light type const id of the directional light.
+         */
+        Light.LIGHTTYPEID_DIRECTIONALLIGHT = 1;
+        /**
+         * Light type const id of the spot light.
+         */
+        Light.LIGHTTYPEID_SPOTLIGHT = 2;
+        /**
+         * Light type const id of the hemispheric light.
+         */
+        Light.LIGHTTYPEID_HEMISPHERICLIGHT = 3;
         __decorate([
             BABYLON.serializeAsColor3()
         ], Light.prototype, "diffuse", void 0);
@@ -28929,7 +28843,8 @@ var BABYLON;
         };
         /**
          * Creates a default light for the scene.
-         * @param replace Whether to replace the existing lights in the scene.
+         * @see http://doc.babylonjs.com/How_To/Fast_Build#create-default-light
+         * @param replace has the default false, when true replaces the existing lights in the scene with a hemispheric light
          */
         Scene.prototype.createDefaultLight = function (replace) {
             if (replace === void 0) { replace = false; }
@@ -28948,9 +28863,10 @@ var BABYLON;
         };
         /**
          * Creates a default camera for the scene.
-         * @param createArcRotateCamera Whether to create an arc rotate or a free camera.
-         * @param replace Whether to replace the existing active camera in the scene.
-         * @param attachCameraControls Whether to attach camera controls to the canvas.
+         * @see http://doc.babylonjs.com/How_To/Fast_Build#create-default-camera
+         * @param createArcRotateCamera has the default false which creates a free camera, when true creates an arc rotate camera
+         * @param replace has default false, when true replaces the active camera in the scene
+         * @param attachCameraControls has default false, when true attaches camera controls to the canvas.
          */
         Scene.prototype.createDefaultCamera = function (createArcRotateCamera, replace, attachCameraControls) {
             if (createArcRotateCamera === void 0) { createArcRotateCamera = false; }
@@ -28997,10 +28913,11 @@ var BABYLON;
             }
         };
         /**
-         * Creates a default camera and a default light
-         * @param createArcRotateCamera defines that the camera will be an ArcRotateCamera
-         * @param replace defines if the camera and/or light will replace the existing ones
-         * @param attachCameraControls defines if attachControl will be called on the new camera
+         * Creates a default camera and a default light.
+         * @see http://doc.babylonjs.com/how_to/Fast_Build#create-default-camera-or-light
+         * @param createArcRotateCamera has the default false which creates a free camera, when true creates an arc rotate camera
+         * @param replace has the default false, when true replaces the active camera/light in the scene
+         * @param attachCameraControls has the default false, when true attaches camera controls to the canvas.
          */
         Scene.prototype.createDefaultCameraOrLight = function (createArcRotateCamera, replace, attachCameraControls) {
             if (createArcRotateCamera === void 0) { createArcRotateCamera = false; }
@@ -29011,12 +28928,12 @@ var BABYLON;
         };
         /**
          * Creates a new sky box
-         * @see http://doc.babylonjs.com/babylon101/environment#skybox
+         * @see http://doc.babylonjs.com/how_to/Fast_Build#create-default-skybox
          * @param environmentTexture defines the texture to use as environment texture
-         * @param pbr defines if PBRMaterial must be used instead of StandardMaterial
+         * @param pbr has default false which requires the StandardMaterial to be used, when true PBRMaterial must be used
          * @param scale defines the overall scale of the skybox
-         * @param blur defines if blurring must be applied to the environment texture (works only with pbr === true)
-         * @param setGlobalEnvTexture defines a boolean indicating that scene.environmentTexture must match the current skybox texture (true by default)
+         * @param blur is only available when pbr is true, default is 0, no blur, maximum value is 1
+         * @param setGlobalEnvTexture has default true indicating that scene.environmentTexture must match the current skybox texture
          * @returns a new mesh holding the sky box
          */
         Scene.prototype.createDefaultSkybox = function (environmentTexture, pbr, scale, blur, setGlobalEnvTexture) {
@@ -29063,7 +28980,7 @@ var BABYLON;
         };
         /**
          * Creates a new environment
-         * @see http://doc.babylonjs.com/babylon101/environment#skybox
+         * @see http://doc.babylonjs.com/How_To/Fast_Build#create-default-environment
          * @param options defines the options you can use to configure the environment
          * @returns the new EnvironmentHelper
          */
@@ -41316,22 +41233,7 @@ var BABYLON;
                     defines["HEMILIGHT" + lightIndex] = false;
                     defines["POINTLIGHT" + lightIndex] = false;
                     defines["DIRLIGHT" + lightIndex] = false;
-                    var type;
-                    if (light.getTypeID() === BABYLON.Light.LIGHTTYPEID_SPOTLIGHT) {
-                        type = "SPOTLIGHT" + lightIndex;
-                        var spotLight = light;
-                        defines["PROJECTEDLIGHTTEXTURE" + lightIndex] = spotLight.projectionTexture ? true : false;
-                    }
-                    else if (light.getTypeID() === BABYLON.Light.LIGHTTYPEID_HEMISPHERICLIGHT) {
-                        type = "HEMILIGHT" + lightIndex;
-                    }
-                    else if (light.getTypeID() === BABYLON.Light.LIGHTTYPEID_POINTLIGHT) {
-                        type = "POINTLIGHT" + lightIndex;
-                    }
-                    else {
-                        type = "DIRLIGHT" + lightIndex;
-                    }
-                    defines[type] = true;
+                    light.prepareLightSpecificDefines(defines, lightIndex);
                     // Specular
                     if (specularSupported && !light.specular.equalsFloats(0, 0, 0)) {
                         specularEnabled = true;
@@ -48257,6 +48159,9 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
+    BABYLON.Node.AddNodeConstructor("Light_Type_3", function (name, scene) {
+        return function () { return new HemisphericLight(name, BABYLON.Vector3.Zero(), scene); };
+    });
     /**
      * The HemisphericLight simulates the ambient environment light,
      * so the passed direction is the light reflection direction, not the incoming direction.
@@ -48343,6 +48248,14 @@ var BABYLON;
         HemisphericLight.prototype.getTypeID = function () {
             return BABYLON.Light.LIGHTTYPEID_HEMISPHERICLIGHT;
         };
+        /**
+         * Prepares the list of defines specific to the light type.
+         * @param defines the list of defines
+         * @param lightIndex defines the index of the light for the effect
+         */
+        HemisphericLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {
+            defines["HEMILIGHT" + lightIndex] = true;
+        };
         __decorate([
             BABYLON.serializeAsColor3()
         ], HemisphericLight.prototype, "groundColor", void 0);
@@ -48603,6 +48516,9 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
+    BABYLON.Node.AddNodeConstructor("Light_Type_0", function (name, scene) {
+        return function () { return new PointLight(name, BABYLON.Vector3.Zero(), scene); };
+    });
     /**
      * A point light is a light defined by an unique point in world space.
      * The light is emitted in every direction from this point.
@@ -48758,6 +48674,14 @@ var BABYLON;
             this._uniformBuffer.updateFloat4("vLightData", this.position.x, this.position.y, this.position.z, 0, lightIndex);
             return this;
         };
+        /**
+         * Prepares the list of defines specific to the light type.
+         * @param defines the list of defines
+         * @param lightIndex defines the index of the light for the effect
+         */
+        PointLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {
+            defines["POINTLIGHT" + lightIndex] = true;
+        };
         __decorate([
             BABYLON.serialize()
         ], PointLight.prototype, "shadowAngle", null);
@@ -48776,6 +48700,9 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
+    BABYLON.Node.AddNodeConstructor("Light_Type_1", function (name, scene) {
+        return function () { return new DirectionalLight(name, BABYLON.Vector3.Zero(), scene); };
+    });
     /**
      * A directional light is defined by a direction (what a surprise!).
      * The light is emitted from everywhere in the specified direction, and has an infinite range.
@@ -48970,6 +48897,14 @@ var BABYLON;
         DirectionalLight.prototype.getDepthMaxZ = function (activeCamera) {
             return 1;
         };
+        /**
+         * Prepares the list of defines specific to the light type.
+         * @param defines the list of defines
+         * @param lightIndex defines the index of the light for the effect
+         */
+        DirectionalLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {
+            defines["DIRLIGHT" + lightIndex] = true;
+        };
         __decorate([
             BABYLON.serialize()
         ], DirectionalLight.prototype, "shadowFrustumSize", null);
@@ -48994,6 +48929,9 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
+    BABYLON.Node.AddNodeConstructor("Light_Type_2", function (name, scene) {
+        return function () { return new SpotLight(name, BABYLON.Vector3.Zero(), BABYLON.Vector3.Zero(), 0, 0, scene); };
+    });
     /**
      * A spot light is defined by a position, a direction, an angle, and an exponent.
      * These values define a cone of light starting from the position, emitting toward the direction.
@@ -49262,6 +49200,15 @@ var BABYLON;
                 this._projectionTexture.dispose();
             }
         };
+        /**
+         * Prepares the list of defines specific to the light type.
+         * @param defines the list of defines
+         * @param lightIndex defines the index of the light for the effect
+         */
+        SpotLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {
+            defines["SPOTLIGHT" + lightIndex] = true;
+            defines["PROJECTEDLIGHTTEXTURE" + lightIndex] = this.projectionTexture ? true : false;
+        };
         __decorate([
             BABYLON.serialize()
         ], SpotLight.prototype, "angle", null);
@@ -67651,7 +67598,6 @@ var BABYLON;
          * @returns The parsed shadow generator
          */
         ShadowGenerator.Parse = function (parsedShadowGenerator, scene) {
-            //casting to point light, as light is missing the position attr and typescript complains.
             var light = scene.getLightByID(parsedShadowGenerator.lightId);
             var shadowGenerator = new ShadowGenerator(parsedShadowGenerator.mapSize, light);
             var shadowMap = shadowGenerator.getShadowMap();
@@ -88953,8 +88899,8 @@ var BABYLON;
     var DebugLayer = /** @class */ (function () {
         function DebugLayer(scene) {
             this.BJSINSPECTOR = typeof INSPECTOR !== 'undefined' ? INSPECTOR : undefined;
+            this.onPropertyChangedObservable = new BABYLON.Observable();
             this._scene = scene;
-            // load inspector using require, if it doesn't exist on the global namespace.
         }
         /** Creates the inspector window. */
         DebugLayer.prototype._createInspector = function (config) {
@@ -88965,7 +88911,7 @@ var BABYLON;
             if (!this._inspector) {
                 this.BJSINSPECTOR = this.BJSINSPECTOR || typeof INSPECTOR !== 'undefined' ? INSPECTOR : undefined;
                 this._inspector = new this.BJSINSPECTOR.Inspector(this._scene, popup, initialTab, parentElement, config.newColors);
-            } // else nothing to do,; instance is already existing
+            } // else nothing to do as instance is already created
         };
         DebugLayer.prototype.isVisible = function () {
             if (!this._inspector) {
@@ -89015,7 +88961,6 @@ var BABYLON;
             else {
                 // Otherwise creates the inspector
                 this._createInspector(config);
-                this.onPropertyChangedObservable = new BABYLON.Observable();
             }
         };
         /**
@@ -96057,6 +96002,9 @@ var BABYLON;
                     return false;
                 }
                 var mesh = abstractMesh;
+                if (mesh.isDisposed()) {
+                    return false;
+                }
                 if (!mesh.isVisible || !mesh.isEnabled()) {
                     return false;
                 }

+ 131 - 183
dist/preview release/babylon.no-module.max.js

@@ -15896,6 +15896,9 @@ var BABYLON;
                 }
                 else {
                     texture.generateMipMaps = !noMipmap;
+                    if (type === Engine.TEXTURETYPE_FLOAT && !_this._caps.textureFloatLinearFiltering) {
+                        texture.generateMipMaps = false;
+                    }
                     _this.updateRawCubeTexture(texture, faceDataArrays, format, type, invertY);
                 }
                 texture.isReady = true;
@@ -21511,135 +21514,6 @@ var BABYLON;
             _this._resyncMeshes();
             return _this;
         }
-        Object.defineProperty(Light, "LIGHTMAP_DEFAULT", {
-            /**
-             * If every light affecting the material is in this lightmapMode,
-             * material.lightmapTexture adds or multiplies
-             * (depends on material.useLightmapAsShadowmap)
-             * after every other light calculations.
-             */
-            get: function () {
-                return Light._LIGHTMAP_DEFAULT;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "LIGHTMAP_SPECULAR", {
-            /**
-             * material.lightmapTexture as only diffuse lighting from this light
-             * adds only specular lighting from this light
-             * adds dynamic shadows
-             */
-            get: function () {
-                return Light._LIGHTMAP_SPECULAR;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "LIGHTMAP_SHADOWSONLY", {
-            /**
-             * material.lightmapTexture as only lighting
-             * no light calculation from this light
-             * only adds dynamic shadows from this light
-             */
-            get: function () {
-                return Light._LIGHTMAP_SHADOWSONLY;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "INTENSITYMODE_AUTOMATIC", {
-            /**
-             * Each light type uses the default quantity according to its type:
-             *      point/spot lights use luminous intensity
-             *      directional lights use illuminance
-             */
-            get: function () {
-                return Light._INTENSITYMODE_AUTOMATIC;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "INTENSITYMODE_LUMINOUSPOWER", {
-            /**
-             * lumen (lm)
-             */
-            get: function () {
-                return Light._INTENSITYMODE_LUMINOUSPOWER;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "INTENSITYMODE_LUMINOUSINTENSITY", {
-            /**
-             * candela (lm/sr)
-             */
-            get: function () {
-                return Light._INTENSITYMODE_LUMINOUSINTENSITY;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "INTENSITYMODE_ILLUMINANCE", {
-            /**
-             * lux (lm/m^2)
-             */
-            get: function () {
-                return Light._INTENSITYMODE_ILLUMINANCE;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "INTENSITYMODE_LUMINANCE", {
-            /**
-             * nit (cd/m^2)
-             */
-            get: function () {
-                return Light._INTENSITYMODE_LUMINANCE;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "LIGHTTYPEID_POINTLIGHT", {
-            /**
-             * Light type const id of the point light.
-             */
-            get: function () {
-                return Light._LIGHTTYPEID_POINTLIGHT;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "LIGHTTYPEID_DIRECTIONALLIGHT", {
-            /**
-             * Light type const id of the directional light.
-             */
-            get: function () {
-                return Light._LIGHTTYPEID_DIRECTIONALLIGHT;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "LIGHTTYPEID_SPOTLIGHT", {
-            /**
-             * Light type const id of the spot light.
-             */
-            get: function () {
-                return Light._LIGHTTYPEID_SPOTLIGHT;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "LIGHTTYPEID_HEMISPHERICLIGHT", {
-            /**
-             * Light type const id of the hemispheric light.
-             */
-            get: function () {
-                return Light._LIGHTTYPEID_HEMISPHERICLIGHT;
-            },
-            enumerable: true,
-            configurable: true
-        });
         Object.defineProperty(Light.prototype, "intensityMode", {
             /**
              * Gets the photometric scale used to interpret the intensity.
@@ -21983,16 +21857,11 @@ var BABYLON;
          * @returns the constructor function
          */
         Light.GetConstructorFromName = function (type, name, scene) {
-            switch (type) {
-                case 0:
-                    return function () { return new BABYLON.PointLight(name, BABYLON.Vector3.Zero(), scene); };
-                case 1:
-                    return function () { return new BABYLON.DirectionalLight(name, BABYLON.Vector3.Zero(), scene); };
-                case 2:
-                    return function () { return new BABYLON.SpotLight(name, BABYLON.Vector3.Zero(), BABYLON.Vector3.Zero(), 0, 0, scene); };
-                case 3:
-                    return function () { return new BABYLON.HemisphericLight(name, BABYLON.Vector3.Zero(), scene); };
+            var constructorFunc = BABYLON.Node.Construct("Light_Type_" + type, name, scene);
+            if (constructorFunc) {
+                return constructorFunc;
             }
+            // Default to no light for none present once.
             return null;
         };
         /**
@@ -22172,20 +22041,65 @@ var BABYLON;
             this.getScene().sortLightsByPriority();
         };
         //lightmapMode Consts
-        Light._LIGHTMAP_DEFAULT = 0;
-        Light._LIGHTMAP_SPECULAR = 1;
-        Light._LIGHTMAP_SHADOWSONLY = 2;
+        /**
+         * If every light affecting the material is in this lightmapMode,
+         * material.lightmapTexture adds or multiplies
+         * (depends on material.useLightmapAsShadowmap)
+         * after every other light calculations.
+         */
+        Light.LIGHTMAP_DEFAULT = 0;
+        /**
+         * material.lightmapTexture as only diffuse lighting from this light
+         * adds only specular lighting from this light
+         * adds dynamic shadows
+         */
+        Light.LIGHTMAP_SPECULAR = 1;
+        /**
+         * material.lightmapTexture as only lighting
+         * no light calculation from this light
+         * only adds dynamic shadows from this light
+         */
+        Light.LIGHTMAP_SHADOWSONLY = 2;
         // Intensity Mode Consts
-        Light._INTENSITYMODE_AUTOMATIC = 0;
-        Light._INTENSITYMODE_LUMINOUSPOWER = 1;
-        Light._INTENSITYMODE_LUMINOUSINTENSITY = 2;
-        Light._INTENSITYMODE_ILLUMINANCE = 3;
-        Light._INTENSITYMODE_LUMINANCE = 4;
+        /**
+         * Each light type uses the default quantity according to its type:
+         *      point/spot lights use luminous intensity
+         *      directional lights use illuminance
+         */
+        Light.INTENSITYMODE_AUTOMATIC = 0;
+        /**
+         * lumen (lm)
+         */
+        Light.INTENSITYMODE_LUMINOUSPOWER = 1;
+        /**
+         * candela (lm/sr)
+         */
+        Light.INTENSITYMODE_LUMINOUSINTENSITY = 2;
+        /**
+         * lux (lm/m^2)
+         */
+        Light.INTENSITYMODE_ILLUMINANCE = 3;
+        /**
+         * nit (cd/m^2)
+         */
+        Light.INTENSITYMODE_LUMINANCE = 4;
         // Light types ids const.
-        Light._LIGHTTYPEID_POINTLIGHT = 0;
-        Light._LIGHTTYPEID_DIRECTIONALLIGHT = 1;
-        Light._LIGHTTYPEID_SPOTLIGHT = 2;
-        Light._LIGHTTYPEID_HEMISPHERICLIGHT = 3;
+        /**
+         * Light type const id of the point light.
+         */
+        Light.LIGHTTYPEID_POINTLIGHT = 0;
+        /**
+         * Light type const id of the directional light.
+         */
+        Light.LIGHTTYPEID_DIRECTIONALLIGHT = 1;
+        /**
+         * Light type const id of the spot light.
+         */
+        Light.LIGHTTYPEID_SPOTLIGHT = 2;
+        /**
+         * Light type const id of the hemispheric light.
+         */
+        Light.LIGHTTYPEID_HEMISPHERICLIGHT = 3;
         __decorate([
             BABYLON.serializeAsColor3()
         ], Light.prototype, "diffuse", void 0);
@@ -28896,7 +28810,8 @@ var BABYLON;
         };
         /**
          * Creates a default light for the scene.
-         * @param replace Whether to replace the existing lights in the scene.
+         * @see http://doc.babylonjs.com/How_To/Fast_Build#create-default-light
+         * @param replace has the default false, when true replaces the existing lights in the scene with a hemispheric light
          */
         Scene.prototype.createDefaultLight = function (replace) {
             if (replace === void 0) { replace = false; }
@@ -28915,9 +28830,10 @@ var BABYLON;
         };
         /**
          * Creates a default camera for the scene.
-         * @param createArcRotateCamera Whether to create an arc rotate or a free camera.
-         * @param replace Whether to replace the existing active camera in the scene.
-         * @param attachCameraControls Whether to attach camera controls to the canvas.
+         * @see http://doc.babylonjs.com/How_To/Fast_Build#create-default-camera
+         * @param createArcRotateCamera has the default false which creates a free camera, when true creates an arc rotate camera
+         * @param replace has default false, when true replaces the active camera in the scene
+         * @param attachCameraControls has default false, when true attaches camera controls to the canvas.
          */
         Scene.prototype.createDefaultCamera = function (createArcRotateCamera, replace, attachCameraControls) {
             if (createArcRotateCamera === void 0) { createArcRotateCamera = false; }
@@ -28964,10 +28880,11 @@ var BABYLON;
             }
         };
         /**
-         * Creates a default camera and a default light
-         * @param createArcRotateCamera defines that the camera will be an ArcRotateCamera
-         * @param replace defines if the camera and/or light will replace the existing ones
-         * @param attachCameraControls defines if attachControl will be called on the new camera
+         * Creates a default camera and a default light.
+         * @see http://doc.babylonjs.com/how_to/Fast_Build#create-default-camera-or-light
+         * @param createArcRotateCamera has the default false which creates a free camera, when true creates an arc rotate camera
+         * @param replace has the default false, when true replaces the active camera/light in the scene
+         * @param attachCameraControls has the default false, when true attaches camera controls to the canvas.
          */
         Scene.prototype.createDefaultCameraOrLight = function (createArcRotateCamera, replace, attachCameraControls) {
             if (createArcRotateCamera === void 0) { createArcRotateCamera = false; }
@@ -28978,12 +28895,12 @@ var BABYLON;
         };
         /**
          * Creates a new sky box
-         * @see http://doc.babylonjs.com/babylon101/environment#skybox
+         * @see http://doc.babylonjs.com/how_to/Fast_Build#create-default-skybox
          * @param environmentTexture defines the texture to use as environment texture
-         * @param pbr defines if PBRMaterial must be used instead of StandardMaterial
+         * @param pbr has default false which requires the StandardMaterial to be used, when true PBRMaterial must be used
          * @param scale defines the overall scale of the skybox
-         * @param blur defines if blurring must be applied to the environment texture (works only with pbr === true)
-         * @param setGlobalEnvTexture defines a boolean indicating that scene.environmentTexture must match the current skybox texture (true by default)
+         * @param blur is only available when pbr is true, default is 0, no blur, maximum value is 1
+         * @param setGlobalEnvTexture has default true indicating that scene.environmentTexture must match the current skybox texture
          * @returns a new mesh holding the sky box
          */
         Scene.prototype.createDefaultSkybox = function (environmentTexture, pbr, scale, blur, setGlobalEnvTexture) {
@@ -29030,7 +28947,7 @@ var BABYLON;
         };
         /**
          * Creates a new environment
-         * @see http://doc.babylonjs.com/babylon101/environment#skybox
+         * @see http://doc.babylonjs.com/How_To/Fast_Build#create-default-environment
          * @param options defines the options you can use to configure the environment
          * @returns the new EnvironmentHelper
          */
@@ -41283,22 +41200,7 @@ var BABYLON;
                     defines["HEMILIGHT" + lightIndex] = false;
                     defines["POINTLIGHT" + lightIndex] = false;
                     defines["DIRLIGHT" + lightIndex] = false;
-                    var type;
-                    if (light.getTypeID() === BABYLON.Light.LIGHTTYPEID_SPOTLIGHT) {
-                        type = "SPOTLIGHT" + lightIndex;
-                        var spotLight = light;
-                        defines["PROJECTEDLIGHTTEXTURE" + lightIndex] = spotLight.projectionTexture ? true : false;
-                    }
-                    else if (light.getTypeID() === BABYLON.Light.LIGHTTYPEID_HEMISPHERICLIGHT) {
-                        type = "HEMILIGHT" + lightIndex;
-                    }
-                    else if (light.getTypeID() === BABYLON.Light.LIGHTTYPEID_POINTLIGHT) {
-                        type = "POINTLIGHT" + lightIndex;
-                    }
-                    else {
-                        type = "DIRLIGHT" + lightIndex;
-                    }
-                    defines[type] = true;
+                    light.prepareLightSpecificDefines(defines, lightIndex);
                     // Specular
                     if (specularSupported && !light.specular.equalsFloats(0, 0, 0)) {
                         specularEnabled = true;
@@ -48224,6 +48126,9 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
+    BABYLON.Node.AddNodeConstructor("Light_Type_3", function (name, scene) {
+        return function () { return new HemisphericLight(name, BABYLON.Vector3.Zero(), scene); };
+    });
     /**
      * The HemisphericLight simulates the ambient environment light,
      * so the passed direction is the light reflection direction, not the incoming direction.
@@ -48310,6 +48215,14 @@ var BABYLON;
         HemisphericLight.prototype.getTypeID = function () {
             return BABYLON.Light.LIGHTTYPEID_HEMISPHERICLIGHT;
         };
+        /**
+         * Prepares the list of defines specific to the light type.
+         * @param defines the list of defines
+         * @param lightIndex defines the index of the light for the effect
+         */
+        HemisphericLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {
+            defines["HEMILIGHT" + lightIndex] = true;
+        };
         __decorate([
             BABYLON.serializeAsColor3()
         ], HemisphericLight.prototype, "groundColor", void 0);
@@ -48570,6 +48483,9 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
+    BABYLON.Node.AddNodeConstructor("Light_Type_0", function (name, scene) {
+        return function () { return new PointLight(name, BABYLON.Vector3.Zero(), scene); };
+    });
     /**
      * A point light is a light defined by an unique point in world space.
      * The light is emitted in every direction from this point.
@@ -48725,6 +48641,14 @@ var BABYLON;
             this._uniformBuffer.updateFloat4("vLightData", this.position.x, this.position.y, this.position.z, 0, lightIndex);
             return this;
         };
+        /**
+         * Prepares the list of defines specific to the light type.
+         * @param defines the list of defines
+         * @param lightIndex defines the index of the light for the effect
+         */
+        PointLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {
+            defines["POINTLIGHT" + lightIndex] = true;
+        };
         __decorate([
             BABYLON.serialize()
         ], PointLight.prototype, "shadowAngle", null);
@@ -48743,6 +48667,9 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
+    BABYLON.Node.AddNodeConstructor("Light_Type_1", function (name, scene) {
+        return function () { return new DirectionalLight(name, BABYLON.Vector3.Zero(), scene); };
+    });
     /**
      * A directional light is defined by a direction (what a surprise!).
      * The light is emitted from everywhere in the specified direction, and has an infinite range.
@@ -48937,6 +48864,14 @@ var BABYLON;
         DirectionalLight.prototype.getDepthMaxZ = function (activeCamera) {
             return 1;
         };
+        /**
+         * Prepares the list of defines specific to the light type.
+         * @param defines the list of defines
+         * @param lightIndex defines the index of the light for the effect
+         */
+        DirectionalLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {
+            defines["DIRLIGHT" + lightIndex] = true;
+        };
         __decorate([
             BABYLON.serialize()
         ], DirectionalLight.prototype, "shadowFrustumSize", null);
@@ -48961,6 +48896,9 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
+    BABYLON.Node.AddNodeConstructor("Light_Type_2", function (name, scene) {
+        return function () { return new SpotLight(name, BABYLON.Vector3.Zero(), BABYLON.Vector3.Zero(), 0, 0, scene); };
+    });
     /**
      * A spot light is defined by a position, a direction, an angle, and an exponent.
      * These values define a cone of light starting from the position, emitting toward the direction.
@@ -49229,6 +49167,15 @@ var BABYLON;
                 this._projectionTexture.dispose();
             }
         };
+        /**
+         * Prepares the list of defines specific to the light type.
+         * @param defines the list of defines
+         * @param lightIndex defines the index of the light for the effect
+         */
+        SpotLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {
+            defines["SPOTLIGHT" + lightIndex] = true;
+            defines["PROJECTEDLIGHTTEXTURE" + lightIndex] = this.projectionTexture ? true : false;
+        };
         __decorate([
             BABYLON.serialize()
         ], SpotLight.prototype, "angle", null);
@@ -67618,7 +67565,6 @@ var BABYLON;
          * @returns The parsed shadow generator
          */
         ShadowGenerator.Parse = function (parsedShadowGenerator, scene) {
-            //casting to point light, as light is missing the position attr and typescript complains.
             var light = scene.getLightByID(parsedShadowGenerator.lightId);
             var shadowGenerator = new ShadowGenerator(parsedShadowGenerator.mapSize, light);
             var shadowMap = shadowGenerator.getShadowMap();
@@ -88920,8 +88866,8 @@ var BABYLON;
     var DebugLayer = /** @class */ (function () {
         function DebugLayer(scene) {
             this.BJSINSPECTOR = typeof INSPECTOR !== 'undefined' ? INSPECTOR : undefined;
+            this.onPropertyChangedObservable = new BABYLON.Observable();
             this._scene = scene;
-            // load inspector using require, if it doesn't exist on the global namespace.
         }
         /** Creates the inspector window. */
         DebugLayer.prototype._createInspector = function (config) {
@@ -88932,7 +88878,7 @@ var BABYLON;
             if (!this._inspector) {
                 this.BJSINSPECTOR = this.BJSINSPECTOR || typeof INSPECTOR !== 'undefined' ? INSPECTOR : undefined;
                 this._inspector = new this.BJSINSPECTOR.Inspector(this._scene, popup, initialTab, parentElement, config.newColors);
-            } // else nothing to do,; instance is already existing
+            } // else nothing to do as instance is already created
         };
         DebugLayer.prototype.isVisible = function () {
             if (!this._inspector) {
@@ -88982,7 +88928,6 @@ var BABYLON;
             else {
                 // Otherwise creates the inspector
                 this._createInspector(config);
-                this.onPropertyChangedObservable = new BABYLON.Observable();
             }
         };
         /**
@@ -96024,6 +95969,9 @@ var BABYLON;
                     return false;
                 }
                 var mesh = abstractMesh;
+                if (mesh.isDisposed()) {
+                    return false;
+                }
                 if (!mesh.isVisible || !mesh.isEnabled()) {
                     return false;
                 }

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


+ 131 - 183
dist/preview release/es6.js

@@ -15896,6 +15896,9 @@ var BABYLON;
                 }
                 else {
                     texture.generateMipMaps = !noMipmap;
+                    if (type === Engine.TEXTURETYPE_FLOAT && !_this._caps.textureFloatLinearFiltering) {
+                        texture.generateMipMaps = false;
+                    }
                     _this.updateRawCubeTexture(texture, faceDataArrays, format, type, invertY);
                 }
                 texture.isReady = true;
@@ -21511,135 +21514,6 @@ var BABYLON;
             _this._resyncMeshes();
             return _this;
         }
-        Object.defineProperty(Light, "LIGHTMAP_DEFAULT", {
-            /**
-             * If every light affecting the material is in this lightmapMode,
-             * material.lightmapTexture adds or multiplies
-             * (depends on material.useLightmapAsShadowmap)
-             * after every other light calculations.
-             */
-            get: function () {
-                return Light._LIGHTMAP_DEFAULT;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "LIGHTMAP_SPECULAR", {
-            /**
-             * material.lightmapTexture as only diffuse lighting from this light
-             * adds only specular lighting from this light
-             * adds dynamic shadows
-             */
-            get: function () {
-                return Light._LIGHTMAP_SPECULAR;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "LIGHTMAP_SHADOWSONLY", {
-            /**
-             * material.lightmapTexture as only lighting
-             * no light calculation from this light
-             * only adds dynamic shadows from this light
-             */
-            get: function () {
-                return Light._LIGHTMAP_SHADOWSONLY;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "INTENSITYMODE_AUTOMATIC", {
-            /**
-             * Each light type uses the default quantity according to its type:
-             *      point/spot lights use luminous intensity
-             *      directional lights use illuminance
-             */
-            get: function () {
-                return Light._INTENSITYMODE_AUTOMATIC;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "INTENSITYMODE_LUMINOUSPOWER", {
-            /**
-             * lumen (lm)
-             */
-            get: function () {
-                return Light._INTENSITYMODE_LUMINOUSPOWER;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "INTENSITYMODE_LUMINOUSINTENSITY", {
-            /**
-             * candela (lm/sr)
-             */
-            get: function () {
-                return Light._INTENSITYMODE_LUMINOUSINTENSITY;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "INTENSITYMODE_ILLUMINANCE", {
-            /**
-             * lux (lm/m^2)
-             */
-            get: function () {
-                return Light._INTENSITYMODE_ILLUMINANCE;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "INTENSITYMODE_LUMINANCE", {
-            /**
-             * nit (cd/m^2)
-             */
-            get: function () {
-                return Light._INTENSITYMODE_LUMINANCE;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "LIGHTTYPEID_POINTLIGHT", {
-            /**
-             * Light type const id of the point light.
-             */
-            get: function () {
-                return Light._LIGHTTYPEID_POINTLIGHT;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "LIGHTTYPEID_DIRECTIONALLIGHT", {
-            /**
-             * Light type const id of the directional light.
-             */
-            get: function () {
-                return Light._LIGHTTYPEID_DIRECTIONALLIGHT;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "LIGHTTYPEID_SPOTLIGHT", {
-            /**
-             * Light type const id of the spot light.
-             */
-            get: function () {
-                return Light._LIGHTTYPEID_SPOTLIGHT;
-            },
-            enumerable: true,
-            configurable: true
-        });
-        Object.defineProperty(Light, "LIGHTTYPEID_HEMISPHERICLIGHT", {
-            /**
-             * Light type const id of the hemispheric light.
-             */
-            get: function () {
-                return Light._LIGHTTYPEID_HEMISPHERICLIGHT;
-            },
-            enumerable: true,
-            configurable: true
-        });
         Object.defineProperty(Light.prototype, "intensityMode", {
             /**
              * Gets the photometric scale used to interpret the intensity.
@@ -21983,16 +21857,11 @@ var BABYLON;
          * @returns the constructor function
          */
         Light.GetConstructorFromName = function (type, name, scene) {
-            switch (type) {
-                case 0:
-                    return function () { return new BABYLON.PointLight(name, BABYLON.Vector3.Zero(), scene); };
-                case 1:
-                    return function () { return new BABYLON.DirectionalLight(name, BABYLON.Vector3.Zero(), scene); };
-                case 2:
-                    return function () { return new BABYLON.SpotLight(name, BABYLON.Vector3.Zero(), BABYLON.Vector3.Zero(), 0, 0, scene); };
-                case 3:
-                    return function () { return new BABYLON.HemisphericLight(name, BABYLON.Vector3.Zero(), scene); };
+            var constructorFunc = BABYLON.Node.Construct("Light_Type_" + type, name, scene);
+            if (constructorFunc) {
+                return constructorFunc;
             }
+            // Default to no light for none present once.
             return null;
         };
         /**
@@ -22172,20 +22041,65 @@ var BABYLON;
             this.getScene().sortLightsByPriority();
         };
         //lightmapMode Consts
-        Light._LIGHTMAP_DEFAULT = 0;
-        Light._LIGHTMAP_SPECULAR = 1;
-        Light._LIGHTMAP_SHADOWSONLY = 2;
+        /**
+         * If every light affecting the material is in this lightmapMode,
+         * material.lightmapTexture adds or multiplies
+         * (depends on material.useLightmapAsShadowmap)
+         * after every other light calculations.
+         */
+        Light.LIGHTMAP_DEFAULT = 0;
+        /**
+         * material.lightmapTexture as only diffuse lighting from this light
+         * adds only specular lighting from this light
+         * adds dynamic shadows
+         */
+        Light.LIGHTMAP_SPECULAR = 1;
+        /**
+         * material.lightmapTexture as only lighting
+         * no light calculation from this light
+         * only adds dynamic shadows from this light
+         */
+        Light.LIGHTMAP_SHADOWSONLY = 2;
         // Intensity Mode Consts
-        Light._INTENSITYMODE_AUTOMATIC = 0;
-        Light._INTENSITYMODE_LUMINOUSPOWER = 1;
-        Light._INTENSITYMODE_LUMINOUSINTENSITY = 2;
-        Light._INTENSITYMODE_ILLUMINANCE = 3;
-        Light._INTENSITYMODE_LUMINANCE = 4;
+        /**
+         * Each light type uses the default quantity according to its type:
+         *      point/spot lights use luminous intensity
+         *      directional lights use illuminance
+         */
+        Light.INTENSITYMODE_AUTOMATIC = 0;
+        /**
+         * lumen (lm)
+         */
+        Light.INTENSITYMODE_LUMINOUSPOWER = 1;
+        /**
+         * candela (lm/sr)
+         */
+        Light.INTENSITYMODE_LUMINOUSINTENSITY = 2;
+        /**
+         * lux (lm/m^2)
+         */
+        Light.INTENSITYMODE_ILLUMINANCE = 3;
+        /**
+         * nit (cd/m^2)
+         */
+        Light.INTENSITYMODE_LUMINANCE = 4;
         // Light types ids const.
-        Light._LIGHTTYPEID_POINTLIGHT = 0;
-        Light._LIGHTTYPEID_DIRECTIONALLIGHT = 1;
-        Light._LIGHTTYPEID_SPOTLIGHT = 2;
-        Light._LIGHTTYPEID_HEMISPHERICLIGHT = 3;
+        /**
+         * Light type const id of the point light.
+         */
+        Light.LIGHTTYPEID_POINTLIGHT = 0;
+        /**
+         * Light type const id of the directional light.
+         */
+        Light.LIGHTTYPEID_DIRECTIONALLIGHT = 1;
+        /**
+         * Light type const id of the spot light.
+         */
+        Light.LIGHTTYPEID_SPOTLIGHT = 2;
+        /**
+         * Light type const id of the hemispheric light.
+         */
+        Light.LIGHTTYPEID_HEMISPHERICLIGHT = 3;
         __decorate([
             BABYLON.serializeAsColor3()
         ], Light.prototype, "diffuse", void 0);
@@ -28896,7 +28810,8 @@ var BABYLON;
         };
         /**
          * Creates a default light for the scene.
-         * @param replace Whether to replace the existing lights in the scene.
+         * @see http://doc.babylonjs.com/How_To/Fast_Build#create-default-light
+         * @param replace has the default false, when true replaces the existing lights in the scene with a hemispheric light
          */
         Scene.prototype.createDefaultLight = function (replace) {
             if (replace === void 0) { replace = false; }
@@ -28915,9 +28830,10 @@ var BABYLON;
         };
         /**
          * Creates a default camera for the scene.
-         * @param createArcRotateCamera Whether to create an arc rotate or a free camera.
-         * @param replace Whether to replace the existing active camera in the scene.
-         * @param attachCameraControls Whether to attach camera controls to the canvas.
+         * @see http://doc.babylonjs.com/How_To/Fast_Build#create-default-camera
+         * @param createArcRotateCamera has the default false which creates a free camera, when true creates an arc rotate camera
+         * @param replace has default false, when true replaces the active camera in the scene
+         * @param attachCameraControls has default false, when true attaches camera controls to the canvas.
          */
         Scene.prototype.createDefaultCamera = function (createArcRotateCamera, replace, attachCameraControls) {
             if (createArcRotateCamera === void 0) { createArcRotateCamera = false; }
@@ -28964,10 +28880,11 @@ var BABYLON;
             }
         };
         /**
-         * Creates a default camera and a default light
-         * @param createArcRotateCamera defines that the camera will be an ArcRotateCamera
-         * @param replace defines if the camera and/or light will replace the existing ones
-         * @param attachCameraControls defines if attachControl will be called on the new camera
+         * Creates a default camera and a default light.
+         * @see http://doc.babylonjs.com/how_to/Fast_Build#create-default-camera-or-light
+         * @param createArcRotateCamera has the default false which creates a free camera, when true creates an arc rotate camera
+         * @param replace has the default false, when true replaces the active camera/light in the scene
+         * @param attachCameraControls has the default false, when true attaches camera controls to the canvas.
          */
         Scene.prototype.createDefaultCameraOrLight = function (createArcRotateCamera, replace, attachCameraControls) {
             if (createArcRotateCamera === void 0) { createArcRotateCamera = false; }
@@ -28978,12 +28895,12 @@ var BABYLON;
         };
         /**
          * Creates a new sky box
-         * @see http://doc.babylonjs.com/babylon101/environment#skybox
+         * @see http://doc.babylonjs.com/how_to/Fast_Build#create-default-skybox
          * @param environmentTexture defines the texture to use as environment texture
-         * @param pbr defines if PBRMaterial must be used instead of StandardMaterial
+         * @param pbr has default false which requires the StandardMaterial to be used, when true PBRMaterial must be used
          * @param scale defines the overall scale of the skybox
-         * @param blur defines if blurring must be applied to the environment texture (works only with pbr === true)
-         * @param setGlobalEnvTexture defines a boolean indicating that scene.environmentTexture must match the current skybox texture (true by default)
+         * @param blur is only available when pbr is true, default is 0, no blur, maximum value is 1
+         * @param setGlobalEnvTexture has default true indicating that scene.environmentTexture must match the current skybox texture
          * @returns a new mesh holding the sky box
          */
         Scene.prototype.createDefaultSkybox = function (environmentTexture, pbr, scale, blur, setGlobalEnvTexture) {
@@ -29030,7 +28947,7 @@ var BABYLON;
         };
         /**
          * Creates a new environment
-         * @see http://doc.babylonjs.com/babylon101/environment#skybox
+         * @see http://doc.babylonjs.com/How_To/Fast_Build#create-default-environment
          * @param options defines the options you can use to configure the environment
          * @returns the new EnvironmentHelper
          */
@@ -41283,22 +41200,7 @@ var BABYLON;
                     defines["HEMILIGHT" + lightIndex] = false;
                     defines["POINTLIGHT" + lightIndex] = false;
                     defines["DIRLIGHT" + lightIndex] = false;
-                    var type;
-                    if (light.getTypeID() === BABYLON.Light.LIGHTTYPEID_SPOTLIGHT) {
-                        type = "SPOTLIGHT" + lightIndex;
-                        var spotLight = light;
-                        defines["PROJECTEDLIGHTTEXTURE" + lightIndex] = spotLight.projectionTexture ? true : false;
-                    }
-                    else if (light.getTypeID() === BABYLON.Light.LIGHTTYPEID_HEMISPHERICLIGHT) {
-                        type = "HEMILIGHT" + lightIndex;
-                    }
-                    else if (light.getTypeID() === BABYLON.Light.LIGHTTYPEID_POINTLIGHT) {
-                        type = "POINTLIGHT" + lightIndex;
-                    }
-                    else {
-                        type = "DIRLIGHT" + lightIndex;
-                    }
-                    defines[type] = true;
+                    light.prepareLightSpecificDefines(defines, lightIndex);
                     // Specular
                     if (specularSupported && !light.specular.equalsFloats(0, 0, 0)) {
                         specularEnabled = true;
@@ -48224,6 +48126,9 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
+    BABYLON.Node.AddNodeConstructor("Light_Type_3", function (name, scene) {
+        return function () { return new HemisphericLight(name, BABYLON.Vector3.Zero(), scene); };
+    });
     /**
      * The HemisphericLight simulates the ambient environment light,
      * so the passed direction is the light reflection direction, not the incoming direction.
@@ -48310,6 +48215,14 @@ var BABYLON;
         HemisphericLight.prototype.getTypeID = function () {
             return BABYLON.Light.LIGHTTYPEID_HEMISPHERICLIGHT;
         };
+        /**
+         * Prepares the list of defines specific to the light type.
+         * @param defines the list of defines
+         * @param lightIndex defines the index of the light for the effect
+         */
+        HemisphericLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {
+            defines["HEMILIGHT" + lightIndex] = true;
+        };
         __decorate([
             BABYLON.serializeAsColor3()
         ], HemisphericLight.prototype, "groundColor", void 0);
@@ -48570,6 +48483,9 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
+    BABYLON.Node.AddNodeConstructor("Light_Type_0", function (name, scene) {
+        return function () { return new PointLight(name, BABYLON.Vector3.Zero(), scene); };
+    });
     /**
      * A point light is a light defined by an unique point in world space.
      * The light is emitted in every direction from this point.
@@ -48725,6 +48641,14 @@ var BABYLON;
             this._uniformBuffer.updateFloat4("vLightData", this.position.x, this.position.y, this.position.z, 0, lightIndex);
             return this;
         };
+        /**
+         * Prepares the list of defines specific to the light type.
+         * @param defines the list of defines
+         * @param lightIndex defines the index of the light for the effect
+         */
+        PointLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {
+            defines["POINTLIGHT" + lightIndex] = true;
+        };
         __decorate([
             BABYLON.serialize()
         ], PointLight.prototype, "shadowAngle", null);
@@ -48743,6 +48667,9 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
+    BABYLON.Node.AddNodeConstructor("Light_Type_1", function (name, scene) {
+        return function () { return new DirectionalLight(name, BABYLON.Vector3.Zero(), scene); };
+    });
     /**
      * A directional light is defined by a direction (what a surprise!).
      * The light is emitted from everywhere in the specified direction, and has an infinite range.
@@ -48937,6 +48864,14 @@ var BABYLON;
         DirectionalLight.prototype.getDepthMaxZ = function (activeCamera) {
             return 1;
         };
+        /**
+         * Prepares the list of defines specific to the light type.
+         * @param defines the list of defines
+         * @param lightIndex defines the index of the light for the effect
+         */
+        DirectionalLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {
+            defines["DIRLIGHT" + lightIndex] = true;
+        };
         __decorate([
             BABYLON.serialize()
         ], DirectionalLight.prototype, "shadowFrustumSize", null);
@@ -48961,6 +48896,9 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
+    BABYLON.Node.AddNodeConstructor("Light_Type_2", function (name, scene) {
+        return function () { return new SpotLight(name, BABYLON.Vector3.Zero(), BABYLON.Vector3.Zero(), 0, 0, scene); };
+    });
     /**
      * A spot light is defined by a position, a direction, an angle, and an exponent.
      * These values define a cone of light starting from the position, emitting toward the direction.
@@ -49229,6 +49167,15 @@ var BABYLON;
                 this._projectionTexture.dispose();
             }
         };
+        /**
+         * Prepares the list of defines specific to the light type.
+         * @param defines the list of defines
+         * @param lightIndex defines the index of the light for the effect
+         */
+        SpotLight.prototype.prepareLightSpecificDefines = function (defines, lightIndex) {
+            defines["SPOTLIGHT" + lightIndex] = true;
+            defines["PROJECTEDLIGHTTEXTURE" + lightIndex] = this.projectionTexture ? true : false;
+        };
         __decorate([
             BABYLON.serialize()
         ], SpotLight.prototype, "angle", null);
@@ -67618,7 +67565,6 @@ var BABYLON;
          * @returns The parsed shadow generator
          */
         ShadowGenerator.Parse = function (parsedShadowGenerator, scene) {
-            //casting to point light, as light is missing the position attr and typescript complains.
             var light = scene.getLightByID(parsedShadowGenerator.lightId);
             var shadowGenerator = new ShadowGenerator(parsedShadowGenerator.mapSize, light);
             var shadowMap = shadowGenerator.getShadowMap();
@@ -88920,8 +88866,8 @@ var BABYLON;
     var DebugLayer = /** @class */ (function () {
         function DebugLayer(scene) {
             this.BJSINSPECTOR = typeof INSPECTOR !== 'undefined' ? INSPECTOR : undefined;
+            this.onPropertyChangedObservable = new BABYLON.Observable();
             this._scene = scene;
-            // load inspector using require, if it doesn't exist on the global namespace.
         }
         /** Creates the inspector window. */
         DebugLayer.prototype._createInspector = function (config) {
@@ -88932,7 +88878,7 @@ var BABYLON;
             if (!this._inspector) {
                 this.BJSINSPECTOR = this.BJSINSPECTOR || typeof INSPECTOR !== 'undefined' ? INSPECTOR : undefined;
                 this._inspector = new this.BJSINSPECTOR.Inspector(this._scene, popup, initialTab, parentElement, config.newColors);
-            } // else nothing to do,; instance is already existing
+            } // else nothing to do as instance is already created
         };
         DebugLayer.prototype.isVisible = function () {
             if (!this._inspector) {
@@ -88982,7 +88928,6 @@ var BABYLON;
             else {
                 // Otherwise creates the inspector
                 this._createInspector(config);
-                this.onPropertyChangedObservable = new BABYLON.Observable();
             }
         };
         /**
@@ -96024,6 +95969,9 @@ var BABYLON;
                     return false;
                 }
                 var mesh = abstractMesh;
+                if (mesh.isDisposed()) {
+                    return false;
+                }
                 if (!mesh.isVisible || !mesh.isEnabled()) {
                     return false;
                 }

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


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


+ 4 - 0
src/Tools/babylon.sceneOptimizer.ts

@@ -362,6 +362,10 @@
 
             var mesh = <Mesh>abstractMesh;
 
+            if (mesh.isDisposed()) {
+                return false;
+            }
+
             if (!mesh.isVisible || !mesh.isEnabled()) {
                 return false;
             }