Selaa lähdekoodia

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

Guide 6 vuotta sitten
vanhempi
commit
fe1769a64c
35 muutettua tiedostoa jossa 278 lisäystä ja 127 poistoa
  1. 8 6
      Playground/babylon.d.txt
  2. 1 1
      dist/preview release/babylon.js
  3. 24 24
      dist/preview release/babylon.max.js
  4. 1 1
      dist/preview release/babylon.max.js.map
  5. 1 1
      dist/preview release/glTF2Interface/package.json
  6. 2 2
      dist/preview release/gui/package.json
  7. 6 6
      dist/preview release/inspector/package.json
  8. 2 2
      dist/preview release/loaders/babylon.glTF2FileLoader.js
  9. 1 1
      dist/preview release/loaders/babylon.glTF2FileLoader.js.map
  10. 1 1
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  11. 2 2
      dist/preview release/loaders/babylon.glTFFileLoader.js
  12. 1 1
      dist/preview release/loaders/babylon.glTFFileLoader.js.map
  13. 1 1
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  14. 2 2
      dist/preview release/loaders/babylonjs.loaders.js
  15. 1 1
      dist/preview release/loaders/babylonjs.loaders.js.map
  16. 1 1
      dist/preview release/loaders/babylonjs.loaders.min.js
  17. 3 3
      dist/preview release/loaders/package.json
  18. 2 2
      dist/preview release/materialsLibrary/package.json
  19. 1 1
      dist/preview release/package.json
  20. 2 2
      dist/preview release/postProcessesLibrary/package.json
  21. 2 2
      dist/preview release/proceduralTexturesLibrary/package.json
  22. 8 6
      dist/preview release/serializers/babylonjs.serializers.d.ts
  23. 72 20
      dist/preview release/serializers/babylonjs.serializers.js
  24. 1 1
      dist/preview release/serializers/babylonjs.serializers.js.map
  25. 1 1
      dist/preview release/serializers/babylonjs.serializers.min.js
  26. 16 12
      dist/preview release/serializers/babylonjs.serializers.module.d.ts
  27. 3 3
      dist/preview release/serializers/package.json
  28. 45 0
      dist/preview release/viewer/babylon.viewer.d.ts
  29. 10 10
      dist/preview release/viewer/babylon.viewer.js
  30. 2 2
      dist/preview release/viewer/babylon.viewer.max.js
  31. 45 1
      dist/preview release/viewer/babylon.viewer.module.d.ts
  32. 2 2
      loaders/src/glTF/2.0/glTFLoader.ts
  33. 2 2
      package.json
  34. 2 2
      src/Engines/engine.ts
  35. 4 2
      src/Shaders/ShadersInclude/pbrBRDFFunctions.fx

+ 8 - 6
Playground/babylon.d.txt

