David Catuhe 6 年之前
父節點
當前提交
39591ffde4
共有 32 個文件被更改,包括 9636 次插入9421 次删除
  1. 4685 4660
      Playground/babylon.d.txt
  2. 4705 4680
      dist/preview release/babylon.d.ts
  3. 1 1
      dist/preview release/babylon.js
  4. 53 2
      dist/preview release/babylon.max.js
  5. 53 2
      dist/preview release/babylon.no-module.max.js
  6. 1 1
      dist/preview release/babylon.worker.js
  7. 53 2
      dist/preview release/es6.js
  8. 1 1
      dist/preview release/gui/babylon.gui.d.ts
  9. 1 1
      dist/preview release/gui/babylon.gui.js
  10. 1 1
      dist/preview release/gui/babylon.gui.min.js
  11. 1 1
      dist/preview release/gui/babylon.gui.min.js.map
  12. 2 2
      dist/preview release/gui/babylon.gui.module.d.ts
  13. 7 7
      dist/preview release/inspector/babylon.inspector.bundle.js
  14. 1 1
      dist/preview release/inspector/babylon.inspector.bundle.js.map
  15. 1 1
      dist/preview release/inspector/babylon.inspector.d.ts
  16. 2 2
      dist/preview release/inspector/babylon.inspector.module.d.ts
  17. 1 1
      dist/preview release/loaders/babylon.glTF1FileLoader.min.js
  18. 1 1
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  19. 1 1
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  20. 1 1
      dist/preview release/loaders/babylonjs.loaders.min.js
  21. 1 1
      dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js
  22. 1 1
      dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js
  23. 1 1
      dist/preview release/postProcessesLibrary/babylonjs.postProcess.min.js
  24. 1 1
      dist/preview release/serializers/babylon.glTF2Serializer.min.js
  25. 1 1
      dist/preview release/serializers/babylonjs.serializers.min.js
  26. 3 17
      dist/preview release/viewer/babylon.viewer.d.ts
  27. 3 3
      dist/preview release/viewer/babylon.viewer.js
  28. 7 7
      dist/preview release/viewer/babylon.viewer.max.js
  29. 3 20
      dist/preview release/viewer/babylon.viewer.module.d.ts
  30. 1 0
      dist/preview release/what's new.md
  31. 22 0
      src/Cameras/babylon.arcRotateCamera.ts
  32. 20 0
      src/Math/babylon.math.ts

File diff suppressed because it is too large
+ 4685 - 4660
Playground/babylon.d.txt


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


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


+ 53 - 2
dist/preview release/babylon.max.js

@@ -5688,6 +5688,16 @@ var BABYLON;
         Vector3.Up = function () {
             return new Vector3(0.0, 1.0, 0.0);
         };
+        Object.defineProperty(Vector3, "UpReadOnly", {
+            /**
+             * Gets a up Vector3 that must not be updated
+             */
+            get: function () {
+                return Vector3._UpReadOnly;
+            },
+            enumerable: true,
+            configurable: true
+        });
         /**
          * Returns a new Vector3 set to (0.0, -1.0, 0.0)
          * @returns a new down Vector3
@@ -6165,6 +6175,7 @@ var BABYLON;
             Quaternion.RotationQuaternionFromAxisToRef(axis1, axis2, axis3, quat);
             quat.toEulerAnglesToRef(ref);
         };
+        Vector3._UpReadOnly = Vector3.Up();
         return Vector3;
     }());
     BABYLON.Vector3 = Vector3;
@@ -6823,6 +6834,16 @@ var BABYLON;
             result.z = (x * m[2]) + (y * m[6]) + (z * m[10]);
             result.w = w;
         };
+        /**
+         * Creates a new Vector4 from a Vector3
+         * @param source defines the source data
+         * @param w defines the 4th component (default is 0)
+         * @returns a new Vector4
+         */
+        Vector4.FromVector3 = function (source, w) {
+            if (w === void 0) { w = 0; }
+            return new Vector4(source.x, source.y, source.z, w);
+        };
         return Vector4;
     }());
     BABYLON.Vector4 = Vector4;
@@ -52632,6 +52653,19 @@ var BABYLON;
             }
             var target = this._getTargetPosition();
             this._computationVector.copyFromFloats(this.radius * cosa * sinb, this.radius * cosb, this.radius * sina * sinb);
