Browse Source

Merge pull request #8317 from BabylonJS/master

Nightly
mergify[bot] 5 years ago
parent
commit
fcc3698631
41 changed files with 1129 additions and 862 deletions
  1. 7 1
      Tools/Gulp/tasks/gulpTasks-libraries.js
  2. 49 34
      azure-pipelines.yml
  3. 52 46
      dist/preview release/babylon.d.ts
  4. 2 2
      dist/preview release/babylon.js
  5. 336 250
      dist/preview release/babylon.max.js
  6. 1 1
      dist/preview release/babylon.max.js.map
  7. 104 92
      dist/preview release/babylon.module.d.ts
  8. 52 46
      dist/preview release/documentation.d.ts
  9. 1 0
      dist/preview release/loaders/babylon.glTF2FileLoader.js
  10. 1 1
      dist/preview release/loaders/babylon.glTF2FileLoader.js.map
  11. 1 1
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  12. 1 0
      dist/preview release/loaders/babylon.glTFFileLoader.js
  13. 1 1
      dist/preview release/loaders/babylon.glTFFileLoader.js.map
  14. 1 1
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  15. 1 0
      dist/preview release/loaders/babylonjs.loaders.js
  16. 1 1
      dist/preview release/loaders/babylonjs.loaders.js.map
  17. 1 1
      dist/preview release/loaders/babylonjs.loaders.min.js
  18. 1 1
      dist/preview release/nodeEditor/babylon.nodeEditor.d.ts
  19. 5 5
      dist/preview release/nodeEditor/babylon.nodeEditor.js
  20. 11 3
      dist/preview release/nodeEditor/babylon.nodeEditor.max.js
  21. 1 1
      dist/preview release/nodeEditor/babylon.nodeEditor.max.js.map
  22. 2 2
      dist/preview release/nodeEditor/babylon.nodeEditor.module.d.ts
  23. 1 1
      dist/preview release/packagesSizeBaseLine.json
  24. 94 92
      dist/preview release/viewer/babylon.module.d.ts
  25. 5 5
      dist/preview release/viewer/babylon.viewer.js
  26. 1 1
      dist/preview release/viewer/babylon.viewer.max.js
  27. 1 0
      dist/preview release/what's new.md
  28. 1 0
      loaders/src/glTF/2.0/glTFLoader.ts
  29. 0 3
      nodeEditor/src/components/propertyTab/propertyTabComponent.tsx
  30. 10 1
      nodeEditor/src/graphEditor.tsx
  31. 28 0
      src/Cameras/targetCamera.ts
  32. 1 1
      src/Culling/ray.ts
  33. 1 1
      src/Maths/math.plane.ts
  34. 303 214
      src/Maths/math.vector.ts
  35. 1 1
      src/Meshes/instancedMesh.ts
  36. 17 20
      src/Meshes/transformNode.ts
  37. 1 1
      src/Particles/particleSystem.ts
  38. 2 2
      src/Shaders/pbr.fragment.fx
  39. 4 2
      src/XR/features/WebXRAnchorSystem.ts
  40. 3 3
      src/XR/webXRCamera.ts
  41. 23 24
      tests/unit/babylon/src/Physics/babylon.physicsComponents.tests.ts

+ 7 - 1
Tools/Gulp/tasks/gulpTasks-libraries.js

@@ -214,4 +214,10 @@ gulp.task("core-workers", buildExternalLibraries(config["core"], true));
 /**
  * Build all libs.
  */
-gulp.task("typescript-libraries", gulp.series(config.modules, config.viewerModules));
+gulp.task("typescript-libraries", gulp.series(config.modules));
+
+
+/**
+ * Build viewer libs temp until fix.
+ */
+gulp.task("typescript-viewer-libraries", gulp.series(["typescript-libraries"], config.viewerModules));

+ 49 - 34
azure-pipelines.yml

@@ -174,37 +174,52 @@ jobs:
       testRunner: JUnit
       testResultsFiles: '.temp/testResults/ModuleTestsWebpack.xml'
 
-- job: ViewerTests
-  displayName: '8. Viewer Tests'
-  pool:
-    vmImage: 'Ubuntu-16.04'
-    demands: npm
-  steps:
-  - task: Npm@1
-    displayName: 'npm install'
-    inputs:
-      workingDir: Tools/Gulp
-      verbose: false
-  - script: 'gulp typescript-all --max-old-space-size=8192'
-    workingDirectory: Tools/Gulp
-    displayName: 'Typescript all'
-  - script: 'gulp tests-viewer-unit --max-old-space-size=8192'
-    workingDirectory: Tools/Gulp
-    displayName: 'Unit Tests'
-  - task: PublishTestResults@2
-    condition: succeededOrFailed()
-    inputs:
-      testRunner: JUnit
-      testResultsFiles: '.temp/testResults/ViewerUnitTests.xml'
-  - script: |
-      export DISPLAY=:99
-      Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
-      sleep 3 # give xvfb some time to start
-      gulp tests-viewer-validation-virtualscreen --max-old-space-size=8192
-    workingDirectory: Tools/Gulp
-    displayName: 'Visual Tests'
-  - task: PublishTestResults@2
-    condition: succeededOrFailed()
-    inputs:
-      testRunner: JUnit
-      testResultsFiles: '.temp/testResults/ViewerValidationTests.xml'
+# - job: ViewerBuild
+#   displayName: '8. Viewer Build'
+#   pool:
+#     vmImage: 'Ubuntu-16.04'
+#     demands: npm
+#   steps:
+#   - task: Npm@1
+#     displayName: 'npm install'
+#     inputs:
+#       workingDir: Tools/Gulp
+#       verbose: false
+#   - script: 'gulp typescript-viewer-libraries --max-old-space-size=8192'
+#     workingDirectory: Tools/Gulp
+#     displayName: 'Typescript all'
+
+# - job: ViewerTests
+#   displayName: '9. Viewer Tests'
+#   pool:
+#     vmImage: 'Ubuntu-16.04'
+#     demands: npm
+#   steps:
+#   - task: Npm@1
+#     displayName: 'npm install'
+#     inputs:
+#       workingDir: Tools/Gulp
+#       verbose: false
+#   - script: 'gulp typescript-viewer-libraries --max-old-space-size=8192'
+#     workingDirectory: Tools/Gulp
+#     displayName: 'Typescript all'
+#   - script: 'gulp tests-viewer-unit --max-old-space-size=8192'
+#     workingDirectory: Tools/Gulp
+#     displayName: 'Unit Tests'
+#   - task: PublishTestResults@2
+#     condition: succeededOrFailed()
+#     inputs:
+#       testRunner: JUnit
+#       testResultsFiles: '.temp/testResults/ViewerUnitTests.xml'
+#   - script: |
+#       export DISPLAY=:99
+#       Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
+#       sleep 3 # give xvfb some time to start
+#       gulp tests-viewer-validation-virtualscreen --max-old-space-size=8192
+#     workingDirectory: Tools/Gulp
+#     displayName: 'Visual Tests'
+#   - task: PublishTestResults@2
+#     condition: succeededOrFailed()
+#     inputs:
+#       testRunner: JUnit
+#       testResultsFiles: '.temp/testResults/ViewerValidationTests.xml'

+ 52 - 46
dist/preview release/babylon.d.ts

