|
@@ -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;
|
|
|
}());
|