David Catuhe 6 年之前
父节点
当前提交
6cd564ca78
共有 32 个文件被更改,包括 17008 次插入16863 次删除
  1. 5543 5517
      Playground/babylon.d.txt
  2. 11269 11243
      dist/preview release/babylon.d.ts
  3. 1 1
      dist/preview release/babylon.js
  4. 33 17
      dist/preview release/babylon.max.js
  5. 33 17
      dist/preview release/babylon.no-module.max.js
  6. 1 1
      dist/preview release/babylon.worker.js
  7. 33 17
      dist/preview release/es6.js
  8. 1 1
      dist/preview release/glTF2Interface/package.json
  9. 4 0
      dist/preview release/gui/babylon.gui.d.ts
  10. 1 1
      dist/preview release/gui/babylon.gui.js
  11. 1 1
      dist/preview release/gui/babylon.gui.min.js
  12. 1 1
      dist/preview release/gui/babylon.gui.min.js.map
  13. 8 0
      dist/preview release/gui/babylon.gui.module.d.ts
  14. 2 2
      dist/preview release/gui/package.json
  15. 5 5
      dist/preview release/inspector/package.json
  16. 3 3
      dist/preview release/loaders/package.json
  17. 2 2
      dist/preview release/materialsLibrary/package.json
  18. 2 2
      dist/preview release/postProcessesLibrary/package.json
  19. 2 2
      dist/preview release/proceduralTexturesLibrary/package.json
  20. 3 3
      dist/preview release/serializers/package.json
  21. 1 1
      dist/preview release/viewer/babylon.viewer.js
  22. 1 1
      dist/preview release/viewer/babylon.viewer.max.js
  23. 3 1
      dist/preview release/what's new.md
  24. 5 0
      gui/src/2D/controls/control.ts
  25. 3 1
      gui/src/2D/valueAndUnit.ts
  26. 1 1
      package.json
  27. 3 3
      src/Behaviors/Mesh/babylon.pointerDragBehavior.ts
  28. 1 1
      src/Engine/babylon.engine.ts
  29. 3 3
      src/Materials/Textures/babylon.internalTexture.ts
  30. 22 13
      src/Materials/Textures/babylon.videoTexture.ts
  31. 6 1
      src/Mesh/babylon.geometry.ts
  32. 11 1
      src/babylon.scene.ts

文件差异内容过多而无法显示
+ 5543 - 5517
Playground/babylon.d.txt


文件差异内容过多而无法显示
+ 11269 - 11243
dist/preview release/babylon.d.ts


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/babylon.js


+ 33 - 17
dist/preview release/babylon.max.js

@@ -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) {
@@ -40983,6 +40991,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;
@@ -75399,12 +75408,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;
@@ -75421,7 +75430,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 () {
@@ -75469,7 +75478,7 @@ var BABYLON;
                 if (_this._texture == null) {
                     return;
                 }
-                if (!_this._poster) {
+                if (!_this._displayingPosterTexture) {
                     _this._texture.dispose();
                     _this._texture = null;
                 }
@@ -75481,6 +75490,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();
@@ -75489,6 +75501,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;
             }
@@ -75499,16 +75512,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;
         }
@@ -75601,7 +75617,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);

+ 33 - 17
dist/preview release/babylon.no-module.max.js

@@ -12885,7 +12885,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
@@ -28733,6 +28733,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.
@@ -28740,7 +28748,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);
@@ -31316,9 +31324,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);
@@ -31369,9 +31377,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);
@@ -31381,9 +31389,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) {
@@ -40950,6 +40958,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;
@@ -75366,12 +75375,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;
@@ -75388,7 +75397,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 () {
@@ -75436,7 +75445,7 @@ var BABYLON;
                 if (_this._texture == null) {
                     return;
                 }
-                if (!_this._poster) {
+                if (!_this._displayingPosterTexture) {
                     _this._texture.dispose();
                     _this._texture = null;
                 }
@@ -75448,6 +75457,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();
@@ -75456,6 +75468,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;
             }
@@ -75466,16 +75479,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;
         }
@@ -75568,7 +75584,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);

文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/babylon.worker.js


+ 33 - 17
dist/preview release/es6.js

