|
@@ -12918,7 +12918,7 @@ var BABYLON;
|
|
|
* Returns the current version of the framework
|
|
|
*/
|
|
|
get: function () {
|
|
|
- return "4.0.0-alpha.6";
|
|
|
+ return "4.0.0-alpha.7";
|
|
|
},
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
@@ -28766,6 +28766,14 @@ var BABYLON;
|
|
|
}
|
|
|
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.
|
|
@@ -28773,7 +28781,7 @@ var BABYLON;
|
|
|
* @return a boolean defining if the geometry was added or not
|
|
|
*/
|
|
|
Scene.prototype.pushGeometry = function (geometry, force) {
|
|
|
- if (!force && this.getGeometryByID(geometry.id)) {
|
|
|
+ if (!force && this._getGeometryByUniqueID(geometry.uniqueId)) {
|
|
|
return false;
|
|
|
}
|
|
|
this.addGeometry(geometry);
|
|
@@ -31349,9 +31357,9 @@ var BABYLON;
|
|
|
return;
|
|
|
case InternalTexture.DATASOURCE_URL:
|
|
|
proxy = this._engine.createTexture(this.url, !this.generateMipMaps, this.invertY, null, this.samplingMode, function () {
|
|
|
+ proxy._swapAndDie(_this);
|
|
|
_this.isReady = true;
|
|
|
}, null, this._buffer, undefined, this.format);
|
|
|
- proxy._swapAndDie(this);
|
|
|
return;
|
|
|
case InternalTexture.DATASOURCE_RAW:
|
|
|
proxy = this._engine.createRawTexture(this._bufferView, this.baseWidth, this.baseHeight, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);
|
|
@@ -31402,9 +31410,9 @@ var BABYLON;
|
|
|
return;
|
|
|
case InternalTexture.DATASOURCE_CUBE:
|
|
|
proxy = this._engine.createCubeTexture(this.url, null, this._files, !this.generateMipMaps, function () {
|
|
|
+ proxy._swapAndDie(_this);
|
|
|
_this.isReady = true;
|
|
|
}, null, this.format, this._extension);
|
|
|
- proxy._swapAndDie(this);
|
|
|
return;
|
|
|
case InternalTexture.DATASOURCE_CUBERAW:
|
|
|
proxy = this._engine.createRawCubeTexture(this._bufferViewArray, this.width, this.format, this.type, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);
|
|
@@ -31414,9 +31422,9 @@ var BABYLON;
|
|
|
case InternalTexture.DATASOURCE_CUBERAW_RGBD:
|
|
|
proxy = this._engine.createRawCubeTexture(null, this.width, this.format, this.type, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);
|
|
|
BABYLON.RawCubeTexture._UpdateRGBDAsync(proxy, this._bufferViewArrayArray, this._sphericalPolynomial, this._lodGenerationScale, this._lodGenerationOffset).then(function () {
|
|
|
+ proxy._swapAndDie(_this);
|
|
|
_this.isReady = true;
|
|
|
});
|
|
|
- proxy._swapAndDie(this);
|
|
|
return;
|
|
|
case InternalTexture.DATASOURCE_CUBEPREFILTERED:
|
|
|
proxy = this._engine.createPrefilteredCubeTexture(this.url, null, this._lodGenerationScale, this._lodGenerationOffset, function (proxy) {
|
|
@@ -40984,6 +40992,7 @@ var BABYLON;
|
|
|
this._isDisposed = false;
|
|
|
this._indexBufferIsUpdatable = false;
|
|
|
this.id = id;
|
|
|
+ this.uniqueId = scene.getUniqueId();
|
|
|
this._engine = scene.getEngine();
|
|
|
this._meshes = [];
|
|
|
this._scene = scene;
|
|
@@ -75424,12 +75433,12 @@ var BABYLON;
|
|
|
var _this = _super.call(this, null, scene, !generateMipMaps, invertY) || this;
|
|
|
_this._onUserActionRequestedObservable = null;
|
|
|
_this._stillImageCaptured = false;
|
|
|
- _this._poster = false;
|
|
|
+ _this._displayingPosterTexture = false;
|
|
|
_this._createInternalTexture = function () {
|
|
|
if (_this._texture != null) {
|
|
|
- if (_this._poster) {
|
|
|
+ if (_this._displayingPosterTexture) {
|
|
|
_this._texture.dispose();
|
|
|
- _this._poster = false;
|
|
|
+ _this._displayingPosterTexture = false;
|
|
|
}
|
|
|
else {
|
|
|
return;
|
|
@@ -75446,7 +75455,7 @@ var BABYLON;
|
|
|
_this._generateMipMaps = false;
|
|
|
}
|
|
|
_this._texture = _this._engine.createDynamicTexture(_this.video.videoWidth, _this.video.videoHeight, _this._generateMipMaps, _this._samplingMode);
|
|
|
- if (!_this.video.autoplay) {
|
|
|
+ if (!_this.video.autoplay && !_this._settings.poster) {
|
|
|
var oldHandler_1 = _this.video.onplaying;
|
|
|
var error_1 = false;
|
|
|
_this.video.onplaying = function () {
|
|
@@ -75494,7 +75503,7 @@ var BABYLON;
|
|
|
if (_this._texture == null) {
|
|
|
return;
|
|
|
}
|
|
|
- if (!_this._poster) {
|
|
|
+ if (!_this._displayingPosterTexture) {
|
|
|
_this._texture.dispose();
|
|
|
_this._texture = null;
|
|
|
}
|
|
@@ -75506,6 +75515,9 @@ var BABYLON;
|
|
|
if (_this.video.readyState < _this.video.HAVE_CURRENT_DATA) {
|
|
|
return;
|
|
|
}
|
|
|
+ if (_this._displayingPosterTexture) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
_this._engine.updateVideoTexture(_this._texture, _this.video, _this._invertY);
|
|
|
};
|
|
|
_this._engine = _this.getScene().getEngine();
|
|
@@ -75514,6 +75526,7 @@ var BABYLON;
|
|
|
_this.autoUpdateTexture = settings.autoUpdateTexture;
|
|
|
_this.name = name || _this._getName(src);
|
|
|
_this.video = _this._getVideo(src);
|
|
|
+ _this._settings = settings;
|
|
|
if (settings.poster) {
|
|
|
_this.video.poster = settings.poster;
|
|
|
}
|
|
@@ -75524,16 +75537,19 @@ var BABYLON;
|
|
|
_this.video.loop = settings.loop;
|
|
|
}
|
|
|
_this.video.setAttribute("playsinline", "");
|
|
|
- _this.video.addEventListener("canplay", _this._createInternalTexture);
|
|
|
_this.video.addEventListener("paused", _this._updateInternalTexture);
|
|
|
_this.video.addEventListener("seeked", _this._updateInternalTexture);
|
|
|
_this.video.addEventListener("emptied", _this.reset);
|
|
|
- if (_this.video.readyState >= _this.video.HAVE_CURRENT_DATA) {
|
|
|
- _this._createInternalTexture();
|
|
|
- }
|
|
|
- if (settings.poster) {
|
|
|
+ _this._createInternalTextureOnEvent = (settings.poster && !settings.autoPlay) ? "play" : "canplay";
|
|
|
+ _this.video.addEventListener(_this._createInternalTextureOnEvent, _this._createInternalTexture);
|
|
|
+ var videoHasEnoughData = (_this.video.readyState >= _this.video.HAVE_CURRENT_DATA);
|
|
|
+ if (settings.poster &&
|
|
|
+ (!settings.autoPlay || !videoHasEnoughData)) {
|
|
|
_this._texture = _this._engine.createTexture(settings.poster, false, true, scene);
|
|
|
- _this._poster = true;
|
|
|
+ _this._displayingPosterTexture = true;
|
|
|
+ }
|
|
|
+ else if (videoHasEnoughData) {
|
|
|
+ _this._createInternalTexture();
|
|
|
}
|
|
|
return _this;
|
|
|
}
|
|
@@ -75626,7 +75642,7 @@ var BABYLON;
|
|
|
this._onUserActionRequestedObservable.clear();
|
|
|
this._onUserActionRequestedObservable = null;
|
|
|
}
|
|
|
- this.video.removeEventListener("canplay", this._createInternalTexture);
|
|
|
+ this.video.removeEventListener(this._createInternalTextureOnEvent, this._createInternalTexture);
|
|
|
this.video.removeEventListener("paused", this._updateInternalTexture);
|
|
|
this.video.removeEventListener("seeked", this._updateInternalTexture);
|
|
|
this.video.removeEventListener("emptied", this.reset);
|