소스 검색

Fix GUI3D containers

David Catuhe 7 년 전
부모
커밋
35127d5942
26개의 변경된 파일13301개의 추가작업 그리고 12971개의 파일을 삭제
  1. 10773 10750
      Playground/babylon.d.txt
  2. 1960 1954
      dist/preview release/babylon.d.ts
  3. 25 25
      dist/preview release/babylon.js
  4. 85 28
      dist/preview release/babylon.max.js
  5. 85 28
      dist/preview release/babylon.no-module.max.js
  6. 25 25
      dist/preview release/babylon.worker.js
  7. 85 28
      dist/preview release/es6.js
  8. 11 9
      dist/preview release/gui/babylon.gui.js
  9. 1 1
      dist/preview release/gui/babylon.gui.min.js
  10. 4 3
      dist/preview release/loaders/babylon.glTF2FileLoader.js
  11. 3 3
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  12. 4 3
      dist/preview release/loaders/babylon.glTFFileLoader.js
  13. 1 1
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  14. 4 3
      dist/preview release/loaders/babylonjs.loaders.js
  15. 3 3
      dist/preview release/loaders/babylonjs.loaders.min.js
  16. 3 1
      dist/preview release/serializers/babylon.glTF2Serializer.js
  17. 1 1
      dist/preview release/serializers/babylon.glTF2Serializer.min.js
  18. 20 9
      dist/preview release/serializers/babylon.objSerializer.js
  19. 1 1
      dist/preview release/serializers/babylon.objSerializer.min.js
  20. 23 10
      dist/preview release/serializers/babylonjs.serializers.js
  21. 2 2
      dist/preview release/serializers/babylonjs.serializers.min.js
  22. 43 43
      dist/preview release/viewer/babylon.viewer.js
  23. 127 31
      dist/preview release/viewer/babylon.viewer.max.js
  24. 3 4
      gui/src/3D/controls/cylinderPanel.ts
  25. 7 2
      gui/src/3D/controls/planePanel.ts
  26. 2 3
      gui/src/3D/controls/spherePanel.ts

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 10773 - 10750
Playground/babylon.d.txt


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1960 - 1954
dist/preview release/babylon.d.ts


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 25 - 25
dist/preview release/babylon.js


+ 85 - 28
dist/preview release/babylon.max.js

@@ -15362,7 +15362,7 @@ var BABYLON;
             this._gl.compressedTexImage2D(target, lod, internalFormat, width, height, 0, data);
         };
         /** @hidden */
-        Engine.prototype._uploadDataToTextureDirectly = function (texture, width, height, imageData, faceIndex, lod) {
+        Engine.prototype._uploadDataToTextureDirectly = function (texture, imageData, faceIndex, lod) {
             if (faceIndex === void 0) { faceIndex = 0; }
             if (lod === void 0) { lod = 0; }
             var gl = this._gl;
@@ -15374,6 +15374,10 @@ var BABYLON;
             if (texture.isCube) {
                 target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;
             }
+            var lodMaxWidth = Math.round(BABYLON.Scalar.Log2(texture.width));
+            var lodMaxHeight = Math.round(BABYLON.Scalar.Log2(texture.height));
+            var width = Math.pow(2, Math.max(lodMaxWidth - lod, 0));
+            var height = Math.pow(2, Math.max(lodMaxHeight - lod, 0));
             gl.texImage2D(target, lod, internalFormat, width, height, 0, format, textureType, imageData);
         };
         /** @hidden */
@@ -15383,7 +15387,7 @@ var BABYLON;
             var gl = this._gl;
             var bindTarget = texture.isCube ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;
             this._bindTextureDirectly(bindTarget, texture, true);
-            this._uploadDataToTextureDirectly(texture, texture.width, texture.height, imageData, faceIndex, lod);
+            this._uploadDataToTextureDirectly(texture, imageData, faceIndex, lod);
             this._bindTextureDirectly(bindTarget, null, true);
         };
         /** @hidden */
@@ -15652,6 +15656,9 @@ var BABYLON;
                         for (var index = 0; index < imgs.length; index++) {
                             var data = imgs[index];
                             info = BABYLON.DDSTools.GetDDSInfo(data);
+                            texture.width = info.width;
+                            texture.height = info.height;
+                            width = info.width;
                             loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && !noMipmap;
                             _this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);
                             _this._unpackFlipY(info.isCompressed);
@@ -15659,10 +15666,6 @@ var BABYLON;
                             if (!noMipmap && !info.isFourCC && info.mipmapCount === 1) {
                                 gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
                             }
-                            texture.width = info.width;
-                            texture.height = info.height;
-                            texture.type = info.textureType;
-                            width = info.width;
                         }
                         _this.setCubeMapTextureParams(gl, loadMipmap);
                         texture.isReady = true;