@@ -61456,17 +61456,19 @@ declare module BABYLON.GLTF2.Exporter.Extensions {
 }
 declare module BABYLON {
     /**
-     * Class for generating STL data from a Babylon scene.
-     */
+    * Class for generating STL data from a Babylon scene.
+    */
     export class STLExport {
         /**
         * Exports the geometry of a Mesh array in .STL file format (ASCII)
-        * @param mesh defines the mesh to serialize
-        * @param fileName Name of the file when downloaded.
+        * @param meshes list defines the mesh to serialize
         * @param download triggers the automatic download of the file.
-        * @returns the ASCII STL format
+        * @param fileName changes the downloads fileName.
+        * @param binary changes the STL to a binary type.
+        * @param isLittleEndian toggle for binary type exporter.
+        * @returns the STL as UTF8 string
         */
-        static ASCII(mesh: Mesh, download?: boolean, fileName?: string): string;
+        static CreateSTL(meshes: Mesh[], download?: boolean, fileName?: string, binary?: boolean, isLittleEndian?: boolean): any;
     }
 }
 /**

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


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 24 - 24
dist/preview release/babylon.max.js


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


+ 1 - 1
dist/preview release/glTF2Interface/package.json

@@ -1,7 +1,7 @@
 {
     "name": "babylonjs-gltf2interface",
     "description": "A typescript declaration of babylon's gltf2 inteface.",
-    "version": "4.0.0-alpha.29",
+    "version": "4.0.0-alpha.30",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"

+ 2 - 2
dist/preview release/gui/package.json

@@ -4,7 +4,7 @@
     },
     "name": "babylonjs-gui",
     "description": "The Babylon.js GUI library is an extension you can use to generate interactive user interface. It is build on top of the DynamicTexture.",
-    "version": "4.0.0-alpha.29",
+    "version": "4.0.0-alpha.30",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"
@@ -28,7 +28,7 @@
     ],
     "license": "Apache-2.0",
     "dependencies": {
-        "babylonjs": "4.0.0-alpha.29"
+        "babylonjs": "4.0.0-alpha.30"
     },
     "engines": {
         "node": "*"

+ 6 - 6
dist/preview release/inspector/package.json

@@ -4,7 +4,7 @@
     },
     "name": "babylonjs-inspector",
     "description": "The Babylon.js inspector.",
-    "version": "4.0.0-alpha.29",
+    "version": "4.0.0-alpha.30",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"
@@ -31,11 +31,11 @@
     "dependencies": {
         "@types/react": "~16.7.3",
         "@types/react-dom": "~16.0.9",
-        "babylonjs": "4.0.0-alpha.29",
-        "babylonjs-gui": "4.0.0-alpha.29",
-        "babylonjs-loaders": "4.0.0-alpha.29",
-        "babylonjs-serializers": "4.0.0-alpha.29",
-        "babylonjs-gltf2interface": "4.0.0-alpha.29"
+        "babylonjs": "4.0.0-alpha.30",
+        "babylonjs-gui": "4.0.0-alpha.30",
+        "babylonjs-loaders": "4.0.0-alpha.30",
+        "babylonjs-serializers": "4.0.0-alpha.30",
+        "babylonjs-gltf2interface": "4.0.0-alpha.30"
     },
     "engines": {
         "node": "*"

+ 2 - 2
dist/preview release/loaders/babylon.glTF2FileLoader.js

@@ -1573,8 +1573,8 @@ var GLTFLoader = /** @class */ (function () {
             if (nodes) {
                 promises.push(_this.loadSceneAsync("/nodes", { nodes: nodes, index: -1 }));
             }
-            else if (_this._gltf.scene != undefined) {
-                var scene = ArrayItem.Get("/scene", _this._gltf.scenes, _this._gltf.scene);
+            else if (_this._gltf.scene != undefined || (_this._gltf.scenes && _this._gltf.scenes[0])) {
+                var scene = ArrayItem.Get("/scene", _this._gltf.scenes, _this._gltf.scene || 0);
                 promises.push(_this.loadSceneAsync("/scenes/" + scene.index, scene));
             }
             if (_this._parent.compileMaterials) {

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.js.map


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


+ 2 - 2
dist/preview release/loaders/babylon.glTFFileLoader.js

@@ -4122,8 +4122,8 @@ var GLTFLoader = /** @class */ (function () {
             if (nodes) {
                 promises.push(_this.loadSceneAsync("/nodes", { nodes: nodes, index: -1 }));
             }
-            else if (_this._gltf.scene != undefined) {
-                var scene = ArrayItem.Get("/scene", _this._gltf.scenes, _this._gltf.scene);
+            else if (_this._gltf.scene != undefined || (_this._gltf.scenes && _this._gltf.scenes[0])) {
+                var scene = ArrayItem.Get("/scene", _this._gltf.scenes, _this._gltf.scene || 0);
                 promises.push(_this.loadSceneAsync("/scenes/" + scene.index, scene));
             }
             if (_this._parent.compileMaterials) {

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
dist/preview release/loaders/babylon.glTFFileLoader.js.map


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


+ 2 - 2
dist/preview release/loaders/babylonjs.loaders.js

@@ -5438,8 +5438,8 @@ var GLTFLoader = /** @class */ (function () {
             if (nodes) {
                 promises.push(_this.loadSceneAsync("/nodes", { nodes: nodes, index: -1 }));
             }
-            else if (_this._gltf.scene != undefined) {
-                var scene = ArrayItem.Get("/scene", _this._gltf.scenes, _this._gltf.scene);
+            else if (_this._gltf.scene != undefined || (_this._gltf.scenes && _this._gltf.scenes[0])) {
+                var scene = ArrayItem.Get("/scene", _this._gltf.scenes, _this._gltf.scene || 0);
                 promises.push(_this.loadSceneAsync("/scenes/" + scene.index, scene));
             }
             if (_this._parent.compileMaterials) {

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


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


+ 3 - 3
dist/preview release/loaders/package.json

@@ -4,7 +4,7 @@
     },
     "name": "babylonjs-loaders",
     "description": "The Babylon.js file loaders library is an extension you can use to load different 3D file types into a Babylon scene.",
-    "version": "4.0.0-alpha.29",
+    "version": "4.0.0-alpha.30",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"
@@ -28,8 +28,8 @@
     ],
     "license": "Apache-2.0",
     "dependencies": {
-        "babylonjs-gltf2interface": "4.0.0-alpha.29",
-        "babylonjs": "4.0.0-alpha.29"
+        "babylonjs-gltf2interface": "4.0.0-alpha.30",
+        "babylonjs": "4.0.0-alpha.30"
     },
     "engines": {
         "node": "*"

+ 2 - 2
dist/preview release/materialsLibrary/package.json

@@ -4,7 +4,7 @@
     },
     "name": "babylonjs-materials",
     "description": "The Babylon.js materials library is a collection of advanced materials to be used in a Babylon.js scene.",
-    "version": "4.0.0-alpha.29",
+    "version": "4.0.0-alpha.30",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"
@@ -28,7 +28,7 @@
     ],
     "license": "Apache-2.0",
     "dependencies": {
-        "babylonjs": "4.0.0-alpha.29"
+        "babylonjs": "4.0.0-alpha.30"
     },
     "engines": {
         "node": "*"

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

@@ -9,7 +9,7 @@
     ],
     "name": "babylonjs",
     "description": "Babylon.js is a JavaScript 3D engine based on webgl.",
-    "version": "4.0.0-alpha.29",
+    "version": "4.0.0-alpha.30",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"

+ 2 - 2
dist/preview release/postProcessesLibrary/package.json

@@ -4,7 +4,7 @@
     },
     "name": "babylonjs-post-process",
     "description": "The Babylon.js materials library is a collection of advanced materials to be used in a Babylon.js scene.",
-    "version": "4.0.0-alpha.29",
+    "version": "4.0.0-alpha.30",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"
@@ -28,7 +28,7 @@
     ],
     "license": "Apache-2.0",
     "dependencies": {
-        "babylonjs": "4.0.0-alpha.29"
+        "babylonjs": "4.0.0-alpha.30"
     },
     "engines": {
         "node": "*"

+ 2 - 2
dist/preview release/proceduralTexturesLibrary/package.json

@@ -4,7 +4,7 @@
     },
     "name": "babylonjs-procedural-textures",
     "description": "The Babylon.js materials library is a collection of advanced materials to be used in a Babylon.js scene.",
-    "version": "4.0.0-alpha.29",
+    "version": "4.0.0-alpha.30",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"
@@ -28,7 +28,7 @@
     ],
     "license": "Apache-2.0",
     "dependencies": {
-        "babylonjs": "4.0.0-alpha.29"
+        "babylonjs": "4.0.0-alpha.30"
     },
     "engines": {
         "node": "*"

+ 8 - 6
dist/preview release/serializers/babylonjs.serializers.d.ts

@@ -1058,16 +1058,18 @@ declare module BABYLON.GLTF2.Exporter.Extensions {
 }
 declare module BABYLON {
     /**
-     * Class for generating STL data from a Babylon scene.
-     */
+    * Class for generating STL data from a Babylon scene.
+    */
     export class STLExport {
         /**
         * Exports the geometry of a Mesh array in .STL file format (ASCII)
-        * @param mesh defines the mesh to serialize
-        * @param fileName Name of the file when downloaded.
+        * @param meshes list defines the mesh to serialize
         * @param download triggers the automatic download of the file.
-        * @returns the ASCII STL format
+        * @param fileName changes the downloads fileName.
+        * @param binary changes the STL to a binary type.
+        * @param isLittleEndian toggle for binary type exporter.
+        * @returns the STL as UTF8 string
         */
-        static ASCII(mesh: Mesh, download?: boolean, fileName?: string): string;
+        static CreateSTL(meshes: Mesh[], download?: boolean, fileName?: string, binary?: boolean, isLittleEndian?: boolean): any;
     }
 }

+ 72 - 20
dist/preview release/serializers/babylonjs.serializers.js

@@ -4537,24 +4537,27 @@ __webpack_require__.r(__webpack_exports__);
 
 
 /**
- * Class for generating STL data from a Babylon scene.
- */
+* Class for generating STL data from a Babylon scene.
+*/
 var STLExport = /** @class */ (function () {
     function STLExport() {
     }
     /**
     * Exports the geometry of a Mesh array in .STL file format (ASCII)
-    * @param mesh defines the mesh to serialize
-    * @param fileName Name of the file when downloaded.
+    * @param meshes list defines the mesh to serialize
     * @param download triggers the automatic download of the file.
-    * @returns the ASCII STL format
+    * @param fileName changes the downloads fileName.
+    * @param binary changes the STL to a binary type.
+    * @param isLittleEndian toggle for binary type exporter.
+    * @returns the STL as UTF8 string
     */
-    STLExport.ASCII = function (mesh, download, fileName) {
-        if (download === void 0) { download = false; }
-        var data = 'solid exportedMesh\r\n';
-        var vertices = mesh.getVerticesData(babylonjs_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__["VertexBuffer"].PositionKind) || [];
-        var indices = mesh.getIndices() || [];
-        for (var i = 0; i < indices.length; i += 3) {
+    STLExport.CreateSTL = function (meshes, download, fileName, binary, isLittleEndian) {
+        //Binary support adapted from https://gist.github.com/paulkaplan/6d5f0ab2c7e8fdc68a61
+        if (download === void 0) { download = true; }
+        if (fileName === void 0) { fileName = 'STL_Mesh'; }
+        if (binary === void 0) { binary = false; }
+        if (isLittleEndian === void 0) { isLittleEndian = true; }
+        var getFaceData = function (indices, vertices, i) {
             var id = [indices[i] * 3, indices[i + 1] * 3, indices[i + 2] * 3];
             var v = [
                 new babylonjs_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__["Vector3"](vertices[id[0]], vertices[id[0] + 1], vertices[id[0] + 2]),
@@ -4564,15 +4567,64 @@ var STLExport = /** @class */ (function () {
             var p1p2 = v[0].subtract(v[1]);
             var p3p2 = v[2].subtract(v[1]);
             var n = (babylonjs_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__["Vector3"].Cross(p1p2, p3p2)).normalize();
-            data += 'facet normal ' + n.x + ' ' + n.y + ' ' + n.z + '\r\n';
-            data += '\touter loop\r\n';
-            data += '\t\tvertex ' + v[0].x + ' ' + v[0].y + ' ' + v[0].z + '\r\n';
-            data += '\t\tvertex ' + v[1].x + ' ' + v[1].y + ' ' + v[1].z + '\r\n';
-            data += '\t\tvertex ' + v[2].x + ' ' + v[2].y + ' ' + v[2].z + '\r\n';
-            data += '\tendloop\r\n';
-            data += 'endfacet\r\n';
-        }
-        data += 'endsolid exportedMesh';
+            return { v: v, n: n };
+        };
+        var writeVector = function (dataview, offset, vector, isLittleEndian) {
+            offset = writeFloat(dataview, offset, vector.x, isLittleEndian);
+            offset = writeFloat(dataview, offset, vector.y, isLittleEndian);
+            return writeFloat(dataview, offset, vector.z, isLittleEndian);
+        };
+        var writeFloat = function (dataview, offset, value, isLittleEndian) {
+            dataview.setFloat32(offset, value, isLittleEndian);
+            return offset + 4;
+        };
+        var data;
+        var faceCount = 0;
+        var offset = 0;
+        if (binary) {
+            for (var i = 0; i < meshes.length; i++) {
+                var mesh = meshes[i];
+                var indices = mesh.getIndices();
+                faceCount += indices ? indices.length : 0;
+            }
+            var bufferSize = 84 + (50 * faceCount);
+            var buffer = new ArrayBuffer(bufferSize);
+            data = new DataView(buffer);
+            offset += 80;
+            data.setUint32(offset, faceCount, isLittleEndian);
+            offset += 4;
+        }
+        else {
+            data = 'solid exportedMesh\r\n';
+        }
+        for (var i = 0; i < meshes.length; i++) {
+            var mesh = meshes[i];
+            mesh.bakeCurrentTransformIntoVertices();
+            var vertices = mesh.getVerticesData(babylonjs_Meshes_buffer__WEBPACK_IMPORTED_MODULE_0__["VertexBuffer"].PositionKind) || [];
+            var indices = mesh.getIndices() || [];
+            for (var i_1 = 0; i_1 < indices.length; i_1 += 3) {
+                var fd = getFaceData(indices, vertices, i_1);
+                if (binary) {
+                    offset = writeVector(data, offset, fd.n, isLittleEndian);
+                    offset = writeVector(data, offset, fd.v[0], isLittleEndian);
+                    offset = writeVector(data, offset, fd.v[1], isLittleEndian);
+                    offset = writeVector(data, offset, fd.v[2], isLittleEndian);
+                    offset += 2;
+                }
+                else {
+                    data += 'facet normal ' + fd.n.x + ' ' + fd.n.y + ' ' + fd.n.z + '\r\n';
+                    data += '\touter loop\r\n';
+                    data += '\t\tvertex ' + fd.v[0].x + ' ' + fd.v[0].y + ' ' + fd.v[0].z + '\r\n';
+                    data += '\t\tvertex ' + fd.v[1].x + ' ' + fd.v[1].y + ' ' + fd.v[1].z + '\r\n';
+                    data += '\t\tvertex ' + fd.v[2].x + ' ' + fd.v[2].y + ' ' + fd.v[2].z + '\r\n';
+                    data += '\tendloop\r\n';
+                    data += 'endfacet\r\n';
+                }
+            }
+        }
+        if (!binary) {
+            data += 'endsolid exportedMesh';
+        }
         if (download) {
             var a = document.createElement('a');
             var blob = new Blob([data], { 'type': 'application/octet-stream' });

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


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


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

@@ -1137,17 +1137,19 @@ declare module "babylonjs-serializers/glTF/index" {
 declare module "babylonjs-serializers/stl/stlSerializer" {
     import { Mesh } from "babylonjs/Meshes/mesh";
     /**
-     * Class for generating STL data from a Babylon scene.
-     */
+    * Class for generating STL data from a Babylon scene.
+    */
     export class STLExport {
         /**
         * Exports the geometry of a Mesh array in .STL file format (ASCII)
-        * @param mesh defines the mesh to serialize
-        * @param fileName Name of the file when downloaded.
+        * @param meshes list defines the mesh to serialize
         * @param download triggers the automatic download of the file.
-        * @returns the ASCII STL format
+        * @param fileName changes the downloads fileName.
+        * @param binary changes the STL to a binary type.
+        * @param isLittleEndian toggle for binary type exporter.
+        * @returns the STL as UTF8 string
         */
-        static ASCII(mesh: Mesh, download?: boolean, fileName?: string): string;
+        static CreateSTL(meshes: Mesh[], download?: boolean, fileName?: string, binary?: boolean, isLittleEndian?: boolean): any;
     }
 }
 declare module "babylonjs-serializers/stl/index" {
@@ -2237,16 +2239,18 @@ declare module BABYLON.GLTF2.Exporter.Extensions {
 }
 declare module BABYLON {
     /**
-     * Class for generating STL data from a Babylon scene.
-     */
+    * Class for generating STL data from a Babylon scene.
+    */
     export class STLExport {
         /**
         * Exports the geometry of a Mesh array in .STL file format (ASCII)
-        * @param mesh defines the mesh to serialize
-        * @param fileName Name of the file when downloaded.
+        * @param meshes list defines the mesh to serialize
         * @param download triggers the automatic download of the file.
-        * @returns the ASCII STL format
+        * @param fileName changes the downloads fileName.
+        * @param binary changes the STL to a binary type.
+        * @param isLittleEndian toggle for binary type exporter.
+        * @returns the STL as UTF8 string
         */
-        static ASCII(mesh: Mesh, download?: boolean, fileName?: string): string;
+        static CreateSTL(meshes: Mesh[], download?: boolean, fileName?: string, binary?: boolean, isLittleEndian?: boolean): any;
     }
 }

+ 3 - 3
dist/preview release/serializers/package.json

@@ -4,7 +4,7 @@
     },
     "name": "babylonjs-serializers",
     "description": "The Babylon.js serializers library is an extension you can use to serialize Babylon scenes.",
-    "version": "4.0.0-alpha.29",
+    "version": "4.0.0-alpha.30",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"
@@ -28,8 +28,8 @@
     ],
     "license": "Apache-2.0",
     "dependencies": {
-        "babylonjs": "4.0.0-alpha.29",
-        "babylonjs-gltf2interface": "4.0.0-alpha.29"
+        "babylonjs": "4.0.0-alpha.30",
+        "babylonjs-gltf2interface": "4.0.0-alpha.30"
     },
     "engines": {
         "node": "*"

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

@@ -463,6 +463,51 @@ declare module BabylonViewer {
 }
 declare module BabylonViewer {
     /**
+        * The data structure of a telemetry event.
+        */
+    export interface TelemetryData {
+            event: string;
+            session: string;
+            date: Date;
+            now: number;
+            viewerId?: string;
+            detail: any;
+    }
+    /**
+        * Receives Telemetry events and raises events to the API
+        */
+    export class TelemetryManager {
+            onEventBroadcastedObservable: BABYLON.Observable<TelemetryData>;
+            /**
+                * Receives a telemetry event
+                * @param event The name of the Telemetry event
+                * @param details An additional value, or an object containing a list of property/value pairs
+                */
+            readonly broadcast: (event: string, viewerId?: string | undefined, details?: any) => void;
+            /**
+                * Log a Telemetry event for errors raised on the WebGL context.
+                * @param engine The Babylon engine with the WebGL context.
+                */
+            flushWebGLErrors(engine: BABYLON.Engine, viewerId?: string): void;
+            /**
+                * Enable or disable telemetry events
+                * @param enabled Boolan, true if events are enabled
+                */
+            enable: boolean;
+            /**
+                * Returns the current session ID or creates one if it doesn't exixt
+                * @return The current session ID
+                */
+            readonly session: string;
+            /**
+                * Disposes the telemetry manager
+                */
+            dispose(): void;
+    }
+    export const telemetryManager: TelemetryManager;
+}
+declare module BabylonViewer {
+    /**
         * An instance of the class is in charge of loading the model correctly.
         * This class will continously be expended with tasks required from the specific loaders Babylon has.
         *

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 10 - 10
dist/preview release/viewer/babylon.viewer.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 2 - 2
dist/preview release/viewer/babylon.viewer.max.js


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

@@ -508,7 +508,51 @@ declare module 'babylonjs-viewer/viewer/viewer' {
 }
 
 declare module 'babylonjs-viewer/managers/telemetryManager' {
-    
+    import { Observable } from "babylonjs/Misc/observable";
+    import { Engine } from "babylonjs/Engines/engine";
+    /**
+        * The data structure of a telemetry event.
+        */
+    export interface TelemetryData {
+            event: string;
+            session: string;
+            date: Date;
+            now: number;
+            viewerId?: string;
+            detail: any;
+    }
+    /**
+        * Receives Telemetry events and raises events to the API
+        */
+    export class TelemetryManager {
+            onEventBroadcastedObservable: Observable<TelemetryData>;
+            /**
+                * Receives a telemetry event
+                * @param event The name of the Telemetry event
+                * @param details An additional value, or an object containing a list of property/value pairs
+                */
+            readonly broadcast: (event: string, viewerId?: string | undefined, details?: any) => void;
+            /**
+                * Log a Telemetry event for errors raised on the WebGL context.
+                * @param engine The Babylon engine with the WebGL context.
+                */
+            flushWebGLErrors(engine: Engine, viewerId?: string): void;
+            /**
+                * Enable or disable telemetry events
+                * @param enabled Boolan, true if events are enabled
+                */
+            enable: boolean;
+            /**
+                * Returns the current session ID or creates one if it doesn't exixt
+                * @return The current session ID
+                */
+            readonly session: string;
+            /**
+                * Disposes the telemetry manager
+                */
+            dispose(): void;
+    }
+    export const telemetryManager: TelemetryManager;
 }
 
 declare module 'babylonjs-viewer/loader/modelLoader' {

+ 2 - 2
loaders/src/glTF/2.0/glTFLoader.ts

@@ -276,8 +276,8 @@ export class GLTFLoader implements IGLTFLoader {
             if (nodes) {
                 promises.push(this.loadSceneAsync("/nodes", { nodes: nodes, index: -1 }));
             }
-            else if (this._gltf.scene != undefined) {
-                const scene = ArrayItem.Get(`/scene`, this._gltf.scenes, this._gltf.scene);
+            else if (this._gltf.scene != undefined || (this._gltf.scenes && this._gltf.scenes[0])) {
+                const scene = ArrayItem.Get(`/scene`, this._gltf.scenes, this._gltf.scene || 0);
                 promises.push(this.loadSceneAsync(`/scenes/${scene.index}`, scene));
             }
 

+ 2 - 2
package.json

@@ -9,7 +9,7 @@
     ],
     "name": "babylonjs",
     "description": "Babylon.js is a JavaScript 3D engine based on webgl.",
-    "version": "4.0.0-alpha.29",
+    "version": "4.0.0-alpha.30",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"
@@ -105,4 +105,4 @@
         "webpack-stream": "5.0.0",
         "xhr2": "^0.1.4"
     }
-}
+}

+ 2 - 2
src/Engines/engine.ts

@@ -495,14 +495,14 @@ export class Engine {
      */
     // Not mixed with Version for tooling purpose.
     public static get NpmPackage(): string {
-        return "babylonjs@4.0.0-alpha.29";
+        return "babylonjs@4.0.0-alpha.30";
     }
 
     /**
      * Returns the current version of the framework
      */
     public static get Version(): string {
-        return "4.0.0-alpha.29";
+        return "4.0.0-alpha.30";
     }
 
     /**

+ 4 - 2
src/Shaders/ShadersInclude/pbrBRDFFunctions.fx

@@ -33,7 +33,9 @@
         #endif
         return reflectance;
     }
-#else
+#endif
+
+#if !defined(ENVIRONMENTBRDF) || defined(REFLECTIONMAP_SKYBOX) || defined(ALPHAFRESNEL)
     vec3 getReflectanceFromAnalyticalBRDFLookup_Jones(float VdotN, vec3 reflectance0, vec3 reflectance90, float smoothness)
     {
         // Schlick fresnel approximation, extended with basic smoothness term so that rough surfaces do not approach reflectance90 at grazing angle
@@ -284,4 +286,4 @@ float diffuseBRDF_Burley(float NdotL, float NdotV, float VdotH, float roughness)
         (1.0 + (diffuseFresnel90 - 1.0) * diffuseFresnelNV);
 
     return fresnel / PI;
-}
+}