Browse Source

Add new mesh.getLODLevels() + nightly

David Catuhe 7 years ago
parent
commit
30f1309bd9

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


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


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


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

@@ -23377,26 +23377,150 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
+    /**
+     * Set of assets to keep when moving a scene into an asset container.
+     */
+    var KeepAssets = /** @class */ (function () {
+        function KeepAssets() {
+            /**
+             * Cameras to keep.
+             */
+            this.cameras = new Array();
+            /**
+             * Lights to keep.
+             */
+            this.lights = new Array();
+            /**
+             * Meshes to keep.
+             */
+            this.meshes = new Array();
+            /**
+             * Skeletons to keep.
+             */
+            this.skeletons = new Array();
+            /**
+             * ParticleSystems to keep.
+             */
+            this.particleSystems = new Array();
+            /**
+             * Animations to keep.
+             */
+            this.animations = new Array();
+            /**
+             * MultiMaterials to keep.
+             */
+            this.multiMaterials = new Array();
+            /**
+             * Materials to keep.
+             */
+            this.materials = new Array();
+            /**
+             * MorphTargetManagers to keep.
+             */
+            this.morphTargetManagers = new Array();
+            /**
+             * Geometries to keep.
+             */
+            this.geometries = new Array();
+            /**
+             * TransformNodes to keep.
+             */
+            this.transformNodes = new Array();
+            /**
+             * LensFlareSystems to keep.
+             */
+            this.lensFlareSystems = new Array();
+            /**
+             * ShadowGenerators to keep.
+             */
+            this.shadowGenerators = new Array();
+            /**
+             * ActionManagers to keep.
+             */
+            this.actionManagers = new Array();
+            /**
+             * Sounds to keep.
+             */
+            this.sounds = new Array();
+        }
+        return KeepAssets;
+    }());
+    BABYLON.KeepAssets = KeepAssets;
+    /**
+     * Container with a set of assets that can be added or removed from a scene.
+     */
     var AssetContainer = /** @class */ (function () {
+        /**
+         * Instantiates an AssetContainer.
+         * @param scene The scene the AssetContainer belongs to.
+         */
         function AssetContainer(scene) {
             // Objects
+            /**
+             * Cameras populated in the container.
+             */
             this.cameras = new Array();
+            /**
+             * Lights populated in the container.
+             */
             this.lights = new Array();
+            /**
+             * Meshes populated in the container.
+             */
             this.meshes = new Array();
+            /**
+             * Skeletons populated in the container.
+             */
             this.skeletons = new Array();
+            /**
+             * ParticleSystems populated in the container.
+             */
             this.particleSystems = new Array();
+            /**
+             * Animations populated in the container.
+             */
             this.animations = new Array();
+            /**
+             * MultiMaterials populated in the container.
+             */
             this.multiMaterials = new Array();
+            /**
+             * Materials populated in the container.
+             */
             this.materials = new Array();
+            /**
+             * MorphTargetManagers populated in the container.
+             */
             this.morphTargetManagers = new Array();
+            /**
+             * Geometries populated in the container.
+             */
             this.geometries = new Array();
+            /**
+             * TransformNodes populated in the container.
+             */
             this.transformNodes = new Array();
+            /**
+             * LensFlareSystems populated in the container.
+             */
             this.lensFlareSystems = new Array();
+            /**
+             * ShadowGenerators populated in the container.
+             */
             this.shadowGenerators = new Array();
+            /**
+             * ActionManagers populated in the container.
+             */
             this.actionManagers = new Array();
+            /**
+             * Sounds populated in the container.
+             */
             this.sounds = new Array();
             this.scene = scene;
         }
+        /**
+         * Adds all the assets from the container to the scene.
+         */
         AssetContainer.prototype.addAllToScene = function () {
             var _this = this;
             this.cameras.forEach(function (o) {
@@ -23444,6 +23568,9 @@ var BABYLON;
                 _this.scene.mainSoundTrack.AddSound(o);
             });
         };
+        /**
+         * Removes all the assets in the container from the scene
+         */
         AssetContainer.prototype.removeAllFromScene = function () {
             var _this = this;
             this.cameras.forEach(function (o) {
@@ -23491,6 +23618,46 @@ var BABYLON;
                 _this.scene.mainSoundTrack.RemoveSound(o);
             });
         };
+        AssetContainer.prototype._moveAssets = function (sourceAssets, targetAssets, keepAssets) {
+            for (var _i = 0, sourceAssets_1 = sourceAssets; _i < sourceAssets_1.length; _i++) {
+                var asset = sourceAssets_1[_i];
+                var move = true;
+                for (var _a = 0, keepAssets_1 = keepAssets; _a < keepAssets_1.length; _a++) {
+                    var keepAsset = keepAssets_1[_a];
+                    if (asset === keepAsset) {
+                        move = false;
+                        break;
+                    }
+                }
+                if (move) {
+                    targetAssets.push(asset);
+                }
+            }
+        };
+        /**
+         * Removes all the assets contained in the scene and adds them to the container.
+         * @param keepAssets Set of assets to keep in the scene. (default: empty)
+         */
+        AssetContainer.prototype.moveAllFromScene = function (keepAssets) {
+            if (keepAssets === undefined) {
+                keepAssets = new KeepAssets();
+            }
+            this._moveAssets(this.scene.cameras, this.cameras, keepAssets.cameras);
+            this._moveAssets(this.scene.meshes, this.meshes, keepAssets.meshes);
+            this._moveAssets(this.scene.getGeometries(), this.geometries, keepAssets.geometries);
+            this._moveAssets(this.scene.materials, this.materials, keepAssets.materials);
+            Array.prototype.push.apply(this.actionManagers, this.scene._actionManagers);
+            Array.prototype.push.apply(this.animations, this.scene.animations);
+            Array.prototype.push.apply(this.lensFlareSystems, this.scene.lensFlareSystems);
+            Array.prototype.push.apply(this.lights, this.scene.lights);
+            Array.prototype.push.apply(this.morphTargetManagers, this.scene.morphTargetManagers);
+            Array.prototype.push.apply(this.multiMaterials, this.scene.multiMaterials);
+            Array.prototype.push.apply(this.skeletons, this.scene.skeletons);
+            Array.prototype.push.apply(this.particleSystems, this.scene.particleSystems);
+            Array.prototype.push.apply(this.sounds, this.scene.mainSoundTrack.soundCollection);
+            Array.prototype.push.apply(this.transformNodes, this.scene.transformNodes);
+            this.removeAllFromScene();
+        };
         return AssetContainer;
     }());
     BABYLON.AssetContainer = AssetContainer;