@@ -15674,6 +15677,8 @@ var BABYLON;
                 else {
                     this._loadFile(rootUrl, function (data) {
                         var info = BABYLON.DDSTools.GetDDSInfo(data);
+                        texture.width = info.width;
+                        texture.height = info.height;
                         if (createPolynomials) {
                             info.sphericalPolynomial = new BABYLON.SphericalPolynomial();
                         }
@@ -15685,10 +15690,7 @@ var BABYLON;
                             gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
                         }
                         _this.setCubeMapTextureParams(gl, loadMipmap);
-                        texture.width = info.width;
-                        texture.height = info.height;
                         texture.isReady = true;
-                        texture.type = info.textureType;
                         if (onLoad) {
                             onLoad({ isDDS: true, width: info.width, info: info, data: data, texture: texture });
                         }
@@ -65330,9 +65332,16 @@ var BABYLON;
             var _this = _super.call(this, null, scene, !generateMipMaps, invertY) || this;
             _this._onUserActionRequestedObservable = null;
             _this._stillImageCaptured = false;
+            _this._poster = false;
             _this._createInternalTexture = function () {
                 if (_this._texture != null) {
-                    return;
+                    if (_this._poster) {
+                        _this._texture.dispose();
+                        _this._poster = false;
+                    }
+                    else {
+                        return;
+                    }
                 }
                 if (!_this._engine.needPOTTextures ||
                     (BABYLON.Tools.IsExponentOfTwo(_this.video.videoWidth) && BABYLON.Tools.IsExponentOfTwo(_this.video.videoHeight))) {
@@ -65393,8 +65402,10 @@ var BABYLON;
                 if (_this._texture == null) {
                     return;
                 }
-                _this._texture.dispose();
-                _this._texture = null;
+                if (!_this._poster) {
+                    _this._texture.dispose();
+                    _this._texture = null;
+                }
             };
             _this._updateInternalTexture = function (e) {
                 if (_this._texture == null || !_this._texture.isReady) {
@@ -65428,6 +65439,10 @@ var BABYLON;
             if (_this.video.readyState >= _this.video.HAVE_CURRENT_DATA) {
                 _this._createInternalTexture();
             }
+            if (settings.poster) {
+                _this._texture = _this._engine.createTexture(settings.poster, false, true, scene);
+                _this._poster = true;
+            }
             return _this;
         }
         Object.defineProperty(VideoTexture.prototype, "onUserActionRequestedObservable", {
@@ -83313,6 +83328,8 @@ var BABYLON;
             if (manifest.specular) {
                 // Extend the header with the position of the payload.
                 manifest.specular.specularDataPosition = pos;
+                // Fallback to 0.8 exactly if lodGenerationScale is not defined for backward compatibility.
+                manifest.specular.lodGenerationScale = manifest.specular.lodGenerationScale || 0.8;
             }
             return manifest;
         };
@@ -83405,7 +83422,8 @@ var BABYLON;
                     width: cubeWidth,
                     irradiance: _this._CreateEnvTextureIrradiance(texture),
                     specular: {
-                        mipmaps: []
+                        mipmaps: [],
+                        lodGenerationScale: texture.lodGenerationScale
                     }
                 };
                 // Sets the specular image data information
@@ -83485,7 +83503,7 @@ var BABYLON;
          */
         EnvironmentTextureTools.UploadEnvLevelsAsync = function (texture, arrayBuffer, info) {
             if (info.version !== 1) {
-                BABYLON.Tools.Warn('Unsupported babylon environment map version "' + info.version + '"');
+                throw new Error("Unsupported babylon environment map version \"" + info.version + "\"");
             }
             var specularInfo = info.specular;
             if (!specularInfo) {
@@ -83496,8 +83514,9 @@ var BABYLON;
             var mipmapsCount = BABYLON.Scalar.Log2(info.width);
             mipmapsCount = Math.round(mipmapsCount) + 1;
             if (specularInfo.mipmaps.length !== 6 * mipmapsCount) {
-                BABYLON.Tools.Warn('Unsupported specular mipmaps number "' + specularInfo.mipmaps.length + '"');
+                throw new Error("Unsupported specular mipmaps number \"" + specularInfo.mipmaps.length + "\"");
             }
+            texture._lodGenerationScale = specularInfo.lodGenerationScale;
             var imageData = new Array(mipmapsCount);
             for (var i = 0; i < mipmapsCount; i++) {
                 imageData[i] = new Array(6);
@@ -83515,7 +83534,10 @@ var BABYLON;
          * @returns a promise
          */
         EnvironmentTextureTools.UploadLevelsAsync = function (texture, imageData) {
-            var mipmapsCount = imageData.length;
+            if (!BABYLON.Tools.IsExponentOfTwo(texture.width)) {
+                throw new Error("Texture size must be a power of two");
+            }
+            var mipmapsCount = Math.round(BABYLON.Scalar.Log2(texture.width)) + 1;
             // Gets everything ready.
             var engine = texture.getEngine();
             var expandTexture = false;
@@ -83526,7 +83548,8 @@ var BABYLON;
             var caps = engine.getCaps();
             texture.format = BABYLON.Engine.TEXTUREFORMAT_RGBA;
             texture.type = BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT;
-            texture.samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE;
+            texture.generateMipMaps = true;
+            engine.updateTextureSamplingMode(BABYLON.Texture.TRILINEAR_SAMPLINGMODE, texture);
             // Add extra process if texture lod is not supported
             if (!caps.textureLOD) {
                 expandTexture = false;
@@ -83634,7 +83657,7 @@ var BABYLON;
                             }
                             else {
                                 engine._uploadImageToTexture(texture, image, face, i);
-                                // Upload the face to the none lod texture support
+                                // Upload the face to the non lod texture support
                                 if (generateNonLODTextures) {
                                     var lodTexture = lodTextures[i];
                                     if (lodTexture) {
@@ -83655,18 +83678,43 @@ var BABYLON;
                     _loop_4(face);
                 }
             };
-            // All mipmaps
-            for (var i = 0; i < mipmapsCount; i++) {
+            // All mipmaps up to provided number of images
+            for (var i = 0; i < imageData.length; i++) {
                 _loop_3(i);
             }
+            // Fill remaining mipmaps with black textures.
+            if (imageData.length < mipmapsCount) {
+                var data = void 0;
+                var size = Math.pow(2, mipmapsCount - 1 - imageData.length);
+                var dataLength = size * size * 4;
+                switch (texture.type) {
+                    case BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT: {
+                        data = new Uint8Array(dataLength);
+                        break;
+                    }
+                    case BABYLON.Engine.TEXTURETYPE_HALF_FLOAT: {
+                        data = new Uint16Array(dataLength);
+                        break;
+                    }
+                    case BABYLON.Engine.TEXTURETYPE_FLOAT: {
+                        data = new Float32Array(dataLength);
+                        break;
+                    }
+                }
+                for (var i = imageData.length; i < mipmapsCount; i++) {
+                    for (var face = 0; face < 6; face++) {
+                        engine._uploadArrayBufferViewToTexture(texture, data, face, i);
+                    }
+                }
+            }
             // Once all done, finishes the cleanup and return
             return Promise.all(promises).then(function () {
-                // Relase temp RTT.
+                // Release temp RTT.
                 if (cubeRtt) {
                     engine._releaseFramebufferObjects(cubeRtt);
                     cubeRtt._swapAndDie(texture);
                 }
-                // Relase temp Post Process.
+                // Release temp Post Process.
                 if (rgbdPostProcess) {
                     rgbdPostProcess.dispose();
                 }
@@ -87770,7 +87818,7 @@ var BABYLON;
             var func = '_getImageData' + (use_grey ? 'Grey' : '') + (header.pixel_size) + 'bits';
             var imageData = TGATools[func](header, palettes, pixel_data, y_start, y_step, y_end, x_start, x_step, x_end);
             var engine = texture.getEngine();
-            engine._uploadDataToTextureDirectly(texture, texture.width, texture.height, imageData);
+            engine._uploadDataToTextureDirectly(texture, imageData);
         };
         TGATools._getImageData8bits = function (header, palettes, pixel_data, y_start, y_step, y_end, x_start, x_step, x_end) {
             var image = pixel_data, colormap = palettes;
@@ -88332,7 +88380,7 @@ var BABYLON;
                                 }
                             }
                             if (floatArray) {
-                                engine._uploadDataToTextureDirectly(texture, width, height, floatArray, face, i);
+                                engine._uploadDataToTextureDirectly(texture, floatArray, face, i);
                             }
                         }
                         else if (info.isRGB) {
@@ -88341,13 +88389,13 @@ var BABYLON;
                                 texture.format = BABYLON.Engine.TEXTUREFORMAT_RGB;
                                 dataLength = width * height * 3;
                                 byteArray = DDSTools._GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, rOffset, gOffset, bOffset);
-                                engine._uploadDataToTextureDirectly(texture, width, height, byteArray, face, i);
+                                engine._uploadDataToTextureDirectly(texture, byteArray, face, i);
                             }
                             else { // 32
                                 texture.format = BABYLON.Engine.TEXTUREFORMAT_RGBA;
                                 dataLength = width * height * 4;
                                 byteArray = DDSTools._GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, rOffset, gOffset, bOffset, aOffset);
-                                engine._uploadDataToTextureDirectly(texture, width, height, byteArray, face, i);
+                                engine._uploadDataToTextureDirectly(texture, byteArray, face, i);
                             }
                         }
                         else if (info.isLuminance) {
@@ -88358,7 +88406,7 @@ var BABYLON;
                             byteArray = DDSTools._GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
                             texture.format = BABYLON.Engine.TEXTUREFORMAT_LUMINANCE;
                             texture.type = BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT;
-                            engine._uploadDataToTextureDirectly(texture, width, height, byteArray, face, i);
+                            engine._uploadDataToTextureDirectly(texture, byteArray, face, i);
                         }
                         else {
                             dataLength = Math.max(4, width) / 4 * Math.max(4, height) / 4 * blockBytes;
@@ -92777,6 +92825,11 @@ var BABYLON;
              */
             _this.onControllerMeshLoadedObservable = new BABYLON.Observable();
             /**
+             * Emits an event when the HMD's pose has been updated.
+             */
+            _this.onPoseUpdatedFromDeviceObservable = new BABYLON.Observable();
+            _this._poseSet = false;
+            /**
              * If the rig cameras be used as parent instead of this camera.
              */
             _this.rigParenting = true;
@@ -93003,6 +93056,7 @@ var BABYLON;
                         this._deviceRoomPosition.z *= -1;
                     }
                 }
+                this._poseSet = true;
             }
         };
         /**
@@ -93107,6 +93161,9 @@ var BABYLON;
             BABYLON.Matrix.FromQuaternionToRef(this._deviceRoomRotationQuaternion, this._workingMatrix);
             this._workingMatrix.multiplyToRef(this._deviceToWorld, this._workingMatrix);
             BABYLON.Quaternion.FromRotationMatrixToRef(this._workingMatrix, this.deviceRotationQuaternion);
+            if (this._poseSet) {
+                this.onPoseUpdatedFromDeviceObservable.notifyObservers(null);
+            }
             _super.prototype.update.call(this);
         };
         /**
@@ -101804,7 +101861,7 @@ var BABYLON;
             if (lod === void 0) { lod = 0; }
         };
         /** @hidden */
-        NullEngine.prototype._uploadDataToTextureDirectly = function (texture, width, height, imageData, faceIndex, lod) {
+        NullEngine.prototype._uploadDataToTextureDirectly = function (texture, imageData, faceIndex, lod) {
             if (faceIndex === void 0) { faceIndex = 0; }
             if (lod === void 0) { lod = 0; }
         };

+ 85 - 28
dist/preview release/babylon.no-module.max.js

@@ -15329,7 +15329,7 @@ var BABYLON;
             this._gl.compressedTexImage2D(target, lod, internalFormat, width, height, 0, data);
         };
         /** @hidden */
-        Engine.prototype._uploadDataToTextureDirectly = function (texture, width, height, imageData, faceIndex, lod) {
+        Engine.prototype._uploadDataToTextureDirectly = function (texture, imageData, faceIndex, lod) {
             if (faceIndex === void 0) { faceIndex = 0; }
             if (lod === void 0) { lod = 0; }
             var gl = this._gl;
@@ -15341,6 +15341,10 @@ var BABYLON;
             if (texture.isCube) {
                 target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;
             }
+            var lodMaxWidth = Math.round(BABYLON.Scalar.Log2(texture.width));
+            var lodMaxHeight = Math.round(BABYLON.Scalar.Log2(texture.height));
+            var width = Math.pow(2, Math.max(lodMaxWidth - lod, 0));
+            var height = Math.pow(2, Math.max(lodMaxHeight - lod, 0));
             gl.texImage2D(target, lod, internalFormat, width, height, 0, format, textureType, imageData);
         };
         /** @hidden */
@@ -15350,7 +15354,7 @@ var BABYLON;
             var gl = this._gl;
             var bindTarget = texture.isCube ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;
             this._bindTextureDirectly(bindTarget, texture, true);
-            this._uploadDataToTextureDirectly(texture, texture.width, texture.height, imageData, faceIndex, lod);
+            this._uploadDataToTextureDirectly(texture, imageData, faceIndex, lod);
             this._bindTextureDirectly(bindTarget, null, true);
         };
         /** @hidden */
@@ -15619,6 +15623,9 @@ var BABYLON;
                         for (var index = 0; index < imgs.length; index++) {
                             var data = imgs[index];
                             info = BABYLON.DDSTools.GetDDSInfo(data);
+                            texture.width = info.width;
+                            texture.height = info.height;
+                            width = info.width;
                             loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && !noMipmap;
                             _this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);
                             _this._unpackFlipY(info.isCompressed);
@@ -15626,10 +15633,6 @@ var BABYLON;
                             if (!noMipmap && !info.isFourCC && info.mipmapCount === 1) {
                                 gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
                             }
-                            texture.width = info.width;
-                            texture.height = info.height;
-                            texture.type = info.textureType;
-                            width = info.width;
                         }
                         _this.setCubeMapTextureParams(gl, loadMipmap);
                         texture.isReady = true;
@@ -15641,6 +15644,8 @@ var BABYLON;
                 else {
                     this._loadFile(rootUrl, function (data) {
                         var info = BABYLON.DDSTools.GetDDSInfo(data);
+                        texture.width = info.width;
+                        texture.height = info.height;
                         if (createPolynomials) {
                             info.sphericalPolynomial = new BABYLON.SphericalPolynomial();
                         }
@@ -15652,10 +15657,7 @@ var BABYLON;
                             gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
                         }
                         _this.setCubeMapTextureParams(gl, loadMipmap);
-                        texture.width = info.width;
-                        texture.height = info.height;
                         texture.isReady = true;
-                        texture.type = info.textureType;
                         if (onLoad) {
                             onLoad({ isDDS: true, width: info.width, info: info, data: data, texture: texture });
                         }
@@ -65297,9 +65299,16 @@ var BABYLON;
             var _this = _super.call(this, null, scene, !generateMipMaps, invertY) || this;
             _this._onUserActionRequestedObservable = null;
             _this._stillImageCaptured = false;
+            _this._poster = false;
             _this._createInternalTexture = function () {
                 if (_this._texture != null) {
-                    return;
+                    if (_this._poster) {
+                        _this._texture.dispose();
+                        _this._poster = false;
+                    }
+                    else {
+                        return;
+                    }
                 }
                 if (!_this._engine.needPOTTextures ||
                     (BABYLON.Tools.IsExponentOfTwo(_this.video.videoWidth) && BABYLON.Tools.IsExponentOfTwo(_this.video.videoHeight))) {
@@ -65360,8 +65369,10 @@ var BABYLON;
                 if (_this._texture == null) {
                     return;
                 }
-                _this._texture.dispose();
-                _this._texture = null;
+                if (!_this._poster) {
+                    _this._texture.dispose();
+                    _this._texture = null;
+                }
             };
             _this._updateInternalTexture = function (e) {
                 if (_this._texture == null || !_this._texture.isReady) {
@@ -65395,6 +65406,10 @@ var BABYLON;
             if (_this.video.readyState >= _this.video.HAVE_CURRENT_DATA) {
                 _this._createInternalTexture();
             }
+            if (settings.poster) {
+                _this._texture = _this._engine.createTexture(settings.poster, false, true, scene);
+                _this._poster = true;
+            }
             return _this;
         }
         Object.defineProperty(VideoTexture.prototype, "onUserActionRequestedObservable", {
@@ -83280,6 +83295,8 @@ var BABYLON;
             if (manifest.specular) {
                 // Extend the header with the position of the payload.
                 manifest.specular.specularDataPosition = pos;
+                // Fallback to 0.8 exactly if lodGenerationScale is not defined for backward compatibility.
+                manifest.specular.lodGenerationScale = manifest.specular.lodGenerationScale || 0.8;
             }
             return manifest;
         };
@@ -83372,7 +83389,8 @@ var BABYLON;
                     width: cubeWidth,
                     irradiance: _this._CreateEnvTextureIrradiance(texture),
                     specular: {
-                        mipmaps: []
+                        mipmaps: [],
+                        lodGenerationScale: texture.lodGenerationScale
                     }
                 };
                 // Sets the specular image data information
@@ -83452,7 +83470,7 @@ var BABYLON;
          */
         EnvironmentTextureTools.UploadEnvLevelsAsync = function (texture, arrayBuffer, info) {
             if (info.version !== 1) {
-                BABYLON.Tools.Warn('Unsupported babylon environment map version "' + info.version + '"');
+                throw new Error("Unsupported babylon environment map version \"" + info.version + "\"");
             }
             var specularInfo = info.specular;
             if (!specularInfo) {
@@ -83463,8 +83481,9 @@ var BABYLON;
             var mipmapsCount = BABYLON.Scalar.Log2(info.width);
             mipmapsCount = Math.round(mipmapsCount) + 1;
             if (specularInfo.mipmaps.length !== 6 * mipmapsCount) {
-                BABYLON.Tools.Warn('Unsupported specular mipmaps number "' + specularInfo.mipmaps.length + '"');
+                throw new Error("Unsupported specular mipmaps number \"" + specularInfo.mipmaps.length + "\"");
             }
+            texture._lodGenerationScale = specularInfo.lodGenerationScale;
             var imageData = new Array(mipmapsCount);
             for (var i = 0; i < mipmapsCount; i++) {
                 imageData[i] = new Array(6);
@@ -83482,7 +83501,10 @@ var BABYLON;
          * @returns a promise
          */
         EnvironmentTextureTools.UploadLevelsAsync = function (texture, imageData) {
-            var mipmapsCount = imageData.length;
+            if (!BABYLON.Tools.IsExponentOfTwo(texture.width)) {
+                throw new Error("Texture size must be a power of two");
+            }
+            var mipmapsCount = Math.round(BABYLON.Scalar.Log2(texture.width)) + 1;
             // Gets everything ready.
             var engine = texture.getEngine();
             var expandTexture = false;
@@ -83493,7 +83515,8 @@ var BABYLON;
             var caps = engine.getCaps();
             texture.format = BABYLON.Engine.TEXTUREFORMAT_RGBA;
             texture.type = BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT;
-            texture.samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE;
+            texture.generateMipMaps = true;
+            engine.updateTextureSamplingMode(BABYLON.Texture.TRILINEAR_SAMPLINGMODE, texture);
             // Add extra process if texture lod is not supported
             if (!caps.textureLOD) {
                 expandTexture = false;
@@ -83601,7 +83624,7 @@ var BABYLON;
                             }
                             else {
                                 engine._uploadImageToTexture(texture, image, face, i);
-                                // Upload the face to the none lod texture support
+                                // Upload the face to the non lod texture support
                                 if (generateNonLODTextures) {
                                     var lodTexture = lodTextures[i];
                                     if (lodTexture) {
@@ -83622,18 +83645,43 @@ var BABYLON;
                     _loop_4(face);
                 }
             };
-            // All mipmaps
-            for (var i = 0; i < mipmapsCount; i++) {
+            // All mipmaps up to provided number of images
+            for (var i = 0; i < imageData.length; i++) {
                 _loop_3(i);
             }
+            // Fill remaining mipmaps with black textures.
+            if (imageData.length < mipmapsCount) {
+                var data = void 0;
+                var size = Math.pow(2, mipmapsCount - 1 - imageData.length);
+                var dataLength = size * size * 4;
+                switch (texture.type) {
+                    case BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT: {
+                        data = new Uint8Array(dataLength);
+                        break;
+                    }
+                    case BABYLON.Engine.TEXTURETYPE_HALF_FLOAT: {
+                        data = new Uint16Array(dataLength);
+                        break;
+                    }
+                    case BABYLON.Engine.TEXTURETYPE_FLOAT: {
+                        data = new Float32Array(dataLength);
+                        break;
+                    }
+                }
+                for (var i = imageData.length; i < mipmapsCount; i++) {
+                    for (var face = 0; face < 6; face++) {
+                        engine._uploadArrayBufferViewToTexture(texture, data, face, i);
+                    }
+                }
+            }
             // Once all done, finishes the cleanup and return
             return Promise.all(promises).then(function () {
-                // Relase temp RTT.
+                // Release temp RTT.
                 if (cubeRtt) {
                     engine._releaseFramebufferObjects(cubeRtt);
                     cubeRtt._swapAndDie(texture);
                 }
-                // Relase temp Post Process.
+                // Release temp Post Process.
                 if (rgbdPostProcess) {
                     rgbdPostProcess.dispose();
                 }
@@ -87737,7 +87785,7 @@ var BABYLON;
             var func = '_getImageData' + (use_grey ? 'Grey' : '') + (header.pixel_size) + 'bits';
             var imageData = TGATools[func](header, palettes, pixel_data, y_start, y_step, y_end, x_start, x_step, x_end);
             var engine = texture.getEngine();
-            engine._uploadDataToTextureDirectly(texture, texture.width, texture.height, imageData);
+            engine._uploadDataToTextureDirectly(texture, imageData);
         };
         TGATools._getImageData8bits = function (header, palettes, pixel_data, y_start, y_step, y_end, x_start, x_step, x_end) {
             var image = pixel_data, colormap = palettes;
@@ -88299,7 +88347,7 @@ var BABYLON;
                                 }
                             }
                             if (floatArray) {
-                                engine._uploadDataToTextureDirectly(texture, width, height, floatArray, face, i);
+                                engine._uploadDataToTextureDirectly(texture, floatArray, face, i);
                             }
                         }
                         else if (info.isRGB) {
@@ -88308,13 +88356,13 @@ var BABYLON;
                                 texture.format = BABYLON.Engine.TEXTUREFORMAT_RGB;
                                 dataLength = width * height * 3;
                                 byteArray = DDSTools._GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, rOffset, gOffset, bOffset);
-                                engine._uploadDataToTextureDirectly(texture, width, height, byteArray, face, i);
+                                engine._uploadDataToTextureDirectly(texture, byteArray, face, i);
                             }
                             else { // 32
                                 texture.format = BABYLON.Engine.TEXTUREFORMAT_RGBA;
                                 dataLength = width * height * 4;
                                 byteArray = DDSTools._GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, rOffset, gOffset, bOffset, aOffset);
-                                engine._uploadDataToTextureDirectly(texture, width, height, byteArray, face, i);
+                                engine._uploadDataToTextureDirectly(texture, byteArray, face, i);
                             }
                         }
                         else if (info.isLuminance) {
@@ -88325,7 +88373,7 @@ var BABYLON;
                             byteArray = DDSTools._GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
                             texture.format = BABYLON.Engine.TEXTUREFORMAT_LUMINANCE;
                             texture.type = BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT;
-                            engine._uploadDataToTextureDirectly(texture, width, height, byteArray, face, i);
+                            engine._uploadDataToTextureDirectly(texture, byteArray, face, i);
                         }
                         else {
                             dataLength = Math.max(4, width) / 4 * Math.max(4, height) / 4 * blockBytes;
@@ -92744,6 +92792,11 @@ var BABYLON;
              */
             _this.onControllerMeshLoadedObservable = new BABYLON.Observable();
             /**
+             * Emits an event when the HMD's pose has been updated.
+             */
+            _this.onPoseUpdatedFromDeviceObservable = new BABYLON.Observable();
+            _this._poseSet = false;
+            /**
              * If the rig cameras be used as parent instead of this camera.
              */
             _this.rigParenting = true;
@@ -92970,6 +93023,7 @@ var BABYLON;
                         this._deviceRoomPosition.z *= -1;
                     }
                 }
+                this._poseSet = true;
             }
         };
         /**
@@ -93074,6 +93128,9 @@ var BABYLON;
             BABYLON.Matrix.FromQuaternionToRef(this._deviceRoomRotationQuaternion, this._workingMatrix);
             this._workingMatrix.multiplyToRef(this._deviceToWorld, this._workingMatrix);
             BABYLON.Quaternion.FromRotationMatrixToRef(this._workingMatrix, this.deviceRotationQuaternion);
+            if (this._poseSet) {
+                this.onPoseUpdatedFromDeviceObservable.notifyObservers(null);
+            }
             _super.prototype.update.call(this);
         };
         /**
@@ -101771,7 +101828,7 @@ var BABYLON;
             if (lod === void 0) { lod = 0; }
         };
         /** @hidden */
-        NullEngine.prototype._uploadDataToTextureDirectly = function (texture, width, height, imageData, faceIndex, lod) {
+        NullEngine.prototype._uploadDataToTextureDirectly = function (texture, imageData, faceIndex, lod) {
             if (faceIndex === void 0) { faceIndex = 0; }
             if (lod === void 0) { lod = 0; }
         };

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 25 - 25
dist/preview release/babylon.worker.js


+ 85 - 28
dist/preview release/es6.js

@@ -15329,7 +15329,7 @@ var BABYLON;
             this._gl.compressedTexImage2D(target, lod, internalFormat, width, height, 0, data);
         };
         /** @hidden */
-        Engine.prototype._uploadDataToTextureDirectly = function (texture, width, height, imageData, faceIndex, lod) {
+        Engine.prototype._uploadDataToTextureDirectly = function (texture, imageData, faceIndex, lod) {
             if (faceIndex === void 0) { faceIndex = 0; }
             if (lod === void 0) { lod = 0; }
             var gl = this._gl;
@@ -15341,6 +15341,10 @@ var BABYLON;
             if (texture.isCube) {
                 target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;
             }
+            var lodMaxWidth = Math.round(BABYLON.Scalar.Log2(texture.width));
+            var lodMaxHeight = Math.round(BABYLON.Scalar.Log2(texture.height));
+            var width = Math.pow(2, Math.max(lodMaxWidth - lod, 0));
+            var height = Math.pow(2, Math.max(lodMaxHeight - lod, 0));
             gl.texImage2D(target, lod, internalFormat, width, height, 0, format, textureType, imageData);
         };
         /** @hidden */
@@ -15350,7 +15354,7 @@ var BABYLON;
             var gl = this._gl;
             var bindTarget = texture.isCube ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;
             this._bindTextureDirectly(bindTarget, texture, true);
-            this._uploadDataToTextureDirectly(texture, texture.width, texture.height, imageData, faceIndex, lod);
+            this._uploadDataToTextureDirectly(texture, imageData, faceIndex, lod);
             this._bindTextureDirectly(bindTarget, null, true);
         };
         /** @hidden */
@@ -15619,6 +15623,9 @@ var BABYLON;
                         for (var index = 0; index < imgs.length; index++) {
                             var data = imgs[index];
                             info = BABYLON.DDSTools.GetDDSInfo(data);
+                            texture.width = info.width;
+                            texture.height = info.height;
+                            width = info.width;
                             loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && !noMipmap;
                             _this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);
                             _this._unpackFlipY(info.isCompressed);
@@ -15626,10 +15633,6 @@ var BABYLON;
                             if (!noMipmap && !info.isFourCC && info.mipmapCount === 1) {
                                 gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
                             }
-                            texture.width = info.width;
-                            texture.height = info.height;
-                            texture.type = info.textureType;
-                            width = info.width;
                         }
                         _this.setCubeMapTextureParams(gl, loadMipmap);
                         texture.isReady = true;
@@ -15641,6 +15644,8 @@ var BABYLON;
                 else {
                     this._loadFile(rootUrl, function (data) {
                         var info = BABYLON.DDSTools.GetDDSInfo(data);
+                        texture.width = info.width;
+                        texture.height = info.height;
                         if (createPolynomials) {
                             info.sphericalPolynomial = new BABYLON.SphericalPolynomial();
                         }
@@ -15652,10 +15657,7 @@ var BABYLON;
                             gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
                         }
                         _this.setCubeMapTextureParams(gl, loadMipmap);
-                        texture.width = info.width;
-                        texture.height = info.height;
                         texture.isReady = true;
-                        texture.type = info.textureType;
                         if (onLoad) {
                             onLoad({ isDDS: true, width: info.width, info: info, data: data, texture: texture });
                         }
@@ -65297,9 +65299,16 @@ var BABYLON;
             var _this = _super.call(this, null, scene, !generateMipMaps, invertY) || this;
             _this._onUserActionRequestedObservable = null;
             _this._stillImageCaptured = false;
+            _this._poster = false;
             _this._createInternalTexture = function () {
                 if (_this._texture != null) {
-                    return;
+                    if (_this._poster) {
+                        _this._texture.dispose();
+                        _this._poster = false;
+                    }
+                    else {
+                        return;
+                    }
                 }
                 if (!_this._engine.needPOTTextures ||
                     (BABYLON.Tools.IsExponentOfTwo(_this.video.videoWidth) && BABYLON.Tools.IsExponentOfTwo(_this.video.videoHeight))) {
@@ -65360,8 +65369,10 @@ var BABYLON;
                 if (_this._texture == null) {
                     return;
                 }
-                _this._texture.dispose();
-                _this._texture = null;
+                if (!_this._poster) {
+                    _this._texture.dispose();
+                    _this._texture = null;
+                }
             };
             _this._updateInternalTexture = function (e) {
                 if (_this._texture == null || !_this._texture.isReady) {
@@ -65395,6 +65406,10 @@ var BABYLON;
             if (_this.video.readyState >= _this.video.HAVE_CURRENT_DATA) {
                 _this._createInternalTexture();
             }
+            if (settings.poster) {
+                _this._texture = _this._engine.createTexture(settings.poster, false, true, scene);
+                _this._poster = true;
+            }
             return _this;
         }
         Object.defineProperty(VideoTexture.prototype, "onUserActionRequestedObservable", {
@@ -83280,6 +83295,8 @@ var BABYLON;
             if (manifest.specular) {
                 // Extend the header with the position of the payload.
                 manifest.specular.specularDataPosition = pos;
+                // Fallback to 0.8 exactly if lodGenerationScale is not defined for backward compatibility.
+                manifest.specular.lodGenerationScale = manifest.specular.lodGenerationScale || 0.8;
             }
             return manifest;
         };
@@ -83372,7 +83389,8 @@ var BABYLON;
                     width: cubeWidth,
                     irradiance: _this._CreateEnvTextureIrradiance(texture),
                     specular: {
-                        mipmaps: []
+                        mipmaps: [],
+                        lodGenerationScale: texture.lodGenerationScale
                     }
                 };
                 // Sets the specular image data information
@@ -83452,7 +83470,7 @@ var BABYLON;
          */
         EnvironmentTextureTools.UploadEnvLevelsAsync = function (texture, arrayBuffer, info) {
             if (info.version !== 1) {
-                BABYLON.Tools.Warn('Unsupported babylon environment map version "' + info.version + '"');
+                throw new Error("Unsupported babylon environment map version \"" + info.version + "\"");
             }
             var specularInfo = info.specular;
             if (!specularInfo) {
@@ -83463,8 +83481,9 @@ var BABYLON;
             var mipmapsCount = BABYLON.Scalar.Log2(info.width);
             mipmapsCount = Math.round(mipmapsCount) + 1;
             if (specularInfo.mipmaps.length !== 6 * mipmapsCount) {
-                BABYLON.Tools.Warn('Unsupported specular mipmaps number "' + specularInfo.mipmaps.length + '"');
+                throw new Error("Unsupported specular mipmaps number \"" + specularInfo.mipmaps.length + "\"");
             }
+            texture._lodGenerationScale = specularInfo.lodGenerationScale;
             var imageData = new Array(mipmapsCount);
             for (var i = 0; i < mipmapsCount; i++) {
                 imageData[i] = new Array(6);
@@ -83482,7 +83501,10 @@ var BABYLON;
          * @returns a promise
          */
         EnvironmentTextureTools.UploadLevelsAsync = function (texture, imageData) {
-            var mipmapsCount = imageData.length;
+            if (!BABYLON.Tools.IsExponentOfTwo(texture.width)) {
+                throw new Error("Texture size must be a power of two");
+            }
+            var mipmapsCount = Math.round(BABYLON.Scalar.Log2(texture.width)) + 1;
             // Gets everything ready.
             var engine = texture.getEngine();
             var expandTexture = false;
@@ -83493,7 +83515,8 @@ var BABYLON;
             var caps = engine.getCaps();
             texture.format = BABYLON.Engine.TEXTUREFORMAT_RGBA;
             texture.type = BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT;
-            texture.samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE;
+            texture.generateMipMaps = true;
+            engine.updateTextureSamplingMode(BABYLON.Texture.TRILINEAR_SAMPLINGMODE, texture);
             // Add extra process if texture lod is not supported
             if (!caps.textureLOD) {
                 expandTexture = false;
@@ -83601,7 +83624,7 @@ var BABYLON;
                             }
                             else {
                                 engine._uploadImageToTexture(texture, image, face, i);
-                                // Upload the face to the none lod texture support
+                                // Upload the face to the non lod texture support
                                 if (generateNonLODTextures) {
                                     var lodTexture = lodTextures[i];
                                     if (lodTexture) {
@@ -83622,18 +83645,43 @@ var BABYLON;
                     _loop_4(face);
                 }
             };
-            // All mipmaps
-            for (var i = 0; i < mipmapsCount; i++) {
+            // All mipmaps up to provided number of images
+            for (var i = 0; i < imageData.length; i++) {
                 _loop_3(i);
             }
+            // Fill remaining mipmaps with black textures.
+            if (imageData.length < mipmapsCount) {
+                var data = void 0;
+                var size = Math.pow(2, mipmapsCount - 1 - imageData.length);
+                var dataLength = size * size * 4;
+                switch (texture.type) {
+                    case BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT: {
+                        data = new Uint8Array(dataLength);
+                        break;
+                    }
+                    case BABYLON.Engine.TEXTURETYPE_HALF_FLOAT: {
+                        data = new Uint16Array(dataLength);
+                        break;
+                    }
+                    case BABYLON.Engine.TEXTURETYPE_FLOAT: {
+                        data = new Float32Array(dataLength);
+                        break;
+                    }
+                }
+                for (var i = imageData.length; i < mipmapsCount; i++) {
+                    for (var face = 0; face < 6; face++) {
+                        engine._uploadArrayBufferViewToTexture(texture, data, face, i);
+                    }
+                }
+            }
             // Once all done, finishes the cleanup and return
             return Promise.all(promises).then(function () {
-                // Relase temp RTT.
+                // Release temp RTT.
                 if (cubeRtt) {
                     engine._releaseFramebufferObjects(cubeRtt);
                     cubeRtt._swapAndDie(texture);
                 }
-                // Relase temp Post Process.
+                // Release temp Post Process.
                 if (rgbdPostProcess) {
                     rgbdPostProcess.dispose();
                 }
@@ -87737,7 +87785,7 @@ var BABYLON;
             var func = '_getImageData' + (use_grey ? 'Grey' : '') + (header.pixel_size) + 'bits';
             var imageData = TGATools[func](header, palettes, pixel_data, y_start, y_step, y_end, x_start, x_step, x_end);
             var engine = texture.getEngine();
-            engine._uploadDataToTextureDirectly(texture, texture.width, texture.height, imageData);
+            engine._uploadDataToTextureDirectly(texture, imageData);
         };
         TGATools._getImageData8bits = function (header, palettes, pixel_data, y_start, y_step, y_end, x_start, x_step, x_end) {
             var image = pixel_data, colormap = palettes;
@@ -88299,7 +88347,7 @@ var BABYLON;
                                 }
                             }
                             if (floatArray) {
-                                engine._uploadDataToTextureDirectly(texture, width, height, floatArray, face, i);
+                                engine._uploadDataToTextureDirectly(texture, floatArray, face, i);
                             }
                         }
                         else if (info.isRGB) {
@@ -88308,13 +88356,13 @@ var BABYLON;
                                 texture.format = BABYLON.Engine.TEXTUREFORMAT_RGB;
                                 dataLength = width * height * 3;
                                 byteArray = DDSTools._GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, rOffset, gOffset, bOffset);
-                                engine._uploadDataToTextureDirectly(texture, width, height, byteArray, face, i);
+                                engine._uploadDataToTextureDirectly(texture, byteArray, face, i);
                             }
                             else { // 32
                                 texture.format = BABYLON.Engine.TEXTUREFORMAT_RGBA;
                                 dataLength = width * height * 4;
                                 byteArray = DDSTools._GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, rOffset, gOffset, bOffset, aOffset);
-                                engine._uploadDataToTextureDirectly(texture, width, height, byteArray, face, i);
+                                engine._uploadDataToTextureDirectly(texture, byteArray, face, i);
                             }
                         }
                         else if (info.isLuminance) {
@@ -88325,7 +88373,7 @@ var BABYLON;
                             byteArray = DDSTools._GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
                             texture.format = BABYLON.Engine.TEXTUREFORMAT_LUMINANCE;
                             texture.type = BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT;
-                            engine._uploadDataToTextureDirectly(texture, width, height, byteArray, face, i);
+                            engine._uploadDataToTextureDirectly(texture, byteArray, face, i);
                         }
                         else {
                             dataLength = Math.max(4, width) / 4 * Math.max(4, height) / 4 * blockBytes;
@@ -92744,6 +92792,11 @@ var BABYLON;
              */
             _this.onControllerMeshLoadedObservable = new BABYLON.Observable();
             /**
+             * Emits an event when the HMD's pose has been updated.
+             */
+            _this.onPoseUpdatedFromDeviceObservable = new BABYLON.Observable();
+            _this._poseSet = false;
+            /**
              * If the rig cameras be used as parent instead of this camera.
              */
             _this.rigParenting = true;
@@ -92970,6 +93023,7 @@ var BABYLON;
                         this._deviceRoomPosition.z *= -1;
                     }
                 }
+                this._poseSet = true;
             }
         };
         /**
@@ -93074,6 +93128,9 @@ var BABYLON;
             BABYLON.Matrix.FromQuaternionToRef(this._deviceRoomRotationQuaternion, this._workingMatrix);
             this._workingMatrix.multiplyToRef(this._deviceToWorld, this._workingMatrix);
             BABYLON.Quaternion.FromRotationMatrixToRef(this._workingMatrix, this.deviceRotationQuaternion);
+            if (this._poseSet) {
+                this.onPoseUpdatedFromDeviceObservable.notifyObservers(null);
+            }
             _super.prototype.update.call(this);
         };
         /**
@@ -101771,7 +101828,7 @@ var BABYLON;
             if (lod === void 0) { lod = 0; }
         };
         /** @hidden */
-        NullEngine.prototype._uploadDataToTextureDirectly = function (texture, width, height, imageData, faceIndex, lod) {
+        NullEngine.prototype._uploadDataToTextureDirectly = function (texture, imageData, faceIndex, lod) {
             if (faceIndex === void 0) { faceIndex = 0; }
             if (lod === void 0) { lod = 0; }
         };

+ 11 - 9
dist/preview release/gui/babylon.gui.js

@@ -8766,13 +8766,12 @@ var BABYLON;
                         mesh.lookAt(new BABYLON.Vector3(-newPos.x, -newPos.y, -newPos.z));
                         break;
                     case GUI.Container3D.FACEORIGINREVERSED_ORIENTATION:
-                        mesh.lookAt(new BABYLON.Vector3(newPos.x, newPos.y, newPos.z));
+                        mesh.lookAt(new BABYLON.Vector3(2 * newPos.x, 2 * newPos.y, 2 * newPos.z));
                         break;
                     case GUI.Container3D.FACEFORWARD_ORIENTATION:
-                        mesh.lookAt(new BABYLON.Vector3(0, 0, 1));
                         break;
                     case GUI.Container3D.FACEFORWARDREVERSED_ORIENTATION:
-                        mesh.lookAt(new BABYLON.Vector3(0, 0, -1));
+                        mesh.rotate(BABYLON.Axis.Y, Math.PI, BABYLON.Space.LOCAL);
                         break;
                 }
             };
@@ -8809,14 +8808,18 @@ var BABYLON;
                     return;
                 }
                 control.position = nodePosition.clone();
+                var target = BABYLON.Tmp.Vector3[0];
+                target.copyFrom(nodePosition);
                 switch (this.orientation) {
                     case GUI.Container3D.FACEORIGIN_ORIENTATION:
                     case GUI.Container3D.FACEFORWARD_ORIENTATION:
-                        mesh.lookAt(new BABYLON.Vector3(0, 0, -1));
+                        target.addInPlace(new BABYLON.Vector3(0, 0, -1));
+                        mesh.lookAt(target);
                         break;
                     case GUI.Container3D.FACEFORWARDREVERSED_ORIENTATION:
                     case GUI.Container3D.FACEORIGINREVERSED_ORIENTATION:
-                        mesh.lookAt(new BABYLON.Vector3(0, 0, 1));
+                        target.addInPlace(new BABYLON.Vector3(0, 0, 1));
+                        mesh.lookAt(target);
                         break;
                 }
             };
@@ -8983,16 +8986,15 @@ var BABYLON;
                 control.position = newPos;
                 switch (this.orientation) {
                     case GUI.Container3D.FACEORIGIN_ORIENTATION:
-                        mesh.lookAt(new BABYLON.Vector3(-newPos.x, 0, -newPos.z));
+                        mesh.lookAt(new BABYLON.Vector3(-newPos.x, newPos.y, -newPos.z));
                         break;
                     case GUI.Container3D.FACEORIGINREVERSED_ORIENTATION:
-                        mesh.lookAt(new BABYLON.Vector3(newPos.x, 0, newPos.z));
+                        mesh.lookAt(new BABYLON.Vector3(2 * newPos.x, newPos.y, 2 * newPos.z));
                         break;
                     case GUI.Container3D.FACEFORWARD_ORIENTATION:
-                        mesh.lookAt(new BABYLON.Vector3(0, 0, 1));
                         break;
                     case GUI.Container3D.FACEFORWARDREVERSED_ORIENTATION:
-                        mesh.lookAt(new BABYLON.Vector3(0, 0, -1));
+                        mesh.rotate(BABYLON.Axis.Y, Math.PI, BABYLON.Space.LOCAL);
                         break;
                 }
             };

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 1
dist/preview release/gui/babylon.gui.min.js


+ 4 - 3
dist/preview release/loaders/babylon.glTF2FileLoader.js

@@ -3194,8 +3194,7 @@ var BABYLON;
                         }
                         this._loader._parent._logClose();
                         light._loaded = Promise.all(promises).then(function () {
-                            var size = Math.pow(2, imageData_1.length - 1);
-                            var babylonTexture = new BABYLON.RawCubeTexture(_this._loader._babylonScene, null, size);
+                            var babylonTexture = new BABYLON.RawCubeTexture(_this._loader._babylonScene, null, light.specularImageSize);
                             light._babylonTexture = babylonTexture;
                             if (light.intensity != undefined) {
                                 babylonTexture.level = light.intensity;
@@ -3212,7 +3211,9 @@ var BABYLON;
                             sphericalHarmonics.scale(light.intensity);
                             sphericalHarmonics.convertIrradianceToLambertianRadiance();
                             var sphericalPolynomial = BABYLON.SphericalPolynomial.FromHarmonics(sphericalHarmonics);
-                            return babylonTexture.updateRGBDAsync(imageData_1, sphericalPolynomial);
+                            // Compute the lod generation scale to fit exactly to the number of levels available.
+                            var lodGenerationScale = (imageData_1.length - 1) / BABYLON.Scalar.Log2(light.specularImageSize);
+                            return babylonTexture.updateRGBDAsync(imageData_1, sphericalPolynomial, lodGenerationScale);
                         });
                     }
                     return light._loaded.then(function () {

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 3 - 3
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


+ 4 - 3
dist/preview release/loaders/babylon.glTFFileLoader.js

@@ -5391,8 +5391,7 @@ var BABYLON;
                         }
                         this._loader._parent._logClose();
                         light._loaded = Promise.all(promises).then(function () {
-                            var size = Math.pow(2, imageData_1.length - 1);
-                            var babylonTexture = new BABYLON.RawCubeTexture(_this._loader._babylonScene, null, size);
+                            var babylonTexture = new BABYLON.RawCubeTexture(_this._loader._babylonScene, null, light.specularImageSize);
                             light._babylonTexture = babylonTexture;
                             if (light.intensity != undefined) {
                                 babylonTexture.level = light.intensity;
@@ -5409,7 +5408,9 @@ var BABYLON;
                             sphericalHarmonics.scale(light.intensity);
                             sphericalHarmonics.convertIrradianceToLambertianRadiance();
                             var sphericalPolynomial = BABYLON.SphericalPolynomial.FromHarmonics(sphericalHarmonics);
-                            return babylonTexture.updateRGBDAsync(imageData_1, sphericalPolynomial);
+                            // Compute the lod generation scale to fit exactly to the number of levels available.
+                            var lodGenerationScale = (imageData_1.length - 1) / BABYLON.Scalar.Log2(light.specularImageSize);
+                            return babylonTexture.updateRGBDAsync(imageData_1, sphericalPolynomial, lodGenerationScale);
                         });
                     }
                     return light._loaded.then(function () {

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 1
dist/preview release/loaders/babylon.glTFFileLoader.min.js


+ 4 - 3
dist/preview release/loaders/babylonjs.loaders.js

@@ -6311,8 +6311,7 @@ var BABYLON;
                         }
                         this._loader._parent._logClose();
                         light._loaded = Promise.all(promises).then(function () {
-                            var size = Math.pow(2, imageData_1.length - 1);
-                            var babylonTexture = new BABYLON.RawCubeTexture(_this._loader._babylonScene, null, size);
+                            var babylonTexture = new BABYLON.RawCubeTexture(_this._loader._babylonScene, null, light.specularImageSize);
                             light._babylonTexture = babylonTexture;
                             if (light.intensity != undefined) {
                                 babylonTexture.level = light.intensity;
@@ -6329,7 +6328,9 @@ var BABYLON;
                             sphericalHarmonics.scale(light.intensity);
                             sphericalHarmonics.convertIrradianceToLambertianRadiance();
                             var sphericalPolynomial = BABYLON.SphericalPolynomial.FromHarmonics(sphericalHarmonics);
-                            return babylonTexture.updateRGBDAsync(imageData_1, sphericalPolynomial);
+                            // Compute the lod generation scale to fit exactly to the number of levels available.
+                            var lodGenerationScale = (imageData_1.length - 1) / BABYLON.Scalar.Log2(light.specularImageSize);
+                            return babylonTexture.updateRGBDAsync(imageData_1, sphericalPolynomial, lodGenerationScale);
                         });
                     }
                     return light._loaded.then(function () {

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 3 - 3
dist/preview release/loaders/babylonjs.loaders.min.js


+ 3 - 1
dist/preview release/serializers/babylon.glTF2Serializer.js

@@ -668,7 +668,9 @@ var BABYLON;
                     var glbFile = new Blob(glbData, { type: 'application/octet-stream' });
                     var container = new BABYLON.GLTFData();
                     container.glTFFiles[glbFileName] = glbFile;
-                    _this._localEngine.dispose();
+                    if (_this._localEngine != null) {
+                        _this._localEngine.dispose();
+                    }
                     return container;
                 });
             };

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 1
dist/preview release/serializers/babylon.glTF2Serializer.min.js


+ 20 - 9
dist/preview release/serializers/babylon.objSerializer.js

@@ -4,7 +4,7 @@ var BABYLON;
     var OBJExport = /** @class */ (function () {
         function OBJExport() {
         }
-        //Exports the geometrys of a Mesh array in .OBJ file format (text)
+        //Exports the geometry of a Mesh array in .OBJ file format (text)
         OBJExport.OBJ = function (mesh, materials, matlibname, globalposition) {
             var output = [];
             var v = 1;
@@ -34,6 +34,7 @@ var BABYLON;
                 }
                 var g = mesh[j].geometry;
                 if (!g) {
+                    BABYLON.Tools.Warn("No geometry is present on the mesh");
                     continue;
                 }
                 var trunkVerts = g.getVerticesData('position');
@@ -41,23 +42,33 @@ var BABYLON;
                 var trunkUV = g.getVerticesData('uv');
                 var trunkFaces = g.getIndices();
                 var curV = 0;
-                if (!trunkVerts || !trunkNormals || !trunkUV || !trunkFaces) {
+                if (!trunkVerts || !trunkFaces) {
+                    BABYLON.Tools.Warn("There are no position vertices or indices on the mesh!");
                     continue;
                 }
                 for (var i = 0; i < trunkVerts.length; i += 3) {
                     output.push("v " + trunkVerts[i] + " " + trunkVerts[i + 1] + " " + trunkVerts[i + 2]);
                     curV++;
                 }
-                for (i = 0; i < trunkNormals.length; i += 3) {
-                    output.push("vn " + trunkNormals[i] + " " + trunkNormals[i + 1] + " " + trunkNormals[i + 2]);
+                if (trunkNormals != null) {
+                    for (i = 0; i < trunkNormals.length; i += 3) {
+                        output.push("vn " + trunkNormals[i] + " " + trunkNormals[i + 1] + " " + trunkNormals[i + 2]);
+                    }
                 }
-                for (i = 0; i < trunkUV.length; i += 2) {
-                    output.push("vt " + trunkUV[i] + " " + trunkUV[i + 1]);
+                if (trunkUV != null) {
+                    for (i = 0; i < trunkUV.length; i += 2) {
+                        output.push("vt " + trunkUV[i] + " " + trunkUV[i + 1]);
+                    }
                 }
                 for (i = 0; i < trunkFaces.length; i += 3) {
-                    output.push("f " + (trunkFaces[i + 2] + v) + "/" + (trunkFaces[i + 2] + v) + "/" + (trunkFaces[i + 2] + v) +
-                        " " + (trunkFaces[i + 1] + v) + "/" + (trunkFaces[i + 1] + v) + "/" + (trunkFaces[i + 1] + v) +
-                        " " + (trunkFaces[i] + v) + "/" + (trunkFaces[i] + v) + "/" + (trunkFaces[i] + v));
+                    var indices = [String(trunkFaces[i + 2] + v), String(trunkFaces[i + 1] + v), String(trunkFaces[i] + v)];
+                    var blanks = ["", "", ""];
+                    var facePositions = indices;
+                    var faceUVs = trunkUV != null ? indices : blanks;
+                    var faceNormals = trunkNormals != null ? indices : blanks;
+                    output.push("f " + facePositions[0] + "/" + faceUVs[0] + "/" + faceNormals[0] +
+                        " " + facePositions[1] + "/" + faceUVs[1] + "/" + faceNormals[1] +
+                        " " + facePositions[2] + "/" + faceUVs[2] + "/" + faceNormals[2]);
                 }
                 //back de previous matrix, to not change the original mesh in the scene
                 if (globalposition && lastMatrix) {

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 1
dist/preview release/serializers/babylon.objSerializer.min.js


+ 23 - 10
dist/preview release/serializers/babylonjs.serializers.js

@@ -29,7 +29,7 @@ var BABYLON;
     var OBJExport = /** @class */ (function () {
         function OBJExport() {
         }
-        //Exports the geometrys of a Mesh array in .OBJ file format (text)
+        //Exports the geometry of a Mesh array in .OBJ file format (text)
         OBJExport.OBJ = function (mesh, materials, matlibname, globalposition) {
             var output = [];
             var v = 1;
@@ -59,6 +59,7 @@ var BABYLON;
                 }
                 var g = mesh[j].geometry;
                 if (!g) {
+                    BABYLON.Tools.Warn("No geometry is present on the mesh");
                     continue;
                 }
                 var trunkVerts = g.getVerticesData('position');
@@ -66,23 +67,33 @@ var BABYLON;
                 var trunkUV = g.getVerticesData('uv');
                 var trunkFaces = g.getIndices();
                 var curV = 0;
-                if (!trunkVerts || !trunkNormals || !trunkUV || !trunkFaces) {
+                if (!trunkVerts || !trunkFaces) {
+                    BABYLON.Tools.Warn("There are no position vertices or indices on the mesh!");
                     continue;
                 }
                 for (var i = 0; i < trunkVerts.length; i += 3) {
                     output.push("v " + trunkVerts[i] + " " + trunkVerts[i + 1] + " " + trunkVerts[i + 2]);
                     curV++;
                 }
-                for (i = 0; i < trunkNormals.length; i += 3) {
-                    output.push("vn " + trunkNormals[i] + " " + trunkNormals[i + 1] + " " + trunkNormals[i + 2]);
+                if (trunkNormals != null) {
+                    for (i = 0; i < trunkNormals.length; i += 3) {
+                        output.push("vn " + trunkNormals[i] + " " + trunkNormals[i + 1] + " " + trunkNormals[i + 2]);
+                    }
                 }
-                for (i = 0; i < trunkUV.length; i += 2) {
-                    output.push("vt " + trunkUV[i] + " " + trunkUV[i + 1]);
+                if (trunkUV != null) {
+                    for (i = 0; i < trunkUV.length; i += 2) {
+                        output.push("vt " + trunkUV[i] + " " + trunkUV[i + 1]);
+                    }
                 }
                 for (i = 0; i < trunkFaces.length; i += 3) {
-                    output.push("f " + (trunkFaces[i + 2] + v) + "/" + (trunkFaces[i + 2] + v) + "/" + (trunkFaces[i + 2] + v) +
-                        " " + (trunkFaces[i + 1] + v) + "/" + (trunkFaces[i + 1] + v) + "/" + (trunkFaces[i + 1] + v) +
-                        " " + (trunkFaces[i] + v) + "/" + (trunkFaces[i] + v) + "/" + (trunkFaces[i] + v));
+                    var indices = [String(trunkFaces[i + 2] + v), String(trunkFaces[i + 1] + v), String(trunkFaces[i] + v)];
+                    var blanks = ["", "", ""];
+                    var facePositions = indices;
+                    var faceUVs = trunkUV != null ? indices : blanks;
+                    var faceNormals = trunkNormals != null ? indices : blanks;
+                    output.push("f " + facePositions[0] + "/" + faceUVs[0] + "/" + faceNormals[0] +
+                        " " + facePositions[1] + "/" + faceUVs[1] + "/" + faceNormals[1] +
+                        " " + facePositions[2] + "/" + faceUVs[2] + "/" + faceNormals[2]);
                 }
                 //back de previous matrix, to not change the original mesh in the scene
                 if (globalposition && lastMatrix) {
@@ -818,7 +829,9 @@ var BABYLON;
                     var glbFile = new Blob(glbData, { type: 'application/octet-stream' });
                     var container = new BABYLON.GLTFData();
                     container.glTFFiles[glbFileName] = glbFile;
-                    _this._localEngine.dispose();
+                    if (_this._localEngine != null) {
+                        _this._localEngine.dispose();
+                    }
                     return container;
                 });
             };

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2 - 2
dist/preview release/serializers/babylonjs.serializers.min.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 43 - 43
dist/preview release/viewer/babylon.viewer.js


+ 127 - 31
dist/preview release/viewer/babylon.viewer.max.js

@@ -15450,7 +15450,7 @@ var BABYLON;
             this._gl.compressedTexImage2D(target, lod, internalFormat, width, height, 0, data);
         };
         /** @hidden */
-        Engine.prototype._uploadDataToTextureDirectly = function (texture, width, height, imageData, faceIndex, lod) {
+        Engine.prototype._uploadDataToTextureDirectly = function (texture, imageData, faceIndex, lod) {
             if (faceIndex === void 0) { faceIndex = 0; }
             if (lod === void 0) { lod = 0; }
             var gl = this._gl;
@@ -15462,6 +15462,10 @@ var BABYLON;
             if (texture.isCube) {
                 target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;
             }
+            var lodMaxWidth = Math.round(BABYLON.Scalar.Log2(texture.width));
+            var lodMaxHeight = Math.round(BABYLON.Scalar.Log2(texture.height));
+            var width = Math.pow(2, Math.max(lodMaxWidth - lod, 0));
+            var height = Math.pow(2, Math.max(lodMaxHeight - lod, 0));
             gl.texImage2D(target, lod, internalFormat, width, height, 0, format, textureType, imageData);
         };
         /** @hidden */
@@ -15471,7 +15475,7 @@ var BABYLON;
             var gl = this._gl;
             var bindTarget = texture.isCube ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;
             this._bindTextureDirectly(bindTarget, texture, true);
-            this._uploadDataToTextureDirectly(texture, texture.width, texture.height, imageData, faceIndex, lod);
+            this._uploadDataToTextureDirectly(texture, imageData, faceIndex, lod);
             this._bindTextureDirectly(bindTarget, null, true);
         };
         /** @hidden */
@@ -15740,6 +15744,9 @@ var BABYLON;
                         for (var index = 0; index < imgs.length; index++) {
                             var data = imgs[index];
                             info = BABYLON.DDSTools.GetDDSInfo(data);
+                            texture.width = info.width;
+                            texture.height = info.height;
+                            width = info.width;
                             loadMipmap = (info.isRGB || info.isLuminance || info.mipmapCount > 1) && !noMipmap;
                             _this._bindTextureDirectly(gl.TEXTURE_CUBE_MAP, texture, true);
                             _this._unpackFlipY(info.isCompressed);
@@ -15747,10 +15754,6 @@ var BABYLON;
                             if (!noMipmap && !info.isFourCC && info.mipmapCount === 1) {
                                 gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
                             }
-                            texture.width = info.width;
-                            texture.height = info.height;
-                            texture.type = info.textureType;
-                            width = info.width;
                         }
                         _this.setCubeMapTextureParams(gl, loadMipmap);
                         texture.isReady = true;
@@ -15762,6 +15765,8 @@ var BABYLON;
                 else {
                     this._loadFile(rootUrl, function (data) {
                         var info = BABYLON.DDSTools.GetDDSInfo(data);
+                        texture.width = info.width;
+                        texture.height = info.height;
                         if (createPolynomials) {
                             info.sphericalPolynomial = new BABYLON.SphericalPolynomial();
                         }
@@ -15773,10 +15778,7 @@ var BABYLON;
                             gl.generateMipmap(gl.TEXTURE_CUBE_MAP);
                         }
                         _this.setCubeMapTextureParams(gl, loadMipmap);
-                        texture.width = info.width;
-                        texture.height = info.height;
                         texture.isReady = true;
-                        texture.type = info.textureType;
                         if (onLoad) {
                             onLoad({ isDDS: true, width: info.width, info: info, data: data, texture: texture });
                         }
@@ -18239,6 +18241,19 @@ var BABYLON;
             this.centerWorld = BABYLON.Vector3.Zero();
             this._update(BABYLON.Matrix.Identity());
         };
+        /**
+         * Scale the current bounding sphere by applying a scale factor
+         * @param factor defines the scale factor to apply
+         * @returns the current bounding box
+         */
+        BoundingSphere.prototype.scale = function (factor) {
+            var newRadius = this.radius * factor;
+            var newRadiusVector = new BABYLON.Vector3(newRadius, newRadius, newRadius);
+            var min = this.center.subtract(newRadiusVector);
+            var max = this.center.add(newRadiusVector);
+            this.reConstruct(min, max);
+            return this;
+        };
         // Methods
         BoundingSphere.prototype._update = function (world) {
             BABYLON.Vector3.TransformCoordinatesToRef(this.center, world, this.centerWorld);
@@ -18329,6 +18344,21 @@ var BABYLON;
             this.extendSizeWorld = BABYLON.Vector3.Zero();
             this._update(this._worldMatrix || BABYLON.Matrix.Identity());
         };
+        /**
+         * Scale the current bounding box by applying a scale factor
+         * @param factor defines the scale factor to apply
+         * @returns the current bounding box
+         */
+        BoundingBox.prototype.scale = function (factor) {
+            var diff = this.maximum.subtract(this.minimum);
+            var distance = diff.length() * factor;
+            diff.normalize();
+            var newRadius = diff.scale(distance / 2);
+            var min = this.center.subtract(newRadius);
+            var max = this.center.add(newRadius);
+            this.reConstruct(min, max);
+            return this;
+        };
         BoundingBox.prototype.getWorldMatrix = function () {
             return this._worldMatrix;
         };
@@ -18499,6 +18529,16 @@ var BABYLON;
             this.boundingSphere = new BABYLON.BoundingSphere(this.minimum, this.maximum);
             return this;
         };
+        /**
+         * Scale the current bounding info by applying a scale factor
+         * @param factor defines the scale factor to apply
+         * @returns the current bounding info
+         */
+        BoundingInfo.prototype.scale = function (factor) {
+            this.boundingBox.scale(factor);
+            this.boundingSphere.scale(factor);
+            return this;
+        };
         BoundingInfo.prototype.isInFrustum = function (frustumPlanes) {
             if (!this.boundingSphere.isInFrustum(frustumPlanes))
                 return false;
@@ -65380,9 +65420,16 @@ var BABYLON;
             var _this = _super.call(this, null, scene, !generateMipMaps, invertY) || this;
             _this._onUserActionRequestedObservable = null;
             _this._stillImageCaptured = false;
+            _this._poster = false;
             _this._createInternalTexture = function () {
                 if (_this._texture != null) {
-                    return;
+                    if (_this._poster) {
+                        _this._texture.dispose();
+                        _this._poster = false;
+                    }
+                    else {
+                        return;
+                    }
                 }
                 if (!_this._engine.needPOTTextures ||
                     (BABYLON.Tools.IsExponentOfTwo(_this.video.videoWidth) && BABYLON.Tools.IsExponentOfTwo(_this.video.videoHeight))) {
@@ -65443,8 +65490,10 @@ var BABYLON;
                 if (_this._texture == null) {
                     return;
                 }
-                _this._texture.dispose();
-                _this._texture = null;
+                if (!_this._poster) {
+                    _this._texture.dispose();
+                    _this._texture = null;
+                }
             };
             _this._updateInternalTexture = function (e) {
                 if (_this._texture == null || !_this._texture.isReady) {
@@ -65478,6 +65527,10 @@ var BABYLON;
             if (_this.video.readyState >= _this.video.HAVE_CURRENT_DATA) {
                 _this._createInternalTexture();
             }
+            if (settings.poster) {
+                _this._texture = _this._engine.createTexture(settings.poster, false, true, scene);
+                _this._poster = true;
+            }
             return _this;
         }
         Object.defineProperty(VideoTexture.prototype, "onUserActionRequestedObservable", {
@@ -83363,6 +83416,8 @@ var BABYLON;
             if (manifest.specular) {
                 // Extend the header with the position of the payload.
                 manifest.specular.specularDataPosition = pos;
+                // Fallback to 0.8 exactly if lodGenerationScale is not defined for backward compatibility.
+                manifest.specular.lodGenerationScale = manifest.specular.lodGenerationScale || 0.8;
             }
             return manifest;
         };
@@ -83455,7 +83510,8 @@ var BABYLON;
                     width: cubeWidth,
                     irradiance: _this._CreateEnvTextureIrradiance(texture),
                     specular: {
-                        mipmaps: []
+                        mipmaps: [],
+                        lodGenerationScale: texture.lodGenerationScale
                     }
                 };
                 // Sets the specular image data information
@@ -83535,7 +83591,7 @@ var BABYLON;
          */
         EnvironmentTextureTools.UploadEnvLevelsAsync = function (texture, arrayBuffer, info) {
             if (info.version !== 1) {
-                BABYLON.Tools.Warn('Unsupported babylon environment map version "' + info.version + '"');
+                throw new Error("Unsupported babylon environment map version \"" + info.version + "\"");
             }
             var specularInfo = info.specular;
             if (!specularInfo) {
@@ -83546,8 +83602,9 @@ var BABYLON;
             var mipmapsCount = BABYLON.Scalar.Log2(info.width);
             mipmapsCount = Math.round(mipmapsCount) + 1;
             if (specularInfo.mipmaps.length !== 6 * mipmapsCount) {
-                BABYLON.Tools.Warn('Unsupported specular mipmaps number "' + specularInfo.mipmaps.length + '"');
+                throw new Error("Unsupported specular mipmaps number \"" + specularInfo.mipmaps.length + "\"");
             }
+            texture._lodGenerationScale = specularInfo.lodGenerationScale;
             var imageData = new Array(mipmapsCount);
             for (var i = 0; i < mipmapsCount; i++) {
                 imageData[i] = new Array(6);
@@ -83565,7 +83622,10 @@ var BABYLON;
          * @returns a promise
          */
         EnvironmentTextureTools.UploadLevelsAsync = function (texture, imageData) {
-            var mipmapsCount = imageData.length;
+            if (!BABYLON.Tools.IsExponentOfTwo(texture.width)) {
+                throw new Error("Texture size must be a power of two");
+            }
+            var mipmapsCount = Math.round(BABYLON.Scalar.Log2(texture.width)) + 1;
             // Gets everything ready.
             var engine = texture.getEngine();
             var expandTexture = false;
@@ -83576,7 +83636,8 @@ var BABYLON;
             var caps = engine.getCaps();
             texture.format = BABYLON.Engine.TEXTUREFORMAT_RGBA;
             texture.type = BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT;
-            texture.samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE;
+            texture.generateMipMaps = true;
+            engine.updateTextureSamplingMode(BABYLON.Texture.TRILINEAR_SAMPLINGMODE, texture);
             // Add extra process if texture lod is not supported
             if (!caps.textureLOD) {
                 expandTexture = false;
@@ -83684,7 +83745,7 @@ var BABYLON;
                             }
                             else {
                                 engine._uploadImageToTexture(texture, image, face, i);
-                                // Upload the face to the none lod texture support
+                                // Upload the face to the non lod texture support
                                 if (generateNonLODTextures) {
                                     var lodTexture = lodTextures[i];
                                     if (lodTexture) {
@@ -83705,18 +83766,43 @@ var BABYLON;
                     _loop_4(face);
                 }
             };
-            // All mipmaps
-            for (var i = 0; i < mipmapsCount; i++) {
+            // All mipmaps up to provided number of images
+            for (var i = 0; i < imageData.length; i++) {
                 _loop_3(i);
             }
+            // Fill remaining mipmaps with black textures.
+            if (imageData.length < mipmapsCount) {
+                var data = void 0;
+                var size = Math.pow(2, mipmapsCount - 1 - imageData.length);
+                var dataLength = size * size * 4;
+                switch (texture.type) {
+                    case BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT: {
+                        data = new Uint8Array(dataLength);
+                        break;
+                    }
+                    case BABYLON.Engine.TEXTURETYPE_HALF_FLOAT: {
+                        data = new Uint16Array(dataLength);
+                        break;
+                    }
+                    case BABYLON.Engine.TEXTURETYPE_FLOAT: {
+                        data = new Float32Array(dataLength);
+                        break;
+                    }
+                }
+                for (var i = imageData.length; i < mipmapsCount; i++) {
+                    for (var face = 0; face < 6; face++) {
+                        engine._uploadArrayBufferViewToTexture(texture, data, face, i);
+                    }
+                }
+            }
             // Once all done, finishes the cleanup and return
             return Promise.all(promises).then(function () {
-                // Relase temp RTT.
+                // Release temp RTT.
                 if (cubeRtt) {
                     engine._releaseFramebufferObjects(cubeRtt);
                     cubeRtt._swapAndDie(texture);
                 }
-                // Relase temp Post Process.
+                // Release temp Post Process.
                 if (rgbdPostProcess) {
                     rgbdPostProcess.dispose();
                 }
@@ -87820,7 +87906,7 @@ var BABYLON;
             var func = '_getImageData' + (use_grey ? 'Grey' : '') + (header.pixel_size) + 'bits';
             var imageData = TGATools[func](header, palettes, pixel_data, y_start, y_step, y_end, x_start, x_step, x_end);
             var engine = texture.getEngine();
-            engine._uploadDataToTextureDirectly(texture, texture.width, texture.height, imageData);
+            engine._uploadDataToTextureDirectly(texture, imageData);
         };
         TGATools._getImageData8bits = function (header, palettes, pixel_data, y_start, y_step, y_end, x_start, x_step, x_end) {
             var image = pixel_data, colormap = palettes;
@@ -88382,7 +88468,7 @@ var BABYLON;
                                 }
                             }
                             if (floatArray) {
-                                engine._uploadDataToTextureDirectly(texture, width, height, floatArray, face, i);
+                                engine._uploadDataToTextureDirectly(texture, floatArray, face, i);
                             }
                         }
                         else if (info.isRGB) {
@@ -88391,13 +88477,13 @@ var BABYLON;
                                 texture.format = BABYLON.Engine.TEXTUREFORMAT_RGB;
                                 dataLength = width * height * 3;
                                 byteArray = DDSTools._GetRGBArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, rOffset, gOffset, bOffset);
-                                engine._uploadDataToTextureDirectly(texture, width, height, byteArray, face, i);
+                                engine._uploadDataToTextureDirectly(texture, byteArray, face, i);
                             }
                             else { // 32
                                 texture.format = BABYLON.Engine.TEXTUREFORMAT_RGBA;
                                 dataLength = width * height * 4;
                                 byteArray = DDSTools._GetRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, rOffset, gOffset, bOffset, aOffset);
-                                engine._uploadDataToTextureDirectly(texture, width, height, byteArray, face, i);
+                                engine._uploadDataToTextureDirectly(texture, byteArray, face, i);
                             }
                         }
                         else if (info.isLuminance) {
@@ -88408,7 +88494,7 @@ var BABYLON;
                             byteArray = DDSTools._GetLuminanceArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer);
                             texture.format = BABYLON.Engine.TEXTUREFORMAT_LUMINANCE;
                             texture.type = BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT;
-                            engine._uploadDataToTextureDirectly(texture, width, height, byteArray, face, i);
+                            engine._uploadDataToTextureDirectly(texture, byteArray, face, i);
                         }
                         else {
                             dataLength = Math.max(4, width) / 4 * Math.max(4, height) / 4 * blockBytes;
@@ -92827,6 +92913,11 @@ var BABYLON;
              */
             _this.onControllerMeshLoadedObservable = new BABYLON.Observable();
             /**
+             * Emits an event when the HMD's pose has been updated.
+             */
+            _this.onPoseUpdatedFromDeviceObservable = new BABYLON.Observable();
+            _this._poseSet = false;
+            /**
              * If the rig cameras be used as parent instead of this camera.
              */
             _this.rigParenting = true;
@@ -93053,6 +93144,7 @@ var BABYLON;
                         this._deviceRoomPosition.z *= -1;
                     }
                 }
+                this._poseSet = true;
             }
         };
         /**
@@ -93157,6 +93249,9 @@ var BABYLON;
             BABYLON.Matrix.FromQuaternionToRef(this._deviceRoomRotationQuaternion, this._workingMatrix);
             this._workingMatrix.multiplyToRef(this._deviceToWorld, this._workingMatrix);
             BABYLON.Quaternion.FromRotationMatrixToRef(this._workingMatrix, this.deviceRotationQuaternion);
+            if (this._poseSet) {
+                this.onPoseUpdatedFromDeviceObservable.notifyObservers(null);
+            }
             _super.prototype.update.call(this);
         };
         /**
@@ -101854,7 +101949,7 @@ var BABYLON;
             if (lod === void 0) { lod = 0; }
         };
         /** @hidden */
-        NullEngine.prototype._uploadDataToTextureDirectly = function (texture, width, height, imageData, faceIndex, lod) {
+        NullEngine.prototype._uploadDataToTextureDirectly = function (texture, imageData, faceIndex, lod) {
             if (faceIndex === void 0) { faceIndex = 0; }
             if (lod === void 0) { lod = 0; }
         };
@@ -113707,8 +113802,7 @@ var BABYLON;
                         }
                         this._loader._parent._logClose();
                         light._loaded = Promise.all(promises).then(function () {
-                            var size = Math.pow(2, imageData_1.length - 1);
-                            var babylonTexture = new BABYLON.RawCubeTexture(_this._loader._babylonScene, null, size);
+                            var babylonTexture = new BABYLON.RawCubeTexture(_this._loader._babylonScene, null, light.specularImageSize);
                             light._babylonTexture = babylonTexture;
                             if (light.intensity != undefined) {
                                 babylonTexture.level = light.intensity;
@@ -113725,7 +113819,9 @@ var BABYLON;
                             sphericalHarmonics.scale(light.intensity);
                             sphericalHarmonics.convertIrradianceToLambertianRadiance();
                             var sphericalPolynomial = BABYLON.SphericalPolynomial.FromHarmonics(sphericalHarmonics);
-                            return babylonTexture.updateRGBDAsync(imageData_1, sphericalPolynomial);
+                            // Compute the lod generation scale to fit exactly to the number of levels available.
+                            var lodGenerationScale = (imageData_1.length - 1) / BABYLON.Scalar.Log2(light.specularImageSize);
+                            return babylonTexture.updateRGBDAsync(imageData_1, sphericalPolynomial, lodGenerationScale);
                         });
                     }
                     return light._loaded.then(function () {

+ 3 - 4
gui/src/3D/controls/cylinderPanel.ts

@@ -37,16 +37,15 @@ module BABYLON.GUI {
 
             switch (this.orientation) {
                 case Container3D.FACEORIGIN_ORIENTATION:
-                    mesh.lookAt(new BABYLON.Vector3(-newPos.x, 0, -newPos.z));
+                    mesh.lookAt(new BABYLON.Vector3(-newPos.x, newPos.y, -newPos.z));
                     break;
                 case Container3D.FACEORIGINREVERSED_ORIENTATION:
-                    mesh.lookAt(new BABYLON.Vector3(newPos.x, 0, newPos.z));
+                    mesh.lookAt(new BABYLON.Vector3(2 * newPos.x, newPos.y, 2 * newPos.z));
                     break;
                 case Container3D.FACEFORWARD_ORIENTATION:
-                    mesh.lookAt(new BABYLON.Vector3(0, 0, 1));
                     break;
                 case Container3D.FACEFORWARDREVERSED_ORIENTATION:
-                    mesh.lookAt(new BABYLON.Vector3(0, 0, -1));
+                    mesh.rotate(BABYLON.Axis.Y, Math.PI, BABYLON.Space.LOCAL);
                     break;
             }            
         }

+ 7 - 2
gui/src/3D/controls/planePanel.ts

@@ -13,15 +13,20 @@ module BABYLON.GUI {
             }
 
             control.position = nodePosition.clone();
+            let target = Tmp.Vector3[0];
+
+            target.copyFrom(nodePosition);
 
             switch (this.orientation) {
                 case Container3D.FACEORIGIN_ORIENTATION:
                 case Container3D.FACEFORWARD_ORIENTATION:
-                    mesh.lookAt(new BABYLON.Vector3(0, 0, -1));
+                    target.addInPlace(new BABYLON.Vector3(0, 0, -1));
+                    mesh.lookAt(target);
                     break;
                 case Container3D.FACEFORWARDREVERSED_ORIENTATION:
                 case Container3D.FACEORIGINREVERSED_ORIENTATION:
-                    mesh.lookAt(new BABYLON.Vector3(0, 0, 1));
+                    target.addInPlace(new BABYLON.Vector3(0, 0, 1));
+                    mesh.lookAt(target);
                     break;
             }
             

+ 2 - 3
gui/src/3D/controls/spherePanel.ts

@@ -41,13 +41,12 @@ module BABYLON.GUI {
                     mesh.lookAt(new BABYLON.Vector3(-newPos.x, -newPos.y, -newPos.z));
                     break;
                 case Container3D.FACEORIGINREVERSED_ORIENTATION:
-                    mesh.lookAt(new BABYLON.Vector3(newPos.x, newPos.y, newPos.z));
+                    mesh.lookAt(new BABYLON.Vector3(2 * newPos.x, 2 * newPos.y, 2 * newPos.z));
                     break;
                 case Container3D.FACEFORWARD_ORIENTATION:
-                    mesh.lookAt(new BABYLON.Vector3(0, 0, 1));
                     break;
                 case Container3D.FACEFORWARDREVERSED_ORIENTATION:
-                    mesh.lookAt(new BABYLON.Vector3(0, 0, -1));
+                    mesh.rotate(BABYLON.Axis.Y, Math.PI, BABYLON.Space.LOCAL);
                     break;
             }           
         }