@@ -2008,7 +2008,7 @@ declare module BABYLON {
          * @returns a new Plane the normal vector to this plane at the given origin point.
          * Note : the vector "normal" is updated because normalized.
          */
-        static FromPositionAndNormal(origin: DeepImmutable<Vector3>, normal: DeepImmutable<Vector3>): Plane;
+        static FromPositionAndNormal(origin: DeepImmutable<Vector3>, normal: Vector3): Plane;
         /**
          * Calculates the distance from a plane and a point
          * @param origin origin of the plane to be constructed
@@ -2408,39 +2408,32 @@ declare module BABYLON {
      * Reminder: js uses a left handed forward facing system
      */
     export class Vector3 {
-        /**
-         * Defines the first coordinates (on X axis)
-         */
-        x: number;
-        /**
-         * Defines the second coordinates (on Y axis)
-         */
-        y: number;
-        /**
-         * Defines the third coordinates (on Z axis)
-         */
-        z: number;
         private static _UpReadOnly;
         private static _ZeroReadOnly;
+        /** @hidden */
+        _x: number;
+        /** @hidden */
+        _y: number;
+        /** @hidden */
+        _z: number;
+        /** @hidden */
+        _isDirty: boolean;
+        /** Gets or sets the x coordinate */
+        get x(): number;
+        set x(value: number);
+        /** Gets or sets the y coordinate */
+        get y(): number;
+        set y(value: number);
+        /** Gets or sets the z coordinate */
+        get z(): number;
+        set z(value: number);
         /**
          * Creates a new Vector3 object from the given x, y, z (floats) coordinates.
          * @param x defines the first coordinates (on X axis)
          * @param y defines the second coordinates (on Y axis)
          * @param z defines the third coordinates (on Z axis)
          */
-        constructor(
-        /**
-         * Defines the first coordinates (on X axis)
-         */
-        x?: number, 
-        /**
-         * Defines the second coordinates (on Y axis)
-         */
-        y?: number, 
-        /**
-         * Defines the third coordinates (on Z axis)
-         */
-        z?: number);
+        constructor(x?: number, y?: number, z?: number);
         /**
          * Creates a string representation of the Vector3
          * @returns a string with the Vector3 coordinates.
@@ -2769,7 +2762,7 @@ declare module BABYLON {
          * @param reference define the Vector3 to update
          * @returns the updated Vector3
          */
-        normalizeToRef(reference: DeepImmutable<Vector3>): Vector3;
+        normalizeToRef(reference: Vector3): Vector3;
         /**
          * Creates a new Vector3 copied from the current Vector3
          * @returns the new Vector3
@@ -3045,7 +3038,7 @@ declare module BABYLON {
          * @param right defines the right operand
          * @param result defines the Vector3 where to store the result
          */
-        static CrossToRef(left: Vector3, right: Vector3, result: Vector3): void;
+        static CrossToRef(left: DeepImmutable<Vector3>, right: DeepImmutable<Vector3>, result: Vector3): void;
         /**
          * Returns a new Vector3 as the normalization of the given vector
          * @param vector defines the Vector3 to normalize
@@ -3600,14 +3593,28 @@ declare module BABYLON {
      * @see http://doc.babylonjs.com/features/position,_rotation,_scaling
      */
     export class Quaternion {
-        /** defines the first component (0 by default) */
-        x: number;
-        /** defines the second component (0 by default) */
-        y: number;
-        /** defines the third component (0 by default) */
-        z: number;
-        /** defines the fourth component (1.0 by default) */
-        w: number;
+        /** @hidden */
+        _x: number;
+        /** @hidden */
+        _y: number;
+        /** @hidden */
+        _z: number;
+        /** @hidden */
+        _w: number;
+        /** @hidden */
+        _isDirty: boolean;
+        /** Gets or sets the x coordinate */
+        get x(): number;
+        set x(value: number);
+        /** Gets or sets the y coordinate */
+        get y(): number;
+        set y(value: number);
+        /** Gets or sets the z coordinate */
+        get z(): number;
+        set z(value: number);
+        /** Gets or sets the w coordinate */
+        get w(): number;
+        set w(value: number);
         /**
          * Creates a new Quaternion from the given floats
          * @param x defines the first component (0 by default)
@@ -3615,15 +3622,7 @@ declare module BABYLON {
          * @param z defines the third component (0 by default)
          * @param w defines the fourth component (1.0 by default)
          */
-        constructor(
-        /** defines the first component (0 by default) */
-        x?: number, 
-        /** defines the second component (0 by default) */
-        y?: number, 
-        /** defines the third component (0 by default) */
-        z?: number, 
-        /** defines the fourth component (1.0 by default) */
-        w?: number);
+        constructor(x?: number, y?: number, z?: number, w?: number);
         /**
          * Gets a string representation for the current quaternion
          * @returns a string with the Quaternion coordinates
@@ -10465,7 +10464,7 @@ declare module BABYLON {
         * @param world a matrix to transform the ray to. Default is the identity matrix.
         * @returns the new ray
         */
-        static CreateNewFromTo(origin: DeepImmutable<Vector3>, end: DeepImmutable<Vector3>, world?: DeepImmutable<Matrix>): Ray;
+        static CreateNewFromTo(origin: Vector3, end: Vector3, world?: DeepImmutable<Matrix>): Ray;
         /**
          * Transforms a ray by a matrix
          * @param ray ray to transform
@@ -14542,6 +14541,9 @@ declare module BABYLON {
          * Object will rotate to face the camera's position instead of orientation
          */
         static BILLBOARDMODE_USE_POSITION: number;
+        private static _TmpRotation;
+        private static _TmpScaling;
+        private static _TmpTranslation;
         private _forward;
         private _forwardInverted;
         private _up;
@@ -18192,6 +18194,8 @@ declare module BABYLON {
         private static _RigCamTransformMatrix;
         private static _TargetTransformMatrix;
         private static _TargetFocalPoint;
+        private _tmpUpVector;
+        private _tmpTargetVector;
         /**
          * Define the current direction the camera is moving to
          */
@@ -18200,6 +18204,8 @@ declare module BABYLON {
          * Define the current rotation the camera is rotating to
          */
         cameraRotation: Vector2;
+        /** Gets or sets a boolean indicating that the scaling of the parent hierarchy will not be taken in account by the camera */
+        ignoreParentScaling: boolean;
         /**
          * When set, the up vector of the camera will be updated by the rotation of the camera
          */

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


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


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


+ 104 - 92
dist/preview release/babylon.module.d.ts

@@ -2040,7 +2040,7 @@ declare module "babylonjs/Maths/math.plane" {
          * @returns a new Plane the normal vector to this plane at the given origin point.
          * Note : the vector "normal" is updated because normalized.
          */
-        static FromPositionAndNormal(origin: DeepImmutable<Vector3>, normal: DeepImmutable<Vector3>): Plane;
+        static FromPositionAndNormal(origin: DeepImmutable<Vector3>, normal: Vector3): Plane;
         /**
          * Calculates the distance from a plane and a point
          * @param origin origin of the plane to be constructed
@@ -2444,39 +2444,32 @@ declare module "babylonjs/Maths/math.vector" {
      * Reminder: js uses a left handed forward facing system
      */
     export class Vector3 {
-        /**
-         * Defines the first coordinates (on X axis)
-         */
-        x: number;
-        /**
-         * Defines the second coordinates (on Y axis)
-         */
-        y: number;
-        /**
-         * Defines the third coordinates (on Z axis)
-         */
-        z: number;
         private static _UpReadOnly;
         private static _ZeroReadOnly;
+        /** @hidden */
+        _x: number;
+        /** @hidden */
+        _y: number;
+        /** @hidden */
+        _z: number;
+        /** @hidden */
+        _isDirty: boolean;
+        /** Gets or sets the x coordinate */
+        get x(): number;
+        set x(value: number);
+        /** Gets or sets the y coordinate */
+        get y(): number;
+        set y(value: number);
+        /** Gets or sets the z coordinate */
+        get z(): number;
+        set z(value: number);
         /**
          * Creates a new Vector3 object from the given x, y, z (floats) coordinates.
          * @param x defines the first coordinates (on X axis)
          * @param y defines the second coordinates (on Y axis)
          * @param z defines the third coordinates (on Z axis)
          */
-        constructor(
-        /**
-         * Defines the first coordinates (on X axis)
-         */
-        x?: number, 
-        /**
-         * Defines the second coordinates (on Y axis)
-         */
-        y?: number, 
-        /**
-         * Defines the third coordinates (on Z axis)
-         */
-        z?: number);
+        constructor(x?: number, y?: number, z?: number);
         /**
          * Creates a string representation of the Vector3
          * @returns a string with the Vector3 coordinates.
@@ -2805,7 +2798,7 @@ declare module "babylonjs/Maths/math.vector" {
          * @param reference define the Vector3 to update
          * @returns the updated Vector3
          */
-        normalizeToRef(reference: DeepImmutable<Vector3>): Vector3;
+        normalizeToRef(reference: Vector3): Vector3;
         /**
          * Creates a new Vector3 copied from the current Vector3
          * @returns the new Vector3
@@ -3081,7 +3074,7 @@ declare module "babylonjs/Maths/math.vector" {
          * @param right defines the right operand
          * @param result defines the Vector3 where to store the result
          */
-        static CrossToRef(left: Vector3, right: Vector3, result: Vector3): void;
+        static CrossToRef(left: DeepImmutable<Vector3>, right: DeepImmutable<Vector3>, result: Vector3): void;
         /**
          * Returns a new Vector3 as the normalization of the given vector
          * @param vector defines the Vector3 to normalize
@@ -3636,14 +3629,28 @@ declare module "babylonjs/Maths/math.vector" {
      * @see http://doc.babylonjs.com/features/position,_rotation,_scaling
      */
     export class Quaternion {
-        /** defines the first component (0 by default) */
-        x: number;
-        /** defines the second component (0 by default) */
-        y: number;
-        /** defines the third component (0 by default) */
-        z: number;
-        /** defines the fourth component (1.0 by default) */
-        w: number;
+        /** @hidden */
+        _x: number;
+        /** @hidden */
+        _y: number;
+        /** @hidden */
+        _z: number;
+        /** @hidden */
+        _w: number;
+        /** @hidden */
+        _isDirty: boolean;
+        /** Gets or sets the x coordinate */
+        get x(): number;
+        set x(value: number);
+        /** Gets or sets the y coordinate */
+        get y(): number;
+        set y(value: number);
+        /** Gets or sets the z coordinate */
+        get z(): number;
+        set z(value: number);
+        /** Gets or sets the w coordinate */
+        get w(): number;
+        set w(value: number);
         /**
          * Creates a new Quaternion from the given floats
          * @param x defines the first component (0 by default)
@@ -3651,15 +3658,7 @@ declare module "babylonjs/Maths/math.vector" {
          * @param z defines the third component (0 by default)
          * @param w defines the fourth component (1.0 by default)
          */
-        constructor(
-        /** defines the first component (0 by default) */
-        x?: number, 
-        /** defines the second component (0 by default) */
-        y?: number, 
-        /** defines the third component (0 by default) */
-        z?: number, 
-        /** defines the fourth component (1.0 by default) */
-        w?: number);
+        constructor(x?: number, y?: number, z?: number, w?: number);
         /**
          * Gets a string representation for the current quaternion
          * @returns a string with the Quaternion coordinates
@@ -10653,7 +10652,7 @@ declare module "babylonjs/Culling/ray" {
         * @param world a matrix to transform the ray to. Default is the identity matrix.
         * @returns the new ray
         */
-        static CreateNewFromTo(origin: DeepImmutable<Vector3>, end: DeepImmutable<Vector3>, world?: DeepImmutable<Matrix>): Ray;
+        static CreateNewFromTo(origin: Vector3, end: Vector3, world?: DeepImmutable<Matrix>): Ray;
         /**
          * Transforms a ray by a matrix
          * @param ray ray to transform
@@ -14916,6 +14915,9 @@ declare module "babylonjs/Meshes/transformNode" {
          * Object will rotate to face the camera's position instead of orientation
          */
         static BILLBOARDMODE_USE_POSITION: number;
+        private static _TmpRotation;
+        private static _TmpScaling;
+        private static _TmpTranslation;
         private _forward;
         private _forwardInverted;
         private _up;
@@ -18712,6 +18714,8 @@ declare module "babylonjs/Cameras/targetCamera" {
         private static _RigCamTransformMatrix;
         private static _TargetTransformMatrix;
         private static _TargetFocalPoint;
+        private _tmpUpVector;
+        private _tmpTargetVector;
         /**
          * Define the current direction the camera is moving to
          */
@@ -18720,6 +18724,8 @@ declare module "babylonjs/Cameras/targetCamera" {
          * Define the current rotation the camera is rotating to
          */
         cameraRotation: Vector2;
+        /** Gets or sets a boolean indicating that the scaling of the parent hierarchy will not be taken in account by the camera */
+        ignoreParentScaling: boolean;
         /**
          * When set, the up vector of the camera will be updated by the rotation of the camera
          */
@@ -79727,7 +79733,7 @@ declare module BABYLON {
          * @returns a new Plane the normal vector to this plane at the given origin point.
          * Note : the vector "normal" is updated because normalized.
          */
-        static FromPositionAndNormal(origin: DeepImmutable<Vector3>, normal: DeepImmutable<Vector3>): Plane;
+        static FromPositionAndNormal(origin: DeepImmutable<Vector3>, normal: Vector3): Plane;
         /**
          * Calculates the distance from a plane and a point
          * @param origin origin of the plane to be constructed
@@ -80127,39 +80133,32 @@ declare module BABYLON {
      * Reminder: js uses a left handed forward facing system
      */
     export class Vector3 {
-        /**
-         * Defines the first coordinates (on X axis)
-         */
-        x: number;
-        /**
-         * Defines the second coordinates (on Y axis)
-         */
-        y: number;
-        /**
-         * Defines the third coordinates (on Z axis)
-         */
-        z: number;
         private static _UpReadOnly;
         private static _ZeroReadOnly;
+        /** @hidden */
+        _x: number;
+        /** @hidden */
+        _y: number;
+        /** @hidden */
+        _z: number;
+        /** @hidden */
+        _isDirty: boolean;
+        /** Gets or sets the x coordinate */
+        get x(): number;
+        set x(value: number);
+        /** Gets or sets the y coordinate */
+        get y(): number;
+        set y(value: number);
+        /** Gets or sets the z coordinate */
+        get z(): number;
+        set z(value: number);
         /**
          * Creates a new Vector3 object from the given x, y, z (floats) coordinates.
          * @param x defines the first coordinates (on X axis)
          * @param y defines the second coordinates (on Y axis)
          * @param z defines the third coordinates (on Z axis)
          */
-        constructor(
-        /**
-         * Defines the first coordinates (on X axis)
-         */
-        x?: number, 
-        /**
-         * Defines the second coordinates (on Y axis)
-         */
-        y?: number, 
-        /**
-         * Defines the third coordinates (on Z axis)
-         */
-        z?: number);
+        constructor(x?: number, y?: number, z?: number);
         /**
          * Creates a string representation of the Vector3
          * @returns a string with the Vector3 coordinates.
@@ -80488,7 +80487,7 @@ declare module BABYLON {
          * @param reference define the Vector3 to update
          * @returns the updated Vector3
          */
-        normalizeToRef(reference: DeepImmutable<Vector3>): Vector3;
+        normalizeToRef(reference: Vector3): Vector3;
         /**
          * Creates a new Vector3 copied from the current Vector3
          * @returns the new Vector3
@@ -80764,7 +80763,7 @@ declare module BABYLON {
          * @param right defines the right operand
          * @param result defines the Vector3 where to store the result
          */
-        static CrossToRef(left: Vector3, right: Vector3, result: Vector3): void;
+        static CrossToRef(left: DeepImmutable<Vector3>, right: DeepImmutable<Vector3>, result: Vector3): void;
         /**
          * Returns a new Vector3 as the normalization of the given vector
          * @param vector defines the Vector3 to normalize
@@ -81319,14 +81318,28 @@ declare module BABYLON {
      * @see http://doc.babylonjs.com/features/position,_rotation,_scaling
      */
     export class Quaternion {
-        /** defines the first component (0 by default) */
-        x: number;
-        /** defines the second component (0 by default) */
-        y: number;
-        /** defines the third component (0 by default) */
-        z: number;
-        /** defines the fourth component (1.0 by default) */
-        w: number;
+        /** @hidden */
+        _x: number;
+        /** @hidden */
+        _y: number;
+        /** @hidden */
+        _z: number;
+        /** @hidden */
+        _w: number;
+        /** @hidden */
+        _isDirty: boolean;
+        /** Gets or sets the x coordinate */
+        get x(): number;
+        set x(value: number);
+        /** Gets or sets the y coordinate */
+        get y(): number;
+        set y(value: number);
+        /** Gets or sets the z coordinate */
+        get z(): number;
+        set z(value: number);
+        /** Gets or sets the w coordinate */
+        get w(): number;
+        set w(value: number);
         /**
          * Creates a new Quaternion from the given floats
          * @param x defines the first component (0 by default)
@@ -81334,15 +81347,7 @@ declare module BABYLON {
          * @param z defines the third component (0 by default)
          * @param w defines the fourth component (1.0 by default)
          */
-        constructor(
-        /** defines the first component (0 by default) */
-        x?: number, 
-        /** defines the second component (0 by default) */
-        y?: number, 
-        /** defines the third component (0 by default) */
-        z?: number, 
-        /** defines the fourth component (1.0 by default) */
-        w?: number);
+        constructor(x?: number, y?: number, z?: number, w?: number);
         /**
          * Gets a string representation for the current quaternion
          * @returns a string with the Quaternion coordinates
@@ -88184,7 +88189,7 @@ declare module BABYLON {
         * @param world a matrix to transform the ray to. Default is the identity matrix.
         * @returns the new ray
         */
-        static CreateNewFromTo(origin: DeepImmutable<Vector3>, end: DeepImmutable<Vector3>, world?: DeepImmutable<Matrix>): Ray;
+        static CreateNewFromTo(origin: Vector3, end: Vector3, world?: DeepImmutable<Matrix>): Ray;
         /**
          * Transforms a ray by a matrix
          * @param ray ray to transform
@@ -92261,6 +92266,9 @@ declare module BABYLON {
          * Object will rotate to face the camera's position instead of orientation
          */
         static BILLBOARDMODE_USE_POSITION: number;
+        private static _TmpRotation;
+        private static _TmpScaling;
+        private static _TmpTranslation;
         private _forward;
         private _forwardInverted;
         private _up;
@@ -95911,6 +95919,8 @@ declare module BABYLON {
         private static _RigCamTransformMatrix;
         private static _TargetTransformMatrix;
         private static _TargetFocalPoint;
+        private _tmpUpVector;
+        private _tmpTargetVector;
         /**
          * Define the current direction the camera is moving to
          */
@@ -95919,6 +95929,8 @@ declare module BABYLON {
          * Define the current rotation the camera is rotating to
          */
         cameraRotation: Vector2;
+        /** Gets or sets a boolean indicating that the scaling of the parent hierarchy will not be taken in account by the camera */
+        ignoreParentScaling: boolean;
         /**
          * When set, the up vector of the camera will be updated by the rotation of the camera
          */

+ 52 - 46
dist/preview release/documentation.d.ts

@@ -2008,7 +2008,7 @@ declare module BABYLON {
          * @returns a new Plane the normal vector to this plane at the given origin point.
          * Note : the vector "normal" is updated because normalized.
          */
-        static FromPositionAndNormal(origin: DeepImmutable<Vector3>, normal: DeepImmutable<Vector3>): Plane;
+        static FromPositionAndNormal(origin: DeepImmutable<Vector3>, normal: Vector3): Plane;
         /**
          * Calculates the distance from a plane and a point
          * @param origin origin of the plane to be constructed
@@ -2408,39 +2408,32 @@ declare module BABYLON {
      * Reminder: js uses a left handed forward facing system
      */
     export class Vector3 {
-        /**
-         * Defines the first coordinates (on X axis)
-         */
-        x: number;
-        /**
-         * Defines the second coordinates (on Y axis)
-         */
-        y: number;
-        /**
-         * Defines the third coordinates (on Z axis)
-         */
-        z: number;
         private static _UpReadOnly;
         private static _ZeroReadOnly;
+        /** @hidden */
+        _x: number;
+        /** @hidden */
+        _y: number;
+        /** @hidden */
+        _z: number;
+        /** @hidden */
+        _isDirty: boolean;
+        /** Gets or sets the x coordinate */
+        get x(): number;
+        set x(value: number);
+        /** Gets or sets the y coordinate */
+        get y(): number;
+        set y(value: number);
+        /** Gets or sets the z coordinate */
+        get z(): number;
+        set z(value: number);
         /**
          * Creates a new Vector3 object from the given x, y, z (floats) coordinates.
          * @param x defines the first coordinates (on X axis)
          * @param y defines the second coordinates (on Y axis)
          * @param z defines the third coordinates (on Z axis)
          */
-        constructor(
-        /**
-         * Defines the first coordinates (on X axis)
-         */
-        x?: number, 
-        /**
-         * Defines the second coordinates (on Y axis)
-         */
-        y?: number, 
-        /**
-         * Defines the third coordinates (on Z axis)
-         */
-        z?: number);
+        constructor(x?: number, y?: number, z?: number);
         /**
          * Creates a string representation of the Vector3
          * @returns a string with the Vector3 coordinates.
@@ -2769,7 +2762,7 @@ declare module BABYLON {
          * @param reference define the Vector3 to update
          * @returns the updated Vector3
          */
-        normalizeToRef(reference: DeepImmutable<Vector3>): Vector3;
+        normalizeToRef(reference: Vector3): Vector3;
         /**
          * Creates a new Vector3 copied from the current Vector3
          * @returns the new Vector3
@@ -3045,7 +3038,7 @@ declare module BABYLON {
          * @param right defines the right operand
          * @param result defines the Vector3 where to store the result
          */
-        static CrossToRef(left: Vector3, right: Vector3, result: Vector3): void;
+        static CrossToRef(left: DeepImmutable<Vector3>, right: DeepImmutable<Vector3>, result: Vector3): void;
         /**
          * Returns a new Vector3 as the normalization of the given vector
          * @param vector defines the Vector3 to normalize
@@ -3600,14 +3593,28 @@ declare module BABYLON {
      * @see http://doc.babylonjs.com/features/position,_rotation,_scaling
      */
     export class Quaternion {
-        /** defines the first component (0 by default) */
-        x: number;
-        /** defines the second component (0 by default) */
-        y: number;
-        /** defines the third component (0 by default) */
-        z: number;
-        /** defines the fourth component (1.0 by default) */
-        w: number;
+        /** @hidden */
+        _x: number;
+        /** @hidden */
+        _y: number;
+        /** @hidden */
+        _z: number;
+        /** @hidden */
+        _w: number;
+        /** @hidden */
+        _isDirty: boolean;
+        /** Gets or sets the x coordinate */
+        get x(): number;
+        set x(value: number);
+        /** Gets or sets the y coordinate */
+        get y(): number;
+        set y(value: number);
+        /** Gets or sets the z coordinate */
+        get z(): number;
+        set z(value: number);
+        /** Gets or sets the w coordinate */
+        get w(): number;
+        set w(value: number);
         /**
          * Creates a new Quaternion from the given floats
          * @param x defines the first component (0 by default)
@@ -3615,15 +3622,7 @@ declare module BABYLON {
          * @param z defines the third component (0 by default)
          * @param w defines the fourth component (1.0 by default)
          */
-        constructor(
-        /** defines the first component (0 by default) */
-        x?: number, 
-        /** defines the second component (0 by default) */
-        y?: number, 
-        /** defines the third component (0 by default) */
-        z?: number, 
-        /** defines the fourth component (1.0 by default) */
-        w?: number);
+        constructor(x?: number, y?: number, z?: number, w?: number);
         /**
          * Gets a string representation for the current quaternion
          * @returns a string with the Quaternion coordinates
@@ -10465,7 +10464,7 @@ declare module BABYLON {
         * @param world a matrix to transform the ray to. Default is the identity matrix.
         * @returns the new ray
         */
-        static CreateNewFromTo(origin: DeepImmutable<Vector3>, end: DeepImmutable<Vector3>, world?: DeepImmutable<Matrix>): Ray;
+        static CreateNewFromTo(origin: Vector3, end: Vector3, world?: DeepImmutable<Matrix>): Ray;
         /**
          * Transforms a ray by a matrix
          * @param ray ray to transform
@@ -14542,6 +14541,9 @@ declare module BABYLON {
          * Object will rotate to face the camera's position instead of orientation
          */
         static BILLBOARDMODE_USE_POSITION: number;
+        private static _TmpRotation;
+        private static _TmpScaling;
+        private static _TmpTranslation;
         private _forward;
         private _forwardInverted;
         private _up;
@@ -18192,6 +18194,8 @@ declare module BABYLON {
         private static _RigCamTransformMatrix;
         private static _TargetTransformMatrix;
         private static _TargetFocalPoint;
+        private _tmpUpVector;
+        private _tmpTargetVector;
         /**
          * Define the current direction the camera is moving to
          */
@@ -18200,6 +18204,8 @@ declare module BABYLON {
          * Define the current rotation the camera is rotating to
          */
         cameraRotation: Vector2;
+        /** Gets or sets a boolean indicating that the scaling of the parent hierarchy will not be taken in account by the camera */
+        ignoreParentScaling: boolean;
         /**
          * When set, the up vector of the camera will be updated by the rotation of the camera
          */

+ 1 - 0
dist/preview release/loaders/babylon.glTF2FileLoader.js

@@ -3319,6 +3319,7 @@ var GLTFLoader = /** @class */ (function () {
         this._babylonScene._blockEntityCollection = this._forAssetContainer;
         var babylonCamera = new babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["FreeCamera"](camera.name || "camera" + camera.index, babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["Vector3"].Zero(), this._babylonScene, false);
         this._babylonScene._blockEntityCollection = false;
+        babylonCamera.ignoreParentScaling = true;
         babylonCamera.rotation = new babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["Vector3"](0, Math.PI, 0);
         switch (camera.type) {
             case "perspective" /* PERSPECTIVE */: {

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


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


+ 1 - 0
dist/preview release/loaders/babylon.glTFFileLoader.js

@@ -5899,6 +5899,7 @@ var GLTFLoader = /** @class */ (function () {
         this._babylonScene._blockEntityCollection = this._forAssetContainer;
         var babylonCamera = new babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["FreeCamera"](camera.name || "camera" + camera.index, babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["Vector3"].Zero(), this._babylonScene, false);
         this._babylonScene._blockEntityCollection = false;
+        babylonCamera.ignoreParentScaling = true;
         babylonCamera.rotation = new babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["Vector3"](0, Math.PI, 0);
         switch (camera.type) {
             case "perspective" /* PERSPECTIVE */: {

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


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


+ 1 - 0
dist/preview release/loaders/babylonjs.loaders.js

@@ -7279,6 +7279,7 @@ var GLTFLoader = /** @class */ (function () {
         this._babylonScene._blockEntityCollection = this._forAssetContainer;
         var babylonCamera = new babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["FreeCamera"](camera.name || "camera" + camera.index, babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["Vector3"].Zero(), this._babylonScene, false);
         this._babylonScene._blockEntityCollection = false;
+        babylonCamera.ignoreParentScaling = true;
         babylonCamera.rotation = new babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__["Vector3"](0, Math.PI, 0);
         switch (camera.type) {
             case "perspective" /* PERSPECTIVE */: {

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


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


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

@@ -1479,7 +1479,7 @@ declare module NODEEDITOR {
         componentWillUnmount(): void;
         constructor(props: IGraphEditorProps);
         reconnectNewNodes(nodeIndex: number, newNodes: GraphNode[], sourceNodes: GraphNode[], done: boolean[]): void;
-        pasteSelection(copiedNodes: GraphNode[], currentX: number, currentY: number, selectNew?: boolean): void;
+        pasteSelection(copiedNodes: GraphNode[], currentX: number, currentY: number, selectNew?: boolean): GraphNode[] | undefined;
         zoomToFit(): void;
         buildMaterial(): void;
         build(): void;

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


+ 11 - 3
dist/preview release/nodeEditor/babylon.nodeEditor.max.js

@@ -61748,8 +61748,7 @@ var PropertyTabComponent = /** @class */ (function (_super) {
                     this.props.globalState.customSave &&
                         react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_buttonLineComponent__WEBPACK_IMPORTED_MODULE_2__["ButtonLineComponent"], { label: this.props.globalState.customSave.label, onClick: function () {
                                 _this.customSave();
-                            } })),
-                react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_lineContainerComponent__WEBPACK_IMPORTED_MODULE_3__["LineContainerComponent"], { title: "FRAME" },
+                            } }),
                     react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_fileButtonLineComponent__WEBPACK_IMPORTED_MODULE_5__["FileButtonLineComponent"], { label: "Load Frame", uploadName: 'frame-upload', onClick: function (file) { return _this.loadFrame(file); }, accept: ".json" })),
                 !this.props.globalState.customSave &&
                     react__WEBPACK_IMPORTED_MODULE_1__["createElement"](_sharedComponents_lineContainerComponent__WEBPACK_IMPORTED_MODULE_3__["LineContainerComponent"], { title: "SNIPPET" },
@@ -66995,7 +66994,15 @@ var GraphEditor = /** @class */ (function (_super) {
                     if (_this._copiedFrame.nodes.length) {
                         currentX_1 = newFrame.x + _this._copiedFrame.nodes[0].x - _this._copiedFrame.x;
                         currentY = newFrame.y + _this._copiedFrame.nodes[0].y - _this._copiedFrame.y;
-                        _this.pasteSelection(_this._copiedFrame.nodes, currentX_1, currentY);
+                        _this._graphCanvas._frameIsMoving = true;
+                        var newNodes = _this.pasteSelection(_this._copiedFrame.nodes, currentX_1, currentY);
+                        if (newNodes) {
+                            for (var _a = 0, newNodes_1 = newNodes; _a < newNodes_1.length; _a++) {
+                                var node = newNodes_1[_a];
+                                newFrame.syncNode(node);
+                            }
+                        }
+                        _this._graphCanvas._frameIsMoving = false;
                     }
                     if (_this._copiedFrame.isCollapsed) {
                         newFrame.isCollapsed = true;
@@ -67156,6 +67163,7 @@ var GraphEditor = /** @class */ (function (_super) {
         for (var index = 0; index < newNodes.length; index++) {
             this.reconnectNewNodes(index, newNodes, copiedNodes, done);
         }
+        return newNodes;
     };
     GraphEditor.prototype.zoomToFit = function () {
         this._graphCanvas.zoomToFit();

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


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

@@ -1794,7 +1794,7 @@ declare module "babylonjs-node-editor/graphEditor" {
         componentWillUnmount(): void;
         constructor(props: IGraphEditorProps);
         reconnectNewNodes(nodeIndex: number, newNodes: GraphNode[], sourceNodes: GraphNode[], done: boolean[]): void;
-        pasteSelection(copiedNodes: GraphNode[], currentX: number, currentY: number, selectNew?: boolean): void;
+        pasteSelection(copiedNodes: GraphNode[], currentX: number, currentY: number, selectNew?: boolean): GraphNode[] | undefined;
         zoomToFit(): void;
         buildMaterial(): void;
         build(): void;
@@ -3342,7 +3342,7 @@ declare module NODEEDITOR {
         componentWillUnmount(): void;
         constructor(props: IGraphEditorProps);
         reconnectNewNodes(nodeIndex: number, newNodes: GraphNode[], sourceNodes: GraphNode[], done: boolean[]): void;
-        pasteSelection(copiedNodes: GraphNode[], currentX: number, currentY: number, selectNew?: boolean): void;
+        pasteSelection(copiedNodes: GraphNode[], currentX: number, currentY: number, selectNew?: boolean): GraphNode[] | undefined;
         zoomToFit(): void;
         buildMaterial(): void;
         build(): void;

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

@@ -1 +1 @@
-{"thinEngineOnly":116078,"engineOnly":152481,"sceneOnly":512691,"minGridMaterial":648842,"minStandardMaterial":797399}
+{"thinEngineOnly":116078,"engineOnly":152481,"sceneOnly":514196,"minGridMaterial":651032,"minStandardMaterial":799589}

+ 94 - 92
dist/preview release/viewer/babylon.module.d.ts

@@ -2040,7 +2040,7 @@ declare module "babylonjs/Maths/math.plane" {
          * @returns a new Plane the normal vector to this plane at the given origin point.
          * Note : the vector "normal" is updated because normalized.
          */
-        static FromPositionAndNormal(origin: DeepImmutable<Vector3>, normal: DeepImmutable<Vector3>): Plane;
+        static FromPositionAndNormal(origin: DeepImmutable<Vector3>, normal: Vector3): Plane;
         /**
          * Calculates the distance from a plane and a point
          * @param origin origin of the plane to be constructed
@@ -2444,39 +2444,32 @@ declare module "babylonjs/Maths/math.vector" {
      * Reminder: js uses a left handed forward facing system
      */
     export class Vector3 {
-        /**
-         * Defines the first coordinates (on X axis)
-         */
-        x: number;
-        /**
-         * Defines the second coordinates (on Y axis)
-         */
-        y: number;
-        /**
-         * Defines the third coordinates (on Z axis)
-         */
-        z: number;
         private static _UpReadOnly;
         private static _ZeroReadOnly;
+        /** @hidden */
+        _x: number;
+        /** @hidden */
+        _y: number;
+        /** @hidden */
+        _z: number;
+        /** @hidden */
+        _isDirty: boolean;
+        /** Gets or sets the x coordinate */
+        get x(): number;
+        set x(value: number);
+        /** Gets or sets the y coordinate */
+        get y(): number;
+        set y(value: number);
+        /** Gets or sets the z coordinate */
+        get z(): number;
+        set z(value: number);
         /**
          * Creates a new Vector3 object from the given x, y, z (floats) coordinates.
          * @param x defines the first coordinates (on X axis)
          * @param y defines the second coordinates (on Y axis)
          * @param z defines the third coordinates (on Z axis)
          */
-        constructor(
-        /**
-         * Defines the first coordinates (on X axis)
-         */
-        x?: number, 
-        /**
-         * Defines the second coordinates (on Y axis)
-         */
-        y?: number, 
-        /**
-         * Defines the third coordinates (on Z axis)
-         */
-        z?: number);
+        constructor(x?: number, y?: number, z?: number);
         /**
          * Creates a string representation of the Vector3
          * @returns a string with the Vector3 coordinates.
@@ -2805,7 +2798,7 @@ declare module "babylonjs/Maths/math.vector" {
          * @param reference define the Vector3 to update
          * @returns the updated Vector3
          */
-        normalizeToRef(reference: DeepImmutable<Vector3>): Vector3;
+        normalizeToRef(reference: Vector3): Vector3;
         /**
          * Creates a new Vector3 copied from the current Vector3
          * @returns the new Vector3
@@ -3081,7 +3074,7 @@ declare module "babylonjs/Maths/math.vector" {
          * @param right defines the right operand
          * @param result defines the Vector3 where to store the result
          */
-        static CrossToRef(left: Vector3, right: Vector3, result: Vector3): void;
+        static CrossToRef(left: DeepImmutable<Vector3>, right: DeepImmutable<Vector3>, result: Vector3): void;
         /**
          * Returns a new Vector3 as the normalization of the given vector
          * @param vector defines the Vector3 to normalize
@@ -3636,14 +3629,28 @@ declare module "babylonjs/Maths/math.vector" {
      * @see http://doc.babylonjs.com/features/position,_rotation,_scaling
      */
     export class Quaternion {
-        /** defines the first component (0 by default) */
-        x: number;
-        /** defines the second component (0 by default) */
-        y: number;
-        /** defines the third component (0 by default) */
-        z: number;
-        /** defines the fourth component (1.0 by default) */
-        w: number;
+        /** @hidden */
+        _x: number;
+        /** @hidden */
+        _y: number;
+        /** @hidden */
+        _z: number;
+        /** @hidden */
+        _w: number;
+        /** @hidden */
+        _isDirty: boolean;
+        /** Gets or sets the x coordinate */
+        get x(): number;
+        set x(value: number);
+        /** Gets or sets the y coordinate */
+        get y(): number;
+        set y(value: number);
+        /** Gets or sets the z coordinate */
+        get z(): number;
+        set z(value: number);
+        /** Gets or sets the w coordinate */
+        get w(): number;
+        set w(value: number);
         /**
          * Creates a new Quaternion from the given floats
          * @param x defines the first component (0 by default)
@@ -3651,15 +3658,7 @@ declare module "babylonjs/Maths/math.vector" {
          * @param z defines the third component (0 by default)
          * @param w defines the fourth component (1.0 by default)
          */
-        constructor(
-        /** defines the first component (0 by default) */
-        x?: number, 
-        /** defines the second component (0 by default) */
-        y?: number, 
-        /** defines the third component (0 by default) */
-        z?: number, 
-        /** defines the fourth component (1.0 by default) */
-        w?: number);
+        constructor(x?: number, y?: number, z?: number, w?: number);
         /**
          * Gets a string representation for the current quaternion
          * @returns a string with the Quaternion coordinates
@@ -10653,7 +10652,7 @@ declare module "babylonjs/Culling/ray" {
         * @param world a matrix to transform the ray to. Default is the identity matrix.
         * @returns the new ray
         */
-        static CreateNewFromTo(origin: DeepImmutable<Vector3>, end: DeepImmutable<Vector3>, world?: DeepImmutable<Matrix>): Ray;
+        static CreateNewFromTo(origin: Vector3, end: Vector3, world?: DeepImmutable<Matrix>): Ray;
         /**
          * Transforms a ray by a matrix
          * @param ray ray to transform
@@ -14921,6 +14920,8 @@ declare module "babylonjs/Meshes/transformNode" {
         private _up;
         private _right;
         private _rightInverted;
+        private _tmpRotation;
+        private _tmpScaling;
         private _position;
         private _rotation;
         private _rotationQuaternion;
@@ -79727,7 +79728,7 @@ declare module BABYLON {
          * @returns a new Plane the normal vector to this plane at the given origin point.
          * Note : the vector "normal" is updated because normalized.
          */
-        static FromPositionAndNormal(origin: DeepImmutable<Vector3>, normal: DeepImmutable<Vector3>): Plane;
+        static FromPositionAndNormal(origin: DeepImmutable<Vector3>, normal: Vector3): Plane;
         /**
          * Calculates the distance from a plane and a point
          * @param origin origin of the plane to be constructed
@@ -80127,39 +80128,32 @@ declare module BABYLON {
      * Reminder: js uses a left handed forward facing system
      */
     export class Vector3 {
-        /**
-         * Defines the first coordinates (on X axis)
-         */
-        x: number;
-        /**
-         * Defines the second coordinates (on Y axis)
-         */
-        y: number;
-        /**
-         * Defines the third coordinates (on Z axis)
-         */
-        z: number;
         private static _UpReadOnly;
         private static _ZeroReadOnly;
+        /** @hidden */
+        _x: number;
+        /** @hidden */
+        _y: number;
+        /** @hidden */
+        _z: number;
+        /** @hidden */
+        _isDirty: boolean;
+        /** Gets or sets the x coordinate */
+        get x(): number;
+        set x(value: number);
+        /** Gets or sets the y coordinate */
+        get y(): number;
+        set y(value: number);
+        /** Gets or sets the z coordinate */
+        get z(): number;
+        set z(value: number);
         /**
          * Creates a new Vector3 object from the given x, y, z (floats) coordinates.
          * @param x defines the first coordinates (on X axis)
          * @param y defines the second coordinates (on Y axis)
          * @param z defines the third coordinates (on Z axis)
          */
-        constructor(
-        /**
-         * Defines the first coordinates (on X axis)
-         */
-        x?: number, 
-        /**
-         * Defines the second coordinates (on Y axis)
-         */
-        y?: number, 
-        /**
-         * Defines the third coordinates (on Z axis)
-         */
-        z?: number);
+        constructor(x?: number, y?: number, z?: number);
         /**
          * Creates a string representation of the Vector3
          * @returns a string with the Vector3 coordinates.
@@ -80488,7 +80482,7 @@ declare module BABYLON {
          * @param reference define the Vector3 to update
          * @returns the updated Vector3
          */
-        normalizeToRef(reference: DeepImmutable<Vector3>): Vector3;
+        normalizeToRef(reference: Vector3): Vector3;
         /**
          * Creates a new Vector3 copied from the current Vector3
          * @returns the new Vector3
@@ -80764,7 +80758,7 @@ declare module BABYLON {
          * @param right defines the right operand
          * @param result defines the Vector3 where to store the result
          */
-        static CrossToRef(left: Vector3, right: Vector3, result: Vector3): void;
+        static CrossToRef(left: DeepImmutable<Vector3>, right: DeepImmutable<Vector3>, result: Vector3): void;
         /**
          * Returns a new Vector3 as the normalization of the given vector
          * @param vector defines the Vector3 to normalize
@@ -81319,14 +81313,28 @@ declare module BABYLON {
      * @see http://doc.babylonjs.com/features/position,_rotation,_scaling
      */
     export class Quaternion {
-        /** defines the first component (0 by default) */
-        x: number;
-        /** defines the second component (0 by default) */
-        y: number;
-        /** defines the third component (0 by default) */
-        z: number;
-        /** defines the fourth component (1.0 by default) */
-        w: number;
+        /** @hidden */
+        _x: number;
+        /** @hidden */
+        _y: number;
+        /** @hidden */
+        _z: number;
+        /** @hidden */
+        _w: number;
+        /** @hidden */
+        _isDirty: boolean;
+        /** Gets or sets the x coordinate */
+        get x(): number;
+        set x(value: number);
+        /** Gets or sets the y coordinate */
+        get y(): number;
+        set y(value: number);
+        /** Gets or sets the z coordinate */
+        get z(): number;
+        set z(value: number);
+        /** Gets or sets the w coordinate */
+        get w(): number;
+        set w(value: number);
         /**
          * Creates a new Quaternion from the given floats
          * @param x defines the first component (0 by default)
@@ -81334,15 +81342,7 @@ declare module BABYLON {
          * @param z defines the third component (0 by default)
          * @param w defines the fourth component (1.0 by default)
          */
-        constructor(
-        /** defines the first component (0 by default) */
-        x?: number, 
-        /** defines the second component (0 by default) */
-        y?: number, 
-        /** defines the third component (0 by default) */
-        z?: number, 
-        /** defines the fourth component (1.0 by default) */
-        w?: number);
+        constructor(x?: number, y?: number, z?: number, w?: number);
         /**
          * Gets a string representation for the current quaternion
          * @returns a string with the Quaternion coordinates
@@ -88184,7 +88184,7 @@ declare module BABYLON {
         * @param world a matrix to transform the ray to. Default is the identity matrix.
         * @returns the new ray
         */
-        static CreateNewFromTo(origin: DeepImmutable<Vector3>, end: DeepImmutable<Vector3>, world?: DeepImmutable<Matrix>): Ray;
+        static CreateNewFromTo(origin: Vector3, end: Vector3, world?: DeepImmutable<Matrix>): Ray;
         /**
          * Transforms a ray by a matrix
          * @param ray ray to transform
@@ -92266,6 +92266,8 @@ declare module BABYLON {
         private _up;
         private _right;
         private _rightInverted;
+        private _tmpRotation;
+        private _tmpScaling;
         private _position;
         private _rotation;
         private _rotationQuaternion;

File diff suppressed because it is too large
+ 5 - 5
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


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

@@ -30,6 +30,7 @@
 
 ### Engine
 
+- Improved world matrix caching engine by using dirty mechanism on vector3 and quaternion ([Deltakosh](https://github.com/deltakosh))
 - Allow logging of shader code when a compilation error occurs ([Popov72](https://github.com/Popov72))
 - Add back support for selecting textures based on engine capabilities ([bghgary](https://github.com/bghgary))
 - Fix Draco decoder when running on IE11 ([bghgary](https://github.com/bghgary))

+ 1 - 0
loaders/src/glTF/2.0/glTFLoader.ts

@@ -1160,6 +1160,7 @@ export class GLTFLoader implements IGLTFLoader {
         this._babylonScene._blockEntityCollection = this._forAssetContainer;
         const babylonCamera = new FreeCamera(camera.name || `camera${camera.index}`, Vector3.Zero(), this._babylonScene, false);
         this._babylonScene._blockEntityCollection = false;
+        babylonCamera.ignoreParentScaling = true;
 
         babylonCamera.rotation = new Vector3(0, Math.PI, 0);
 

+ 0 - 3
nodeEditor/src/components/propertyTab/propertyTabComponent.tsx

@@ -419,9 +419,6 @@ export class PropertyTabComponent extends React.Component<IPropertyTabComponentP
                                 this.customSave();
                             }} />
                         }
-
-                    </LineContainerComponent>
-                    <LineContainerComponent title="FRAME">
                         <FileButtonLineComponent label="Load Frame" uploadName={'frame-upload'} onClick={(file) => this.loadFrame(file)} accept=".json" />
                     </LineContainerComponent>
                     {

+ 10 - 1
nodeEditor/src/graphEditor.tsx

@@ -258,7 +258,15 @@ export class GraphEditor extends React.Component<IGraphEditorProps, IGraphEditor
                     if (this._copiedFrame.nodes.length) {
                         currentX = newFrame.x + this._copiedFrame.nodes[0].x - this._copiedFrame.x;
                         currentY = newFrame.y + this._copiedFrame.nodes[0].y - this._copiedFrame.y;
-                        this.pasteSelection(this._copiedFrame.nodes, currentX, currentY);                  
+                        
+                        this._graphCanvas._frameIsMoving = true;
+                        let newNodes = this.pasteSelection(this._copiedFrame.nodes, currentX, currentY);       
+                        if (newNodes) {           
+                            for (var node of newNodes) {
+                                newFrame.syncNode(node);
+                            }
+                        }
+                        this._graphCanvas._frameIsMoving = false;
                     }
 
                     if (this._copiedFrame.isCollapsed) {
@@ -380,6 +388,7 @@ export class GraphEditor extends React.Component<IGraphEditorProps, IGraphEditor
             this.reconnectNewNodes(index, newNodes, copiedNodes, done);
         }
 
+        return newNodes;
     }
 
     zoomToFit() {

+ 28 - 0
src/Cameras/targetCamera.ts

@@ -15,6 +15,9 @@ export class TargetCamera extends Camera {
     private static _TargetTransformMatrix = new Matrix();
     private static _TargetFocalPoint = new Vector3();
 
+    private _tmpUpVector = Vector3.Zero();
+    private _tmpTargetVector = Vector3.Zero();
+
     /**
      * Define the current direction the camera is moving to
      */
@@ -23,6 +26,10 @@ export class TargetCamera extends Camera {
      * Define the current rotation the camera is rotating to
      */
     public cameraRotation = new Vector2(0, 0);
+
+    /** Gets or sets a boolean indicating that the scaling of the parent hierarchy will not be taken in account by the camera */
+    public ignoreParentScaling = false;
+
     /**
      * When set, the up vector of the camera will be updated by the rotation of the camera
      */
@@ -421,6 +428,27 @@ export class TargetCamera extends Camera {
     }
 
     protected _computeViewMatrix(position: Vector3, target: Vector3, up: Vector3): void {
+        if (this.ignoreParentScaling) {
+            if (this.parent) {
+                const parentWorldMatrix = this.parent.getWorldMatrix();
+                Vector3.TransformCoordinatesToRef(position, parentWorldMatrix, this._globalPosition);
+                Vector3.TransformCoordinatesToRef(target, parentWorldMatrix, this._tmpTargetVector);
+                Vector3.TransformNormalToRef(up, parentWorldMatrix, this._tmpUpVector);
+                this._markSyncedWithParent();
+            } else {
+                this._globalPosition.copyFrom(position);
+                this._tmpTargetVector.copyFrom(target);
+                this._tmpUpVector.copyFrom(up);
+            }
+
+            if (this.getScene().useRightHandedSystem) {
+                Matrix.LookAtRHToRef(this._globalPosition, this._tmpTargetVector, this._tmpUpVector, this._viewMatrix);
+            } else {
+                Matrix.LookAtLHToRef(this._globalPosition, this._tmpTargetVector, this._tmpUpVector, this._viewMatrix);
+            }
+            return;
+        }
+
         if (this.getScene().useRightHandedSystem) {
             Matrix.LookAtRHToRef(position, target, up, this._viewMatrix);
         } else {

+ 1 - 1
src/Culling/ray.ts

@@ -491,7 +491,7 @@ export class Ray {
     * @param world a matrix to transform the ray to. Default is the identity matrix.
     * @returns the new ray
     */
-    public static CreateNewFromTo(origin: DeepImmutable<Vector3>, end: DeepImmutable<Vector3>, world: DeepImmutable<Matrix> = Matrix.IdentityReadOnly): Ray {
+    public static CreateNewFromTo(origin: Vector3, end: Vector3, world: DeepImmutable<Matrix> = Matrix.IdentityReadOnly): Ray {
         var direction = end.subtract(origin);
         var length = Math.sqrt((direction.x * direction.x) + (direction.y * direction.y) + (direction.z * direction.z));
         direction.normalize();

+ 1 - 1
src/Maths/math.plane.ts

@@ -186,7 +186,7 @@ export class Plane {
      * @returns a new Plane the normal vector to this plane at the given origin point.
      * Note : the vector "normal" is updated because normalized.
      */
-    static FromPositionAndNormal(origin: DeepImmutable<Vector3>, normal: DeepImmutable<Vector3>): Plane {
+    static FromPositionAndNormal(origin: DeepImmutable<Vector3>, normal: Vector3): Plane {
         var result = new Plane(0.0, 0.0, 0.0, 0.0);
         normal.normalize();
         result.normal = normal;

File diff suppressed because it is too large
+ 303 - 214
src/Maths/math.vector.ts


+ 1 - 1
src/Meshes/instancedMesh.ts

@@ -427,7 +427,7 @@ export class InstancedMesh extends AbstractMesh {
             "sourceMesh", "isAnInstance", "facetNb", "isFacetDataEnabled",
             "isBlocked", "useBones", "hasInstances", "collider", "edgesRenderer",
             "forward", "up", "right", "absolutePosition", "absoluteScaling", "absoluteRotationQuaternion",
-            "isWorldMatrixFrozen", "nonUniformScaling", "behaviors", "worldMatrixFromCache"
+            "isWorldMatrixFrozen", "nonUniformScaling", "behaviors", "worldMatrixFromCache", "hasThinInstances"
         ], []);
 
         // Bounding info

+ 17 - 20
src/Meshes/transformNode.ts

@@ -41,6 +41,10 @@ export class TransformNode extends Node {
      */
     public static BILLBOARDMODE_USE_POSITION = 128;
 
+    private static _TmpRotation = Quaternion.Zero();
+    private static _TmpScaling = Vector3.Zero();
+    private static _TmpTranslation = Vector3.Zero();
+
     private _forward = new Vector3(0, 0, 1);
     private _forwardInverted = new Vector3(0, 0, -1);
     private _up = new Vector3(0, 1, 0);
@@ -308,19 +312,15 @@ export class TransformNode extends Node {
             return false;
         }
 
-        if (!cache.position.equals(this._position)) {
+        if (this.position._isDirty) {
             return false;
         }
 
-        if (this._rotationQuaternion) {
-            if (!cache.rotationQuaternion.equals(this._rotationQuaternion)) {
-                return false;
-            }
-        } else if (!cache.rotation.equals(this._rotation)) {
+        if (this.scaling._isDirty) {
             return false;
         }
 
-        if (!cache.scaling.equals(this._scaling)) {
+        if (this._rotationQuaternion && this._rotationQuaternion._isDirty || this.rotation._isDirty) {
             return false;
         }
 
@@ -333,10 +333,6 @@ export class TransformNode extends Node {
 
         let cache = this._cache;
         cache.localMatrixUpdated = false;
-        cache.position = Vector3.Zero();
-        cache.scaling = Vector3.Zero();
-        cache.rotation = Vector3.Zero();
-        cache.rotationQuaternion = new Quaternion(0, 0, 0, 0);
         cache.billboardMode = -1;
         cache.infiniteDistance = false;
     }
@@ -1009,11 +1005,14 @@ export class TransformNode extends Node {
         this._currentRenderId = currentRenderId;
         this._childUpdateId++;
         this._isDirty = false;
+        this._position._isDirty = false;
+        this._rotation._isDirty = false;
+        this._scaling._isDirty = false;
         let parent = this._getEffectiveParent();
 
         // Scaling
-        let scaling: Vector3 = cache.scaling;
-        let translation: Vector3 = cache.position;
+        let scaling: Vector3 = TransformNode._TmpScaling;
+        let translation: Vector3 = this._position;
 
         // Translation
         if (this._infiniteDistance) {
@@ -1021,20 +1020,19 @@ export class TransformNode extends Node {
                 var cameraWorldMatrix = camera.getWorldMatrix();
                 var cameraGlobalPosition = new Vector3(cameraWorldMatrix.m[12], cameraWorldMatrix.m[13], cameraWorldMatrix.m[14]);
 
+                translation = TransformNode._TmpTranslation;
                 translation.copyFromFloats(this._position.x + cameraGlobalPosition.x, this._position.y + cameraGlobalPosition.y, this._position.z + cameraGlobalPosition.z);
-            } else {
-                translation.copyFrom(this._position);
             }
-        } else {
-            translation.copyFrom(this._position);
         }
 
         // Scaling
         scaling.copyFromFloats(this._scaling.x * this.scalingDeterminant, this._scaling.y * this.scalingDeterminant, this._scaling.z * this.scalingDeterminant);
 
         // Rotation
-        let rotation: Quaternion = cache.rotationQuaternion;
+        let rotation: Quaternion;
         if (this._rotationQuaternion) {
+            this._rotationQuaternion._isDirty = false;
+            rotation = this._rotationQuaternion;
             if (this.reIntegrateRotationIntoRotationQuaternion) {
                 var len = this.rotation.lengthSquared();
                 if (len) {
@@ -1042,10 +1040,9 @@ export class TransformNode extends Node {
                     this._rotation.copyFromFloats(0, 0, 0);
                 }
             }
-            rotation.copyFrom(this._rotationQuaternion);
         } else {
+            rotation = TransformNode._TmpRotation;
             Quaternion.RotationYawPitchRollToRef(this._rotation.y, this._rotation.x, this._rotation.z, rotation);
-            cache.rotation.copyFrom(this._rotation);
         }
 
         // Compose

+ 1 - 1
src/Particles/particleSystem.ts

@@ -2090,7 +2090,7 @@ export class ParticleSystem extends BaseParticleSystem implements IDisposable, I
                 ctx.drawImage((<unknown>this.particleTexture as DynamicTexture).getContext().canvas, 0, 0);
                 (<unknown>result.particleTexture as DynamicTexture).update();
             } else {
-                result.particleTexture = new Texture(this.particleTexture.url, this._scene);
+                result.particleTexture = new Texture(this.particleTexture.url || this.particleTexture.name, this._scene);
             }
         }
 

+ 2 - 2
src/Shaders/pbr.fragment.fx

@@ -49,6 +49,8 @@ precision highp float;
     #include<reflectionFunction>
 #endif
 
+#define CUSTOM_FRAGMENT_DEFINITIONS
+
 #include<pbrBlockAlbedoOpacity>
 #include<pbrBlockReflectivity>
 #include<pbrBlockAmbientOcclusion>
@@ -59,8 +61,6 @@ precision highp float;
 #include<pbrBlockClearcoat>
 #include<pbrBlockSubSurface>
 
-#define CUSTOM_FRAGMENT_DEFINITIONS
-
 // _____________________________ MAIN FUNCTION ____________________________
 void main(void) {
 

+ 4 - 2
src/XR/features/WebXRAnchorSystem.ts

@@ -152,7 +152,8 @@ export class WebXRAnchorSystem extends WebXRAbstractFeature {
         // convert to XR space (right handed) if needed
         this._populateTmpTransformation(position, rotationQuaternion);
         // the matrix that we'll use
-        const m = new XRRigidTransform({...this._tmpVector}, {...this._tmpQuaternion});
+        const m = new XRRigidTransform({x: this._tmpVector.x, y: this._tmpVector.y, z: this._tmpVector.z},
+                                       {x: this._tmpQuaternion.x, y: this._tmpQuaternion.y, z: this._tmpQuaternion.z, w: this._tmpQuaternion.w});
         if (!hitTestResult.xrHitResult.createAnchor) {
             throw new Error('Anchors not enabled in this browsed. Add "anchors" to optional features');
         } else {
@@ -181,7 +182,8 @@ export class WebXRAnchorSystem extends WebXRAbstractFeature {
         // convert to XR space (right handed) if needed
         this._populateTmpTransformation(position, rotationQuaternion);
         // the matrix that we'll use
-        const xrTransformation = new XRRigidTransform({...this._tmpVector}, {...this._tmpQuaternion});
+        const xrTransformation = new XRRigidTransform({x: this._tmpVector.x, y: this._tmpVector.y, z: this._tmpVector.z},
+                                                      {x: this._tmpQuaternion.x, y: this._tmpQuaternion.y, z: this._tmpQuaternion.z, w: this._tmpQuaternion.w});
         if (forceCreateInCurrentFrame && this.attached && this._xrSessionManager.currentFrame) {
             return this._createAnchorAtTransformation(xrTransformation, this._xrSessionManager.currentFrame);
         } else {

+ 3 - 3
src/XR/webXRCamera.ts

@@ -275,8 +275,8 @@ export class WebXRCamera extends FreeCamera {
             this._xrInvPositionCache.y = 0;
         }
         const transform = new XRRigidTransform(
-            { ...this._xrInvPositionCache },
-            { ...this._xrInvQuaternionCache });
+            { x: this._xrInvPositionCache.x, y: this._xrInvPositionCache.y, z: this._xrInvPositionCache.z },
+            { x: this._xrInvQuaternionCache.x, y: this._xrInvQuaternionCache.y, z: this._xrInvQuaternionCache.z, w: this._xrInvQuaternionCache.w });
         // Update offset reference to use a new originOffset with the teleported
         // player position and orientation.
         // This new offset needs to be applied to the base ref space.
@@ -297,7 +297,7 @@ export class WebXRCamera extends FreeCamera {
             pos.negateInPlace();
 
             const transform2 = new XRRigidTransform(
-                { ...pos });
+                {  x: pos.x, y: pos.y, z: pos.z  });
             // Update offset reference to use a new originOffset with the teleported
             // player position and orientation.
             // This new offset needs to be applied to the base ref space.

+ 23 - 24
tests/unit/babylon/src/Physics/babylon.physicsComponents.tests.ts

@@ -149,7 +149,7 @@ describe('Babylon physicsComponents', () => {
     // now test 'applyImpulse' which is an injected property of AbstractMesh
     describe('applyImpulse should move a mesh', function() {
 
-        it('should move if an impulse is applied', function() {
+        it('if an impulse is applied', function() {
 
             scene.enablePhysics(noGravityVector, physicsPlugin);   // NO gravity
             let getGravity = scene.getPhysicsEngine().gravity;
@@ -158,28 +158,28 @@ describe('Babylon physicsComponents', () => {
             let sphere = BABYLON.MeshBuilder.CreateSphere("mySphere", { diameter: 1 }, scene);  // use MeshBuilder instead of Mesh
             sphere.physicsImpostor = new BABYLON.PhysicsImpostor(sphere, BABYLON.PhysicsImpostor.SphereImpostor, { mass: 1, restitution: 0.9 }, scene);
 
-            let getPosition = sphere.position;
-            expect(getPosition).to.deep.equal(BABYLON.Vector3.Zero());
+            let getPosition = sphere.position.asArray();
+            expect(getPosition).to.deep.equal([0, 0, 0]);
 
-            let linearVelocity = sphere.physicsImpostor.getLinearVelocity();
-            expect(linearVelocity).to.deep.equal(BABYLON.Vector3.Zero());
+            let linearVelocity = sphere.physicsImpostor.getLinearVelocity().asArray();
+            expect(linearVelocity).to.deep.equal([0, 0, 0]);
 
-            let angularVelocity = sphere.physicsImpostor.getAngularVelocity();
-            expect(linearVelocity).to.deep.equal(BABYLON.Vector3.Zero());
+            let angularVelocity = sphere.physicsImpostor.getAngularVelocity().asArray();
+            expect(linearVelocity).to.deep.equal([0, 0, 0]);
 
             //////////////////////////////`/////////////////////
             // so far, so good.  let's run the physics engine.  nothing should change.
 
             scene.animate();
 
-            getPosition = sphere.position;
-            expect(getPosition).to.deep.equal(BABYLON.Vector3.Zero());
+            getPosition = sphere.position.asArray();
+            expect(getPosition).to.deep.equal([0, 0, 0]);
 
-            linearVelocity = sphere.physicsImpostor.getLinearVelocity();
-            expect(linearVelocity).to.deep.equal(BABYLON.Vector3.Zero());
+            linearVelocity = sphere.physicsImpostor.getLinearVelocity().asArray();
+            expect(linearVelocity).to.deep.equal([0, 0, 0]);
 
-            angularVelocity = sphere.physicsImpostor.getAngularVelocity();
-            expect(linearVelocity).to.deep.equal(BABYLON.Vector3.Zero());
+            angularVelocity = sphere.physicsImpostor.getAngularVelocity().asArray();
+            expect(linearVelocity).to.deep.equal([0, 0, 0]);
 
             ///////////////////////////////////////////////////
             // now give an impulse, and run the physics engine again.  the sphere should start moving.
@@ -189,20 +189,19 @@ describe('Babylon physicsComponents', () => {
             sphere.applyImpulse(force, contact);  // give the sphere its kick
             scene.animate();   // and run the physics engine
 
-            getPosition = sphere.position;
-            expect(getPosition.x).to.be.greaterThan(0);   // moved about 0.01, I'm clueless how that was calculated
-            expect(getPosition.y).to.be.equal(0);
-            expect(getPosition.z).to.be.equal(0);
+            var getPosition2 = sphere.position;
+            expect(getPosition2.x).to.be.greaterThan(0);   // moved about 0.01, I'm clueless how that was calculated
+            expect(getPosition2.y).to.be.equal(0);
+            expect(getPosition2.z).to.be.equal(0);
 
-            linearVelocity = sphere.physicsImpostor.getLinearVelocity();
-            expect(linearVelocity.x).to.be.closeTo(10, 0.001);      // mass of 1, whack of 10, sounds right
-            expect(linearVelocity.y).to.be.equal(0);
-            expect(linearVelocity.z).to.be.equal(0);
+            var linearVelocity2 = sphere.physicsImpostor.getLinearVelocity();
+            expect(linearVelocity2.x).to.be.closeTo(10, 0.001);      // mass of 1, whack of 10, sounds right
+            expect(linearVelocity2.y).to.be.equal(0);
+            expect(linearVelocity2.z).to.be.equal(0);
 
             // we whacked it right along the axis, so don't expect any angular velocity
-            angularVelocity = sphere.physicsImpostor.getAngularVelocity()
-            console.log(angularVelocity);
-            expect(angularVelocity).to.deep.equal(BABYLON.Vector3.Zero());
+            var angularVelocity2 = sphere.physicsImpostor.getAngularVelocity()
+            expect(angularVelocity2.asArray()).to.deep.equal([0, 0, 0]);
 
         });
     });