+            // Rotate according to up vector
+            if (this.upVector.x !== 0 || this.upVector.y !== 1.0 || this.upVector.z !== 0) {
+                if (!this._tempAxisVector) {
+                    this._tempAxisVector = new BABYLON.Vector3();
+                    this._tempAxisRotationMatrix = new BABYLON.Matrix();
+                }
+                BABYLON.Vector3.CrossToRef(BABYLON.Vector3.Up(), this.upVector, this._tempAxisVector);
+                this._tempAxisVector.normalize();
+                var angle = Math.acos(BABYLON.Vector3.Dot(BABYLON.Vector3.UpReadOnly, this.upVector));
+                BABYLON.Matrix.RotationAxisToRef(this._tempAxisVector, angle, this._tempAxisRotationMatrix);
+                this._tempAxisVector.copyFrom(this._computationVector);
+                BABYLON.Vector3.TransformCoordinatesToRef(this._tempAxisVector, this._tempAxisRotationMatrix, this._computationVector);
+            }
             target.addToRef(this._computationVector, this._newPosition);
             if (this.getScene().collisionsEnabled && this.checkCollisions) {
                 if (!this._collider) {
@@ -99909,6 +99943,7 @@ var BABYLON;
              */
             this.name = "AmmoJSPlugin";
             this._timeStep = 1 / 60;
+            this._fixedTimeStep = 1 / 60;
             this._maxSteps = 5;
             this._tmpQuaternion = new BABYLON.Quaternion();
             this._tmpContactCallbackResult = false;
@@ -99952,6 +99987,20 @@ var BABYLON;
             this._timeStep = timeStep;
         };
         /**
+         * Increment to step forward in the physics engine (If timeStep is set to 1/60 and fixedTimeStep is set to 1/120 the physics engine should run 2 steps per frame) (Default: 1/60)
+         * @param fixedTimeStep fixedTimeStep to use in seconds
+         */
+        AmmoJSPlugin.prototype.setFixedTimeStep = function (fixedTimeStep) {
+            this._fixedTimeStep = fixedTimeStep;
+        };
+        /**
+         * Sets the maximum number of steps by the physics engine per frame (Default: 5)
+         * @param maxSteps the maximum number of steps by the physics engine per frame
+         */
+        AmmoJSPlugin.prototype.setMaxSteps = function (maxSteps) {
+            this._maxSteps = maxSteps;
+        };
+        /**
          * Gets the current timestep (only used if useDeltaForWorldStep is false in the constructor)
          * @returns the current timestep in seconds
          */
@@ -100012,7 +100061,7 @@ var BABYLON;
                 // Update physics world objects to match babylon world
                 impostor.beforeStep();
             }
-            this._stepSimulation(this._useDeltaForWorldStep ? delta : this._timeStep, this._maxSteps);
+            this._stepSimulation(this._useDeltaForWorldStep ? delta : this._timeStep, this._maxSteps, this._fixedTimeStep);
             for (var _a = 0, impostors_2 = impostors; _a < impostors_2.length; _a++) {
                 var mainImpostor = impostors_2[_a];
                 // After physics update make babylon world objects match physics world objects
@@ -100156,7 +100205,9 @@ var BABYLON;
          * @param impostorJoint the imposter joint to remove the joint from
          */
         AmmoJSPlugin.prototype.removeJoint = function (impostorJoint) {
-            this.world.removeConstraint(impostorJoint.joint.physicsJoint);
+            if (this.world) {
+                this.world.removeConstraint(impostorJoint.joint.physicsJoint);
+            }
         };
         // adds all verticies (including child verticies) to the triangle mesh
         AmmoJSPlugin.prototype._addMeshVerts = function (btTriangleMesh, topLevelObject, object) {

+ 53 - 2
dist/preview release/babylon.no-module.max.js

@@ -5655,6 +5655,16 @@ var BABYLON;
         Vector3.Up = function () {
             return new Vector3(0.0, 1.0, 0.0);
         };
+        Object.defineProperty(Vector3, "UpReadOnly", {
+            /**
+             * Gets a up Vector3 that must not be updated
+             */
+            get: function () {
+                return Vector3._UpReadOnly;
+            },
+            enumerable: true,
+            configurable: true
+        });
         /**
          * Returns a new Vector3 set to (0.0, -1.0, 0.0)
          * @returns a new down Vector3
@@ -6132,6 +6142,7 @@ var BABYLON;
             Quaternion.RotationQuaternionFromAxisToRef(axis1, axis2, axis3, quat);
             quat.toEulerAnglesToRef(ref);
         };
+        Vector3._UpReadOnly = Vector3.Up();
         return Vector3;
     }());
     BABYLON.Vector3 = Vector3;
@@ -6790,6 +6801,16 @@ var BABYLON;
             result.z = (x * m[2]) + (y * m[6]) + (z * m[10]);
             result.w = w;
         };
+        /**
+         * Creates a new Vector4 from a Vector3
+         * @param source defines the source data
+         * @param w defines the 4th component (default is 0)
+         * @returns a new Vector4
+         */
+        Vector4.FromVector3 = function (source, w) {
+            if (w === void 0) { w = 0; }
+            return new Vector4(source.x, source.y, source.z, w);
+        };
         return Vector4;
     }());
     BABYLON.Vector4 = Vector4;
