David Catuhe 6 years ago
parent
commit
54fe7112e4

+ 1 - 0
Playground/babylon.d.txt

@@ -7371,6 +7371,7 @@ declare module BABYLON {
         private _pivotMatrixInverse;
         private _pivotMatrixInverse;
         protected _postMultiplyPivotMatrix: boolean;
         protected _postMultiplyPivotMatrix: boolean;
         private _tempMatrix;
         private _tempMatrix;
+        private _tempMatrix2;
         protected _isWorldMatrixFrozen: boolean;
         protected _isWorldMatrixFrozen: boolean;
         /** @hidden */
indexInSceneTransformNodesArray: number;
         /** @hidden */
indexInSceneTransformNodesArray: number;
         /**
         /**

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

@@ -7454,6 +7454,7 @@ declare module BABYLON {
         private _pivotMatrixInverse;
         private _pivotMatrixInverse;
         protected _postMultiplyPivotMatrix: boolean;
         protected _postMultiplyPivotMatrix: boolean;
         private _tempMatrix;
         private _tempMatrix;
+        private _tempMatrix2;
         protected _isWorldMatrixFrozen: boolean;
         protected _isWorldMatrixFrozen: boolean;
         /** @hidden */
         /** @hidden */
         _indexInSceneTransformNodesArray: number;
         _indexInSceneTransformNodesArray: number;

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


+ 13 - 11
dist/preview release/babylon.max.js

@@ -96325,6 +96325,7 @@ var TransformNode = /** @class */ (function (_super) {
         _this._pivotMatrix = _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Matrix"].Identity();
         _this._pivotMatrix = _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Matrix"].Identity();
         _this._postMultiplyPivotMatrix = false;
         _this._postMultiplyPivotMatrix = false;
         _this._tempMatrix = _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Matrix"].Identity();
         _this._tempMatrix = _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Matrix"].Identity();
+        _this._tempMatrix2 = _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Matrix"].Identity();
         _this._isWorldMatrixFrozen = false;
         _this._isWorldMatrixFrozen = false;
         /** @hidden */
         /** @hidden */
         _this._indexInSceneTransformNodesArray = -1;
         _this._indexInSceneTransformNodesArray = -1;
@@ -97068,10 +97069,10 @@ var TransformNode = /** @class */ (function (_super) {
         if (this.infiniteDistance && !this.parent && camera) {
         if (this.infiniteDistance && !this.parent && camera) {
             var cameraWorldMatrix = camera.getWorldMatrix();
             var cameraWorldMatrix = camera.getWorldMatrix();
             var cameraGlobalPosition = new _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Vector3"](cameraWorldMatrix.m[12], cameraWorldMatrix.m[13], cameraWorldMatrix.m[14]);
             var cameraGlobalPosition = new _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Vector3"](cameraWorldMatrix.m[12], cameraWorldMatrix.m[13], cameraWorldMatrix.m[14]);
-            _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Matrix"].TranslationToRef(this.position.x + cameraGlobalPosition.x, this.position.y + cameraGlobalPosition.y, this.position.z + cameraGlobalPosition.z, _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[2]);
+            _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Matrix"].TranslationToRef(this.position.x + cameraGlobalPosition.x, this.position.y + cameraGlobalPosition.y, this.position.z + cameraGlobalPosition.z, this._tempMatrix2);
         }
         }
         else {
         else {
-            _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Matrix"].TranslationToRef(this.position.x, this.position.y, this.position.z, _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[2]);
+            _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Matrix"].TranslationToRef(this.position.x, this.position.y, this.position.z, this._tempMatrix2);
         }
         }
         // Composing transformations
         // Composing transformations
         this._pivotMatrix.multiplyToRef(_Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[1], _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[4]);
         this._pivotMatrix.multiplyToRef(_Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[1], _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[4]);
@@ -97111,29 +97112,30 @@ var TransformNode = /** @class */ (function (_super) {
                 _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[1].setTranslationFromFloats(0, 0, 0);
                 _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[1].setTranslationFromFloats(0, 0, 0);
                 _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[1].invertToRef(_Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[0]);
                 _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[1].invertToRef(_Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[0]);
             }
             }
-            _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[1].copyFrom(this._tempMatrix);
-            _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[1].multiplyToRef(_Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[0], this._tempMatrix);
+            this._tempMatrix.multiplyToRef(_Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[0], this._tempMatrix);
         }
         }
         // Post multiply inverse of pivotMatrix
         // Post multiply inverse of pivotMatrix
         if (this._postMultiplyPivotMatrix) {
         if (this._postMultiplyPivotMatrix) {
             this._tempMatrix.multiplyToRef(this._pivotMatrixInverse, this._tempMatrix);
             this._tempMatrix.multiplyToRef(this._pivotMatrixInverse, this._tempMatrix);
         }
         }
         // Local world
         // Local world
-        this._tempMatrix.multiplyToRef(_Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[2], this._localMatrix);
+        this._tempMatrix.multiplyToRef(this._tempMatrix2, this._localMatrix);
         // Parent
         // Parent
         if (this.parent && this.parent.getWorldMatrix) {
         if (this.parent && this.parent.getWorldMatrix) {
             if (this.billboardMode !== TransformNode.BILLBOARDMODE_NONE) {
             if (this.billboardMode !== TransformNode.BILLBOARDMODE_NONE) {
                 if (this._transformToBoneReferal) {
                 if (this._transformToBoneReferal) {
-                    this.parent.getWorldMatrix().multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[6]);
-                    _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[7].copyFrom(_Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[6]);
+                    this.parent.getWorldMatrix().multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[7]);
                 }
                 }
                 else {
                 else {
                     _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[7].copyFrom(this.parent.getWorldMatrix());
                     _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[7].copyFrom(this.parent.getWorldMatrix());
                 }
                 }
-                this._localMatrix.getTranslationToRef(_Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Vector3[5]);
-                _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Vector3"].TransformCoordinatesToRef(_Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Vector3[5], _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[7], _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Vector3[5]);
-                this._worldMatrix.copyFrom(this._localMatrix);
-                this._worldMatrix.setTranslation(_Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Vector3[5]);
+                // Extract scaling and translation from parent
+                var translation = _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Vector3[5];
+                var scale = _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Vector3[6];
+                _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[7].decompose(scale, undefined, translation);
+                _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Matrix"].ScalingToRef(scale.x, scale.y, scale.z, _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[7]);
+                _Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[7].setTranslation(translation);
+                this._localMatrix.multiplyToRef(_Maths_math__WEBPACK_IMPORTED_MODULE_3__["Tmp"].Matrix[7], this._worldMatrix);
             }
             }
             else {
             else {
                 if (this._transformToBoneReferal) {
                 if (this._transformToBoneReferal) {

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


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

@@ -7510,6 +7510,7 @@ declare module "babylonjs/Meshes/transformNode" {
         private _pivotMatrixInverse;
         private _pivotMatrixInverse;
         protected _postMultiplyPivotMatrix: boolean;
         protected _postMultiplyPivotMatrix: boolean;
         private _tempMatrix;
         private _tempMatrix;
+        private _tempMatrix2;
         protected _isWorldMatrixFrozen: boolean;
         protected _isWorldMatrixFrozen: boolean;
         /** @hidden */
         /** @hidden */
         _indexInSceneTransformNodesArray: number;
         _indexInSceneTransformNodesArray: number;
@@ -65157,6 +65158,7 @@ declare module BABYLON {
         private _pivotMatrixInverse;
         private _pivotMatrixInverse;
         protected _postMultiplyPivotMatrix: boolean;
         protected _postMultiplyPivotMatrix: boolean;
         private _tempMatrix;
         private _tempMatrix;
+        private _tempMatrix2;
         protected _isWorldMatrixFrozen: boolean;
         protected _isWorldMatrixFrozen: boolean;
         /** @hidden */
         /** @hidden */
         _indexInSceneTransformNodesArray: number;
         _indexInSceneTransformNodesArray: number;

+ 2 - 2
dist/preview release/gui/babylon.gui.js

@@ -1467,7 +1467,7 @@ var Button = /** @class */ (function (_super) {
     // While being a container, the button behaves like a control.
     // While being a container, the button behaves like a control.
     /** @hidden */
     /** @hidden */
     Button.prototype._processPicking = function (x, y, type, pointerId, buttonIndex) {
     Button.prototype._processPicking = function (x, y, type, pointerId, buttonIndex) {
-        if (!this.isHitTestVisible || !this.isVisible || this.notRenderable) {
+        if (!this._isEnabled || !this.isHitTestVisible || !this.isVisible || this.notRenderable) {
             return false;
             return false;
         }
         }
         if (!_super.prototype.contains.call(this, x, y)) {
         if (!_super.prototype.contains.call(this, x, y)) {
@@ -3596,7 +3596,7 @@ var Container = /** @class */ (function (_super) {
     };
     };
     /** @hidden */
     /** @hidden */
     Container.prototype._processPicking = function (x, y, type, pointerId, buttonIndex) {
     Container.prototype._processPicking = function (x, y, type, pointerId, buttonIndex) {
-        if (!this.isVisible || this.notRenderable) {
+        if (!this._isEnabled || !this.isVisible || this.notRenderable) {
             return false;
             return false;
         }
         }
         if (!_super.prototype.contains.call(this, x, y)) {
         if (!_super.prototype.contains.call(this, x, y)) {

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


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


+ 1 - 1
dist/preview release/packagesSizeBaseLine.json

@@ -1 +1 @@
-{"engineOnly":304368,"sceneOnly":505638,"minGridMaterial":626056,"minStandardMaterial":748975}
+{"engineOnly":304368,"sceneOnly":505607,"minGridMaterial":626025,"minStandardMaterial":748944}

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

@@ -7510,6 +7510,7 @@ declare module "babylonjs/Meshes/transformNode" {
         private _pivotMatrixInverse;
         private _pivotMatrixInverse;
         protected _postMultiplyPivotMatrix: boolean;
         protected _postMultiplyPivotMatrix: boolean;
         private _tempMatrix;
         private _tempMatrix;
+        private _tempMatrix2;
         protected _isWorldMatrixFrozen: boolean;
         protected _isWorldMatrixFrozen: boolean;
         /** @hidden */
         /** @hidden */
         _indexInSceneTransformNodesArray: number;
         _indexInSceneTransformNodesArray: number;
@@ -65157,6 +65158,7 @@ declare module BABYLON {
         private _pivotMatrixInverse;
         private _pivotMatrixInverse;
         protected _postMultiplyPivotMatrix: boolean;
         protected _postMultiplyPivotMatrix: boolean;
         private _tempMatrix;
         private _tempMatrix;
+        private _tempMatrix2;
         protected _isWorldMatrixFrozen: boolean;
         protected _isWorldMatrixFrozen: boolean;
         /** @hidden */
         /** @hidden */
         _indexInSceneTransformNodesArray: number;
         _indexInSceneTransformNodesArray: number;

+ 9 - 0
dist/preview release/viewer/babylon.viewer.d.ts

@@ -946,6 +946,15 @@ declare module BabylonViewer {
 }
 }
 declare module BabylonViewer {
 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): (sceneManager: SceneManager) => boolean;
+    export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
+}
+declare module BabylonViewer {
+    /**
         * Will attach an init function the the DOMContentLoaded event.
         * Will attach an init function the the DOMContentLoaded event.
         * The init function will be removed automatically after the event was triggered.
         * The init function will be removed automatically after the event was triggered.
         */
         */

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


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


+ 8 - 1
dist/preview release/viewer/babylon.viewer.module.d.ts

@@ -1030,7 +1030,14 @@ declare module 'babylonjs-viewer/templating/viewerTemplatePlugin' {
 }
 }
 
 
 declare module 'babylonjs-viewer/optimizer/custom' {
 declare module 'babylonjs-viewer/optimizer/custom' {
-    
+    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): (sceneManager: SceneManager) => boolean;
+    export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
 }
 }
 
 
 declare module 'babylonjs-viewer/initializer' {
 declare module 'babylonjs-viewer/initializer' {

+ 1 - 1
gui/src/2D/controls/button.ts

@@ -84,7 +84,7 @@ export class Button extends Rectangle {
     // While being a container, the button behaves like a control.
     // While being a container, the button behaves like a control.
     /** @hidden */
     /** @hidden */
     public _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean {
     public _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean {
-        if (!this.isHitTestVisible || !this.isVisible || this.notRenderable) {
+        if (!this._isEnabled || !this.isHitTestVisible || !this.isVisible || this.notRenderable) {
             return false;
             return false;
         }
         }
 
 

+ 1 - 1
gui/src/2D/controls/container.ts

@@ -405,7 +405,7 @@ export class Container extends Control {
 
 
     /** @hidden */
     /** @hidden */
     public _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean {
     public _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean {
-        if (!this.isVisible || this.notRenderable) {
+        if (!this._isEnabled || !this.isVisible || this.notRenderable) {
             return false;
             return false;
         }
         }
 
 

+ 1 - 1
src/Meshes/transformNode.ts

@@ -981,7 +981,7 @@ export class TransformNode extends Node {
                 Tmp.Matrix[7].decompose(scale, undefined, translation);
                 Tmp.Matrix[7].decompose(scale, undefined, translation);
                 Matrix.ScalingToRef(scale.x, scale.y, scale.z, Tmp.Matrix[7]);
                 Matrix.ScalingToRef(scale.x, scale.y, scale.z, Tmp.Matrix[7]);
                 Tmp.Matrix[7].setTranslation(translation);
                 Tmp.Matrix[7].setTranslation(translation);
-                
+
                 this._localMatrix.multiplyToRef(Tmp.Matrix[7], this._worldMatrix);
                 this._localMatrix.multiplyToRef(Tmp.Matrix[7], this._worldMatrix);
 
 
             } else {
             } else {