David Catuhe 6 年 前
コミット
6425f2d08d

ファイルの差分が大きいため隠しています
+ 8606 - 8601
Playground/babylon.d.txt


ファイルの差分が大きいため隠しています
+ 9073 - 9068
dist/preview release/babylon.d.ts


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/preview release/babylon.js


+ 26 - 1
dist/preview release/babylon.max.js

@@ -27681,7 +27681,7 @@ var BABYLON;
          * @param animatable defines an animatable object. If not provided a new one will be created from the given params
          * @param stopCurrent defines if the current animations must be stopped first (true by default)
          * @param targetMask defines if the target should be animated if animations are present (this is called recursively on descendant animatables regardless of return value)
-         * @returns the animatable object created for this animation
+         * @returns the list of created animatables
          */
         Scene.prototype.beginHierarchyAnimation = function (target, directDescendantsOnly, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask) {
             if (speedRatio === void 0) { speedRatio = 1.0; }
@@ -48717,6 +48717,11 @@ var BABYLON;
              */
             _this.cameraRotation = new BABYLON.Vector2(0, 0);
             /**
+             * When set, the up vector of the camera will be updated by the rotation of the camera
+             */
+            _this.updateUpVectorFromRotation = false;
+            _this._tmpQuaternion = new BABYLON.Quaternion();
+            /**
              * Define the current rotation of the camera
              */
             _this.rotation = new BABYLON.Vector3(0, 0, 0);
@@ -48991,6 +48996,15 @@ var BABYLON;
             BABYLON.Vector3.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);
             // Computing target and final matrix
             this.position.addToRef(this._transformedReferencePoint, this._currentTarget);
+            if (this.updateUpVectorFromRotation) {
+                if (this.rotationQuaternion) {
+                    BABYLON.Axis.Y.rotateByQuaternionToRef(this.rotationQuaternion, this.upVector);
+                }
+                else {
+                    BABYLON.Quaternion.FromEulerVectorToRef(this.rotation, this._tmpQuaternion);
+                    BABYLON.Axis.Y.rotateByQuaternionToRef(this._tmpQuaternion, this.upVector);
+                }
+            }
             this._computeViewMatrix(this.position, this._currentTarget, this.upVector);
             return this._viewMatrix;
         };
@@ -107780,6 +107794,16 @@ var BABYLON;
             }
             if (this._scene.activeCamera) {
                 this._position = this._scene.activeCamera.position.clone();
+                if (this.vrDeviceOrientationCamera) {
+                    this.vrDeviceOrientationCamera.rotation = BABYLON.Quaternion.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles();
+                }
+                if (this.webVRCamera) {
+                    var currentYRotation = this.webVRCamera.deviceRotationQuaternion.toEulerAngles().y;
+                    var desiredYRotation = BABYLON.Quaternion.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles().y;
+                    var delta = desiredYRotation - currentYRotation;
+                    var currentGlobalRotation = this.webVRCamera.rotationQuaternion.toEulerAngles().y;
+                    this.webVRCamera.rotationQuaternion = BABYLON.Quaternion.FromEulerAngles(0, currentGlobalRotation + delta, 0);
+                }
                 // make sure that we return to the last active camera
                 this._existingCamera = this._scene.activeCamera;
             }
@@ -108625,6 +108649,7 @@ var BABYLON;
             _this.minZ = 0;
             _this.rotationQuaternion = new BABYLON.Quaternion();
             _this.cameraRigMode = BABYLON.Camera.RIG_MODE_CUSTOM;
+            _this.updateUpVectorFromRotation = true;
             _this._updateNumberOfRigCameras(1);
             return _this;
         }

+ 26 - 1
dist/preview release/babylon.no-module.max.js

@@ -27648,7 +27648,7 @@ var BABYLON;
          * @param animatable defines an animatable object. If not provided a new one will be created from the given params
          * @param stopCurrent defines if the current animations must be stopped first (true by default)
          * @param targetMask defines if the target should be animated if animations are present (this is called recursively on descendant animatables regardless of return value)