@@ -52599,6 +52620,19 @@ var BABYLON;
             }
             var target = this._getTargetPosition();
             this._computationVector.copyFromFloats(this.radius * cosa * sinb, this.radius * cosb, this.radius * sina * sinb);
+            // Rotate according to up vector
+            if (this.upVector.x !== 0 || this.upVector.y !== 1.0 || this.upVector.z !== 0) {
+                if (!this._tempAxisVector) {
+                    this._tempAxisVector = new BABYLON.Vector3();
+                    this._tempAxisRotationMatrix = new BABYLON.Matrix();
+                }
+                BABYLON.Vector3.CrossToRef(BABYLON.Vector3.Up(), this.upVector, this._tempAxisVector);
+                this._tempAxisVector.normalize();
+                var angle = Math.acos(BABYLON.Vector3.Dot(BABYLON.Vector3.UpReadOnly, this.upVector));
+                BABYLON.Matrix.RotationAxisToRef(this._tempAxisVector, angle, this._tempAxisRotationMatrix);
+                this._tempAxisVector.copyFrom(this._computationVector);
+                BABYLON.Vector3.TransformCoordinatesToRef(this._tempAxisVector, this._tempAxisRotationMatrix, this._computationVector);
+            }
             target.addToRef(this._computationVector, this._newPosition);
             if (this.getScene().collisionsEnabled && this.checkCollisions) {
                 if (!this._collider) {
@@ -99876,6 +99910,7 @@ var BABYLON;
              */
             this.name = "AmmoJSPlugin";
             this._timeStep = 1 / 60;
+            this._fixedTimeStep = 1 / 60;
             this._maxSteps = 5;
             this._tmpQuaternion = new BABYLON.Quaternion();
             this._tmpContactCallbackResult = false;
@@ -99919,6 +99954,20 @@ var BABYLON;
             this._timeStep = timeStep;
         };
         /**
+         * Increment to step forward in the physics engine (If timeStep is set to 1/60 and fixedTimeStep is set to 1/120 the physics engine should run 2 steps per frame) (Default: 1/60)
+         * @param fixedTimeStep fixedTimeStep to use in seconds
+         */
+        AmmoJSPlugin.prototype.setFixedTimeStep = function (fixedTimeStep) {
+            this._fixedTimeStep = fixedTimeStep;
+        };
+        /**
+         * Sets the maximum number of steps by the physics engine per frame (Default: 5)
+         * @param maxSteps the maximum number of steps by the physics engine per frame
+         */
+        AmmoJSPlugin.prototype.setMaxSteps = function (maxSteps) {
+            this._maxSteps = maxSteps;
+        };
+        /**
          * Gets the current timestep (only used if useDeltaForWorldStep is false in the constructor)
          * @returns the current timestep in seconds
          */
@@ -99979,7 +100028,7 @@ var BABYLON;
                 // Update physics world objects to match babylon world
                 impostor.beforeStep();
             }
