瀏覽代碼

Fixed FileInput loader
setPivotMatrix clone support

David Catuhe 7 年之前
父節點
當前提交
d306de7ce0

File diff suppressed because it is too large
+ 4489 - 4489
dist/preview release/babylon.d.ts


File diff suppressed because it is too large
+ 21 - 21
dist/preview release/babylon.js


+ 31 - 3
dist/preview release/babylon.max.js

@@ -13290,7 +13290,7 @@ var BABYLON;
          */
         AbstractMesh.prototype.setPivotMatrix = function (matrix, postMultiplyPivotMatrix) {
             if (postMultiplyPivotMatrix === void 0) { postMultiplyPivotMatrix = false; }
-            this._pivotMatrix = matrix;
+            this._pivotMatrix = matrix.clone();
             this._cache.pivotMatrixUpdated = true;
             this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;
             if (this._postMultiplyPivotMatrix) {
@@ -35576,6 +35576,11 @@ var BABYLON;
     var ArcRotateCameraMouseWheelInput = (function () {
         function ArcRotateCameraMouseWheelInput() {
             this.wheelPrecision = 3.0;
+            /**
+             * wheelPrecisionPercentage will be used instead of whellPrecision if different from 0.
+             * It defines the percentage of current camera.radius to use as delta when wheel is used.
+             */
+            this.wheelPrecisionPercentage = 0;
         }
         ArcRotateCameraMouseWheelInput.prototype.attachControl = function (element, noPreventDefault) {
             var _this = this;
@@ -35586,7 +35591,7 @@ var BABYLON;
                 var event = p.event;
                 var delta = 0;
                 if (event.wheelDelta) {
-                    delta = event.wheelDelta / (_this.wheelPrecision * 40);
+                    delta = _this.wheelPrecisionPercentage ? (event.wheelDelta * 0.01) * _this.camera.radius * _this.wheelPrecisionPercentage : event.wheelDelta / (_this.wheelPrecision * 40);
                 }
                 else if (event.detail) {
                     delta = -event.detail / _this.wheelPrecision;
@@ -35617,6 +35622,9 @@ var BABYLON;
         __decorate([
             BABYLON.serialize()
         ], ArcRotateCameraMouseWheelInput.prototype, "wheelPrecision", void 0);
+        __decorate([
+            BABYLON.serialize()
+        ], ArcRotateCameraMouseWheelInput.prototype, "wheelPrecisionPercentage", void 0);
         return ArcRotateCameraMouseWheelInput;
     }());
     BABYLON.ArcRotateCameraMouseWheelInput = ArcRotateCameraMouseWheelInput;
@@ -36154,6 +36162,20 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(ArcRotateCamera.prototype, "wheelPrecisionPercentage", {
+            get: function () {
+                var mousewheel = this.inputs.attached["mousewheel"];
+                if (mousewheel)
+                    return mousewheel.wheelPrecisionPercentage;
+            },
+            set: function (value) {
+                var mousewheel = this.inputs.attached["mousewheel"];
+                if (mousewheel)
+                    mousewheel.wheelPrecisionPercentage = value;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(ArcRotateCamera.prototype, "bouncingBehavior", {
             get: function () {
                 return this._bouncingBehavior;
@@ -49176,7 +49198,13 @@ var BABYLON;
                 }
             }
             else {
-                BABYLON.Tools.ReadFile(sceneFilename, dataCallback, onProgress, useArrayBuffer);
+                if (BABYLON.FilesInput.FilesToLoad[sceneFilename]) {
+                    BABYLON.Tools.ReadFile(BABYLON.FilesInput.FilesToLoad[sceneFilename], dataCallback, onProgress, useArrayBuffer);
+                }
+                else {
+                    onError("Unable to find file named " + sceneFilename);
+                    return;
+                }
             }
         };
         // Public functions

File diff suppressed because it is too large
+ 4489 - 4489
dist/preview release/babylon.module.d.ts


File diff suppressed because it is too large
+ 21 - 21
dist/preview release/babylon.worker.js


File diff suppressed because it is too large
+ 1049 - 1043
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


File diff suppressed because it is too large
+ 21 - 21
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 31 - 3
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -13290,7 +13290,7 @@ var BABYLON;
          */
         AbstractMesh.prototype.setPivotMatrix = function (matrix, postMultiplyPivotMatrix) {
             if (postMultiplyPivotMatrix === void 0) { postMultiplyPivotMatrix = false; }
-            this._pivotMatrix = matrix;
+            this._pivotMatrix = matrix.clone();
             this._cache.pivotMatrixUpdated = true;
             this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;
             if (this._postMultiplyPivotMatrix) {
@@ -35576,6 +35576,11 @@ var BABYLON;
     var ArcRotateCameraMouseWheelInput = (function () {
         function ArcRotateCameraMouseWheelInput() {
             this.wheelPrecision = 3.0;
+            /**
+             * wheelPrecisionPercentage will be used instead of whellPrecision if different from 0.
+             * It defines the percentage of current camera.radius to use as delta when wheel is used.
+             */
+            this.wheelPrecisionPercentage = 0;
         }
         ArcRotateCameraMouseWheelInput.prototype.attachControl = function (element, noPreventDefault) {
             var _this = this;
@@ -35586,7 +35591,7 @@ var BABYLON;
                 var event = p.event;
                 var delta = 0;
                 if (event.wheelDelta) {
-                    delta = event.wheelDelta / (_this.wheelPrecision * 40);
+                    delta = _this.wheelPrecisionPercentage ? (event.wheelDelta * 0.01) * _this.camera.radius * _this.wheelPrecisionPercentage : event.wheelDelta / (_this.wheelPrecision * 40);
                 }
                 else if (event.detail) {
                     delta = -event.detail / _this.wheelPrecision;
@@ -35617,6 +35622,9 @@ var BABYLON;
         __decorate([
             BABYLON.serialize()
         ], ArcRotateCameraMouseWheelInput.prototype, "wheelPrecision", void 0);
+        __decorate([
+            BABYLON.serialize()
+        ], ArcRotateCameraMouseWheelInput.prototype, "wheelPrecisionPercentage", void 0);
         return ArcRotateCameraMouseWheelInput;
     }());
     BABYLON.ArcRotateCameraMouseWheelInput = ArcRotateCameraMouseWheelInput;
@@ -36154,6 +36162,20 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(ArcRotateCamera.prototype, "wheelPrecisionPercentage", {
+            get: function () {
+                var mousewheel = this.inputs.attached["mousewheel"];
+                if (mousewheel)
+                    return mousewheel.wheelPrecisionPercentage;
+            },
+            set: function (value) {
+                var mousewheel = this.inputs.attached["mousewheel"];
+                if (mousewheel)
+                    mousewheel.wheelPrecisionPercentage = value;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(ArcRotateCamera.prototype, "bouncingBehavior", {
             get: function () {
                 return this._bouncingBehavior;
@@ -49176,7 +49198,13 @@ var BABYLON;
                 }
             }
             else {
-                BABYLON.Tools.ReadFile(sceneFilename, dataCallback, onProgress, useArrayBuffer);
+                if (BABYLON.FilesInput.FilesToLoad[sceneFilename]) {
+                    BABYLON.Tools.ReadFile(BABYLON.FilesInput.FilesToLoad[sceneFilename], dataCallback, onProgress, useArrayBuffer);
+                }
+                else {
+                    onError("Unable to find file named " + sceneFilename);
+                    return;
+                }
             }
         };
         // Public functions

File diff suppressed because it is too large
+ 1049 - 1043
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts


File diff suppressed because it is too large
+ 5 - 5
dist/preview release/inspector/babylon.inspector.bundle.js


+ 55 - 76
dist/preview release/inspector/babylon.inspector.css

@@ -17,7 +17,10 @@
  * - a refresh tool - refresh the whole panel
  * - a popup tool - Open the inspector in a new panel
  * ...
- */ }
+ */
+  /*
+* 1. Set to 0 height and width, and remove border for a slider without a thumb
+*/ }
   .insp-wrapper .gutter {
     background-color: #2c2c2c; }
     .insp-wrapper .gutter.gutter-vertical:not(.blocked) {
@@ -430,79 +433,55 @@
       color: #b3b3b3;
       padding: 3px 0 3px 10px;
       margin: 6px 0 6px 0; }
-  .insp-wrapper [type='range'] {
+  .insp-wrapper input[type="range"] {
+    margin: auto;
     -webkit-appearance: none;
-    margin: 7px 0;
-    width: 50%; }
-    .insp-wrapper [type='range']:focus {
-      outline: 0; }
-      .insp-wrapper [type='range']:focus::-webkit-slider-runnable-track {
-        background: #54b3f3; }
-      .insp-wrapper [type='range']:focus::-ms-fill-lower {
-        background: #3ca9f1; }
-      .insp-wrapper [type='range']:focus::-ms-fill-upper {
-        background: #54b3f3; }
-    .insp-wrapper [type='range']::-webkit-slider-runnable-track {
-      cursor: pointer;
-      height: 5px;
-      transition: all .2s ease;
-      width: 50%;
-      box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2), 0 0 1px rgba(13, 13, 13, 0.2);
-      background: #3ca9f1;
-      border: 1px solid #5db0d7;
-      border-radius: 5px; }
-    .insp-wrapper [type='range']::-webkit-slider-thumb {
-      box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2), 0 0 1px rgba(13, 13, 13, 0.2);
-      background: #5db0d7;
-      border: 1px solid #5db0d7;
-      border-radius: 0px;
-      cursor: pointer;
-      height: 14px;
-      width: 7px;
-      -webkit-appearance: none;
-      margin-top: -5.5px; }
-    .insp-wrapper [type='range']::-moz-range-track {
-      cursor: pointer;
-      height: 5px;
-      transition: all .2s ease;
-      width: 50%;
-      box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2), 0 0 1px rgba(13, 13, 13, 0.2);
-      background: #3ca9f1;
-      border: 1px solid #5db0d7;
-      border-radius: 5px; }
-    .insp-wrapper [type='range']::-moz-range-thumb {
-      box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2), 0 0 1px rgba(13, 13, 13, 0.2);
-      background: #5db0d7;
-      border: 1px solid #5db0d7;
-      border-radius: 0px;
-      cursor: pointer;
-      height: 14px;
-      width: 7px; }
-    .insp-wrapper [type='range']::-ms-track {
-      cursor: pointer;
-      height: 5px;
-      transition: all .2s ease;
-      width: 50%;
-      background: transparent;
-      border-color: transparent;
-      border-width: 7px 0;
-      color: transparent; }
-    .insp-wrapper [type='range']::-ms-fill-lower {
-      box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2), 0 0 1px rgba(13, 13, 13, 0.2);
-      background: #249fef;
-      border: 1px solid #5db0d7;
-      border-radius: 10px; }
-    .insp-wrapper [type='range']::-ms-fill-upper {
-      box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2), 0 0 1px rgba(13, 13, 13, 0.2);
-      background: #3ca9f1;
-      border: 1px solid #5db0d7;
-      border-radius: 10px; }
-    .insp-wrapper [type='range']::-ms-thumb {
-      box-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2), 0 0 1px rgba(13, 13, 13, 0.2);
-      background: #5db0d7;
-      border: 1px solid #5db0d7;
-      border-radius: 0px;
-      cursor: pointer;
-      height: 14px;
-      width: 7px;
-      margin-top: 0; }
+    position: relative;
+    overflow: hidden;
+    height: 15px;
+    width: 50%;
+    cursor: pointer;
+    border-radius: 0;
+    /* iOS */ }
+  .insp-wrapper ::-webkit-slider-runnable-track {
+    background: #ddd; }
+  .insp-wrapper ::-webkit-slider-thumb {
+    -webkit-appearance: none;
+    width: 20px;
+    /* 1 */
+    height: 15px;
+    /* 1 */
+    background: #fff;
+    box-shadow: -100vw 0 0 100vw dodgerblue;
+    border: 0px solid #999;
+    /* 1 */ }
+  .insp-wrapper ::-moz-range-track {
+    height: 15px;
+    background: #ddd; }
+  .insp-wrapper ::-moz-range-thumb {
+    background: #fff;
+    height: 15px;
+    width: 20px;
+    border: 0px solid #999;
+    border-radius: 0 !important;
+    box-shadow: -100vw 0 0 100vw dodgerblue;
+    box-sizing: border-box; }
+  .insp-wrapper ::-ms-fill-lower {
+    background: dodgerblue; }
+  .insp-wrapper ::-ms-thumb {
+    background: #fff;
+    border: 0px solid #999;
+    height: 15px;
+    width: 20px;
+    box-sizing: border-box; }
+  .insp-wrapper ::-ms-ticks-after {
+    display: none; }
+  .insp-wrapper ::-ms-ticks-before {
+    display: none; }
+  .insp-wrapper ::-ms-track {
+    background: #ddd;
+    color: transparent;
+    height: 15px;
+    border: none; }
+  .insp-wrapper ::-ms-tooltip {
+    display: none; }

+ 26 - 0
dist/preview release/inspector/babylon.inspector.d.ts

@@ -174,11 +174,28 @@ declare module INSPECTOR {
                     max: number;
                     step: number;
                 };
+                beta: {
+                    min: number;
+                    max: number;
+                    step: number;
+                };
+                fov: {
+                    min: number;
+                    max: number;
+                    step: number;
+                };
             };
         };
         'FreeCamera': {
             type: typeof BABYLON.FreeCamera;
             properties: string[];
+            slider: {
+                fov: {
+                    min: number;
+                    max: number;
+                    step: number;
+                };
+            };
         };
         'Scene': {
             type: typeof BABYLON.Scene;
@@ -188,6 +205,13 @@ declare module INSPECTOR {
             type: typeof BABYLON.Mesh;
             properties: string[];
             format: (m: BABYLON.Mesh) => string;
+            slider: {
+                visibility: {
+                    min: number;
+                    max: number;
+                    step: number;
+                };
+            };
         };
         'StandardMaterial': {
             type: typeof BABYLON.StandardMaterial;
@@ -606,6 +630,8 @@ declare module INSPECTOR {
         private _onMouseDownHandler;
         private _onMouseDragHandler;
         private _onMouseUpHandler;
+        private _sliderfill;
+        private _slidertrack;
         private _textValue;
         /** Save previous Y mouse position */
         private _prevY;

+ 13 - 4
dist/preview release/inspector/babylon.inspector.js

@@ -466,7 +466,9 @@ var INSPECTOR;
                 'checkCollisions'
             ],
             slider: {
-                alpha: { min: 0, max: 1, step: 0.01 }
+                alpha: { min: 0, max: 2 * Math.PI, step: 0.01 },
+                beta: { min: -Math.PI, max: Math.PI, step: 0.01 },
+                fov: { min: 0, max: 180, step: 1 }
             }
         },
         'FreeCamera': {
@@ -497,7 +499,10 @@ var INSPECTOR;
                 'orthoTop',
                 'orthoLeft',
                 'orthoRight'
-            ]
+            ],
+            slider: {
+                fov: { min: 0, max: 180, step: 1 }
+            }
         },
         'Scene': {
             type: BABYLON.Scene,
@@ -559,7 +564,10 @@ var INSPECTOR;
                 'checkCollisions',
                 'hasLODLevels'
             ],
-            format: function (m) { return m.name; }
+            format: function (m) { return m.name; },
+            slider: {
+                visibility: { min: 0, max: 1, step: 0.1 }
+            }
         },
         'StandardMaterial': {
             type: BABYLON.StandardMaterial,
@@ -2094,13 +2102,14 @@ var INSPECTOR;
                     INSPECTOR.Scheduler.getInstance().pause = false;
                 });
                 this._textValue = INSPECTOR.Helpers.CreateDiv('value-text', this._valueDiv);
-                this._textValue.innerText = this.value;
+                this._textValue.innerText = INSPECTOR.Helpers.Trunc(this.value).toString();
                 this._textValue.style.paddingLeft = '10px';
                 this._textValue.style.display = 'inline-block';
             }
         };
         PropertyLine.prototype._rangeHandler = function () {
             INSPECTOR.Scheduler.getInstance().pause = true;
+            //this._input.style.backgroundSize = ((parseFloat(this._input.value) - parseFloat(this._input.min)) * 100 / ( parseFloat(this._input.max) - parseFloat(this._input.min))) + '% 100%'
             this._textValue.innerText = this._input.value;
             this.validateInput(this._input.value, false);
         };

File diff suppressed because it is too large
+ 4 - 4
dist/preview release/inspector/babylon.inspector.min.js


+ 6 - 1
src/Loading/babylon.sceneLoader.ts

@@ -185,7 +185,12 @@
             }
             // Loading file from disk via input file or drag'n'drop
             else {
-                Tools.ReadFile(sceneFilename, dataCallback, onProgress, useArrayBuffer);
+                if (FilesInput.FilesToLoad[sceneFilename]) {
+                    Tools.ReadFile(FilesInput.FilesToLoad[sceneFilename], dataCallback, onProgress, useArrayBuffer);
+                } else {
+                    onError("Unable to find file named " + sceneFilename);
+                    return;
+                }
             }
         }
 

+ 1 - 1
src/Mesh/babylon.abstractMesh.ts

@@ -1090,7 +1090,7 @@
          * Returns the AbstractMesh.
          */
         public setPivotMatrix(matrix: Matrix, postMultiplyPivotMatrix = false): AbstractMesh {
-            this._pivotMatrix = matrix;
+            this._pivotMatrix = matrix.clone();
             this._cache.pivotMatrixUpdated = true;
             this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;
 

+ 2 - 2
src/Tools/babylon.tools.ts

@@ -563,7 +563,7 @@
             head.appendChild(script);
         }
 
-        public static ReadFileAsDataURL(fileToLoad, callback, progressCallback): void {
+        public static ReadFileAsDataURL(fileToLoad: Blob, callback, progressCallback): void {
             var reader = new FileReader();
             reader.onload = e => {
                 //target doesn't have result from ts 1.3
@@ -573,7 +573,7 @@
             reader.readAsDataURL(fileToLoad);
         }
 
-        public static ReadFile(fileToLoad, callback, progressCallBack, useArrayBuffer?: boolean): void {
+        public static ReadFile(fileToLoad: File, callback, progressCallBack, useArrayBuffer?: boolean): void {
             var reader = new FileReader();
             reader.onerror = e => {
                 Tools.Log("Error while reading file: " + fileToLoad.name);