-         * @returns the animatable object created for this animation
+         * @returns the list of created animatables
          */
         Scene.prototype.beginHierarchyAnimation = function (target, directDescendantsOnly, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask) {
             if (speedRatio === void 0) { speedRatio = 1.0; }
@@ -48684,6 +48684,11 @@ var BABYLON;
              */
             _this.cameraRotation = new BABYLON.Vector2(0, 0);
             /**
+             * When set, the up vector of the camera will be updated by the rotation of the camera
+             */
+            _this.updateUpVectorFromRotation = false;
+            _this._tmpQuaternion = new BABYLON.Quaternion();
+            /**
              * Define the current rotation of the camera
              */
             _this.rotation = new BABYLON.Vector3(0, 0, 0);
@@ -48958,6 +48963,15 @@ var BABYLON;
             BABYLON.Vector3.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);
             // Computing target and final matrix
             this.position.addToRef(this._transformedReferencePoint, this._currentTarget);
+            if (this.updateUpVectorFromRotation) {
+                if (this.rotationQuaternion) {
+                    BABYLON.Axis.Y.rotateByQuaternionToRef(this.rotationQuaternion, this.upVector);
+                }
+                else {
+                    BABYLON.Quaternion.FromEulerVectorToRef(this.rotation, this._tmpQuaternion);
+                    BABYLON.Axis.Y.rotateByQuaternionToRef(this._tmpQuaternion, this.upVector);
+                }
+            }
             this._computeViewMatrix(this.position, this._currentTarget, this.upVector);
             return this._viewMatrix;
         };
@@ -107747,6 +107761,16 @@ var BABYLON;
             }
             if (this._scene.activeCamera) {
                 this._position = this._scene.activeCamera.position.clone();
+                if (this.vrDeviceOrientationCamera) {
+                    this.vrDeviceOrientationCamera.rotation = BABYLON.Quaternion.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles();
+                }
+                if (this.webVRCamera) {
+                    var currentYRotation = this.webVRCamera.deviceRotationQuaternion.toEulerAngles().y;
+                    var desiredYRotation = BABYLON.Quaternion.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles().y;
+                    var delta = desiredYRotation - currentYRotation;
+                    var currentGlobalRotation = this.webVRCamera.rotationQuaternion.toEulerAngles().y;
+                    this.webVRCamera.rotationQuaternion = BABYLON.Quaternion.FromEulerAngles(0, currentGlobalRotation + delta, 0);
+                }
                 // make sure that we return to the last active camera
                 this._existingCamera = this._scene.activeCamera;
             }
@@ -108592,6 +108616,7 @@ var BABYLON;
             _this.minZ = 0;
             _this.rotationQuaternion = new BABYLON.Quaternion();
             _this.cameraRigMode = BABYLON.Camera.RIG_MODE_CUSTOM;
+            _this.updateUpVectorFromRotation = true;
             _this._updateNumberOfRigCameras(1);
             return _this;
         }

ファイルの差分が大きいため隠しています
+ 1 - 1
dist/preview release/babylon.worker.js


+ 26 - 1
dist/preview release/es6.js

@@ -27648,7 +27648,7 @@ var BABYLON;
          * @param animatable defines an animatable object. If not provided a new one will be created from the given params
          * @param stopCurrent defines if the current animations must be stopped first (true by default)
          * @param targetMask defines if the target should be animated if animations are present (this is called recursively on descendant animatables regardless of return value)
-         * @returns the animatable object created for this animation
+         * @returns the list of created animatables
          */
         Scene.prototype.beginHierarchyAnimation = function (target, directDescendantsOnly, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask) {
             if (speedRatio === void 0) { speedRatio = 1.0; }
@@ -48684,6 +48684,11 @@ var BABYLON;
              */
             _this.cameraRotation = new BABYLON.Vector2(0, 0);
             /**
+             * When set, the up vector of the camera will be updated by the rotation of the camera
+             */
+            _this.updateUpVectorFromRotation = false;
+            _this._tmpQuaternion = new BABYLON.Quaternion();
+            /**
              * Define the current rotation of the camera
              */
             _this.rotation = new BABYLON.Vector3(0, 0, 0);
@@ -48958,6 +48963,15 @@ var BABYLON;
             BABYLON.Vector3.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);
             // Computing target and final matrix
             this.position.addToRef(this._transformedReferencePoint, this._currentTarget);
+            if (this.updateUpVectorFromRotation) {
+                if (this.rotationQuaternion) {
+                    BABYLON.Axis.Y.rotateByQuaternionToRef(this.rotationQuaternion, this.upVector);
+                }
+                else {
+                    BABYLON.Quaternion.FromEulerVectorToRef(this.rotation, this._tmpQuaternion);
+                    BABYLON.Axis.Y.rotateByQuaternionToRef(this._tmpQuaternion, this.upVector);
+                }
+            }
             this._computeViewMatrix(this.position, this._currentTarget, this.upVector);
             return this._viewMatrix;
         };