-            this._stepSimulation(this._useDeltaForWorldStep ? delta : this._timeStep, this._maxSteps);
+            this._stepSimulation(this._useDeltaForWorldStep ? delta : this._timeStep, this._maxSteps, this._fixedTimeStep);
             for (var _a = 0, impostors_2 = impostors; _a < impostors_2.length; _a++) {
                 var mainImpostor = impostors_2[_a];
                 // After physics update make babylon world objects match physics world objects
@@ -100123,7 +100172,9 @@ var BABYLON;
          * @param impostorJoint the imposter joint to remove the joint from
          */
         AmmoJSPlugin.prototype.removeJoint = function (impostorJoint) {
-            this.world.removeConstraint(impostorJoint.joint.physicsJoint);
+            if (this.world) {
+                this.world.removeConstraint(impostorJoint.joint.physicsJoint);
+            }
         };
         // adds all verticies (including child verticies) to the triangle mesh
         AmmoJSPlugin.prototype._addMeshVerts = function (btTriangleMesh, topLevelObject, object) {

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


+ 53 - 2
dist/preview release/es6.js

@@ -5655,6 +5655,16 @@ var BABYLON;
         Vector3.Up = function () {
             return new Vector3(0.0, 1.0, 0.0);
         };
+        Object.defineProperty(Vector3, "UpReadOnly", {
+            /**
+             * Gets a up Vector3 that must not be updated
+             */
+            get: function () {
+                return Vector3._UpReadOnly;
+            },
+            enumerable: true,
+            configurable: true
+        });
         /**
          * Returns a new Vector3 set to (0.0, -1.0, 0.0)
          * @returns a new down Vector3
@@ -6132,6 +6142,7 @@ var BABYLON;
             Quaternion.RotationQuaternionFromAxisToRef(axis1, axis2, axis3, quat);
             quat.toEulerAnglesToRef(ref);
         };
+        Vector3._UpReadOnly = Vector3.Up();
         return Vector3;
     }());
     BABYLON.Vector3 = Vector3;
@@ -6790,6 +6801,16 @@ var BABYLON;
             result.z = (x * m[2]) + (y * m[6]) + (z * m[10]);
             result.w = w;
         };
+        /**
+         * Creates a new Vector4 from a Vector3
+         * @param source defines the source data
+         * @param w defines the 4th component (default is 0)
+         * @returns a new Vector4
+         */
+        Vector4.FromVector3 = function (source, w) {
+            if (w === void 0) { w = 0; }
+            return new Vector4(source.x, source.y, source.z, w);
+        };
         return Vector4;
     }());
     BABYLON.Vector4 = Vector4;
@@ -52599,6 +52620,19 @@ var BABYLON;
             }
             var target = this._getTargetPosition();
             this._computationVector.copyFromFloats(this.radius * cosa * sinb, this.radius * cosb, this.radius * sina * sinb);
+            // Rotate according to up vector
+            if (this.upVector.x !== 0 || this.upVector.y !== 1.0 || this.upVector.z !== 0) {
+                if (!this._tempAxisVector) {
+                    this._tempAxisVector = new BABYLON.Vector3();
+                    this._tempAxisRotationMatrix = new BABYLON.Matrix();
+                }
+                BABYLON.Vector3.CrossToRef(BABYLON.Vector3.Up(), this.upVector, this._tempAxisVector);
+                this._tempAxisVector.normalize();
+                var angle = Math.acos(BABYLON.Vector3.Dot(BABYLON.Vector3.UpReadOnly, this.upVector));
+                BABYLON.Matrix.RotationAxisToRef(this._tempAxisVector, angle, this._tempAxisRotationMatrix);
+                this._tempAxisVector.copyFrom(this._computationVector);
+                BABYLON.Vector3.TransformCoordinatesToRef(this._tempAxisVector, this._tempAxisRotationMatrix, this._computationVector);
+            }
             target.addToRef(this._computationVector, this._newPosition);
             if (this.getScene().collisionsEnabled && this.checkCollisions) {
                 if (!this._collider) {
@@ -99876,6 +99910,7 @@ var BABYLON;
              */
             this.name = "AmmoJSPlugin";
             this._timeStep = 1 / 60;
+            this._fixedTimeStep = 1 / 60;
             this._maxSteps = 5;
             this._tmpQuaternion = new BABYLON.Quaternion();
             this._tmpContactCallbackResult = false;
@@ -99919,6 +99954,20 @@ var BABYLON;
             this._timeStep = timeStep;
         };
         /**
+         * Increment to step forward in the physics engine (If timeStep is set to 1/60 and fixedTimeStep is set to 1/120 the physics engine should run 2 steps per frame) (Default: 1/60)
+         * @param fixedTimeStep fixedTimeStep to use in seconds
+         */
+        AmmoJSPlugin.prototype.setFixedTimeStep = function (fixedTimeStep) {
+            this._fixedTimeStep = fixedTimeStep;
+        };
+        /**
+         * Sets the maximum number of steps by the physics engine per frame (Default: 5)
+         * @param maxSteps the maximum number of steps by the physics engine per frame
+         */
+        AmmoJSPlugin.prototype.setMaxSteps = function (maxSteps) {
+            this._maxSteps = maxSteps;
+        };
+        /**
          * Gets the current timestep (only used if useDeltaForWorldStep is false in the constructor)
          * @returns the current timestep in seconds
          */
@@ -99979,7 +100028,7 @@ var BABYLON;
                 // Update physics world objects to match babylon world
                 impostor.beforeStep();
             }