@@ -25274,6 +25441,13 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        /**
+         * Gets the list of {BABYLON.MeshLODLevel} associated with the current mesh
+         * @returns an array of {BABYLON.MeshLODLevel}
+         */
+        Mesh.prototype.getLODLevels = function () {
+            return this._LODLevels;
+        };
         Mesh.prototype._sortLODLevels = function () {
             this._LODLevels.sort(function (a, b) {
                 if (a.distance < b.distance) {

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


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


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


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

@@ -23377,26 +23377,150 @@ var BABYLON;
 
 var BABYLON;
 (function (BABYLON) {
+    /**
+     * Set of assets to keep when moving a scene into an asset container.
+     */
+    var KeepAssets = /** @class */ (function () {
+        function KeepAssets() {
+            /**
+             * Cameras to keep.
+             */
+            this.cameras = new Array();
+            /**
+             * Lights to keep.
+             */
+            this.lights = new Array();
+            /**
+             * Meshes to keep.
+             */
+            this.meshes = new Array();
+            /**
+             * Skeletons to keep.
+             */
+            this.skeletons = new Array();
+            /**
+             * ParticleSystems to keep.
+             */
+            this.particleSystems = new Array();
+            /**
+             * Animations to keep.
+             */
+            this.animations = new Array();
+            /**
+             * MultiMaterials to keep.
+             */
+            this.multiMaterials = new Array();
+            /**
+             * Materials to keep.
+             */
+            this.materials = new Array();
+            /**
+             * MorphTargetManagers to keep.
+             */
+            this.morphTargetManagers = new Array();
+            /**
+             * Geometries to keep.
+             */
+            this.geometries = new Array();
+            /**
+             * TransformNodes to keep.
+             */
+            this.transformNodes = new Array();
+            /**
+             * LensFlareSystems to keep.
+             */
+            this.lensFlareSystems = new Array();
+            /**
+             * ShadowGenerators to keep.
+             */
+            this.shadowGenerators = new Array();
+            /**
+             * ActionManagers to keep.
+             */
+            this.actionManagers = new Array();
+            /**
+             * Sounds to keep.
+             */
+            this.sounds = new Array();
+        }
+        return KeepAssets;
+    }());
+    BABYLON.KeepAssets = KeepAssets;
+    /**
+     * Container with a set of assets that can be added or removed from a scene.
+     */
     var AssetContainer = /** @class */ (function () {
+        /**
+         * Instantiates an AssetContainer.
+         * @param scene The scene the AssetContainer belongs to.
+         */
         function AssetContainer(scene) {
             // Objects
+            /**
+             * Cameras populated in the container.
+             */
             this.cameras = new Array();
+            /**
+             * Lights populated in the container.
+             */
             this.lights = new Array();
+            /**
+             * Meshes populated in the container.
+             */
             this.meshes = new Array();
+            /**
+             * Skeletons populated in the container.
+             */
             this.skeletons = new Array();
+            /**
+             * ParticleSystems populated in the container.
+             */
             this.particleSystems = new Array();
+            /**
+             * Animations populated in the container.
+             */
             this.animations = new Array();
+            /**
+             * MultiMaterials populated in the container.
+             */
             this.multiMaterials = new Array();
+            /**
+             * Materials populated in the container.
+             */
             this.materials = new Array();
+            /**
+             * MorphTargetManagers populated in the container.
+             */
             this.morphTargetManagers = new Array();
+            /**
+             * Geometries populated in the container.
+             */
             this.geometries = new Array();
+            /**
+             * TransformNodes populated in the container.
+             */
             this.transformNodes = new Array();
+            /**
+             * LensFlareSystems populated in the container.
+             */
             this.lensFlareSystems = new Array();
+            /**
+             * ShadowGenerators populated in the container.
+             */
             this.shadowGenerators = new Array();
+            /**
+             * ActionManagers populated in the container.
+             */
             this.actionManagers = new Array();
+            /**
+             * Sounds populated in the container.
+             */
             this.sounds = new Array();
             this.scene = scene;
         }
+        /**
+         * Adds all the assets from the container to the scene.
+         */
         AssetContainer.prototype.addAllToScene = function () {
             var _this = this;
             this.cameras.forEach(function (o) {
@@ -23444,6 +23568,9 @@ var BABYLON;
                 _this.scene.mainSoundTrack.AddSound(o);
             });
         };
+        /**
+         * Removes all the assets in the container from the scene
+         */
         AssetContainer.prototype.removeAllFromScene = function () {
             var _this = this;
             this.cameras.forEach(function (o) {
@@ -23491,6 +23618,46 @@ var BABYLON;
                 _this.scene.mainSoundTrack.RemoveSound(o);
             });
         };
+        AssetContainer.prototype._moveAssets = function (sourceAssets, targetAssets, keepAssets) {
+            for (var _i = 0, sourceAssets_1 = sourceAssets; _i < sourceAssets_1.length; _i++) {
+                var asset = sourceAssets_1[_i];
+                var move = true;
+                for (var _a = 0, keepAssets_1 = keepAssets; _a < keepAssets_1.length; _a++) {
+                    var keepAsset = keepAssets_1[_a];
+                    if (asset === keepAsset) {
+                        move = false;
+                        break;
+                    }
+                }
+                if (move) {
+                    targetAssets.push(asset);
+                }
+            }
+        };
+        /**
+         * Removes all the assets contained in the scene and adds them to the container.
+         * @param keepAssets Set of assets to keep in the scene. (default: empty)
+         */
+        AssetContainer.prototype.moveAllFromScene = function (keepAssets) {
+            if (keepAssets === undefined) {
+                keepAssets = new KeepAssets();
+            }
+            this._moveAssets(this.scene.cameras, this.cameras, keepAssets.cameras);
+            this._moveAssets(this.scene.meshes, this.meshes, keepAssets.meshes);
+            this._moveAssets(this.scene.getGeometries(), this.geometries, keepAssets.geometries);
+            this._moveAssets(this.scene.materials, this.materials, keepAssets.materials);
+            Array.prototype.push.apply(this.actionManagers, this.scene._actionManagers);
+            Array.prototype.push.apply(this.animations, this.scene.animations);
+            Array.prototype.push.apply(this.lensFlareSystems, this.scene.lensFlareSystems);
+            Array.prototype.push.apply(this.lights, this.scene.lights);
+            Array.prototype.push.apply(this.morphTargetManagers, this.scene.morphTargetManagers);
+            Array.prototype.push.apply(this.multiMaterials, this.scene.multiMaterials);
+            Array.prototype.push.apply(this.skeletons, this.scene.skeletons);
+            Array.prototype.push.apply(this.particleSystems, this.scene.particleSystems);
+            Array.prototype.push.apply(this.sounds, this.scene.mainSoundTrack.soundCollection);
+            Array.prototype.push.apply(this.transformNodes, this.scene.transformNodes);
+            this.removeAllFromScene();
+        };
         return AssetContainer;
     }());
     BABYLON.AssetContainer = AssetContainer;
@@ -25274,6 +25441,13 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        /**
+         * Gets the list of {BABYLON.MeshLODLevel} associated with the current mesh
+         * @returns an array of {BABYLON.MeshLODLevel}
+         */
+        Mesh.prototype.getLODLevels = function () {
+            return this._LODLevels;
+        };
         Mesh.prototype._sortLODLevels = function () {
             this._LODLevels.sort(function (a, b) {
                 if (a.distance < b.distance) {

File diff suppressed because it is too large
+ 176 - 2
dist/preview release/customConfigurations/minimalGLTFViewer/es6.js


File diff suppressed because it is too large
+ 176 - 2
dist/preview release/es6.js


+ 2 - 2
dist/preview release/loaders/babylon.glTF2FileLoader.d.ts

@@ -362,7 +362,7 @@ declare module BABYLON.GLTF2 {
         index: number;
         texCoord?: number;
     }
-    interface IGLTF extends IGLTFProperty {
+    interface _IGLTF extends IGLTFProperty {
         accessors?: IGLTFAccessor[];
         animations?: IGLTFAnimation[];
         asset: IGLTFAsset;
@@ -386,7 +386,7 @@ declare module BABYLON.GLTF2 {
 
 declare module BABYLON.GLTF2 {
     class GLTFLoader implements IGLTFLoader {
-        _gltf: IGLTF;
+        _gltf: _IGLTF;
         _babylonScene: Scene;
         private _disposed;
         private _rootUrl;

+ 2 - 2
dist/preview release/loaders/babylon.glTFFileLoader.d.ts

@@ -919,7 +919,7 @@ declare module BABYLON.GLTF2 {
         index: number;
         texCoord?: number;
     }
-    interface IGLTF extends IGLTFProperty {
+    interface _IGLTF extends IGLTFProperty {
         accessors?: IGLTFAccessor[];
         animations?: IGLTFAnimation[];
         asset: IGLTFAsset;
@@ -943,7 +943,7 @@ declare module BABYLON.GLTF2 {
 
 declare module BABYLON.GLTF2 {
     class GLTFLoader implements IGLTFLoader {
-        _gltf: IGLTF;
+        _gltf: _IGLTF;
         _babylonScene: Scene;
         private _disposed;
         private _rootUrl;

+ 2 - 2
dist/preview release/loaders/babylonjs.loaders.module.d.ts

@@ -1020,7 +1020,7 @@ declare module BABYLON.GLTF2 {
         index: number;
         texCoord?: number;
     }
-    interface IGLTF extends IGLTFProperty {
+    interface _IGLTF extends IGLTFProperty {
         accessors?: IGLTFAccessor[];
         animations?: IGLTFAnimation[];
         asset: IGLTFAsset;
@@ -1044,7 +1044,7 @@ declare module BABYLON.GLTF2 {
 
 declare module BABYLON.GLTF2 {
     class GLTFLoader implements IGLTFLoader {
-        _gltf: IGLTF;
+        _gltf: _IGLTF;
         _babylonScene: Scene;
         private _disposed;
         private _rootUrl;

+ 104 - 53
dist/preview release/serializers/babylon.glTF2Serializer.d.ts

@@ -1,80 +1,110 @@
 
 declare module BABYLON {
-    interface IGLTFExporterOptions {
+    /**
+     * Holds a collection of exporter options and parameters
+     */
+    interface IExporterOptions {
         /**
-         * Interface function which indicates whether a babylon mesh should be exported or not.
-         * @param mesh
+         * Function which indicates whether a babylon mesh should be exported or not.
+         * @param mesh - source Babylon mesh. It is used to check whether it should be
+         * exported to glTF or not.
          * @returns boolean, which indicates whether the mesh should be exported (true) or not (false)
          */
         shouldExportMesh?(mesh: AbstractMesh): boolean;
     }
+    /**
+     * Class for generating glTF data from a Babylon scene.
+     */
     class GLTF2Export {
         /**
-         * Exports the geometry of a Mesh array in .gltf file format.
-         * @param meshes
-         * @param materials
-         * @param options
-         *
-         * @returns - Returns an object with a .gltf, .glb and associates textures
+         * Exports the geometry of the scene to .gltf file format.
+         * @param scene - Babylon scene with scene hierarchy information.
+         * @param filePrefix - File prefix to use when generating the glTF file.
+         * @param options - Exporter options.
+         * @returns - Returns an object with a .gltf file and associates texture names
          * as keys and their data and paths as values.
          */
-        static GLTF(scene: Scene, filename: string, options?: IGLTFExporterOptions): _GLTFData;
+        static GLTF(scene: Scene, filePrefix: string, options?: IExporterOptions): _GLTFData;
         /**
-         *
-         * @param meshes
-         * @param filename
-         *
+         * Exports the geometry of the scene to .glb file format.
+         * @param scene - Babylon scene with scene hierarchy information.
+         * @param filePrefix - File prefix to use when generating glb file.
+         * @param options - Exporter options.
          * @returns - Returns an object with a .glb filename as key and data as value
          */
-        static GLB(scene: Scene, filename: string, options?: IGLTFExporterOptions): _GLTFData;
+        static GLB(scene: Scene, filePrefix: string, options?: IExporterOptions): _GLTFData;
     }
 }
 
-declare module BABYLON {
-    /**
-     * glTF Alpha Mode Enum
-     */
-    enum _EGLTFAlphaModeEnum {
-        OPAQUE = "OPAQUE",
-        MASK = "MASK",
-        BLEND = "BLEND",
-    }
-    /**
-     * Babylon Specular Glossiness interface
-     */
-    interface _IBabylonSpecularGlossiness {
-        diffuse: Color3;
-        opacity: number;
-        specular: Color3;
-        glossiness: number;
-    }
-    /**
-     * Babylon Metallic Roughness interface
-     */
-    interface _IBabylonMetallicRoughness {
-        baseColor: Color3;
-        opacity: number;
-        metallic: number;
-        roughness: number;
-    }
+
+/**
+ * Module for the Babylon glTF 2.0 exporter.  Should ONLY be used internally.
+ * @ignore - capitalization of GLTF2 module.
+ */
+declare module BABYLON.GLTF2 {
     /**
-     * Converts Babylon Scene into glTF 2.0
+     * Converts Babylon Scene into glTF 2.0.
      */
-    class _GLTF2Exporter {
+    class _Exporter {
+        /**
+         * Stores all generated buffer views, which represents views into the main glTF buffer data.
+         */
         private bufferViews;
+        /**
+         * Stores all the generated accessors, which is used for accessing the data within the buffer views in glTF.
+         */
         private accessors;
+        /**
+         * Stores all the generated nodes, which contains transform and/or mesh information per node.
+         */
         private nodes;
+        /**
+         * Stores the glTF asset information, which represents the glTF version and this file generator.
+         */
         private asset;
+        /**
+         * Stores all the generated glTF scenes, which stores multiple node hierarchies.
+         */
         private scenes;
+        /**
+         * Stores all the generated mesh information, each containing a set of primitives to render in glTF.
+         */
         private meshes;
+        /**
+         * Stores all the generated material information, which represents the appearance of each primitive.
+         */
         private materials;
+        /**
+         * Stores all the generated texture information, which is referenced by glTF materials.
+         */
         private textures;
+        /**
+         * Stores all the generated image information, which is referenced by glTF textures.
+         */
         private images;
+        /**
+         * Stores the total amount of bytes stored in the glTF buffer.
+         */
         private totalByteLength;
+        /**
+         * Stores a reference to the Babylon scene containing the source geometry and material information.
+         */
         private babylonScene;
+        /**
+         * Stores the exporter options, which are optionally passed in from the glTF serializer.
+         */
         private options?;
+        /**
+         * Stores a map of the image data, where the key is the file name and the value
+         * is the image data.
+         */
         private imageData;
-        constructor(babylonScene: Scene, options?: IGLTFExporterOptions);
+        /**
+         * Creates a glTF Exporter instance, which can accept optional exporter options.
+         * @param babylonScene - Babylon scene object
+         * @param options - Options to modify the behavior of the exporter.
+         */
+        constructor(babylonScene: Scene, options?: IExporterOptions);
         /**
          * Creates a buffer view based on teh supplied arguments
          * @param {number} bufferIndex - index value of the specified buffer
@@ -189,35 +219,56 @@ declare module BABYLON {
     }
 }
 
+
 declare module BABYLON {
     /**
      * Class for holding and downloading glTF file data
      */
     class _GLTFData {
+        /**
+         * Object which contains the file name as the key and its data as the value.
+         */
         glTFFiles: {
             [fileName: string]: string | Blob;
         };
+        /**
+         * Initializes the glTF file object.
+         */
         constructor();
         /**
-         * Downloads glTF data.
+         * Downloads the glTF data as files based on their names and data.
          */
         downloadFiles(): void;
     }
 }
 
-declare module BABYLON {
+
+declare module BABYLON.GLTF2 {
     /**
-     * Utility methods for working with glTF material conversion properties
+     * Utility methods for working with glTF material conversion properties.  This class should only be used internally.
      */
     class _GLTFMaterial {
-        private static dielectricSpecular;
-        private static epsilon;
         /**
-         * Converts Specular Glossiness to Metallic Roughness
+         * Represents the dielectric specular values for R, G and B.
+         */
+        private static readonly dielectricSpecular;
+        /**
+         * Epsilon value, used as a small tolerance value for a numeric value.
+         */
+        private static readonly epsilon;
+        /**
+         * Converts a Babylon StandardMaterial to a glTF Metallic Roughness Material.
+         * @param babylonStandardMaterial
+         * @returns - glTF Metallic Roughness Material representation
+         */
+        static ConvertToGLTFPBRMetallicRoughness(babylonStandardMaterial: StandardMaterial): IMaterialPbrMetallicRoughness;
+        /**
+         * Converts Specular Glossiness to Metallic Roughness.  This is based on the algorithm used in the Babylon glTF 3ds Max Exporter.
+         * {@link https://github.com/BabylonJS/Exporters/blob/master/3ds%20Max/Max2Babylon/Exporter/BabylonExporter.GLTFExporter.Material.cs}
          * @param  babylonSpecularGlossiness - Babylon specular glossiness parameters
          * @returns - Babylon metallic roughness values
          */
-        static ConvertToMetallicRoughness(babylonSpecularGlossiness: _IBabylonSpecularGlossiness): _IBabylonMetallicRoughness;
+        private static _ConvertToMetallicRoughness(babylonSpecularGlossiness);
         /**
          * Returns the perceived brightness value based on the provided color
          * @param color - color used in calculating the perceived brightness
@@ -237,6 +288,6 @@ declare module BABYLON {
          * @param babylonMaterial - Babylon Material
          * @returns - The Babylon alpha mode value
          */
-        static GetAlphaMode(babylonMaterial: Material): string;
+        static GetAlphaMode(babylonMaterial: Material): MaterialAlphaMode;
     }
 }

File diff suppressed because it is too large
+ 917 - 889
dist/preview release/serializers/babylon.glTF2Serializer.js


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


File diff suppressed because it is too large
+ 917 - 889
dist/preview release/serializers/babylonjs.serializers.js


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


+ 104 - 53
dist/preview release/serializers/babylonjs.serializers.module.d.ts

@@ -14,81 +14,111 @@ declare module BABYLON {
 
 
 declare module BABYLON {
-    interface IGLTFExporterOptions {
+    /**
+     * Holds a collection of exporter options and parameters
+     */
+    interface IExporterOptions {
         /**
-         * Interface function which indicates whether a babylon mesh should be exported or not.
-         * @param mesh
+         * Function which indicates whether a babylon mesh should be exported or not.
+         * @param mesh - source Babylon mesh. It is used to check whether it should be
+         * exported to glTF or not.
          * @returns boolean, which indicates whether the mesh should be exported (true) or not (false)
          */
         shouldExportMesh?(mesh: AbstractMesh): boolean;
     }
+    /**
+     * Class for generating glTF data from a Babylon scene.
+     */
     class GLTF2Export {
         /**
-         * Exports the geometry of a Mesh array in .gltf file format.
-         * @param meshes
-         * @param materials
-         * @param options
-         *
-         * @returns - Returns an object with a .gltf, .glb and associates textures
+         * Exports the geometry of the scene to .gltf file format.
+         * @param scene - Babylon scene with scene hierarchy information.
+         * @param filePrefix - File prefix to use when generating the glTF file.
+         * @param options - Exporter options.
+         * @returns - Returns an object with a .gltf file and associates texture names
          * as keys and their data and paths as values.
          */
-        static GLTF(scene: Scene, filename: string, options?: IGLTFExporterOptions): _GLTFData;
+        static GLTF(scene: Scene, filePrefix: string, options?: IExporterOptions): _GLTFData;
         /**
-         *
-         * @param meshes
-         * @param filename
-         *
+         * Exports the geometry of the scene to .glb file format.
+         * @param scene - Babylon scene with scene hierarchy information.
+         * @param filePrefix - File prefix to use when generating glb file.
+         * @param options - Exporter options.
          * @returns - Returns an object with a .glb filename as key and data as value
          */
-        static GLB(scene: Scene, filename: string, options?: IGLTFExporterOptions): _GLTFData;
+        static GLB(scene: Scene, filePrefix: string, options?: IExporterOptions): _GLTFData;
     }
 }
 
-declare module BABYLON {
-    /**
-     * glTF Alpha Mode Enum
-     */
-    enum _EGLTFAlphaModeEnum {
-        OPAQUE = "OPAQUE",
-        MASK = "MASK",
-        BLEND = "BLEND",
-    }
-    /**
-     * Babylon Specular Glossiness interface
-     */
-    interface _IBabylonSpecularGlossiness {
-        diffuse: Color3;
-        opacity: number;
-        specular: Color3;
-        glossiness: number;
-    }
-    /**
-     * Babylon Metallic Roughness interface
-     */
-    interface _IBabylonMetallicRoughness {
-        baseColor: Color3;
-        opacity: number;
-        metallic: number;
-        roughness: number;
-    }
+
+/**
+ * Module for the Babylon glTF 2.0 exporter.  Should ONLY be used internally.
+ * @ignore - capitalization of GLTF2 module.
+ */
+declare module BABYLON.GLTF2 {
     /**
-     * Converts Babylon Scene into glTF 2.0
+     * Converts Babylon Scene into glTF 2.0.
      */
-    class _GLTF2Exporter {
+    class _Exporter {
+        /**
+         * Stores all generated buffer views, which represents views into the main glTF buffer data.
+         */
         private bufferViews;
+        /**
+         * Stores all the generated accessors, which is used for accessing the data within the buffer views in glTF.
+         */
         private accessors;
+        /**
+         * Stores all the generated nodes, which contains transform and/or mesh information per node.
+         */
         private nodes;
+        /**
+         * Stores the glTF asset information, which represents the glTF version and this file generator.
+         */
         private asset;
+        /**
+         * Stores all the generated glTF scenes, which stores multiple node hierarchies.
+         */
         private scenes;
+        /**
+         * Stores all the generated mesh information, each containing a set of primitives to render in glTF.
+         */
         private meshes;
+        /**
+         * Stores all the generated material information, which represents the appearance of each primitive.
+         */
         private materials;
+        /**
+         * Stores all the generated texture information, which is referenced by glTF materials.
+         */
         private textures;
+        /**
+         * Stores all the generated image information, which is referenced by glTF textures.
+         */
         private images;
+        /**
+         * Stores the total amount of bytes stored in the glTF buffer.
+         */
         private totalByteLength;
+        /**
+         * Stores a reference to the Babylon scene containing the source geometry and material information.
+         */
         private babylonScene;
+        /**
+         * Stores the exporter options, which are optionally passed in from the glTF serializer.
+         */
         private options?;
+        /**
+         * Stores a map of the image data, where the key is the file name and the value
+         * is the image data.
+         */
         private imageData;
-        constructor(babylonScene: Scene, options?: IGLTFExporterOptions);
+        /**
+         * Creates a glTF Exporter instance, which can accept optional exporter options.
+         * @param babylonScene - Babylon scene object
+         * @param options - Options to modify the behavior of the exporter.
+         */
+        constructor(babylonScene: Scene, options?: IExporterOptions);
         /**
          * Creates a buffer view based on teh supplied arguments
          * @param {number} bufferIndex - index value of the specified buffer
@@ -203,35 +233,56 @@ declare module BABYLON {
     }
 }
 
+
 declare module BABYLON {
     /**
      * Class for holding and downloading glTF file data
      */
     class _GLTFData {
+        /**
+         * Object which contains the file name as the key and its data as the value.
+         */
         glTFFiles: {
             [fileName: string]: string | Blob;
         };
+        /**
+         * Initializes the glTF file object.
+         */
         constructor();
         /**
-         * Downloads glTF data.
+         * Downloads the glTF data as files based on their names and data.
          */
         downloadFiles(): void;
     }
 }
 
-declare module BABYLON {
+
+declare module BABYLON.GLTF2 {
     /**
-     * Utility methods for working with glTF material conversion properties
+     * Utility methods for working with glTF material conversion properties.  This class should only be used internally.
      */
     class _GLTFMaterial {
-        private static dielectricSpecular;
-        private static epsilon;
         /**
-         * Converts Specular Glossiness to Metallic Roughness
+         * Represents the dielectric specular values for R, G and B.
+         */
+        private static readonly dielectricSpecular;
+        /**
+         * Epsilon value, used as a small tolerance value for a numeric value.
+         */
+        private static readonly epsilon;
+        /**
+         * Converts a Babylon StandardMaterial to a glTF Metallic Roughness Material.
+         * @param babylonStandardMaterial
+         * @returns - glTF Metallic Roughness Material representation
+         */
+        static ConvertToGLTFPBRMetallicRoughness(babylonStandardMaterial: StandardMaterial): IMaterialPbrMetallicRoughness;
+        /**
+         * Converts Specular Glossiness to Metallic Roughness.  This is based on the algorithm used in the Babylon glTF 3ds Max Exporter.
+         * {@link https://github.com/BabylonJS/Exporters/blob/master/3ds%20Max/Max2Babylon/Exporter/BabylonExporter.GLTFExporter.Material.cs}
          * @param  babylonSpecularGlossiness - Babylon specular glossiness parameters
          * @returns - Babylon metallic roughness values
          */
-        static ConvertToMetallicRoughness(babylonSpecularGlossiness: _IBabylonSpecularGlossiness): _IBabylonMetallicRoughness;
+        private static _ConvertToMetallicRoughness(babylonSpecularGlossiness);
         /**
          * Returns the perceived brightness value based on the provided color
          * @param color - color used in calculating the perceived brightness
@@ -251,6 +302,6 @@ declare module BABYLON {
          * @param babylonMaterial - Babylon Material
          * @returns - The Babylon alpha mode value
          */
-        static GetAlphaMode(babylonMaterial: Material): string;
+        static GetAlphaMode(babylonMaterial: Material): MaterialAlphaMode;
     }
 }

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


+ 8 - 0
src/Mesh/babylon.mesh.ts

@@ -297,6 +297,14 @@
             return this._LODLevels.length > 0;
         }
 
+        /**
+         * Gets the list of {BABYLON.MeshLODLevel} associated with the current mesh
+         * @returns an array of {BABYLON.MeshLODLevel} 
+         */
+        public getLODLevels(): MeshLODLevel[] {
+            return this._LODLevels;
+        }
+
         private _sortLODLevels(): void {
             this._LODLevels.sort((a, b) => {
                 if (a.distance < b.distance) {