@@ -107747,6 +107761,16 @@ var BABYLON;
             }
             if (this._scene.activeCamera) {
                 this._position = this._scene.activeCamera.position.clone();
+                if (this.vrDeviceOrientationCamera) {
+                    this.vrDeviceOrientationCamera.rotation = BABYLON.Quaternion.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles();
+                }
+                if (this.webVRCamera) {
+                    var currentYRotation = this.webVRCamera.deviceRotationQuaternion.toEulerAngles().y;
+                    var desiredYRotation = BABYLON.Quaternion.FromRotationMatrix(this._scene.activeCamera.getWorldMatrix().getRotationMatrix()).toEulerAngles().y;
+                    var delta = desiredYRotation - currentYRotation;
+                    var currentGlobalRotation = this.webVRCamera.rotationQuaternion.toEulerAngles().y;
+                    this.webVRCamera.rotationQuaternion = BABYLON.Quaternion.FromEulerAngles(0, currentGlobalRotation + delta, 0);
+                }
                 // make sure that we return to the last active camera
                 this._existingCamera = this._scene.activeCamera;
             }
@@ -108592,6 +108616,7 @@ var BABYLON;
             _this.minZ = 0;
             _this.rotationQuaternion = new BABYLON.Quaternion();
             _this.cameraRigMode = BABYLON.Camera.RIG_MODE_CUSTOM;
+            _this.updateUpVectorFromRotation = true;
             _this._updateNumberOfRigCameras(1);
             return _this;
         }

+ 5 - 19
dist/preview release/viewer/babylon.viewer.d.ts

@@ -168,11 +168,11 @@ declare module BabylonViewer {
                 * Mainly used for help and errors
                 * @param subScreen the name of the subScreen. Those can be defined in the configuration object
                 */
-            showOverlayScreen(subScreen: string): Promise<Template> | Promise<string>;
+            showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
             /**
                 * Hide the overlay screen.
                 */
-            hideOverlayScreen(): Promise<Template> | Promise<string>;
+            hideOverlayScreen(): Promise<string> | Promise<Template>;
             /**
                 * show the viewer (in case it was hidden)
                 *
@@ -189,11 +189,11 @@ declare module BabylonViewer {
                 * Show the loading screen.
                 * The loading screen can be configured using the configuration object
                 */
-            showLoadingScreen(): Promise<Template> | Promise<string>;
+            showLoadingScreen(): Promise<string> | Promise<Template>;
             /**
                 * Hide the loading screen
                 */
-            hideLoadingScreen(): Promise<Template> | Promise<string>;
+            hideLoadingScreen(): Promise<string> | Promise<Template>;
             dispose(): void;
             protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
     }
@@ -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 {

ファイルの差分が大きいため隠しています
+ 1 - 1
dist/preview release/viewer/babylon.viewer.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/preview release/viewer/babylon.viewer.max.js


+ 5 - 22
dist/preview release/viewer/babylon.viewer.module.d.ts

@@ -200,11 +200,11 @@ declare module 'babylonjs-viewer/viewer/defaultViewer' {
                 * Mainly used for help and errors
                 * @param subScreen the name of the subScreen. Those can be defined in the configuration object
                 */
-            showOverlayScreen(subScreen: string): Promise<Template> | Promise<string>;
+            showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
             /**
                 * Hide the overlay screen.
                 */
-            hideOverlayScreen(): Promise<Template> | Promise<string>;
+            hideOverlayScreen(): Promise<string> | Promise<Template>;
             /**
                 * show the viewer (in case it was hidden)
                 *
@@ -221,11 +221,11 @@ declare module 'babylonjs-viewer/viewer/defaultViewer' {
                 * Show the loading screen.
                 * The loading screen can be configured using the configuration object
                 */
-            showLoadingScreen(): Promise<Template> | Promise<string>;
+            showLoadingScreen(): Promise<string> | Promise<Template>;
             /**
                 * Hide the loading screen
                 */
-            hideLoadingScreen(): Promise<Template> | Promise<string>;
+            hideLoadingScreen(): Promise<string> | Promise<Template>;
             dispose(): void;
             protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
     }
@@ -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';