-            this._stepSimulation(this._useDeltaForWorldStep ? delta : this._timeStep, this._maxSteps);
+            this._stepSimulation(this._useDeltaForWorldStep ? delta : this._timeStep, this._maxSteps, this._fixedTimeStep);
             for (var _a = 0, impostors_2 = impostors; _a < impostors_2.length; _a++) {
                 var mainImpostor = impostors_2[_a];
                 // After physics update make babylon world objects match physics world objects
@@ -100123,7 +100172,9 @@ var BABYLON;
          * @param impostorJoint the imposter joint to remove the joint from
          */
         AmmoJSPlugin.prototype.removeJoint = function (impostorJoint) {
-            this.world.removeConstraint(impostorJoint.joint.physicsJoint);
+            if (this.world) {
+                this.world.removeConstraint(impostorJoint.joint.physicsJoint);
+            }
         };
         // adds all verticies (including child verticies) to the triangle mesh
         AmmoJSPlugin.prototype._addMeshVerts = function (btTriangleMesh, topLevelObject, object) {

+ 1 - 1
dist/preview release/gui/babylon.gui.d.ts

@@ -1,6 +1,6 @@
 /*Babylon.js GUI*/
 // Dependencies for this module:
-//   ../../../../Tools/Gulp/babylonjs
+//   ../../../../Tools/gulp/babylonjs
 declare module BABYLON.GUI {
 }
 declare module BABYLON.GUI {

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


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


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/gui/babylon.gui.min.js.map


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

@@ -1,6 +1,6 @@
 /*Babylon.js GUI*/
 // Dependencies for this module:
-//   ../../../../Tools/Gulp/babylonjs
+//   ../../../../Tools/gulp/babylonjs
 
 declare module 'babylonjs-gui' {
     export * from "babylonjs-gui/2D";
@@ -3134,7 +3134,7 @@ declare module 'babylonjs-gui/3D/materials/fluentMaterial' {
 
 /*Babylon.js GUI*/
 // Dependencies for this module:
-//   ../../../../Tools/Gulp/babylonjs
+//   ../../../../Tools/gulp/babylonjs
 declare module BABYLON.GUI {
 }
 declare module BABYLON.GUI {

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


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


+ 1 - 1
dist/preview release/inspector/babylon.inspector.d.ts

@@ -1,6 +1,6 @@
 /*Babylon.js Inspector*/
 // Dependencies for this module:
-//   ../../../../Tools/Gulp/babylonjs
+//   ../../../../Tools/gulp/babylonjs
 declare module INSPECTOR {
 }
 declare module INSPECTOR {

+ 2 - 2
dist/preview release/inspector/babylon.inspector.module.d.ts

@@ -1,6 +1,6 @@
 /*Babylon.js Inspector*/
 // Dependencies for this module:
-//   ../../../../Tools/Gulp/babylonjs
+//   ../../../../Tools/gulp/babylonjs
 
 declare module 'babylonjs-inspector' {
     export * from "babylonjs-inspector/inspector";
@@ -31,7 +31,7 @@ declare module 'babylonjs-inspector/components/propertyChangedEvent' {
 
 /*Babylon.js Inspector*/
 // Dependencies for this module:
-//   ../../../../Tools/Gulp/babylonjs
+//   ../../../../Tools/gulp/babylonjs
 declare module INSPECTOR {
 }
 declare module INSPECTOR {

File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylon.glTF1FileLoader.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylon.glTFFileLoader.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/loaders/babylonjs.loaders.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/postProcessesLibrary/babylonjs.postProcess.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/serializers/babylon.glTF2Serializer.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/preview release/serializers/babylonjs.serializers.min.js


+ 3 - 17
dist/preview release/viewer/babylon.viewer.d.ts

@@ -4,8 +4,8 @@
 declare module "babylonjs-loaders"{ export=BABYLON;}
 // Generated by dts-bundle v0.7.3
 // Dependencies for this module:
-//   ../../../../../Tools/Gulp/babylonjs
-//   ../../../../../Tools/Gulp/babylonjs-loaders
+//   ../../../../../Tools/gulp/babylonjs
+//   ../../../../../Tools/gulp/babylonjs-loaders
 declare module BabylonViewer {
     /**
         * BabylonJS Viewer
@@ -924,7 +924,7 @@ declare module BabylonViewer {
       * @param name the name of the custom optimizer configuration
       * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
       */
-    export function getCustomOptimizerByName(name: string, upgrade?: boolean): typeof extendedUpgrade;
+    export function getCustomOptimizerByName(name: string, upgrade?: boolean): (sceneManager: SceneManager) => boolean;
     export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
 }
 declare module BabylonViewer {
@@ -1558,20 +1558,6 @@ declare module BabylonViewer {
     export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
 }
 declare module BabylonViewer {
-    /**
-        * A custom upgrade-oriented function configuration for the scene optimizer.
-        *
-        * @param viewer the viewer to optimize
-        */
-    export function extendedUpgrade(sceneManager: SceneManager): boolean;
-    /**
-        * A custom degrade-oriented function configuration for the scene optimizer.
-        *
-        * @param viewer the viewer to optimize
-        */
-    export function extendedDegrade(sceneManager: SceneManager): boolean;
-}
-declare module BabylonViewer {
 }
 declare module BabylonViewer {
     export interface IEnvironmentMapConfiguration {

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


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


+ 3 - 20
dist/preview release/viewer/babylon.viewer.module.d.ts

@@ -5,8 +5,8 @@ declare module "babylonjs-loaders"{ export=BABYLON;}
 
 // Generated by dts-bundle v0.7.3
 // Dependencies for this module:
-//   ../../../../../Tools/Gulp/babylonjs
-//   ../../../../../Tools/Gulp/babylonjs-loaders
+//   ../../../../../Tools/gulp/babylonjs
+//   ../../../../../Tools/gulp/babylonjs-loaders
 
 declare module 'babylonjs-viewer' {
     import { mapperManager } from 'babylonjs-viewer/configuration/mappers';
@@ -985,14 +985,13 @@ declare module 'babylonjs-viewer/templating/viewerTemplatePlugin' {
 }
 
 declare module 'babylonjs-viewer/optimizer/custom' {
-    import { extendedUpgrade } from "babylonjs-viewer/optimizer/custom/extended";
     import { SceneManager } from "babylonjs-viewer/managers/sceneManager";
     /**
       *
       * @param name the name of the custom optimizer configuration
       * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
       */
-    export function getCustomOptimizerByName(name: string, upgrade?: boolean): typeof extendedUpgrade;
+    export function getCustomOptimizerByName(name: string, upgrade?: boolean): (sceneManager: SceneManager) => boolean;
     export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
 }
 
@@ -1663,22 +1662,6 @@ declare module 'babylonjs-viewer/loader/plugins' {
     export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
 }
 
-declare module 'babylonjs-viewer/optimizer/custom/extended' {
-    import { SceneManager } from 'babylonjs-viewer/managers/sceneManager';
-    /**
-        * A custom upgrade-oriented function configuration for the scene optimizer.
-        *
-        * @param viewer the viewer to optimize
-        */
-    export function extendedUpgrade(sceneManager: SceneManager): boolean;
-    /**
-        * A custom degrade-oriented function configuration for the scene optimizer.
-        *
-        * @param viewer the viewer to optimize
-        */
-    export function extendedDegrade(sceneManager: SceneManager): boolean;
-}
-
 declare module 'babylonjs-viewer/configuration/interfaces' {
     export * from 'babylonjs-viewer/configuration/interfaces/cameraConfiguration';
     export * from 'babylonjs-viewer/configuration/interfaces/colorGradingConfiguration';

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

@@ -92,6 +92,7 @@
 ### Materials Library
 
 ## Bug fixes
+- Fixed ArcRotateCamera control when upVector was modified ([Deltakosh](https://github.com/deltakosh))
 - Fixed anaglyph mode for Free and Universal cameras ([Deltakosh](https://github.com/deltakosh))
 - Fixed FileLoader's loading of a skybox, & added a parsed value for whether to create with PBR or STDMaterial ([Palmer-JC](https://github.com/Palmer-JC))
 - Removed bones from rootNodes where they should never have been ([Deltakosh](https://github.com/deltakosh))

+ 22 - 0
src/Cameras/babylon.arcRotateCamera.ts

@@ -544,6 +544,8 @@ module BABYLON {
         protected _targetBoundingCenter: Nullable<Vector3>;
 
         private _computationVector: Vector3 = Vector3.Zero();
+        private _tempAxisVector: Vector3;
+        private _tempAxisRotationMatrix: Matrix;
 
         /**
          * Instantiates a new ArcRotateCamera in a given scene
@@ -907,6 +909,26 @@ module BABYLON {
 
             var target = this._getTargetPosition();
             this._computationVector.copyFromFloats(this.radius * cosa * sinb, this.radius * cosb, this.radius * sina * sinb);
+
+            // Rotate according to up vector
+            if (this.upVector.x !== 0 || this.upVector.y !== 1.0 || this.upVector.z !== 0) {
+
+                if (!this._tempAxisVector) {
+                    this._tempAxisVector = new Vector3();
+                    this._tempAxisRotationMatrix = new Matrix();
+                }
+
+                Vector3.CrossToRef(Vector3.Up(), this.upVector, this._tempAxisVector);
+                this._tempAxisVector.normalize();
+
+                let angle = Math.acos(Vector3.Dot(Vector3.UpReadOnly, this.upVector));
+
+                Matrix.RotationAxisToRef(this._tempAxisVector, angle, this._tempAxisRotationMatrix);
+
+                this._tempAxisVector.copyFrom(this._computationVector);
+                Vector3.TransformCoordinatesToRef(this._tempAxisVector, this._tempAxisRotationMatrix, this._computationVector);
+            }
+
             target.addToRef(this._computationVector, this._newPosition);
             if (this.getScene().collisionsEnabled && this.checkCollisions) {
                 if (!this._collider) {

+ 20 - 0
src/Math/babylon.math.ts

@@ -1540,6 +1540,8 @@ module BABYLON {
      * Reminder: Babylon.js uses a left handed forward facing system
      */
     export class Vector3 {
+        private static _UpReadOnly = Vector3.Up() as DeepImmutable<Vector3>;
+
         /**
          * Creates a new Vector3 object from the given x, y, z (floats) coordinates.
          * @param x defines the first coordinates (on X axis)
@@ -2224,6 +2226,14 @@ module BABYLON {
         public static Up(): Vector3 {
             return new Vector3(0.0, 1.0, 0.0);
         }
+
+        /**
+         * Gets a up Vector3 that must not be updated
+         */
+        public static get UpReadOnly(): DeepImmutable<Vector3> {
+            return Vector3._UpReadOnly;
+        }
+
         /**
          * Returns a new Vector3 set to (0.0, -1.0, 0.0)
          * @returns a new down Vector3
@@ -3430,6 +3440,16 @@ module BABYLON {
             result.z = (x * m[2]) + (y * m[6]) + (z * m[10]);
             result.w = w;
         }
+
+        /**
+         * Creates a new Vector4 from a Vector3
+         * @param source defines the source data
+         * @param w defines the 4th component (default is 0)
+         * @returns a new Vector4
+         */
+        public static FromVector3(source: Vector3, w: number = 0) {
+            return new Vector4(source.x, source.y, source.z, w);
+        }
     }
 
     /**