|
@@ -12974,7 +12974,7 @@ var BABYLON;
|
|
|
* Returns the current version of the framework
|
|
|
*/
|
|
|
get: function () {
|
|
|
- return "4.0.0-alpha.11";
|
|
|
+ return "4.0.0-alpha.14";
|
|
|
},
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
@@ -15823,8 +15823,7 @@ var BABYLON;
|
|
|
customFallback = true;
|
|
|
excludeLoaders.push(loader);
|
|
|
BABYLON.Tools.Warn(loader.constructor.name + " failed when trying to load " + texture.url + ", falling back to the next supported loader");
|
|
|
- _this.createTexture(urlArg, noMipmap, texture.invertY, scene, samplingMode, null, onError, buffer, texture, undefined, undefined, excludeLoaders);
|
|
|
- return;
|
|
|
+ _this.createTexture(urlArg, noMipmap, texture.invertY, scene, samplingMode, null, null, buffer, texture, undefined, undefined, excludeLoaders);
|
|
|
}
|
|
|
}
|
|
|
if (!customFallback) {
|
|
@@ -15832,8 +15831,7 @@ var BABYLON;
|
|
|
texture.onLoadedObservable.remove(onLoadObserver);
|
|
|
}
|
|
|
if (BABYLON.Tools.UseFallbackTexture) {
|
|
|
- _this.createTexture(BABYLON.Tools.fallbackTexture, noMipmap, texture.invertY, scene, samplingMode, null, onError, buffer, texture);
|
|
|
- return;
|
|
|
+ _this.createTexture(BABYLON.Tools.fallbackTexture, noMipmap, texture.invertY, scene, samplingMode, null, null, buffer, texture);
|
|
|
}
|
|
|
}
|
|
|
if (onError) {
|
|
@@ -19572,8 +19570,25 @@ var BABYLON;
|
|
|
* @returns true if there is an intersection
|
|
|
*/
|
|
|
BoundingSphere.prototype.isInFrustum = function (frustumPlanes) {
|
|
|
+ var center = this.centerWorld;
|
|
|
+ var radius = this.radiusWorld;
|
|
|
+ for (var i = 0; i < 6; i++) {
|
|
|
+ if (frustumPlanes[i].dotCoordinate(center) <= -radius) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ };
|
|
|
+ /**
|
|
|
+ * Tests if the bounding sphere center is in between the frustum planes.
|
|
|
+ * Used for optimistic fast inclusion.
|
|
|
+ * @param frustumPlanes defines the frustum planes to test
|
|
|
+ * @returns true if the sphere center is in between the frustum planes
|
|
|
+ */
|
|
|
+ BoundingSphere.prototype.isCenterInFrustum = function (frustumPlanes) {
|
|
|
+ var center = this.centerWorld;
|
|
|
for (var i = 0; i < 6; i++) {
|
|
|
- if (frustumPlanes[i].dotCoordinate(this.centerWorld) <= -this.radiusWorld) {
|
|
|
+ if (frustumPlanes[i].dotCoordinate(center) < 0) {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -20010,15 +20025,22 @@ var BABYLON;
|
|
|
/**
|
|
|
* Returns `true` if the bounding info is within the frustum defined by the passed array of planes.
|
|
|
* @param frustumPlanes defines the frustum to test
|
|
|
- * @param strategy defines the strategy to use for the culling (default is BABYLON.Scene.CULLINGSTRATEGY_STANDARD)
|
|
|
+ * @param strategy defines the strategy to use for the culling (default is BABYLON.AbstractMesh.CULLINGSTRATEGY_STANDARD)
|
|
|
* @returns true if the bounding info is in the frustum planes
|
|
|
*/
|
|
|
BoundingInfo.prototype.isInFrustum = function (frustumPlanes, strategy) {
|
|
|
if (strategy === void 0) { strategy = BABYLON.AbstractMesh.CULLINGSTRATEGY_STANDARD; }
|
|
|
+ var inclusionTest = (strategy === BABYLON.AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION || strategy === BABYLON.AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY);
|
|
|
+ if (inclusionTest) {
|
|
|
+ if (this.boundingSphere.isCenterInFrustum(frustumPlanes)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
if (!this.boundingSphere.isInFrustum(frustumPlanes)) {
|
|
|
return false;
|
|
|
}
|
|
|
- if (strategy === BABYLON.AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY) {
|
|
|
+ var bSphereOnlyTest = (strategy === BABYLON.AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY || strategy === BABYLON.AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY);
|
|
|
+ if (bSphereOnlyTest) {
|
|
|
return true;
|
|
|
}
|
|
|
return this.boundingBox.isInFrustum(frustumPlanes);
|
|
@@ -21273,7 +21295,16 @@ var BABYLON;
|
|
|
if (scene === void 0) { scene = null; }
|
|
|
var _this = _super.call(this, name, scene, false) || this;
|
|
|
_this._facetData = new _FacetDataStorage();
|
|
|
- /** Gets ot sets the culling strategy to use to find visible meshes */
|
|
|
+ /**
|
|
|
+ * The culling strategy to use to check whether the mesh must be rendered or not.
|
|
|
+ * This value can be changed at any time and will be used on the next render mesh selection.
|
|
|
+ * The possible values are :
|
|
|
+ * - AbstractMesh.CULLINGSTRATEGY_STANDARD
|
|
|
+ * - AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY
|
|
|
+ * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION
|
|
|
+ * - AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY
|
|
|
+ * Please read each static variable documentation to get details about the culling process.
|
|
|
+ * */
|
|
|
_this.cullingStrategy = AbstractMesh.CULLINGSTRATEGY_STANDARD;
|
|
|
// Events
|
|
|
/**
|
|
@@ -23074,10 +23105,40 @@ var BABYLON;
|
|
|
AbstractMesh.OCCLUSION_ALGORITHM_TYPE_ACCURATE = 0;
|
|
|
/** Use a conservative occlusion algorithm */
|
|
|
AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE = 1;
|
|
|
- /** Default culling strategy with bounding box and bounding sphere and then frustum culling */
|
|
|
+ /** Default culling strategy : this is an exclusion test and it's the more accurate.
|
|
|
+ * Test order :
|
|
|
+ * Is the bounding sphere outside the frustum ?
|
|
|
+ * If not, are the bounding box vertices outside the frustum ?
|
|
|
+ * It not, then the cullable object is in the frustum.
|
|
|
+ */
|
|
|
AbstractMesh.CULLINGSTRATEGY_STANDARD = 0;
|
|
|
- /** Culling strategy with bounding sphere only and then frustum culling */
|
|
|
+ /** Culling strategy : Bounding Sphere Only.
|
|
|
+ * This is an exclusion test. It's faster than the standard strategy because the bounding box is not tested.
|
|
|
+ * It's also less accurate than the standard because some not visible objects can still be selected.
|
|
|
+ * Test : is the bounding sphere outside the frustum ?
|
|
|
+ * If not, then the cullable object is in the frustum.
|
|
|
+ */
|
|
|
AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY = 1;
|
|
|
+ /** Culling strategy : Optimistic Inclusion.
|
|
|
+ * This in an inclusion test first, then the standard exclusion test.
|
|
|
+ * This can be faster when a cullable object is expected to be almost always in the camera frustum.
|
|
|
+ * This could also be a little slower than the standard test when the tested object center is not the frustum but one of its bounding box vertex is still inside.
|
|
|
+ * Anyway, it's as accurate as the standard strategy.
|
|
|
+ * Test :
|
|
|
+ * Is the cullable object bounding sphere center in the frustum ?
|
|
|
+ * If not, apply the default culling strategy.
|
|
|
+ */
|
|
|
+ AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION = 2;
|
|
|
+ /** Culling strategy : Optimistic Inclusion then Bounding Sphere Only.
|
|
|
+ * This in an inclusion test first, then the bounding sphere only exclusion test.
|
|
|
+ * This can be the fastest test when a cullable object is expected to be almost always in the camera frustum.
|
|
|
+ * This could also be a little slower than the BoundingSphereOnly strategy when the tested object center is not in the frustum but its bounding sphere still intersects it.
|
|
|
+ * It's less accurate than the standard strategy and as accurate as the BoundingSphereOnly strategy.
|
|
|
+ * Test :
|
|
|
+ * Is the cullable object bounding sphere center in the frustum ?
|
|
|
+ * If not, apply the Bounding Sphere Only strategy. No Bounding Box is tested here.
|
|
|
+ */
|
|
|
+ AbstractMesh.CULLINGSTRATEGY_OPTIMISTIC_INCLUSION_THEN_BSPHERE_ONLY = 3;
|
|
|
return AbstractMesh;
|
|
|
}(BABYLON.TransformNode));
|
|
|
BABYLON.AbstractMesh = AbstractMesh;
|
|
@@ -26372,7 +26433,7 @@ var BABYLON;
|
|
|
/**
|
|
|
* an optional map from Geometry Id to Geometry index in the 'geometries' array
|
|
|
*/
|
|
|
- _this.geometriesById = null;
|
|
|
+ _this.geometriesByUniqueId = null;
|
|
|
_this._defaultMeshCandidates = {
|
|
|
data: [],
|
|
|
length: 0
|
|
@@ -26412,10 +26473,10 @@ var BABYLON;
|
|
|
_this._imageProcessingConfiguration = new BABYLON.ImageProcessingConfiguration();
|
|
|
}
|
|
|
_this.setDefaultCandidateProviders();
|
|
|
- if (options && options.useGeometryIdsMap === true) {
|
|
|
- _this.geometriesById = {};
|
|
|
+ if (options && options.useGeometryUniqueIdsMap === true) {
|
|
|
+ _this.geometriesByUniqueId = {};
|
|
|
}
|
|
|
- _this.useMaterialMeshMap = options && options.useGeometryIdsMap || false;
|
|
|
+ _this.useMaterialMeshMap = options && options.useGeometryUniqueIdsMap || false;
|
|
|
_this.useClonedMeshhMap = options && options.useClonedMeshhMap || false;
|
|
|
_this._engine.onNewSceneAddedObservable.notifyObservers(_this);
|
|
|
return _this;
|
|
@@ -28657,8 +28718,8 @@ var BABYLON;
|
|
|
* @param newGeometry The geometry to add
|
|
|
*/
|
|
|
Scene.prototype.addGeometry = function (newGeometry) {
|
|
|
- if (this.geometriesById) {
|
|
|
- this.geometriesById[newGeometry.id] = this.geometries.length;
|
|
|
+ if (this.geometriesByUniqueId) {
|
|
|
+ this.geometriesByUniqueId[newGeometry.uniqueId] = this.geometries.length;
|
|
|
}
|
|
|
this.geometries.push(newGeometry);
|
|
|
};
|
|
@@ -28890,29 +28951,29 @@ var BABYLON;
|
|
|
* @return the geometry or null if none found.
|
|
|
*/
|
|
|
Scene.prototype.getGeometryByID = function (id) {
|
|
|
- if (this.geometriesById) {
|
|
|
- var index_1 = this.geometriesById[id];
|
|
|
+ for (var index = 0; index < this.geometries.length; index++) {
|
|
|
+ if (this.geometries[index].id === id) {
|
|
|
+ return this.geometries[index];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ };
|
|
|
+ Scene.prototype._getGeometryByUniqueID = function (uniqueId) {
|
|
|
+ if (this.geometriesByUniqueId) {
|
|
|
+ var index_1 = this.geometriesByUniqueId[uniqueId];
|
|
|
if (index_1 !== undefined) {
|
|
|
return this.geometries[index_1];
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
for (var index = 0; index < this.geometries.length; index++) {
|
|
|
- if (this.geometries[index].id === id) {
|
|
|
+ if (this.geometries[index].uniqueId === uniqueId) {
|
|
|
return this.geometries[index];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return null;
|
|
|
};
|
|
|
- Scene.prototype._getGeometryByUniqueID = function (id) {
|
|
|
- for (var index = 0; index < this.geometries.length; index++) {
|
|
|
- if (this.geometries[index].uniqueId === id) {
|
|
|
- return this.geometries[index];
|
|
|
- }
|
|
|
- }
|
|
|
- return null;
|
|
|
- };
|
|
|
/**
|
|
|
* Add a new geometry to this scene
|
|
|
* @param geometry defines the geometry to be added to the scene.
|
|
@@ -28938,8 +28999,8 @@ var BABYLON;
|
|
|
*/
|
|
|
Scene.prototype.removeGeometry = function (geometry) {
|
|
|
var index;
|
|
|
- if (this.geometriesById) {
|
|
|
- index = this.geometriesById[geometry.id];
|
|
|
+ if (this.geometriesByUniqueId) {
|
|
|
+ index = this.geometriesByUniqueId[geometry.uniqueId];
|
|
|
if (index === undefined) {
|
|
|
return false;
|
|
|
}
|
|
@@ -28953,9 +29014,9 @@ var BABYLON;
|
|
|
if (index !== this.geometries.length - 1) {
|
|
|
var lastGeometry = this.geometries[this.geometries.length - 1];
|
|
|
this.geometries[index] = lastGeometry;
|
|
|
- if (this.geometriesById) {
|
|
|
- this.geometriesById[lastGeometry.id] = index;
|
|
|
- this.geometriesById[geometry.id] = undefined;
|
|
|
+ if (this.geometriesByUniqueId) {
|
|
|
+ this.geometriesByUniqueId[lastGeometry.uniqueId] = index;
|
|
|
+ this.geometriesByUniqueId[geometry.uniqueId] = undefined;
|
|
|
}
|
|
|
}
|
|
|
this.geometries.pop();
|
|
@@ -31768,14 +31829,6 @@ var BABYLON;
|
|
|
*/
|
|
|
this.anisotropicFilteringLevel = BaseTexture.DEFAULT_ANISOTROPIC_FILTERING_LEVEL;
|
|
|
/**
|
|
|
- * Define if the texture is a cube texture or if false a 2d texture.
|
|
|
- */
|
|
|
- this.isCube = false;
|
|
|
- /**
|
|
|
- * Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.
|
|
|
- */
|
|
|
- this.is3D = false;
|
|
|
- /**
|
|
|
* Define if the texture contains data in gamma space (most of the png/jpg aside bump).
|
|
|
* HDR texture are usually stored in linear space.
|
|
|
* This only impacts the PBR and Background materials
|
|
@@ -31864,6 +31917,44 @@ var BABYLON;
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
|
});
|
|
|
+ Object.defineProperty(BaseTexture.prototype, "isCube", {
|
|
|
+ /**
|
|
|
+ * Define if the texture is a cube texture or if false a 2d texture.
|
|
|
+ */
|
|
|
+ get: function () {
|
|
|
+ if (!this._texture) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return this._texture.isCube;
|
|
|
+ },
|
|
|
+ set: function (value) {
|
|
|
+ if (!this._texture) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this._texture.isCube = value;
|
|
|
+ },
|
|
|
+ enumerable: true,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
+ Object.defineProperty(BaseTexture.prototype, "is3D", {
|
|
|
+ /**
|
|
|
+ * Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.
|
|
|
+ */
|
|
|
+ get: function () {
|
|
|
+ if (!this._texture) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return this._texture.is3D;
|
|
|
+ },
|
|
|
+ set: function (value) {
|
|
|
+ if (!this._texture) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this._texture.is3D = value;
|
|
|
+ },
|
|
|
+ enumerable: true,
|
|
|
+ configurable: true
|
|
|
+ });
|
|
|
Object.defineProperty(BaseTexture.prototype, "isRGBD", {
|
|
|
/**
|
|
|
* Gets whether or not the texture contains RGBD data.
|
|
@@ -32086,7 +32177,6 @@ var BABYLON;
|
|
|
if (!scene) {
|
|
|
return;
|
|
|
}
|
|
|
- this._samplingMode = samplingMode;
|
|
|
scene.getEngine().updateTextureSamplingMode(samplingMode, this._texture);
|
|
|
};
|
|
|
/**
|
|
@@ -32379,10 +32469,10 @@ var BABYLON;
|
|
|
], BaseTexture.prototype, "anisotropicFilteringLevel", void 0);
|
|
|
__decorate([
|
|
|
BABYLON.serialize()
|
|
|
- ], BaseTexture.prototype, "isCube", void 0);
|
|
|
+ ], BaseTexture.prototype, "isCube", null);
|
|
|
__decorate([
|
|
|
BABYLON.serialize()
|
|
|
- ], BaseTexture.prototype, "is3D", void 0);
|
|
|
+ ], BaseTexture.prototype, "is3D", null);
|
|
|
__decorate([
|
|
|
BABYLON.serialize()
|
|
|
], BaseTexture.prototype, "gammaSpace", void 0);
|
|
@@ -32493,6 +32583,8 @@ var BABYLON;
|
|
|
* Defines the center of rotation (W)
|
|
|
*/
|
|
|
_this.wRotationCenter = 0.5;
|
|
|
+ /** @hidden */
|
|
|
+ _this._initialSamplingMode = Texture.BILINEAR_SAMPLINGMODE;
|
|
|
/**
|
|
|
* Observable triggered once the texture has been loaded.
|
|
|
*/
|
|
@@ -32502,7 +32594,7 @@ var BABYLON;
|
|
|
_this.url = url;
|
|
|
_this._noMipmap = noMipmap;
|
|
|
_this._invertY = invertY;
|
|
|
- _this._samplingMode = samplingMode;
|
|
|
+ _this._initialSamplingMode = samplingMode;
|
|
|
_this._buffer = buffer;
|
|
|
_this._deleteBuffer = deleteBuffer;
|
|
|
if (format) {
|
|
@@ -32535,7 +32627,7 @@ var BABYLON;
|
|
|
_this._texture = _this._getFromCache(_this.url, noMipmap, samplingMode);
|
|
|
if (!_this._texture) {
|
|
|
if (!scene.useDelayedTextureLoading) {
|
|
|
- _this._texture = scene.getEngine().createTexture(_this.url, noMipmap, invertY, scene, _this._samplingMode, load, onError, _this._buffer, undefined, _this._format);
|
|
|
+ _this._texture = scene.getEngine().createTexture(_this.url, noMipmap, invertY, scene, samplingMode, load, onError, _this._buffer, undefined, _this._format);
|
|
|
if (deleteBuffer) {
|
|
|
delete _this._buffer;
|
|
|
}
|
|
@@ -32585,7 +32677,10 @@ var BABYLON;
|
|
|
* Get the current sampling mode associated with the texture.
|
|
|
*/
|
|
|
get: function () {
|
|
|
- return this._samplingMode;
|
|
|
+ if (!this._texture) {
|
|
|
+ return this._initialSamplingMode;
|
|
|
+ }
|
|
|
+ return this._texture.samplingMode;
|
|
|
},
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
@@ -32633,9 +32728,9 @@ var BABYLON;
|
|
|
return;
|
|
|
}
|
|
|
this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_LOADED;
|
|
|
- this._texture = this._getFromCache(this.url, this._noMipmap, this._samplingMode);
|
|
|
+ this._texture = this._getFromCache(this.url, this._noMipmap, this.samplingMode);
|
|
|
if (!this._texture) {
|
|
|
- this._texture = scene.getEngine().createTexture(this.url, this._noMipmap, this._invertY, scene, this._samplingMode, this._delayedOnLoad, this._delayedOnError, this._buffer, null, this._format);
|
|
|
+ this._texture = scene.getEngine().createTexture(this.url, this._noMipmap, this._invertY, scene, this.samplingMode, this._delayedOnLoad, this._delayedOnError, this._buffer, null, this._format);
|
|
|
if (this._deleteBuffer) {
|
|
|
delete this._buffer;
|
|
|
}
|
|
@@ -32774,7 +32869,7 @@ var BABYLON;
|
|
|
Texture.prototype.clone = function () {
|
|
|
var _this = this;
|
|
|
return BABYLON.SerializationHelper.Clone(function () {
|
|
|
- return new Texture(_this._texture ? _this._texture.url : null, _this.getScene(), _this._noMipmap, _this._invertY, _this._samplingMode);
|
|
|
+ return new Texture(_this._texture ? _this._texture.url : null, _this.getScene(), _this._noMipmap, _this._invertY, _this.samplingMode);
|
|
|
}, this);
|
|
|
};
|
|
|
/**
|
|
@@ -32880,7 +32975,7 @@ var BABYLON;
|
|
|
// Update Sampling Mode
|
|
|
if (parsedTexture.samplingMode) {
|
|
|
var sampling = parsedTexture.samplingMode;
|
|
|
- if (texture && texture._samplingMode !== sampling) {
|
|
|
+ if (texture && texture.samplingMode !== sampling) {
|
|
|
texture.updateSamplingMode(sampling);
|
|
|
}
|
|
|
}
|
|
@@ -33137,7 +33232,9 @@ var BABYLON;
|
|
|
// Deep copy
|
|
|
BABYLON.Tools.DeepCopy(source, _this, ["name", "material", "skeleton", "instances", "parent", "uniqueId",
|
|
|
"source", "metadata", "hasLODLevels", "geometry", "isBlocked", "areNormalsFrozen",
|
|
|
- "onBeforeDrawObservable", "onBeforeRenderObservable", "onAfterRenderObservable", "onBeforeDraw"
|
|
|
+ "onBeforeDrawObservable", "onBeforeRenderObservable", "onAfterRenderObservable", "onBeforeDraw",
|
|
|
+ "onAfterWorldMatrixUpdateObservable", "onCollideObservable", "onCollisionPositionChangeObservable", "onRebuildObservable",
|
|
|
+ "onDisposeObservable"
|
|
|
], ["_poseMatrix"]);
|
|
|
// Source mesh
|
|
|
_this._source = source;
|
|
@@ -41590,7 +41687,15 @@ var BABYLON;
|
|
|
this.setIndices(indices, null, true);
|
|
|
}
|
|
|
else {
|
|
|
+ var needToUpdateSubMeshes = indices.length !== this._indices.length;
|
|
|
+ this._indices = indices;
|
|
|
this._engine.updateDynamicIndexBuffer(this._indexBuffer, indices, offset);
|
|
|
+ if (needToUpdateSubMeshes) {
|
|
|
+ for (var _i = 0, _a = this._meshes; _i < _a.length; _i++) {
|
|
|
+ var mesh = _a[_i];
|
|
|
+ mesh._createGlobalSubMesh(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
/**
|
|
@@ -41614,10 +41719,9 @@ var BABYLON;
|
|
|
if (totalVertices != undefined) { // including null and undefined
|
|
|
this._totalVertices = totalVertices;
|
|
|
}
|
|
|
- var meshes = this._meshes;
|
|
|
- var numOfMeshes = meshes.length;
|
|
|
- for (var index = 0; index < numOfMeshes; index++) {
|
|
|
- meshes[index]._createGlobalSubMesh(true);
|
|
|
+ for (var _i = 0, _a = this._meshes; _i < _a.length; _i++) {
|
|
|
+ var mesh = _a[_i];
|
|
|
+ mesh._createGlobalSubMesh(true);
|
|
|
}
|
|
|
this.notifyUpdate();
|
|
|
};
|
|
@@ -41923,17 +42027,19 @@ var BABYLON;
|
|
|
for (kind in this._vertexBuffers) {
|
|
|
// using slice() to make a copy of the array and not just reference it
|
|
|
var data = this.getVerticesData(kind);
|
|
|
- if (data instanceof Float32Array) {
|
|
|
- vertexData.set(new Float32Array(data), kind);
|
|
|
- }
|
|
|
- else {
|
|
|
- vertexData.set(data.slice(0), kind);
|
|
|
- }
|
|
|
- if (!stopChecking) {
|
|
|
- var vb = this.getVertexBuffer(kind);
|
|
|
- if (vb) {
|
|
|
- updatable = vb.isUpdatable();
|
|
|
- stopChecking = !updatable;
|
|
|
+ if (data) {
|
|
|
+ if (data instanceof Float32Array) {
|
|
|
+ vertexData.set(new Float32Array(data), kind);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ vertexData.set(data.slice(0), kind);
|
|
|
+ }
|
|
|
+ if (!stopChecking) {
|
|
|
+ var vb = this.getVertexBuffer(kind);
|
|
|
+ if (vb) {
|
|
|
+ updatable = vb.isUpdatable();
|
|
|
+ stopChecking = !updatable;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -45272,10 +45378,10 @@ var BABYLON;
|
|
|
};
|
|
|
/**
|
|
|
* Creates a standard material from parsed material data
|
|
|
- * @param source defines the JSON represnetation of the material
|
|
|
+ * @param source defines the JSON representation of the material
|
|
|
* @param scene defines the hosting scene
|
|
|
* @param rootUrl defines the root URL to use to load textures and relative dependencies
|
|
|
- * @returns a new material
|
|
|
+ * @returns a new standard material
|
|
|
*/
|
|
|
StandardMaterial.Parse = function (source, scene, rootUrl) {
|
|
|
return BABYLON.SerializationHelper.Parse(function () { return new StandardMaterial(source.name, scene); }, source, scene, rootUrl);
|
|
@@ -67084,7 +67190,7 @@ var BABYLON;
|
|
|
*/
|
|
|
function DebugLayer(scene) {
|
|
|
var _this = this;
|
|
|
- this.BJSINSPECTOR = typeof INSPECTOR !== 'undefined' ? INSPECTOR : undefined;
|
|
|
+ this.BJSINSPECTOR = this._getGlobalInspector();
|
|
|
/**
|
|
|
* Observable triggered when a property is changed through the inspector.
|
|
|
*/
|
|
@@ -67103,9 +67209,21 @@ var BABYLON;
|
|
|
return;
|
|
|
}
|
|
|
var userOptions = __assign({ overlay: false, showExplorer: true, showInspector: true, embedMode: false, handleResize: true, enablePopup: true }, config);
|
|
|
- this.BJSINSPECTOR = this.BJSINSPECTOR || typeof INSPECTOR !== 'undefined' ? INSPECTOR : undefined;
|
|
|
+ this.BJSINSPECTOR = this.BJSINSPECTOR || this._getGlobalInspector();
|
|
|
this.BJSINSPECTOR.Inspector.Show(this._scene, userOptions);
|
|
|
};
|
|
|
+ /** Get the inspector from bundle or global */
|
|
|
+ DebugLayer.prototype._getGlobalInspector = function () {
|
|
|
+ // UMD Global name detection from Webpack Bundle UMD Name.
|
|
|
+ if (typeof INSPECTOR !== 'undefined') {
|
|
|
+ return INSPECTOR;
|
|
|
+ }
|
|
|
+ // In case of module let s check the global emitted from the Inspector entry point.
|
|
|
+ if (BABYLON && BABYLON.Inspector) {
|
|
|
+ return BABYLON;
|
|
|
+ }
|
|
|
+ return undefined;
|
|
|
+ };
|
|
|
/**
|
|
|
* Get if the inspector is visible or not.
|
|
|
* @returns true if visible otherwise, false
|
|
@@ -70173,7 +70291,7 @@ var BABYLON;
|
|
|
var MeshBuilder = /** @class */ (function () {
|
|
|
function MeshBuilder() {
|
|
|
}
|
|
|
- MeshBuilder.updateSideOrientation = function (orientation) {
|
|
|
+ MeshBuilder._UpdateSideOrientation = function (orientation) {
|
|
|
if (orientation == BABYLON.Mesh.DOUBLESIDE) {
|
|
|
return BABYLON.Mesh.DOUBLESIDE;
|
|
|
}
|
|
@@ -70200,7 +70318,7 @@ var BABYLON;
|
|
|
MeshBuilder.CreateBox = function (name, options, scene) {
|
|
|
if (scene === void 0) { scene = null; }
|
|
|
var box = new BABYLON.Mesh(name, scene);
|
|
|
- options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation);
|
|
|
+ options.sideOrientation = MeshBuilder._UpdateSideOrientation(options.sideOrientation);
|
|
|
box._originalBuilderSideOrientation = options.sideOrientation;
|
|
|
var vertexData = BABYLON.VertexData.CreateBox(options);
|
|
|
vertexData.applyToMesh(box, options.updatable);
|
|
@@ -70224,7 +70342,7 @@ var BABYLON;
|
|
|
*/
|
|
|
MeshBuilder.CreateSphere = function (name, options, scene) {
|
|
|
var sphere = new BABYLON.Mesh(name, scene);
|
|
|
- options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation);
|
|
|
+ options.sideOrientation = MeshBuilder._UpdateSideOrientation(options.sideOrientation);
|
|
|
sphere._originalBuilderSideOrientation = options.sideOrientation;
|
|
|
var vertexData = BABYLON.VertexData.CreateSphere(options);
|
|
|
vertexData.applyToMesh(sphere, options.updatable);
|
|
@@ -70247,7 +70365,7 @@ var BABYLON;
|
|
|
MeshBuilder.CreateDisc = function (name, options, scene) {
|
|
|
if (scene === void 0) { scene = null; }
|
|
|
var disc = new BABYLON.Mesh(name, scene);
|
|
|
- options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation);
|
|
|
+ options.sideOrientation = MeshBuilder._UpdateSideOrientation(options.sideOrientation);
|
|
|
disc._originalBuilderSideOrientation = options.sideOrientation;
|
|
|
var vertexData = BABYLON.VertexData.CreateDisc(options);
|
|
|
vertexData.applyToMesh(disc, options.updatable);
|
|
@@ -70270,7 +70388,7 @@ var BABYLON;
|
|
|
*/
|
|
|
MeshBuilder.CreateIcoSphere = function (name, options, scene) {
|
|
|
var sphere = new BABYLON.Mesh(name, scene);
|
|
|
- options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation);
|
|
|
+ options.sideOrientation = MeshBuilder._UpdateSideOrientation(options.sideOrientation);
|
|
|
sphere._originalBuilderSideOrientation = options.sideOrientation;
|
|
|
var vertexData = BABYLON.VertexData.CreateIcoSphere(options);
|
|
|
vertexData.applyToMesh(sphere, options.updatable);
|
|
@@ -70304,7 +70422,7 @@ var BABYLON;
|
|
|
var pathArray = options.pathArray;
|
|
|
var closeArray = options.closeArray;
|
|
|
var closePath = options.closePath;
|
|
|
- var sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation);
|
|
|
+ var sideOrientation = MeshBuilder._UpdateSideOrientation(options.sideOrientation);
|
|
|
var instance = options.instance;
|
|
|
var updatable = options.updatable;
|
|
|
if (instance) { // existing ribbon instance update
|
|
@@ -70442,7 +70560,7 @@ var BABYLON;
|
|
|
*/
|
|
|
MeshBuilder.CreateCylinder = function (name, options, scene) {
|
|
|
var cylinder = new BABYLON.Mesh(name, scene);
|
|
|
- options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation);
|
|
|
+ options.sideOrientation = MeshBuilder._UpdateSideOrientation(options.sideOrientation);
|
|
|
cylinder._originalBuilderSideOrientation = options.sideOrientation;
|
|
|
var vertexData = BABYLON.VertexData.CreateCylinder(options);
|
|
|
vertexData.applyToMesh(cylinder, options.updatable);
|
|
@@ -70464,7 +70582,7 @@ var BABYLON;
|
|
|
*/
|
|
|
MeshBuilder.CreateTorus = function (name, options, scene) {
|
|
|
var torus = new BABYLON.Mesh(name, scene);
|
|
|
- options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation);
|
|
|
+ options.sideOrientation = MeshBuilder._UpdateSideOrientation(options.sideOrientation);
|
|
|
torus._originalBuilderSideOrientation = options.sideOrientation;
|
|
|
var vertexData = BABYLON.VertexData.CreateTorus(options);
|
|
|
vertexData.applyToMesh(torus, options.updatable);
|
|
@@ -70487,7 +70605,7 @@ var BABYLON;
|
|
|
*/
|
|
|
MeshBuilder.CreateTorusKnot = function (name, options, scene) {
|
|
|
var torusKnot = new BABYLON.Mesh(name, scene);
|
|
|
- options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation);
|
|
|
+ options.sideOrientation = MeshBuilder._UpdateSideOrientation(options.sideOrientation);
|
|
|
torusKnot._originalBuilderSideOrientation = options.sideOrientation;
|
|
|
var vertexData = BABYLON.VertexData.CreateTorusKnot(options);
|
|
|
vertexData.applyToMesh(torusKnot, options.updatable);
|
|
@@ -70682,7 +70800,7 @@ var BABYLON;
|
|
|
var rotation = options.rotation || 0;
|
|
|
var cap = (options.cap === 0) ? 0 : options.cap || BABYLON.Mesh.NO_CAP;
|
|
|
var updatable = options.updatable;
|
|
|
- var sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation);
|
|
|
+ var sideOrientation = MeshBuilder._UpdateSideOrientation(options.sideOrientation);
|
|
|
var instance = options.instance || null;
|
|
|
var invertUV = options.invertUV || false;
|
|
|
return MeshBuilder._ExtrudeShapeGeneric(name, shape, path, scale, rotation, null, null, false, false, cap, false, scene, updatable ? true : false, sideOrientation, instance, invertUV, options.frontUVs || null, options.backUVs || null);
|
|
@@ -70722,7 +70840,7 @@ var BABYLON;
|
|
|
var ribbonClosePath = options.ribbonClosePath || false;
|
|
|
var cap = (options.cap === 0) ? 0 : options.cap || BABYLON.Mesh.NO_CAP;
|
|
|
var updatable = options.updatable;
|
|
|
- var sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation);
|
|
|
+ var sideOrientation = MeshBuilder._UpdateSideOrientation(options.sideOrientation);
|
|
|
var instance = options.instance;
|
|
|
var invertUV = options.invertUV || false;
|
|
|
return MeshBuilder._ExtrudeShapeGeneric(name, shape, path, null, null, scaleFunction, rotationFunction, ribbonCloseArray, ribbonClosePath, cap, true, scene, updatable ? true : false, sideOrientation, instance || null, invertUV, options.frontUVs || null, options.backUVs || null);
|
|
@@ -70755,7 +70873,7 @@ var BABYLON;
|
|
|
var tessellation = options.tessellation || 64;
|
|
|
var clip = options.clip || 0;
|
|
|
var updatable = options.updatable;
|
|
|
- var sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation);
|
|
|
+ var sideOrientation = MeshBuilder._UpdateSideOrientation(options.sideOrientation);
|
|
|
var cap = options.cap || BABYLON.Mesh.NO_CAP;
|
|
|
var pi2 = Math.PI * 2;
|
|
|
var paths = new Array();
|
|
@@ -70801,7 +70919,7 @@ var BABYLON;
|
|
|
*/
|
|
|
MeshBuilder.CreatePlane = function (name, options, scene) {
|
|
|
var plane = new BABYLON.Mesh(name, scene);
|
|
|
- options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation);
|
|
|
+ options.sideOrientation = MeshBuilder._UpdateSideOrientation(options.sideOrientation);
|
|
|
plane._originalBuilderSideOrientation = options.sideOrientation;
|
|
|
var vertexData = BABYLON.VertexData.CreatePlane(options);
|
|
|
vertexData.applyToMesh(plane, options.updatable);
|
|
@@ -70945,7 +71063,7 @@ var BABYLON;
|
|
|
* @returns the polygon mesh
|
|
|
*/
|
|
|
MeshBuilder.CreatePolygon = function (name, options, scene) {
|
|
|
- options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation);
|
|
|
+ options.sideOrientation = MeshBuilder._UpdateSideOrientation(options.sideOrientation);
|
|
|
var shape = options.shape;
|
|
|
var holes = options.holes || [];
|
|
|
var depth = options.depth || 0;
|
|
@@ -71021,7 +71139,7 @@ var BABYLON;
|
|
|
var cap = options.cap || BABYLON.Mesh.NO_CAP;
|
|
|
var invertUV = options.invertUV || false;
|
|
|
var updatable = options.updatable;
|
|
|
- var sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation);
|
|
|
+ var sideOrientation = MeshBuilder._UpdateSideOrientation(options.sideOrientation);
|
|
|
options.arc = options.arc && (options.arc <= 0.0 || options.arc > 1.0) ? 1.0 : options.arc || 1.0;
|
|
|
// tube geometry
|
|
|
var tubePathArray = function (path, path3D, circlePaths, radius, tessellation, radiusFunction, cap, arc) {
|
|
@@ -71132,7 +71250,7 @@ var BABYLON;
|
|
|
*/
|
|
|
MeshBuilder.CreatePolyhedron = function (name, options, scene) {
|
|
|
var polyhedron = new BABYLON.Mesh(name, scene);
|
|
|
- options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation);
|
|
|
+ options.sideOrientation = MeshBuilder._UpdateSideOrientation(options.sideOrientation);
|
|
|
polyhedron._originalBuilderSideOrientation = options.sideOrientation;
|
|
|
var vertexData = BABYLON.VertexData.CreatePolyhedron(options);
|
|
|
vertexData.applyToMesh(polyhedron, options.updatable);
|
|
@@ -75651,7 +75769,7 @@ var BABYLON;
|
|
|
this._canvas.width = textureSize.width;
|
|
|
this._canvas.height = textureSize.height;
|
|
|
this.releaseInternalTexture();
|
|
|
- this._texture = this._engine.createDynamicTexture(textureSize.width, textureSize.height, this._generateMipMaps, this._samplingMode);
|
|
|
+ this._texture = this._engine.createDynamicTexture(textureSize.width, textureSize.height, this._generateMipMaps, this.samplingMode);
|
|
|
};
|
|
|
/**
|
|
|
* Scales the texture
|
|
@@ -75831,7 +75949,7 @@ var BABYLON;
|
|
|
_this.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
|
|
|
_this._generateMipMaps = false;
|
|
|
}
|
|
|
- _this._texture = _this._engine.createDynamicTexture(_this.video.videoWidth, _this.video.videoHeight, _this._generateMipMaps, _this._samplingMode);
|
|
|
+ _this._texture = _this._engine.createDynamicTexture(_this.video.videoWidth, _this.video.videoHeight, _this._generateMipMaps, _this.samplingMode);
|
|
|
if (!_this.video.autoplay && !_this._settings.poster) {
|
|
|
var oldHandler_1 = _this.video.onplaying;
|
|
|
var error_1 = false;
|
|
@@ -75899,7 +76017,7 @@ var BABYLON;
|
|
|
};
|
|
|
_this._engine = _this.getScene().getEngine();
|
|
|
_this._generateMipMaps = generateMipMaps;
|
|
|
- _this._samplingMode = samplingMode;
|
|
|
+ _this._initialSamplingMode = samplingMode;
|
|
|
_this.autoUpdateTexture = settings.autoUpdateTexture;
|
|
|
_this.name = name || _this._getName(src);
|
|
|
_this.video = _this._getVideo(src);
|
|
@@ -102270,23 +102388,23 @@ var BABYLON;
|
|
|
BABYLON.Tools.Error("texture missing KTX identifier");
|
|
|
return;
|
|
|
}
|
|
|
- // load the reset of the header in native 32 bit int
|
|
|
- var header = new Int32Array(this.arrayBuffer, 12, 13);
|
|
|
- // determine of the remaining header values are recorded in the opposite endianness & require conversion
|
|
|
- var oppositeEndianess = header[0] === 0x01020304;
|
|
|
- // read all the header elements in order they exist in the file, without modification (sans endainness)
|
|
|
- this.glType = oppositeEndianess ? this.switchEndianness(header[1]) : header[1]; // must be 0 for compressed textures
|
|
|
- this.glTypeSize = oppositeEndianess ? this.switchEndianness(header[2]) : header[2]; // must be 1 for compressed textures
|
|
|
- this.glFormat = oppositeEndianess ? this.switchEndianness(header[3]) : header[3]; // must be 0 for compressed textures
|
|
|
- this.glInternalFormat = oppositeEndianess ? this.switchEndianness(header[4]) : header[4]; // the value of arg passed to gl.compressedTexImage2D(,,x,,,,)
|
|
|
- this.glBaseInternalFormat = oppositeEndianess ? this.switchEndianness(header[5]) : header[5]; // specify GL_RGB, GL_RGBA, GL_ALPHA, etc (un-compressed only)
|
|
|
- this.pixelWidth = oppositeEndianess ? this.switchEndianness(header[6]) : header[6]; // level 0 value of arg passed to gl.compressedTexImage2D(,,,x,,,)
|
|
|
- this.pixelHeight = oppositeEndianess ? this.switchEndianness(header[7]) : header[7]; // level 0 value of arg passed to gl.compressedTexImage2D(,,,,x,,)
|
|
|
- this.pixelDepth = oppositeEndianess ? this.switchEndianness(header[8]) : header[8]; // level 0 value of arg passed to gl.compressedTexImage3D(,,,,,x,,)
|
|
|
- this.numberOfArrayElements = oppositeEndianess ? this.switchEndianness(header[9]) : header[9]; // used for texture arrays
|
|
|
- this.numberOfFaces = oppositeEndianess ? this.switchEndianness(header[10]) : header[10]; // used for cubemap textures, should either be 1 or 6
|
|
|
- this.numberOfMipmapLevels = oppositeEndianess ? this.switchEndianness(header[11]) : header[11]; // number of levels; disregard possibility of 0 for compressed textures
|
|
|
- this.bytesOfKeyValueData = oppositeEndianess ? this.switchEndianness(header[12]) : header[12]; // the amount of space after the header for meta-data
|
|
|
+ // load the reset of the header in native 32 bit uint
|
|
|
+ var dataSize = Uint32Array.BYTES_PER_ELEMENT;
|
|
|
+ var headerDataView = new DataView(this.arrayBuffer, 12, 13 * dataSize);
|
|
|
+ var endianness = headerDataView.getUint32(0, true);
|
|
|
+ var littleEndian = endianness === 0x04030201;
|
|
|
+ this.glType = headerDataView.getUint32(1 * dataSize, littleEndian); // must be 0 for compressed textures
|
|
|
+ this.glTypeSize = headerDataView.getUint32(2 * dataSize, littleEndian); // must be 1 for compressed textures
|
|
|
+ this.glFormat = headerDataView.getUint32(3 * dataSize, littleEndian); // must be 0 for compressed textures
|
|
|
+ this.glInternalFormat = headerDataView.getUint32(4 * dataSize, littleEndian); // the value of arg passed to gl.compressedTexImage2D(,,x,,,,)
|
|
|
+ this.glBaseInternalFormat = headerDataView.getUint32(5 * dataSize, littleEndian); // specify GL_RGB, GL_RGBA, GL_ALPHA, etc (un-compressed only)
|
|
|
+ this.pixelWidth = headerDataView.getUint32(6 * dataSize, littleEndian); // level 0 value of arg passed to gl.compressedTexImage2D(,,,x,,,)
|
|
|
+ this.pixelHeight = headerDataView.getUint32(7 * dataSize, littleEndian); // level 0 value of arg passed to gl.compressedTexImage2D(,,,,x,,)
|
|
|
+ this.pixelDepth = headerDataView.getUint32(8 * dataSize, littleEndian); // level 0 value of arg passed to gl.compressedTexImage3D(,,,,,x,,)
|
|
|
+ this.numberOfArrayElements = headerDataView.getUint32(9 * dataSize, littleEndian); // used for texture arrays
|
|
|
+ this.numberOfFaces = headerDataView.getUint32(10 * dataSize, littleEndian); // used for cubemap textures, should either be 1 or 6
|
|
|
+ this.numberOfMipmapLevels = headerDataView.getUint32(11 * dataSize, littleEndian); // number of levels; disregard possibility of 0 for compressed textures
|
|
|
+ this.bytesOfKeyValueData = headerDataView.getUint32(12 * dataSize, littleEndian); // the amount of space after the header for meta-data
|
|
|
// Make sure we have a compressed type. Not only reduces work, but probably better to let dev know they are not compressing.
|
|
|
if (this.glType !== 0) {
|
|
|
BABYLON.Tools.Error("only compressed formats currently supported");
|
|
@@ -102312,19 +102430,6 @@ var BABYLON;
|
|
|
// would need to make this more elaborate & adjust checks above to support more than one load type
|
|
|
this.loadType = KhronosTextureContainer.COMPRESSED_2D;
|
|
|
}
|
|
|
- //
|
|
|
- /**
|
|
|
- * Revert the endianness of a value.
|
|
|
- * Not as fast hardware based, but will probably never need to use
|
|
|
- * @param val defines the value to convert
|
|
|
- * @returns the new value
|
|
|
- */
|
|
|
- KhronosTextureContainer.prototype.switchEndianness = function (val) {
|
|
|
- return ((val & 0xFF) << 24)
|
|
|
- | ((val & 0xFF00) << 8)
|
|
|
- | ((val >> 8) & 0xFF00)
|
|
|
- | ((val >> 24) & 0xFF);
|
|
|
- };
|
|
|
/**
|
|
|
* Uploads KTX content to a Babylon Texture.
|
|
|
* It is assumed that the texture has already been created & is currently bound
|
|
@@ -117236,7 +117341,7 @@ var BABYLON;
|
|
|
if (useBilinearMode === void 0) { useBilinearMode = true; }
|
|
|
var scene = texture.getScene();
|
|
|
var engine = scene.getEngine();
|
|
|
- var rtt = new BABYLON.RenderTargetTexture('resized' + texture.name, { width: width, height: height }, scene, !texture.noMipmap, true, texture._texture.type, false, texture._samplingMode, false);
|
|
|
+ var rtt = new BABYLON.RenderTargetTexture('resized' + texture.name, { width: width, height: height }, scene, !texture.noMipmap, true, texture._texture.type, false, texture.samplingMode, false);
|
|
|
rtt.wrapU = texture.wrapU;
|
|
|
rtt.wrapV = texture.wrapV;
|
|
|
rtt.uOffset = texture.uOffset;
|