@@ -12885,7 +12885,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
@@ -28733,6 +28733,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.
@@ -28740,7 +28748,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);
@@ -31316,9 +31324,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);
@@ -31369,9 +31377,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);
@@ -31381,9 +31389,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) {
@@ -40950,6 +40958,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;
@@ -75366,12 +75375,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;
@@ -75388,7 +75397,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 () {
@@ -75436,7 +75445,7 @@ var BABYLON;
                 if (_this._texture == null) {
                     return;
                 }
-                if (!_this._poster) {
+                if (!_this._displayingPosterTexture) {
                     _this._texture.dispose();
                     _this._texture = null;
                 }
@@ -75448,6 +75457,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();
@@ -75456,6 +75468,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;
             }
@@ -75466,16 +75479,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;
         }
@@ -75568,7 +75584,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);

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

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

+ 4 - 0
dist/preview release/gui/babylon.gui.d.ts

@@ -879,6 +879,10 @@ declare module BABYLON.GUI {
             protected _disabledColor: string;
             /** @hidden */
             _tag: any;
+            /**
+                * Gets or sets an object used to store user defined information for the node
+                */
+            metadata: any;
             /** Gets or sets a boolean indicating if the control can be hit with pointer events */
             isHitTestVisible: boolean;
             /** Gets or sets a boolean indicating if the control can block pointer events */

文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/gui/babylon.gui.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/gui/babylon.gui.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/gui/babylon.gui.min.js.map


+ 8 - 0
dist/preview release/gui/babylon.gui.module.d.ts

@@ -986,6 +986,10 @@ declare module 'babylonjs-gui/2D/controls/control' {
             protected _disabledColor: string;
             /** @hidden */
             _tag: any;
+            /**
+                * Gets or sets an object used to store user defined information for the node
+                */
+            metadata: any;
             /** Gets or sets a boolean indicating if the control can be hit with pointer events */
             isHitTestVisible: boolean;
             /** Gets or sets a boolean indicating if the control can block pointer events */
@@ -3866,6 +3870,10 @@ declare module BABYLON.GUI {
             protected _disabledColor: string;
             /** @hidden */
             _tag: any;
+            /**
+                * Gets or sets an object used to store user defined information for the node
+                */
+            metadata: any;
             /** Gets or sets a boolean indicating if the control can be hit with pointer events */
             isHitTestVisible: boolean;
             /** Gets or sets a boolean indicating if the control can block pointer events */

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

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

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

@@ -4,7 +4,7 @@
     },
     "name": "babylonjs-inspector",
     "description": "The Babylon.js inspector.",
-    "version": "4.0.0-alpha.6",
+    "version": "4.0.0-alpha.7",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"
@@ -28,10 +28,10 @@
     ],
     "license": "Apache-2.0",
     "dependencies": {
-        "babylonjs": "4.0.0-alpha.6",
-        "babylonjs-gui": "4.0.0-alpha.6",
-        "babylonjs-loaders": "4.0.0-alpha.6",
-        "babylonjs-serializers": "4.0.0-alpha.6"
+        "babylonjs": "4.0.0-alpha.7",
+        "babylonjs-gui": "4.0.0-alpha.7",
+        "babylonjs-loaders": "4.0.0-alpha.7",
+        "babylonjs-serializers": "4.0.0-alpha.7"
     },
     "engines": {
         "node": "*"

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

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

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

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

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

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

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

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

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

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

文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/viewer/babylon.viewer.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/viewer/babylon.viewer.max.js


+ 3 - 1
dist/preview release/what's new.md

@@ -78,12 +78,13 @@
 - Removed bones from rootNodes where they should never have been ([Deltakosh](https://github.com/deltakosh))
 - Refocusing on input gui with pointer events ([TrevorDev](https://github.com/TrevorDev))
 - Gizmo scaling not consistent when camera is parented ([TrevorDev](https://github.com/TrevorDev))
-- Context loss causing unexpected results with dynamic textures ([TrevorDev](https://github.com/TrevorDev))
+- Context loss causing unexpected results with dynamic textures, geometries with the same name and reflectionTextures ([TrevorDev](https://github.com/TrevorDev))
 - CreateScreenshotUsingRenderTarget stretches mirror textures when setting both width and height ([TrevorDev](https://github.com/TrevorDev))
 - VR helper only updating vr cameras position when entering vr, rotation was missing ([TrevorDev](https://github.com/TrevorDev))
 - Fix VR controllers after gltfLoader transformNode change ([TrevorDev](https://github.com/TrevorDev))
 - Bounding Box fixedDragMeshScreenSize stopped working and allow rotating through bounding box ([TrevorDev](https://github.com/TrevorDev))
 - VR helper would rotate non vr camera while in VR ([TrevorDev](https://github.com/TrevorDev))
+- PointerDragBahavior using Mesh as base type, causing type-checking problems with AbstractMesh ([Poolminer](https://github.com/Poolminer/))
 
 ### Core Engine
 - Fixed a bug with `mesh.alwaysSelectAsActiveMesh` preventing layerMask to be taken in account ([Deltakosh](https://github.com/deltakosh))
@@ -95,6 +96,7 @@
 - Add missing effect layer to asset container ([TrevorDev](https://github.com/TrevorDev))
 - Fixed effect layer compatibility with multi materials ([Sebavan](https://github.com/Sebavan))
 - Added a `DeepImmutable<T>` type to specifiy that a referenced object should be considered recursively immutable, meaning that all its properties are `readonly` and that if a property is a reference to an object, this object is also recursively immutable. ([barroij](https://github.com/barroij))
+- Fixed `VideoTexture` poster property when autoplay is turned off.
 
 ### Viewer
 

+ 5 - 0
gui/src/2D/controls/control.ts

@@ -86,6 +86,11 @@ export class Control {
     /** @hidden */
     public _tag: any;
 
+    /**
+     * Gets or sets an object used to store user defined information for the node
+     */
+    public metadata: any = null;
+
     /** Gets or sets a boolean indicating if the control can be hit with pointer events */
     public isHitTestVisible = true;
     /** Gets or sets a boolean indicating if the control can block pointer events */

+ 3 - 1
gui/src/2D/valueAndUnit.ts

@@ -5,6 +5,7 @@ import { AdvancedDynamicTexture } from "./advancedDynamicTexture";
  */
 export class ValueAndUnit {
     private _value = 1;
+    private _originalUnit: number;
     /**
      * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
      * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
@@ -23,6 +24,7 @@ export class ValueAndUnit {
         /** defines a boolean indicating if the value can be negative */
         public negativeValueAllowed = true) {
         this._value = value;
+        this._originalUnit = unit;
     }
 
     /** Gets a boolean indicating if the value is a percentage */
@@ -116,7 +118,7 @@ export class ValueAndUnit {
         }
 
         var sourceValue = parseFloat(match[1]);
-        var sourceUnit = this.unit;
+        var sourceUnit = this._originalUnit;
 
         if (!this.negativeValueAllowed) {
             if (sourceValue < 0) {

+ 1 - 1
package.json

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

+ 3 - 3
src/Behaviors/Mesh/babylon.pointerDragBehavior.ts

@@ -2,9 +2,9 @@ module BABYLON {
     /**
      * A behavior that when attached to a mesh will allow the mesh to be dragged around the screen based on pointer events
      */
-    export class PointerDragBehavior implements Behavior<Mesh> {
+    export class PointerDragBehavior implements Behavior<AbstractMesh> {
         private static _AnyMouseID = -2;
-        private _attachedNode: Mesh;
+        private _attachedNode: AbstractMesh;
         private _dragPlane: Mesh;
         private _scene: Scene;
         private _pointerObserver: Nullable<Observer<PointerInfo>>;
@@ -117,7 +117,7 @@ module BABYLON {
          * Attaches the drag behavior the passed in mesh
          * @param ownerNode The mesh that will be dragged around once attached
          */
-        public attach(ownerNode: Mesh): void {
+        public attach(ownerNode: AbstractMesh): void {
             this._scene = ownerNode.getScene();
             this._attachedNode = ownerNode;
 

+ 1 - 1
src/Engine/babylon.engine.ts

@@ -481,7 +481,7 @@ module BABYLON {
          * Returns the current version of the framework
          */
         public static get Version(): string {
-            return "4.0.0-alpha.6";
+            return "4.0.0-alpha.7";
         }
 
         /**

+ 3 - 3
src/Materials/Textures/babylon.internalTexture.ts

@@ -287,9 +287,9 @@ module BABYLON {
 
                 case InternalTexture.DATASOURCE_URL:
                     proxy = this._engine.createTexture(this.url, !this.generateMipMaps, this.invertY, null, this.samplingMode, () => {
+                        proxy._swapAndDie(this);
                         this.isReady = true;
                     }, null, this._buffer, undefined, this.format);
-                    proxy._swapAndDie(this);
                     return;
 
                 case InternalTexture.DATASOURCE_RAW:
@@ -354,9 +354,9 @@ module BABYLON {
 
                 case InternalTexture.DATASOURCE_CUBE:
                     proxy = this._engine.createCubeTexture(this.url, null, this._files, !this.generateMipMaps, () => {
+                        proxy._swapAndDie(this);
                         this.isReady = true;
                     }, null, this.format, this._extension);
-                    proxy._swapAndDie(this);
                     return;
 
                 case InternalTexture.DATASOURCE_CUBERAW:
@@ -368,9 +368,9 @@ module 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);
                     RawCubeTexture._UpdateRGBDAsync(proxy, this._bufferViewArrayArray!, this._sphericalPolynomial, this._lodGenerationScale, this._lodGenerationOffset).then(() => {
+                        proxy._swapAndDie(this);
                         this.isReady = true;
                     });
-                    proxy._swapAndDie(this);
                     return;
 
                 case InternalTexture.DATASOURCE_CUBEPREFILTERED:

+ 22 - 13
src/Materials/Textures/babylon.videoTexture.ts

@@ -56,7 +56,9 @@ module BABYLON {
         private _generateMipMaps: boolean;
         private _engine: Engine;
         private _stillImageCaptured = false;
-        private _poster = false;
+        private _displayingPosterTexture = false;
+        private _settings: VideoTextureSettings;
+        private _createInternalTextureOnEvent: string;
 
         /**
          * Creates a video texture.
@@ -93,6 +95,8 @@ module BABYLON {
 
             this.name = name || this._getName(src);
             this.video = this._getVideo(src);
+            this._settings = settings;
+
             if (settings.poster) {
                 this.video.poster = settings.poster;
             }
@@ -106,18 +110,20 @@ module BABYLON {
 
             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);
+            this._createInternalTextureOnEvent = (settings.poster && !settings.autoPlay) ? "play" : "canplay";
+            this.video.addEventListener(this._createInternalTextureOnEvent, this._createInternalTexture);
 
-            if (this.video.readyState >= this.video.HAVE_CURRENT_DATA) {
-                this._createInternalTexture();
-            }
-
-            if (settings.poster) {
+            const 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();
             }
         }
 
@@ -155,9 +161,9 @@ module BABYLON {
 
         private _createInternalTexture = (): void => {
             if (this._texture != null) {
-                if (this._poster) {
+                if (this._displayingPosterTexture) {
                     this._texture.dispose();
-                    this._poster = false;
+                    this._displayingPosterTexture = false;
                 }
                 else {
                     return;
@@ -181,7 +187,7 @@ module BABYLON {
                 this._samplingMode
             );
 
-            if (!this.video.autoplay) {
+            if (!this.video.autoplay && !this._settings.poster) {
                 let oldHandler = this.video.onplaying;
                 let error = false;
                 this.video.onplaying = () => {
@@ -231,7 +237,7 @@ module BABYLON {
                 return;
             }
 
-            if (!this._poster) {
+            if (!this._displayingPosterTexture) {
                 this._texture.dispose();
                 this._texture = null;
             }
@@ -278,6 +284,9 @@ module BABYLON {
             if (this.video.readyState < this.video.HAVE_CURRENT_DATA) {
                 return;
             }
+            if (this._displayingPosterTexture) {
+                return;
+            }
 
             this._engine.updateVideoTexture(this._texture, this.video, this._invertY);
         }
@@ -301,7 +310,7 @@ module BABYLON {
                 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);

+ 6 - 1
src/Mesh/babylon.geometry.ts

@@ -5,10 +5,14 @@ module BABYLON {
     export class Geometry implements IGetSetVerticesData {
         // Members
         /**
-         * Gets or sets the unique ID of the geometry
+         * Gets or sets the ID of the geometry
          */
         public id: string;
         /**
+         * Gets or sets the unique ID of the geometry
+         */
+        public uniqueId: number;
+        /**
          * Gets the delay loading state of the geometry (none by default which means not delayed)
          */
         public delayLoadState = Engine.DELAYLOADSTATE_NONE;
@@ -94,6 +98,7 @@ module BABYLON {
          */
         constructor(id: string, scene: Scene, vertexData?: VertexData, updatable: boolean = false, mesh: Nullable<Mesh> = null) {
             this.id = id;
+            this.uniqueId = scene.getUniqueId();
             this._engine = scene.getEngine();
             this._meshes = [];
             this._scene = scene;

+ 11 - 1
src/babylon.scene.ts

@@ -3622,6 +3622,16 @@ module BABYLON {
             return null;
         }
 
+        private _getGeometryByUniqueID(id: number): Nullable<Geometry> {
+            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.
@@ -3629,7 +3639,7 @@ module BABYLON {
          * @return a boolean defining if the geometry was added or not
          */
         public pushGeometry(geometry: Geometry, force?: boolean): boolean {
-            if (!force && this.getGeometryByID(geometry.id)) {
+            if (!force && this._getGeometryByUniqueID(geometry.uniqueId)) {
                 return false;
             }