David Catuhe 7 vuotta sitten
vanhempi
commit
dc36f7b486

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 6465 - 6465
Playground/babylon.d.txt


+ 2 - 2
Tools/Gulp/gulpfile.js

@@ -420,7 +420,7 @@ var buildExternalLibrary = function (library, settings, watch) {
  * The default task, concat and min the main BJS files.
  */
 gulp.task("default", function (cb) {
-    runSequence("typescript-all", "intellisense", "tests-saucelabs", cb);
+    runSequence("typescript-all", "intellisense", cb);
 });
 
 gulp.task("mainBuild", function (cb) {
@@ -478,7 +478,7 @@ gulp.task("typescript-all", function (cb) {
 /**
  * Watch ts files from typescript .
  */
-gulp.task("srcTscWatch", function() {
+gulp.task("srcTscWatch", function () {
     // Reuse The TSC CLI from gulp to enable -w.
     process.argv[2] = "-w";
     process.argv[3] = "-p";

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 4324 - 4324
dist/preview release/babylon.d.ts


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 7735 - 7735
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


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

@@ -10,9 +10,7 @@ declare module BABYLON {
          * @returns {[fileName: string]: string | Blob} Returns an object with a .gltf, .glb and associates textures
          * as keys and their data and paths as values.
          */
-        static GLTF(scene: BABYLON.Scene, filename: string): {
-            [fileName: string]: string | Blob;
-        };
+        static GLTF(scene: BABYLON.Scene, filename: string): _GLTFData;
         /**
          *
          * @param meshes
@@ -20,17 +18,7 @@ declare module BABYLON {
          *
          * @returns {[fileName: string]: string | Blob} Returns an object with a .glb filename as key and data as value
          */
-        static GLB(scene: BABYLON.Scene, filename: string): {
-            [fileName: string]: string | Blob;
-        };
-        /**
-         * Downloads data from glTF object.
-         *
-         * @param gltfData glTF object with keys being file names and values being data
-         */
-        static downloadFiles(gltfData: {
-            [fileName: string]: string | Blob;
-        }): void;
+        static GLB(scene: BABYLON.Scene, filename: string): _GLTFData;
     }
 }
 
@@ -108,9 +96,7 @@ declare module BABYLON {
          * @returns {[x: string]: string | Blob} object with glTF json tex filename
          * and binary file name as keys and their data as values
          */
-        _generateGLTF(glTFPrefix: string): {
-            [x: string]: string | Blob;
-        };
+        _generateGLTF(glTFPrefix: string): _GLTFData;
         /**
          * Creates a binary buffer for glTF
          *
@@ -126,9 +112,7 @@ declare module BABYLON {
          *
          * @returns {[glbFileName: string]: Blob} object with glb filename as key and data as value
          */
-        _generateGLB(glTFPrefix: string): {
-            [glbFileName: string]: Blob;
-        };
+        _generateGLB(glTFPrefix: string): _GLTFData;
         /**
          * Sets the TRS for each node
          * @param node
@@ -160,3 +144,19 @@ declare module BABYLON {
         private createScene(babylonScene, byteOffset, dataBuffer?);
     }
 }
+
+declare module BABYLON {
+    /**
+     * Class for holding and downloading glTF file data
+     */
+    class _GLTFData {
+        _glTFFiles: {
+            [fileName: string]: string | Blob;
+        };
+        constructor();
+        /**
+         * Downloads glTF data.
+         */
+        downloadFiles(): void;
+    }
+}

+ 60 - 48
dist/preview release/serializers/babylon.glTF2Serializer.js

@@ -30,42 +30,6 @@ var BABYLON;
             var gltfGenerator = new BABYLON._GLTF2Exporter(scene);
             return gltfGenerator._generateGLB(glTFPrefix);
         };
-        /**
-         * Downloads data from glTF object.
-         *
-         * @param gltfData glTF object with keys being file names and values being data
-         */
-        GLTF2Export.downloadFiles = function (gltfData) {
-            /**
-             * Checks for a matching suffix at the end of a string (for ES5 and lower)
-             * @param str
-             * @param suffix
-             *
-             * @returns {boolean} indicating whether the suffix matches or not
-             */
-            function endsWith(str, suffix) {
-                return str.indexOf(suffix, str.length - suffix.length) !== -1;
-            }
-            for (var key in gltfData) {
-                var link = document.createElement('a');
-                document.body.appendChild(link);
-                link.setAttribute("type", "hidden");
-                link.download = key;
-                var blob = gltfData[key];
-                var mimeType = void 0;
-                if (endsWith(key, ".glb")) {
-                    mimeType = { type: "model/gltf-binary" };
-                }
-                else if (endsWith(key, ".bin")) {
-                    mimeType = { type: "application/octet-stream" };
-                }
-                else if (endsWith(key, ".gltf")) {
-                    mimeType = { type: "model/gltf+json" };
-                }
-                link.href = window.URL.createObjectURL(new Blob([blob], mimeType));
-                link.click();
-            }
-        };
         return GLTF2Export;
     }());
     BABYLON.GLTF2Export = GLTF2Export;
@@ -282,7 +246,7 @@ var BABYLON;
          */
         _GLTF2Exporter.prototype.generateJSON = function (glb, glTFPrefix, prettyPrint) {
             var buffer = { byteLength: this.totalByteLength };
-            var glTf = {
+            var glTF = {
                 buffers: [buffer],
                 asset: this.asset,
                 meshes: this.meshes,
@@ -292,12 +256,12 @@ var BABYLON;
                 accessors: this.accessors
             };
             if (this.scenes.length > 0) {
-                glTf.scene = 0;
+                glTF.scene = 0;
             }
             if (!glb) {
                 buffer.uri = glTFPrefix + ".bin";
             }
-            var jsonText = prettyPrint ? JSON.stringify(glTf, null, 2) : JSON.stringify(glTf);
+            var jsonText = prettyPrint ? JSON.stringify(glTF, null, 2) : JSON.stringify(glTF);
             return jsonText;
         };
         /**
@@ -313,11 +277,10 @@ var BABYLON;
             var bin = new Blob([binaryBuffer], { type: 'application/octet-stream' });
             var glTFFileName = glTFPrefix + '.gltf';
             var glTFBinFile = glTFPrefix + '.bin';
-            return _a = {},
-                _a[glTFFileName] = jsonText,
-                _a[glTFBinFile] = bin,
-                _a;
-            var _a;
+            var container = new BABYLON._GLTFData();
+            container._glTFFiles[glTFFileName] = jsonText;
+            container._glTFFiles[glTFBinFile] = bin;
+            return container;
         };
         /**
          * Creates a binary buffer for glTF
@@ -386,10 +349,9 @@ var BABYLON;
             }
             // binary data
             var glbFile = new Blob([headerBuffer, jsonChunkBuffer, binaryChunkBuffer, binaryBuffer, binPaddingBuffer], { type: 'application/octet-stream' });
-            return _a = {},
-                _a[glbFileName] = glbFile,
-                _a;
-            var _a;
+            var container = new BABYLON._GLTFData();
+            container._glTFFiles[glbFileName] = glbFile;
+            return container;
         };
         /**
          * Sets the TRS for each node
@@ -647,3 +609,53 @@ var BABYLON;
 })(BABYLON || (BABYLON = {}));
 
 //# sourceMappingURL=babylon.glTFExporter.js.map
+
+var BABYLON;
+(function (BABYLON) {
+    /**
+     * Class for holding and downloading glTF file data
+     */
+    var _GLTFData = /** @class */ (function () {
+        function _GLTFData() {
+            this._glTFFiles = {};
+        }
+        /**
+         * Downloads glTF data.
+         */
+        _GLTFData.prototype.downloadFiles = function () {
+            /**
+            * Checks for a matching suffix at the end of a string (for ES5 and lower)
+            * @param str
+            * @param suffix
+            *
+            * @returns {boolean} indicating whether the suffix matches or not
+            */
+            function endsWith(str, suffix) {
+                return str.indexOf(suffix, str.length - suffix.length) !== -1;
+            }
+            for (var key in this._glTFFiles) {
+                var link = document.createElement('a');
+                document.body.appendChild(link);
+                link.setAttribute("type", "hidden");
+                link.download = key;
+                var blob = this._glTFFiles[key];
+                var mimeType = void 0;
+                if (endsWith(key, ".glb")) {
+                    mimeType = { type: "model/gltf-binary" };
+                }
+                else if (endsWith(key, ".bin")) {
+                    mimeType = { type: "application/octet-stream" };
+                }
+                else if (endsWith(key, ".gltf")) {
+                    mimeType = { type: "model/gltf+json" };
+                }
+                link.href = window.URL.createObjectURL(new Blob([blob], mimeType));
+                link.click();
+            }
+        };
+        return _GLTFData;
+    }());
+    BABYLON._GLTFData = _GLTFData;
+})(BABYLON || (BABYLON = {}));
+
+//# sourceMappingURL=babylon.glTFData.js.map

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
dist/preview release/serializers/babylon.glTF2Serializer.min.js


+ 60 - 48
dist/preview release/serializers/babylonjs.serializers.js

@@ -174,42 +174,6 @@ var BABYLON;
             var gltfGenerator = new BABYLON._GLTF2Exporter(scene);
             return gltfGenerator._generateGLB(glTFPrefix);
         };
-        /**
-         * Downloads data from glTF object.
-         *
-         * @param gltfData glTF object with keys being file names and values being data
-         */
-        GLTF2Export.downloadFiles = function (gltfData) {
-            /**
-             * Checks for a matching suffix at the end of a string (for ES5 and lower)
-             * @param str
-             * @param suffix
-             *
-             * @returns {boolean} indicating whether the suffix matches or not
-             */
-            function endsWith(str, suffix) {
-                return str.indexOf(suffix, str.length - suffix.length) !== -1;
-            }
-            for (var key in gltfData) {
-                var link = document.createElement('a');
-                document.body.appendChild(link);
-                link.setAttribute("type", "hidden");
-                link.download = key;
-                var blob = gltfData[key];
-                var mimeType = void 0;
-                if (endsWith(key, ".glb")) {
-                    mimeType = { type: "model/gltf-binary" };
-                }
-                else if (endsWith(key, ".bin")) {
-                    mimeType = { type: "application/octet-stream" };
-                }
-                else if (endsWith(key, ".gltf")) {
-                    mimeType = { type: "model/gltf+json" };
-                }
-                link.href = window.URL.createObjectURL(new Blob([blob], mimeType));
-                link.click();
-            }
-        };
         return GLTF2Export;
     }());
     BABYLON.GLTF2Export = GLTF2Export;
@@ -426,7 +390,7 @@ var BABYLON;
          */
         _GLTF2Exporter.prototype.generateJSON = function (glb, glTFPrefix, prettyPrint) {
             var buffer = { byteLength: this.totalByteLength };
-            var glTf = {
+            var glTF = {
                 buffers: [buffer],
                 asset: this.asset,
                 meshes: this.meshes,
@@ -436,12 +400,12 @@ var BABYLON;
                 accessors: this.accessors
             };
             if (this.scenes.length > 0) {
-                glTf.scene = 0;
+                glTF.scene = 0;
             }
             if (!glb) {
                 buffer.uri = glTFPrefix + ".bin";
             }
-            var jsonText = prettyPrint ? JSON.stringify(glTf, null, 2) : JSON.stringify(glTf);
+            var jsonText = prettyPrint ? JSON.stringify(glTF, null, 2) : JSON.stringify(glTF);
             return jsonText;
         };
         /**
@@ -457,11 +421,10 @@ var BABYLON;
             var bin = new Blob([binaryBuffer], { type: 'application/octet-stream' });
             var glTFFileName = glTFPrefix + '.gltf';
             var glTFBinFile = glTFPrefix + '.bin';
-            return _a = {},
-                _a[glTFFileName] = jsonText,
-                _a[glTFBinFile] = bin,
-                _a;
-            var _a;
+            var container = new BABYLON._GLTFData();
+            container._glTFFiles[glTFFileName] = jsonText;
+            container._glTFFiles[glTFBinFile] = bin;
+            return container;
         };
         /**
          * Creates a binary buffer for glTF
@@ -530,10 +493,9 @@ var BABYLON;
             }
             // binary data
             var glbFile = new Blob([headerBuffer, jsonChunkBuffer, binaryChunkBuffer, binaryBuffer, binPaddingBuffer], { type: 'application/octet-stream' });
-            return _a = {},
-                _a[glbFileName] = glbFile,
-                _a;
-            var _a;
+            var container = new BABYLON._GLTFData();
+            container._glTFFiles[glbFileName] = glbFile;
+            return container;
         };
         /**
          * Sets the TRS for each node
@@ -792,6 +754,56 @@ var BABYLON;
 
 //# sourceMappingURL=babylon.glTFExporter.js.map
 
+var BABYLON;
+(function (BABYLON) {
+    /**
+     * Class for holding and downloading glTF file data
+     */
+    var _GLTFData = /** @class */ (function () {
+        function _GLTFData() {
+            this._glTFFiles = {};
+        }
+        /**
+         * Downloads glTF data.
+         */
+        _GLTFData.prototype.downloadFiles = function () {
+            /**
+            * Checks for a matching suffix at the end of a string (for ES5 and lower)
+            * @param str
+            * @param suffix
+            *
+            * @returns {boolean} indicating whether the suffix matches or not
+            */
+            function endsWith(str, suffix) {
+                return str.indexOf(suffix, str.length - suffix.length) !== -1;
+            }
+            for (var key in this._glTFFiles) {
+                var link = document.createElement('a');
+                document.body.appendChild(link);
+                link.setAttribute("type", "hidden");
+                link.download = key;
+                var blob = this._glTFFiles[key];
+                var mimeType = void 0;
+                if (endsWith(key, ".glb")) {
+                    mimeType = { type: "model/gltf-binary" };
+                }
+                else if (endsWith(key, ".bin")) {
+                    mimeType = { type: "application/octet-stream" };
+                }
+                else if (endsWith(key, ".gltf")) {
+                    mimeType = { type: "model/gltf+json" };
+                }
+                link.href = window.URL.createObjectURL(new Blob([blob], mimeType));
+                link.click();
+            }
+        };
+        return _GLTFData;
+    }());
+    BABYLON._GLTFData = _GLTFData;
+})(BABYLON || (BABYLON = {}));
+
+//# sourceMappingURL=babylon.glTFData.js.map
+
 
 (function universalModuleDefinition(root, factory) {
                 var f = factory();

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
dist/preview release/serializers/babylonjs.serializers.min.js


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

@@ -23,9 +23,7 @@ declare module BABYLON {
          * @returns {[fileName: string]: string | Blob} Returns an object with a .gltf, .glb and associates textures
          * as keys and their data and paths as values.
          */
-        static GLTF(scene: BABYLON.Scene, filename: string): {
-            [fileName: string]: string | Blob;
-        };
+        static GLTF(scene: BABYLON.Scene, filename: string): _GLTFData;
         /**
          *
          * @param meshes
@@ -33,17 +31,7 @@ declare module BABYLON {
          *
          * @returns {[fileName: string]: string | Blob} Returns an object with a .glb filename as key and data as value
          */
-        static GLB(scene: BABYLON.Scene, filename: string): {
-            [fileName: string]: string | Blob;
-        };
-        /**
-         * Downloads data from glTF object.
-         *
-         * @param gltfData glTF object with keys being file names and values being data
-         */
-        static downloadFiles(gltfData: {
-            [fileName: string]: string | Blob;
-        }): void;
+        static GLB(scene: BABYLON.Scene, filename: string): _GLTFData;
     }
 }
 
@@ -121,9 +109,7 @@ declare module BABYLON {
          * @returns {[x: string]: string | Blob} object with glTF json tex filename
          * and binary file name as keys and their data as values
          */
-        _generateGLTF(glTFPrefix: string): {
-            [x: string]: string | Blob;
-        };
+        _generateGLTF(glTFPrefix: string): _GLTFData;
         /**
          * Creates a binary buffer for glTF
          *
@@ -139,9 +125,7 @@ declare module BABYLON {
          *
          * @returns {[glbFileName: string]: Blob} object with glb filename as key and data as value
          */
-        _generateGLB(glTFPrefix: string): {
-            [glbFileName: string]: Blob;
-        };
+        _generateGLB(glTFPrefix: string): _GLTFData;
         /**
          * Sets the TRS for each node
          * @param node
@@ -173,3 +157,19 @@ declare module BABYLON {
         private createScene(babylonScene, byteOffset, dataBuffer?);
     }
 }
+
+declare module BABYLON {
+    /**
+     * Class for holding and downloading glTF file data
+     */
+    class _GLTFData {
+        _glTFFiles: {
+            [fileName: string]: string | Blob;
+        };
+        constructor();
+        /**
+         * Downloads glTF data.
+         */
+        downloadFiles(): void;
+    }
+}

+ 16 - 16
serializers/src/glTF/2.0/babylon.glTFData.ts

@@ -3,8 +3,8 @@ module BABYLON {
      * Class for holding and downloading glTF file data
      */
     export class _GLTFData {
-        _glTFFiles: {[fileName: string]: string | Blob};
-    
+        _glTFFiles: { [fileName: string]: string | Blob };
+
         public constructor() {
             this._glTFFiles = {};
         }
@@ -12,13 +12,13 @@ module BABYLON {
          * Downloads glTF data.
          */
         public downloadFiles(): void {
-             /**
-             * Checks for a matching suffix at the end of a string (for ES5 and lower)
-             * @param str 
-             * @param suffix 
-             * 
-             * @returns {boolean} indicating whether the suffix matches or not
-             */
+            /**
+            * Checks for a matching suffix at the end of a string (for ES5 and lower)
+            * @param str 
+            * @param suffix 
+            * 
+            * @returns {boolean} indicating whether the suffix matches or not
+            */
             function endsWith(str: string, suffix: string): boolean {
                 return str.indexOf(suffix, str.length - suffix.length) !== -1;
             }
@@ -29,21 +29,21 @@ module BABYLON {
                 link.download = key;
                 let blob = this._glTFFiles[key];
                 let mimeType;
-                
+
                 if (endsWith(key, ".glb")) {
-                    mimeType = {type: "model/gltf-binary"};
+                    mimeType = { type: "model/gltf-binary" };
                 }
                 else if (endsWith(key, ".bin")) {
-                    mimeType = {type: "application/octet-stream"};
+                    mimeType = { type: "application/octet-stream" };
                 }
                 else if (endsWith(key, ".gltf")) {
-                    mimeType = {type: "model/gltf+json"};
+                    mimeType = { type: "model/gltf+json" };
                 }
-    
+
                 link.href = window.URL.createObjectURL(new Blob([blob], mimeType));
                 link.click();
             }
-    
-        } 
+
+        }
     }
 }

+ 3 - 3
serializers/src/glTF/2.0/babylon.glTFExporter.ts

@@ -75,7 +75,7 @@ module BABYLON {
             let totalByteLength = 0;
 
             totalByteLength = this.createScene(this.babylonScene, totalByteLength);
-            
+
             this.totalByteLength = totalByteLength;
         }
 
@@ -334,7 +334,7 @@ module BABYLON {
             let binaryBuffer = new ArrayBuffer(this.totalByteLength);
             let dataBuffer = new DataView(binaryBuffer);
             byteOffset = this.createScene(this.babylonScene, byteOffset, dataBuffer);
-            
+
             return binaryBuffer;
         }
         /**
@@ -691,7 +691,7 @@ module BABYLON {
          * @returns {number} bytelength + byteoffset
          */
         private createScene(babylonScene: BABYLON.Scene, byteOffset: number, dataBuffer?: DataView): number {
-            if (babylonScene.meshes.length > 0 ) {
+            if (babylonScene.meshes.length > 0) {
                 let babylonMeshes = babylonScene.meshes;
                 let scene = { nodes: new Array<number>() };