David Catuhe 7 lat temu
rodzic
commit
0c60ebaa34

Plik diff jest za duży
+ 11846 - 11814
Playground/babylon.d.txt


Plik diff jest za duży
+ 19052 - 19020
dist/preview release/babylon.d.ts


Plik diff jest za duży
+ 1 - 1
dist/preview release/babylon.js


+ 64 - 22
dist/preview release/babylon.max.js

@@ -11293,7 +11293,7 @@ var BABYLON;
     var Engine = /** @class */ (function () {
         /**
          * Creates a new engine
-         * @param canvasOrContext defines the canvas or WebGL context to use for rendering
+         * @param canvasOrContext defines the canvas or WebGL context to use for rendering. If you provide a WebGL context, Babylon.js will not hook events on the canvas (like pointers, keyboards, etc...) so no event observables will be available. This is mostly used when Babylon.js is used as a plugin on a system which alreay used the WebGL context
          * @param antialias defines enable antialiasing (default: false)
          * @param options defines further options to be sent to the getContext() function
          * @param adaptToDeviceRatio defines whether to adapt to the device's viewport characteristics (default: false)
@@ -23445,8 +23445,11 @@ var BABYLON;
             // Set back stencil to false in case it changes before the edge renderer.
             engine.setStencilBuffer(false);
             // Edges
-            for (var edgesRendererIndex = 0; edgesRendererIndex < this._edgesRenderers.length; edgesRendererIndex++) {
-                this._edgesRenderers.data[edgesRendererIndex].render();
+            if (this._edgesRenderers.length) {
+                for (var edgesRendererIndex = 0; edgesRendererIndex < this._edgesRenderers.length; edgesRendererIndex++) {
+                    this._edgesRenderers.data[edgesRendererIndex].render();
+                }
+                engine.setAlphaMode(BABYLON.Engine.ALPHA_DISABLE);
             }
             // Restore Stencil state.
             engine.setStencilBuffer(stencilState);
@@ -30957,6 +30960,29 @@ var BABYLON;
             this._delayedOnLoad = null;
             this._delayedOnError = null;
         };
+        /**
+        * Default is Trilinear mode.
+        *
+        * | Value | Type               | Description |
+        * | ----- | ------------------ | ----------- |
+        * | 1     | NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR  | Nearest is: mag = nearest, min = nearest, mip = linear |
+        * | 2     | BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST | Bilinear is: mag = linear, min = linear, mip = nearest |
+        * | 3     | TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR | Trilinear is: mag = linear, min = linear, mip = linear |
+        * | 4     | NEAREST_NEAREST_MIPNEAREST |             |
+        * | 5    | NEAREST_LINEAR_MIPNEAREST |             |
+        * | 6    | NEAREST_LINEAR_MIPLINEAR |             |
+        * | 7    | NEAREST_LINEAR |             |
+        * | 8    | NEAREST_NEAREST |             |
+        * | 9   | LINEAR_NEAREST_MIPNEAREST |             |
+        * | 10   | LINEAR_NEAREST_MIPLINEAR |             |
+        * | 11   | LINEAR_LINEAR |             |
+        * | 12   | LINEAR_NEAREST |             |
+        *
+        *    > _mag_: magnification filter (close to the viewer)
+        *    > _min_: minification filter (far from the viewer)
+        *    > _mip_: filter used between mip map levels
+        *
+        */
         Texture.prototype.updateSamplingMode = function (samplingMode) {
             if (!this._texture) {
                 return;
@@ -31875,14 +31901,15 @@ var BABYLON;
         };
         /**
          * Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.
-         * If the parameter `copyWhenShared` is true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.
-         * Returns an empty array if the mesh has no geometry.
+         * @param copyWhenShared If true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.
+         * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it
+         * @returns the indices array or an empty array if the mesh has no geometry
          */
-        Mesh.prototype.getIndices = function (copyWhenShared) {
+        Mesh.prototype.getIndices = function (copyWhenShared, forceCopy) {
             if (!this._geometry) {
                 return [];
             }
-            return this._geometry.getIndices(copyWhenShared);
+            return this._geometry.getIndices(copyWhenShared, forceCopy);
         };
         Object.defineProperty(Mesh.prototype, "isBlocked", {
             get: function () {
@@ -34332,11 +34359,11 @@ var BABYLON;
         };
         /**
          * Merge the array of meshes into a single mesh for performance reasons.
-         * @param {Array<Mesh>} meshes - The vertices source.  They should all be of the same material.  Entries can empty
-         * @param {boolean} disposeSource - When true (default), dispose of the vertices from the source meshes
-         * @param {boolean} allow32BitsIndices - When the sum of the vertices > 64k, this must be set to true.
-         * @param {Mesh} meshSubclass - When set, vertices inserted into this Mesh.  Meshes can then be merged into a Mesh sub-class.
-         * @param {boolean} subdivideWithSubMeshes - When true (false default), subdivide mesh to his subMesh array with meshes source.
+         * @param meshes - The vertices source.  They should all be of the same material.  Entries can empty
+         * @param disposeSource - When true (default), dispose of the vertices from the source meshes
+         * @param allow32BitsIndices - When the sum of the vertices > 64k, this must be set to true.
+         * @param meshSubclass - When set, vertices inserted into this Mesh.  Meshes can then be merged into a Mesh sub-class.
+         * @param subdivideWithSubMeshes - When true (false default), subdivide mesh to his subMesh array with meshes source.
          */
         Mesh.MergeMeshes = function (meshes, disposeSource, allow32BitsIndices, meshSubclass, subdivideWithSubMeshes) {
             if (disposeSource === void 0) { disposeSource = true; }
@@ -34361,11 +34388,11 @@ var BABYLON;
             var source = null;
             for (index = 0; index < meshes.length; index++) {
                 if (meshes[index]) {
-                    meshes[index].computeWorldMatrix(true);
+                    var wm = meshes[index].computeWorldMatrix(true);
                     otherVertexData = BABYLON.VertexData.ExtractFromMesh(meshes[index], true, true);
-                    otherVertexData.transform(meshes[index].getWorldMatrix());
+                    otherVertexData.transform(wm);
                     if (vertexData) {
-                        vertexData.merge(otherVertexData);
+                        vertexData.merge(otherVertexData, allow32BitsIndices);
                     }
                     else {
                         vertexData = otherVertexData;
@@ -36821,9 +36848,11 @@ var BABYLON;
         /**
          * Merges the passed VertexData into the current one
          * @param other the VertexData to be merged into the current one
+         * @param use32BitsIndices defines a boolean indicating if indices must be store in a 32 bits array
          * @returns the modified VertexData
          */
-        VertexData.prototype.merge = function (other) {
+        VertexData.prototype.merge = function (other, use32BitsIndices) {
+            if (use32BitsIndices === void 0) { use32BitsIndices = false; }
             this._validate();
             other._validate();
             if (!this.normals !== !other.normals ||
@@ -36849,7 +36878,7 @@ var BABYLON;
                 var isSrcTypedArray = this.indices.BYTES_PER_ELEMENT !== undefined;
                 if (isSrcTypedArray) {
                     var len = this.indices.length + other.indices.length;
-                    var temp = this.indices instanceof Uint32Array ? new Uint32Array(len) : new Uint16Array(len);
+                    var temp = use32BitsIndices || this.indices instanceof Uint32Array ? new Uint32Array(len) : new Uint16Array(len);
                     temp.set(this.indices);
                     var decal = this.indices.length;
                     for (var index = 0; index < other.indices.length; index++) {
@@ -37072,7 +37101,7 @@ var BABYLON;
             if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesWeightsExtraKind)) {
                 result.matricesWeightsExtra = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.MatricesWeightsExtraKind, copyWhenShared, forceCopy);
             }
-            result.indices = meshOrGeometry.getIndices(copyWhenShared);
+            result.indices = meshOrGeometry.getIndices(copyWhenShared, forceCopy);
             return result;
         };
         /**
@@ -39375,7 +39404,14 @@ var BABYLON;
                     return new Float32Array(data, vertexBuffer.byteOffset, count);
                 }
                 else {
-                    return new Float32Array(data.buffer, data.byteOffset + vertexBuffer.byteOffset, count);
+                    var offset = data.byteOffset + vertexBuffer.byteOffset;
+                    if (forceCopy || (copyWhenShared && this._meshes.length !== 1)) {
+                        var result = new Float32Array(count);
+                        var source = new Float32Array(data.buffer, offset, count);
+                        result.set(source);
+                        return result;
+                    }
+                    return new Float32Array(data.buffer, offset, count);
                 }
             }
             if (forceCopy || (copyWhenShared && this._meshes.length !== 1)) {
@@ -39506,14 +39542,15 @@ var BABYLON;
         /**
          * Gets the index buffer array
          * @param copyWhenShared defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes
+         * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it
          * @returns the index buffer array
          */
-        Geometry.prototype.getIndices = function (copyWhenShared) {
+        Geometry.prototype.getIndices = function (copyWhenShared, forceCopy) {
             if (!this.isReady()) {
                 return null;
             }
             var orig = this._indices;
-            if (!copyWhenShared || this._meshes.length === 1) {
+            if (!forceCopy && (!copyWhenShared || this._meshes.length === 1)) {
                 return orig;
             }
             else {
@@ -99346,6 +99383,12 @@ var BABYLON;
             }
             var engine = scene.getEngine();
             this._lineShader._preBind();
+            if (this._source.edgesColor.a !== 1) {
+                engine.setAlphaMode(BABYLON.Engine.ALPHA_COMBINE);
+            }
+            else {
+                engine.setAlphaMode(BABYLON.Engine.ALPHA_DISABLE);
+            }
             // VBOs
             engine.bindBuffers(this._buffers, this._ib, this._lineShader.getEffect());
             scene.resetCachedMaterial();
@@ -99361,7 +99404,6 @@ var BABYLON;
             // Draw order
             engine.drawElementsType(BABYLON.Material.TriangleFillMode, 0, this._indicesCount);
             this._lineShader.unbind();
-            engine.setDepthWrite(true);
         };
         return EdgesRenderer;
     }());

+ 64 - 22
dist/preview release/babylon.no-module.max.js

@@ -11260,7 +11260,7 @@ var BABYLON;
     var Engine = /** @class */ (function () {
         /**
          * Creates a new engine
-         * @param canvasOrContext defines the canvas or WebGL context to use for rendering
+         * @param canvasOrContext defines the canvas or WebGL context to use for rendering. If you provide a WebGL context, Babylon.js will not hook events on the canvas (like pointers, keyboards, etc...) so no event observables will be available. This is mostly used when Babylon.js is used as a plugin on a system which alreay used the WebGL context
          * @param antialias defines enable antialiasing (default: false)
          * @param options defines further options to be sent to the getContext() function
          * @param adaptToDeviceRatio defines whether to adapt to the device's viewport characteristics (default: false)
@@ -23412,8 +23412,11 @@ var BABYLON;
             // Set back stencil to false in case it changes before the edge renderer.
             engine.setStencilBuffer(false);
             // Edges
-            for (var edgesRendererIndex = 0; edgesRendererIndex < this._edgesRenderers.length; edgesRendererIndex++) {
-                this._edgesRenderers.data[edgesRendererIndex].render();
+            if (this._edgesRenderers.length) {
+                for (var edgesRendererIndex = 0; edgesRendererIndex < this._edgesRenderers.length; edgesRendererIndex++) {
+                    this._edgesRenderers.data[edgesRendererIndex].render();
+                }
+                engine.setAlphaMode(BABYLON.Engine.ALPHA_DISABLE);
             }
             // Restore Stencil state.
             engine.setStencilBuffer(stencilState);
@@ -30924,6 +30927,29 @@ var BABYLON;
             this._delayedOnLoad = null;
             this._delayedOnError = null;
         };
+        /**
+        * Default is Trilinear mode.
+        *
+        * | Value | Type               | Description |
+        * | ----- | ------------------ | ----------- |
+        * | 1     | NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR  | Nearest is: mag = nearest, min = nearest, mip = linear |
+        * | 2     | BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST | Bilinear is: mag = linear, min = linear, mip = nearest |
+        * | 3     | TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR | Trilinear is: mag = linear, min = linear, mip = linear |
+        * | 4     | NEAREST_NEAREST_MIPNEAREST |             |
+        * | 5    | NEAREST_LINEAR_MIPNEAREST |             |
+        * | 6    | NEAREST_LINEAR_MIPLINEAR |             |
+        * | 7    | NEAREST_LINEAR |             |
+        * | 8    | NEAREST_NEAREST |             |
+        * | 9   | LINEAR_NEAREST_MIPNEAREST |             |
+        * | 10   | LINEAR_NEAREST_MIPLINEAR |             |
+        * | 11   | LINEAR_LINEAR |             |
+        * | 12   | LINEAR_NEAREST |             |
+        *
+        *    > _mag_: magnification filter (close to the viewer)
+        *    > _min_: minification filter (far from the viewer)
+        *    > _mip_: filter used between mip map levels
+        *
+        */
         Texture.prototype.updateSamplingMode = function (samplingMode) {
             if (!this._texture) {
                 return;
@@ -31842,14 +31868,15 @@ var BABYLON;
         };
         /**
          * Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.
-         * If the parameter `copyWhenShared` is true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.
-         * Returns an empty array if the mesh has no geometry.
+         * @param copyWhenShared If true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.
+         * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it
+         * @returns the indices array or an empty array if the mesh has no geometry
          */
-        Mesh.prototype.getIndices = function (copyWhenShared) {
+        Mesh.prototype.getIndices = function (copyWhenShared, forceCopy) {
             if (!this._geometry) {
                 return [];
             }
-            return this._geometry.getIndices(copyWhenShared);
+            return this._geometry.getIndices(copyWhenShared, forceCopy);
         };
         Object.defineProperty(Mesh.prototype, "isBlocked", {
             get: function () {
@@ -34299,11 +34326,11 @@ var BABYLON;
         };
         /**
          * Merge the array of meshes into a single mesh for performance reasons.
-         * @param {Array<Mesh>} meshes - The vertices source.  They should all be of the same material.  Entries can empty
-         * @param {boolean} disposeSource - When true (default), dispose of the vertices from the source meshes
-         * @param {boolean} allow32BitsIndices - When the sum of the vertices > 64k, this must be set to true.
-         * @param {Mesh} meshSubclass - When set, vertices inserted into this Mesh.  Meshes can then be merged into a Mesh sub-class.
-         * @param {boolean} subdivideWithSubMeshes - When true (false default), subdivide mesh to his subMesh array with meshes source.
+         * @param meshes - The vertices source.  They should all be of the same material.  Entries can empty
+         * @param disposeSource - When true (default), dispose of the vertices from the source meshes
+         * @param allow32BitsIndices - When the sum of the vertices > 64k, this must be set to true.
+         * @param meshSubclass - When set, vertices inserted into this Mesh.  Meshes can then be merged into a Mesh sub-class.
+         * @param subdivideWithSubMeshes - When true (false default), subdivide mesh to his subMesh array with meshes source.
          */
         Mesh.MergeMeshes = function (meshes, disposeSource, allow32BitsIndices, meshSubclass, subdivideWithSubMeshes) {
             if (disposeSource === void 0) { disposeSource = true; }
@@ -34328,11 +34355,11 @@ var BABYLON;
             var source = null;
             for (index = 0; index < meshes.length; index++) {
                 if (meshes[index]) {
-                    meshes[index].computeWorldMatrix(true);
+                    var wm = meshes[index].computeWorldMatrix(true);
                     otherVertexData = BABYLON.VertexData.ExtractFromMesh(meshes[index], true, true);
-                    otherVertexData.transform(meshes[index].getWorldMatrix());
+                    otherVertexData.transform(wm);
                     if (vertexData) {
-                        vertexData.merge(otherVertexData);
+                        vertexData.merge(otherVertexData, allow32BitsIndices);
                     }
                     else {
                         vertexData = otherVertexData;
@@ -36788,9 +36815,11 @@ var BABYLON;
         /**
          * Merges the passed VertexData into the current one
          * @param other the VertexData to be merged into the current one
+         * @param use32BitsIndices defines a boolean indicating if indices must be store in a 32 bits array
          * @returns the modified VertexData
          */
-        VertexData.prototype.merge = function (other) {
+        VertexData.prototype.merge = function (other, use32BitsIndices) {
+            if (use32BitsIndices === void 0) { use32BitsIndices = false; }
             this._validate();
             other._validate();
             if (!this.normals !== !other.normals ||
@@ -36816,7 +36845,7 @@ var BABYLON;
                 var isSrcTypedArray = this.indices.BYTES_PER_ELEMENT !== undefined;
                 if (isSrcTypedArray) {
                     var len = this.indices.length + other.indices.length;
-                    var temp = this.indices instanceof Uint32Array ? new Uint32Array(len) : new Uint16Array(len);
+                    var temp = use32BitsIndices || this.indices instanceof Uint32Array ? new Uint32Array(len) : new Uint16Array(len);
                     temp.set(this.indices);
                     var decal = this.indices.length;
                     for (var index = 0; index < other.indices.length; index++) {
@@ -37039,7 +37068,7 @@ var BABYLON;
             if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesWeightsExtraKind)) {
                 result.matricesWeightsExtra = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.MatricesWeightsExtraKind, copyWhenShared, forceCopy);
             }
-            result.indices = meshOrGeometry.getIndices(copyWhenShared);
+            result.indices = meshOrGeometry.getIndices(copyWhenShared, forceCopy);
             return result;
         };
         /**
@@ -39342,7 +39371,14 @@ var BABYLON;
                     return new Float32Array(data, vertexBuffer.byteOffset, count);
                 }
                 else {
-                    return new Float32Array(data.buffer, data.byteOffset + vertexBuffer.byteOffset, count);
+                    var offset = data.byteOffset + vertexBuffer.byteOffset;
+                    if (forceCopy || (copyWhenShared && this._meshes.length !== 1)) {
+                        var result = new Float32Array(count);
+                        var source = new Float32Array(data.buffer, offset, count);
+                        result.set(source);
+                        return result;
+                    }
+                    return new Float32Array(data.buffer, offset, count);
                 }
             }
             if (forceCopy || (copyWhenShared && this._meshes.length !== 1)) {
@@ -39473,14 +39509,15 @@ var BABYLON;
         /**
          * Gets the index buffer array
          * @param copyWhenShared defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes
+         * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it
          * @returns the index buffer array
          */
-        Geometry.prototype.getIndices = function (copyWhenShared) {
+        Geometry.prototype.getIndices = function (copyWhenShared, forceCopy) {
             if (!this.isReady()) {
                 return null;
             }
             var orig = this._indices;
-            if (!copyWhenShared || this._meshes.length === 1) {
+            if (!forceCopy && (!copyWhenShared || this._meshes.length === 1)) {
                 return orig;
             }
             else {
@@ -99313,6 +99350,12 @@ var BABYLON;
             }
             var engine = scene.getEngine();
             this._lineShader._preBind();
+            if (this._source.edgesColor.a !== 1) {
+                engine.setAlphaMode(BABYLON.Engine.ALPHA_COMBINE);
+            }
+            else {
+                engine.setAlphaMode(BABYLON.Engine.ALPHA_DISABLE);
+            }
             // VBOs
             engine.bindBuffers(this._buffers, this._ib, this._lineShader.getEffect());
             scene.resetCachedMaterial();
@@ -99328,7 +99371,6 @@ var BABYLON;
             // Draw order
             engine.drawElementsType(BABYLON.Material.TriangleFillMode, 0, this._indicesCount);
             this._lineShader.unbind();
-            engine.setDepthWrite(true);
         };
         return EdgesRenderer;
     }());

Plik diff jest za duży
+ 1 - 1
dist/preview release/babylon.worker.js


+ 64 - 22
dist/preview release/es6.js

@@ -11260,7 +11260,7 @@ var BABYLON;
     var Engine = /** @class */ (function () {
         /**
          * Creates a new engine
-         * @param canvasOrContext defines the canvas or WebGL context to use for rendering
+         * @param canvasOrContext defines the canvas or WebGL context to use for rendering. If you provide a WebGL context, Babylon.js will not hook events on the canvas (like pointers, keyboards, etc...) so no event observables will be available. This is mostly used when Babylon.js is used as a plugin on a system which alreay used the WebGL context
          * @param antialias defines enable antialiasing (default: false)
          * @param options defines further options to be sent to the getContext() function
          * @param adaptToDeviceRatio defines whether to adapt to the device's viewport characteristics (default: false)
@@ -23412,8 +23412,11 @@ var BABYLON;
             // Set back stencil to false in case it changes before the edge renderer.
             engine.setStencilBuffer(false);
             // Edges
-            for (var edgesRendererIndex = 0; edgesRendererIndex < this._edgesRenderers.length; edgesRendererIndex++) {
-                this._edgesRenderers.data[edgesRendererIndex].render();
+            if (this._edgesRenderers.length) {
+                for (var edgesRendererIndex = 0; edgesRendererIndex < this._edgesRenderers.length; edgesRendererIndex++) {
+                    this._edgesRenderers.data[edgesRendererIndex].render();
+                }
+                engine.setAlphaMode(BABYLON.Engine.ALPHA_DISABLE);
             }
             // Restore Stencil state.
             engine.setStencilBuffer(stencilState);
@@ -30924,6 +30927,29 @@ var BABYLON;
             this._delayedOnLoad = null;
             this._delayedOnError = null;
         };
+        /**
+        * Default is Trilinear mode.
+        *
+        * | Value | Type               | Description |
+        * | ----- | ------------------ | ----------- |
+        * | 1     | NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR  | Nearest is: mag = nearest, min = nearest, mip = linear |
+        * | 2     | BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST | Bilinear is: mag = linear, min = linear, mip = nearest |
+        * | 3     | TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR | Trilinear is: mag = linear, min = linear, mip = linear |
+        * | 4     | NEAREST_NEAREST_MIPNEAREST |             |
+        * | 5    | NEAREST_LINEAR_MIPNEAREST |             |
+        * | 6    | NEAREST_LINEAR_MIPLINEAR |             |
+        * | 7    | NEAREST_LINEAR |             |
+        * | 8    | NEAREST_NEAREST |             |
+        * | 9   | LINEAR_NEAREST_MIPNEAREST |             |
+        * | 10   | LINEAR_NEAREST_MIPLINEAR |             |
+        * | 11   | LINEAR_LINEAR |             |
+        * | 12   | LINEAR_NEAREST |             |
+        *
+        *    > _mag_: magnification filter (close to the viewer)
+        *    > _min_: minification filter (far from the viewer)
+        *    > _mip_: filter used between mip map levels
+        *
+        */
         Texture.prototype.updateSamplingMode = function (samplingMode) {
             if (!this._texture) {
                 return;
@@ -31842,14 +31868,15 @@ var BABYLON;
         };
         /**
          * Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.
-         * If the parameter `copyWhenShared` is true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.
-         * Returns an empty array if the mesh has no geometry.
+         * @param copyWhenShared If true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.
+         * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it
+         * @returns the indices array or an empty array if the mesh has no geometry
          */
-        Mesh.prototype.getIndices = function (copyWhenShared) {
+        Mesh.prototype.getIndices = function (copyWhenShared, forceCopy) {
             if (!this._geometry) {
                 return [];
             }
-            return this._geometry.getIndices(copyWhenShared);
+            return this._geometry.getIndices(copyWhenShared, forceCopy);
         };
         Object.defineProperty(Mesh.prototype, "isBlocked", {
             get: function () {
@@ -34299,11 +34326,11 @@ var BABYLON;
         };
         /**
          * Merge the array of meshes into a single mesh for performance reasons.
-         * @param {Array<Mesh>} meshes - The vertices source.  They should all be of the same material.  Entries can empty
-         * @param {boolean} disposeSource - When true (default), dispose of the vertices from the source meshes
-         * @param {boolean} allow32BitsIndices - When the sum of the vertices > 64k, this must be set to true.
-         * @param {Mesh} meshSubclass - When set, vertices inserted into this Mesh.  Meshes can then be merged into a Mesh sub-class.
-         * @param {boolean} subdivideWithSubMeshes - When true (false default), subdivide mesh to his subMesh array with meshes source.
+         * @param meshes - The vertices source.  They should all be of the same material.  Entries can empty
+         * @param disposeSource - When true (default), dispose of the vertices from the source meshes
+         * @param allow32BitsIndices - When the sum of the vertices > 64k, this must be set to true.
+         * @param meshSubclass - When set, vertices inserted into this Mesh.  Meshes can then be merged into a Mesh sub-class.
+         * @param subdivideWithSubMeshes - When true (false default), subdivide mesh to his subMesh array with meshes source.
          */
         Mesh.MergeMeshes = function (meshes, disposeSource, allow32BitsIndices, meshSubclass, subdivideWithSubMeshes) {
             if (disposeSource === void 0) { disposeSource = true; }
@@ -34328,11 +34355,11 @@ var BABYLON;
             var source = null;
             for (index = 0; index < meshes.length; index++) {
                 if (meshes[index]) {
-                    meshes[index].computeWorldMatrix(true);
+                    var wm = meshes[index].computeWorldMatrix(true);
                     otherVertexData = BABYLON.VertexData.ExtractFromMesh(meshes[index], true, true);
-                    otherVertexData.transform(meshes[index].getWorldMatrix());
+                    otherVertexData.transform(wm);
                     if (vertexData) {
-                        vertexData.merge(otherVertexData);
+                        vertexData.merge(otherVertexData, allow32BitsIndices);
                     }
                     else {
                         vertexData = otherVertexData;
@@ -36788,9 +36815,11 @@ var BABYLON;
         /**
          * Merges the passed VertexData into the current one
          * @param other the VertexData to be merged into the current one
+         * @param use32BitsIndices defines a boolean indicating if indices must be store in a 32 bits array
          * @returns the modified VertexData
          */
-        VertexData.prototype.merge = function (other) {
+        VertexData.prototype.merge = function (other, use32BitsIndices) {
+            if (use32BitsIndices === void 0) { use32BitsIndices = false; }
             this._validate();
             other._validate();
             if (!this.normals !== !other.normals ||
@@ -36816,7 +36845,7 @@ var BABYLON;
                 var isSrcTypedArray = this.indices.BYTES_PER_ELEMENT !== undefined;
                 if (isSrcTypedArray) {
                     var len = this.indices.length + other.indices.length;
-                    var temp = this.indices instanceof Uint32Array ? new Uint32Array(len) : new Uint16Array(len);
+                    var temp = use32BitsIndices || this.indices instanceof Uint32Array ? new Uint32Array(len) : new Uint16Array(len);
                     temp.set(this.indices);
                     var decal = this.indices.length;
                     for (var index = 0; index < other.indices.length; index++) {
@@ -37039,7 +37068,7 @@ var BABYLON;
             if (meshOrGeometry.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesWeightsExtraKind)) {
                 result.matricesWeightsExtra = meshOrGeometry.getVerticesData(BABYLON.VertexBuffer.MatricesWeightsExtraKind, copyWhenShared, forceCopy);
             }
-            result.indices = meshOrGeometry.getIndices(copyWhenShared);
+            result.indices = meshOrGeometry.getIndices(copyWhenShared, forceCopy);
             return result;
         };
         /**
@@ -39342,7 +39371,14 @@ var BABYLON;
                     return new Float32Array(data, vertexBuffer.byteOffset, count);
                 }
                 else {
-                    return new Float32Array(data.buffer, data.byteOffset + vertexBuffer.byteOffset, count);
+                    var offset = data.byteOffset + vertexBuffer.byteOffset;
+                    if (forceCopy || (copyWhenShared && this._meshes.length !== 1)) {
+                        var result = new Float32Array(count);
+                        var source = new Float32Array(data.buffer, offset, count);
+                        result.set(source);
+                        return result;
+                    }
+                    return new Float32Array(data.buffer, offset, count);
                 }
             }
             if (forceCopy || (copyWhenShared && this._meshes.length !== 1)) {
@@ -39473,14 +39509,15 @@ var BABYLON;
         /**
          * Gets the index buffer array
          * @param copyWhenShared defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes
+         * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it
          * @returns the index buffer array
          */
-        Geometry.prototype.getIndices = function (copyWhenShared) {
+        Geometry.prototype.getIndices = function (copyWhenShared, forceCopy) {
             if (!this.isReady()) {
                 return null;
             }
             var orig = this._indices;
-            if (!copyWhenShared || this._meshes.length === 1) {
+            if (!forceCopy && (!copyWhenShared || this._meshes.length === 1)) {
                 return orig;
             }
             else {
@@ -99313,6 +99350,12 @@ var BABYLON;
             }
             var engine = scene.getEngine();
             this._lineShader._preBind();
+            if (this._source.edgesColor.a !== 1) {
+                engine.setAlphaMode(BABYLON.Engine.ALPHA_COMBINE);
+            }
+            else {
+                engine.setAlphaMode(BABYLON.Engine.ALPHA_DISABLE);
+            }
             // VBOs
             engine.bindBuffers(this._buffers, this._ib, this._lineShader.getEffect());
             scene.resetCachedMaterial();
@@ -99328,7 +99371,6 @@ var BABYLON;
             // Draw order
             engine.drawElementsType(BABYLON.Material.TriangleFillMode, 0, this._indicesCount);
             this._lineShader.unbind();
-            engine.setDepthWrite(true);
         };
         return EdgesRenderer;
     }());

Plik diff jest za duży
+ 1 - 1
dist/preview release/gui/babylon.gui.js


Plik diff jest za duży
+ 1 - 1
dist/preview release/gui/babylon.gui.min.js


Plik diff jest za duży
+ 1 - 1
dist/preview release/gui/babylon.gui.min.js.map


Plik diff jest za duży
+ 1 - 1
dist/preview release/inspector/babylon.inspector.bundle.js.map


+ 1 - 1
dist/preview release/loaders/babylon.glTF1FileLoader.js

@@ -1901,7 +1901,7 @@ var BABYLON;
                     (sampler.minFilter === GLTF1.ETextureFilterType.LINEAR_MIPMAP_NEAREST) ||
                     (sampler.minFilter === GLTF1.ETextureFilterType.LINEAR_MIPMAP_LINEAR);
                 var samplingMode = BABYLON.Texture.BILINEAR_SAMPLINGMODE;
-                var blob = new Blob([buffer]);
+                var blob = buffer == null ? new Blob() : new Blob([buffer]);
                 var blobURL = URL.createObjectURL(blob);
                 var revokeBlobURL = function () { return URL.revokeObjectURL(blobURL); };
                 var newTexture = new BABYLON.Texture(blobURL, gltfRuntime.scene, !createMipMaps, true, samplingMode, revokeBlobURL, revokeBlobURL);

Plik diff jest za duży
+ 1 - 1
dist/preview release/loaders/babylon.glTF1FileLoader.min.js


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

@@ -1901,7 +1901,7 @@ var BABYLON;
                     (sampler.minFilter === GLTF1.ETextureFilterType.LINEAR_MIPMAP_NEAREST) ||
                     (sampler.minFilter === GLTF1.ETextureFilterType.LINEAR_MIPMAP_LINEAR);
                 var samplingMode = BABYLON.Texture.BILINEAR_SAMPLINGMODE;
-                var blob = new Blob([buffer]);
+                var blob = buffer == null ? new Blob() : new Blob([buffer]);
                 var blobURL = URL.createObjectURL(blob);
                 var revokeBlobURL = function () { return URL.revokeObjectURL(blobURL); };
                 var newTexture = new BABYLON.Texture(blobURL, gltfRuntime.scene, !createMipMaps, true, samplingMode, revokeBlobURL, revokeBlobURL);

Plik diff jest za duży
+ 1 - 1
dist/preview release/loaders/babylon.glTFFileLoader.min.js


+ 2 - 17
dist/preview release/typedocValidationBaseline.json

@@ -1,7 +1,7 @@
 {
-  "errors": 4023,
+  "errors": 4020,
   "babylon.typedoc.json": {
-    "errors": 4023,
+    "errors": 4020,
     "AbstractMesh": {
       "Property": {
         "showBoundingBox": {
@@ -17865,9 +17865,6 @@
       },
       "Method": {
         "updateSamplingMode": {
-          "Comments": {
-            "MissingText": true
-          },
           "Parameter": {
             "samplingMode": {
               "Comments": {
@@ -21212,18 +21209,6 @@
     },
     "IGetSetVerticesData": {
       "Method": {
-        "getIndices": {
-          "Comments": {
-            "MissingText": true
-          },
-          "Parameter": {
-            "copyWhenShared": {
-              "Comments": {
-                "MissingText": true
-              }
-            }
-          }
-        },
         "getVerticesData": {
           "Comments": {
             "MissingText": true

Plik diff jest za duży
+ 2 - 2
dist/preview release/viewer/babylon.viewer.js


Plik diff jest za duży
+ 5 - 5
dist/preview release/viewer/babylon.viewer.max.js


+ 13 - 3
src/Mesh/babylon.geometry.ts

@@ -409,7 +409,16 @@
                     return new Float32Array(data, vertexBuffer.byteOffset, count);
                 }
                 else {
-                    return new Float32Array(data.buffer, data.byteOffset + vertexBuffer.byteOffset, count);
+                    const offset = data.byteOffset + vertexBuffer.byteOffset;
+                    if (forceCopy || (copyWhenShared && this._meshes.length !== 1)) {
+                        let result = new Float32Array(count);
+                        let source = new Float32Array(data.buffer, offset, count);
+
+                        result.set(source);
+                
+                        return result;
+                    }
+                    return new Float32Array(data.buffer, offset, count);
                 }
             }
 
@@ -556,14 +565,15 @@
         /**
          * Gets the index buffer array
          * @param copyWhenShared defines if the returned array must be cloned upon returning it if the current geometry is shared between multiple meshes
+         * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it
          * @returns the index buffer array
          */
-        public getIndices(copyWhenShared?: boolean): Nullable<IndicesArray> {
+        public getIndices(copyWhenShared?: boolean, forceCopy?: boolean): Nullable<IndicesArray> {
             if (!this.isReady()) {
                 return null;
             }
             var orig = this._indices;
-            if (!copyWhenShared || this._meshes.length === 1) {
+            if (!forceCopy && (!copyWhenShared || this._meshes.length === 1)) {
                 return orig;
             } else {
                 var len = orig.length;

+ 5 - 4
src/Mesh/babylon.mesh.ts

@@ -617,15 +617,16 @@
 
         /**
          * Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.  
-         * If the parameter `copyWhenShared` is true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.
-         * Returns an empty array if the mesh has no geometry.
+         * @param copyWhenShared If true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.
+         * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it
+         * @returns the indices array or an empty array if the mesh has no geometry
          */
-        public getIndices(copyWhenShared?: boolean): Nullable<IndicesArray> {
+        public getIndices(copyWhenShared?: boolean, forceCopy?: boolean): Nullable<IndicesArray> {
 
             if (!this._geometry) {
                 return [];
             }
-            return this._geometry.getIndices(copyWhenShared);
+            return this._geometry.getIndices(copyWhenShared, forceCopy);
         }
 
         public get isBlocked(): boolean {

+ 8 - 2
src/Mesh/babylon.mesh.vertexData.ts

@@ -5,7 +5,13 @@
     export interface IGetSetVerticesData {
         isVerticesDataPresent(kind: string): boolean;
         getVerticesData(kind: string, copyWhenShared?: boolean, forceCopy?: boolean): Nullable<FloatArray>;
-        getIndices(copyWhenShared?: boolean): Nullable<IndicesArray>;
+        /**
+         * Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.  
+         * @param copyWhenShared If true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.
+         * @param forceCopy defines a boolean indicating that the returned array must be cloned upon returning it
+         * @returns the indices array or an empty array if the mesh has no geometry
+         */
+        getIndices(copyWhenShared?: boolean, forceCopy?: boolean): Nullable<IndicesArray>;
         setVerticesData(kind: string, data: FloatArray, updatable: boolean): void;
         updateVerticesData(kind: string, data: FloatArray, updateExtends?: boolean, makeItUnique?: boolean): void;
         setIndices(indices: IndicesArray, totalVertices: Nullable<number>, updatable?: boolean): void;
@@ -676,7 +682,7 @@
                 result.matricesWeightsExtra = meshOrGeometry.getVerticesData(VertexBuffer.MatricesWeightsExtraKind, copyWhenShared, forceCopy);
             }
 
-            result.indices = meshOrGeometry.getIndices(copyWhenShared);
+            result.indices = meshOrGeometry.getIndices(copyWhenShared, forceCopy);
 
             return result;
         }