瀏覽代碼

Restore performance

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

文件差異過大導致無法顯示
+ 1781 - 1793
dist/preview release/babylon.d.ts


文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/babylon.js


+ 15 - 49
dist/preview release/babylon.max.js

@@ -17652,8 +17652,6 @@ var BABYLON;
             this._parentRenderId = -1;
             this._childRenderId = -1;
             /** @hidden */
-            this._worldMatrixWasUpdated = false;
-            /** @hidden */
             this._worldMatrix = BABYLON.Matrix.Zero();
             /** @hidden */
             this._worldMatrixDeterminant = 0;
@@ -17926,23 +17924,17 @@ var BABYLON;
             return this._parentNode.isSynchronized();
         };
         /** @hidden */
-        Node.prototype.isSynchronized = function (useWasUpdatedFlag) {
-            var check = this.hasNewParent();
-            if (!useWasUpdatedFlag) {
-                check = check || !this.isSynchronizedWithParent();
+        Node.prototype.isSynchronized = function () {
+            if (this._cache.parent != this._parentNode) {
+                this._cache.parent = this._parentNode;
+                return false;
             }
-            else if (this._parentNode) {
-                check = this._parentNode._worldMatrixWasUpdated;
+            if (this._parentNode) {
+                if (!this.isSynchronizedWithParent()) {
+                    return false;
+                }
             }
-            check = check || !this._isSynchronized();
-            return !check;
-        };
-        /** @hidden */
-        Node.prototype.hasNewParent = function () {
-            if (this._cache.parent === this._parentNode)
-                return false;
-            this._cache.parent = this._parentNode;
-            return true;
+            return this._isSynchronized();
         };
         /**
          * Is this node ready to be used/rendered
@@ -18162,10 +18154,9 @@ var BABYLON;
         /**
          * Computes the world matrix of the node
          * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
-         * @param useWasUpdatedFlag defines a reserved property
          * @returns the world matrix
          */
-        Node.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
+        Node.prototype.computeWorldMatrix = function (force) {
             if (!this._worldMatrix) {
                 this._worldMatrix = BABYLON.Matrix.Identity();
             }
@@ -19350,14 +19341,13 @@ var BABYLON;
         /**
          * Computes the world matrix of the node
          * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
-         * @param useWasUpdatedFlag defines a reserved property
          * @returns the world matrix
          */
-        TransformNode.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
+        TransformNode.prototype.computeWorldMatrix = function (force) {
             if (this._isWorldMatrixFrozen) {
                 return this._worldMatrix;
             }
-            if (!force && this.isSynchronized(useWasUpdatedFlag)) {
+            if (!force && this.isSynchronized()) {
                 this._currentRenderId = this.getScene().getRenderId();
                 return this._worldMatrix;
             }
@@ -19369,7 +19359,6 @@ var BABYLON;
             this._currentRenderId = this.getScene().getRenderId();
             this._childRenderId = this.getScene().getRenderId();
             this._isDirty = false;
-            this._worldMatrixWasUpdated = true;
             // Scaling
             BABYLON.Matrix.ScalingToRef(this.scaling.x * this.scalingDeterminant, this.scaling.y * this.scalingDeterminant, this.scaling.z * this.scalingDeterminant, BABYLON.Tmp.Matrix[1]);
             // Rotation
@@ -27493,26 +27482,6 @@ var BABYLON;
             this._activeMeshesFrozen = false;
             return this;
         };
-        Scene.prototype._computeAllWorldMatricesforBranch = function (node) {
-            node.computeWorldMatrix(false, true);
-            var children = node.getChildren();
-            if (children) {
-                for (var _i = 0, children_2 = children; _i < children_2.length; _i++) {
-                    var child = children_2[_i];
-                    this._computeAllWorldMatricesforBranch(child);
-                }
-            }
-            node._worldMatrixWasUpdated = false;
-        };
-        /**
-         * This function will traverse the scene graph and makes sure that all worldMatrix are up to date
-         */
-        Scene.prototype.computeAllWorldMatrices = function () {
-            for (var _i = 0, _a = this.rootNodes; _i < _a.length; _i++) {
-                var node = _a[_i];
-                this._computeAllWorldMatricesforBranch(node);
-            }
-        };
         Scene.prototype._evaluateActiveMeshes = function () {
             if (this._activeMeshesFrozen && this._activeMeshes.length) {
                 return;
@@ -27532,8 +27501,6 @@ var BABYLON;
                 var step = _a[_i];
                 step.action();
             }
-            // World matrices
-            this.computeAllWorldMatrices();
             // Determine mesh candidates
             var meshes = this.getActiveMeshCandidates();
             // Check each mesh
@@ -27547,6 +27514,7 @@ var BABYLON;
                 if (!mesh.isReady() || !mesh.isEnabled()) {
                     continue;
                 }
+                mesh.computeWorldMatrix();
                 // Intersections
                 if (mesh.actionManager && mesh.actionManager.hasSpecificTriggers2(BABYLON.ActionManager.OnIntersectionEnterTrigger, BABYLON.ActionManager.OnIntersectionExitTrigger)) {
                     this._meshesForIntersections.pushNoDuplicate(mesh);
@@ -48922,17 +48890,15 @@ var BABYLON;
         /**
          * Computes the world matrix of the node
          * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
-         * @param useWasUpdatedFlag defines a reserved property
          * @returns the world matrix
          */
-        ShadowLight.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
-            if (!force && this.isSynchronized(useWasUpdatedFlag)) {
+        ShadowLight.prototype.computeWorldMatrix = function (force) {
+            if (!force && this.isSynchronized()) {
                 this._currentRenderId = this.getScene().getRenderId();
                 return this._worldMatrix;
             }
             this._updateCache();
             this._cache.position.copyFrom(this.position);
-            this._worldMatrixWasUpdated = true;
             if (!this._worldMatrix) {
                 this._worldMatrix = BABYLON.Matrix.Identity();
             }

+ 15 - 49
dist/preview release/babylon.no-module.max.js

@@ -17619,8 +17619,6 @@ var BABYLON;
             this._parentRenderId = -1;
             this._childRenderId = -1;
             /** @hidden */
-            this._worldMatrixWasUpdated = false;
-            /** @hidden */
             this._worldMatrix = BABYLON.Matrix.Zero();
             /** @hidden */
             this._worldMatrixDeterminant = 0;
@@ -17893,23 +17891,17 @@ var BABYLON;
             return this._parentNode.isSynchronized();
         };
         /** @hidden */
-        Node.prototype.isSynchronized = function (useWasUpdatedFlag) {
-            var check = this.hasNewParent();
-            if (!useWasUpdatedFlag) {
-                check = check || !this.isSynchronizedWithParent();
+        Node.prototype.isSynchronized = function () {
+            if (this._cache.parent != this._parentNode) {
+                this._cache.parent = this._parentNode;
+                return false;
             }
-            else if (this._parentNode) {
-                check = this._parentNode._worldMatrixWasUpdated;
+            if (this._parentNode) {
+                if (!this.isSynchronizedWithParent()) {
+                    return false;
+                }
             }
-            check = check || !this._isSynchronized();
-            return !check;
-        };
-        /** @hidden */
-        Node.prototype.hasNewParent = function () {
-            if (this._cache.parent === this._parentNode)
-                return false;
-            this._cache.parent = this._parentNode;
-            return true;
+            return this._isSynchronized();
         };
         /**
          * Is this node ready to be used/rendered
@@ -18129,10 +18121,9 @@ var BABYLON;
         /**
          * Computes the world matrix of the node
          * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
-         * @param useWasUpdatedFlag defines a reserved property
          * @returns the world matrix
          */
-        Node.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
+        Node.prototype.computeWorldMatrix = function (force) {
             if (!this._worldMatrix) {
                 this._worldMatrix = BABYLON.Matrix.Identity();
             }
@@ -19317,14 +19308,13 @@ var BABYLON;
         /**
          * Computes the world matrix of the node
          * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
-         * @param useWasUpdatedFlag defines a reserved property
          * @returns the world matrix
          */
-        TransformNode.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
+        TransformNode.prototype.computeWorldMatrix = function (force) {
             if (this._isWorldMatrixFrozen) {
                 return this._worldMatrix;
             }
-            if (!force && this.isSynchronized(useWasUpdatedFlag)) {
+            if (!force && this.isSynchronized()) {
                 this._currentRenderId = this.getScene().getRenderId();
                 return this._worldMatrix;
             }
@@ -19336,7 +19326,6 @@ var BABYLON;
             this._currentRenderId = this.getScene().getRenderId();
             this._childRenderId = this.getScene().getRenderId();
             this._isDirty = false;
-            this._worldMatrixWasUpdated = true;
             // Scaling
             BABYLON.Matrix.ScalingToRef(this.scaling.x * this.scalingDeterminant, this.scaling.y * this.scalingDeterminant, this.scaling.z * this.scalingDeterminant, BABYLON.Tmp.Matrix[1]);
             // Rotation
@@ -27460,26 +27449,6 @@ var BABYLON;
             this._activeMeshesFrozen = false;
             return this;
         };
-        Scene.prototype._computeAllWorldMatricesforBranch = function (node) {
-            node.computeWorldMatrix(false, true);
-            var children = node.getChildren();
-            if (children) {
-                for (var _i = 0, children_2 = children; _i < children_2.length; _i++) {
-                    var child = children_2[_i];
-                    this._computeAllWorldMatricesforBranch(child);
-                }
-            }
-            node._worldMatrixWasUpdated = false;
-        };
-        /**
-         * This function will traverse the scene graph and makes sure that all worldMatrix are up to date
-         */
-        Scene.prototype.computeAllWorldMatrices = function () {
-            for (var _i = 0, _a = this.rootNodes; _i < _a.length; _i++) {
-                var node = _a[_i];
-                this._computeAllWorldMatricesforBranch(node);
-            }
-        };
         Scene.prototype._evaluateActiveMeshes = function () {
             if (this._activeMeshesFrozen && this._activeMeshes.length) {
                 return;
@@ -27499,8 +27468,6 @@ var BABYLON;
                 var step = _a[_i];
                 step.action();
             }
-            // World matrices
-            this.computeAllWorldMatrices();
             // Determine mesh candidates
             var meshes = this.getActiveMeshCandidates();
             // Check each mesh
@@ -27514,6 +27481,7 @@ var BABYLON;
                 if (!mesh.isReady() || !mesh.isEnabled()) {
                     continue;
                 }
+                mesh.computeWorldMatrix();
                 // Intersections
                 if (mesh.actionManager && mesh.actionManager.hasSpecificTriggers2(BABYLON.ActionManager.OnIntersectionEnterTrigger, BABYLON.ActionManager.OnIntersectionExitTrigger)) {
                     this._meshesForIntersections.pushNoDuplicate(mesh);
@@ -48889,17 +48857,15 @@ var BABYLON;
         /**
          * Computes the world matrix of the node
          * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
-         * @param useWasUpdatedFlag defines a reserved property
          * @returns the world matrix
          */
-        ShadowLight.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
-            if (!force && this.isSynchronized(useWasUpdatedFlag)) {
+        ShadowLight.prototype.computeWorldMatrix = function (force) {
+            if (!force && this.isSynchronized()) {
                 this._currentRenderId = this.getScene().getRenderId();
                 return this._worldMatrix;
             }
             this._updateCache();
             this._cache.position.copyFrom(this.position);
-            this._worldMatrixWasUpdated = true;
             if (!this._worldMatrix) {
                 this._worldMatrix = BABYLON.Matrix.Identity();
             }

文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/babylon.worker.js


+ 15 - 49
dist/preview release/es6.js

@@ -17619,8 +17619,6 @@ var BABYLON;
             this._parentRenderId = -1;
             this._childRenderId = -1;
             /** @hidden */
-            this._worldMatrixWasUpdated = false;
-            /** @hidden */
             this._worldMatrix = BABYLON.Matrix.Zero();
             /** @hidden */
             this._worldMatrixDeterminant = 0;
@@ -17893,23 +17891,17 @@ var BABYLON;
             return this._parentNode.isSynchronized();
         };
         /** @hidden */
-        Node.prototype.isSynchronized = function (useWasUpdatedFlag) {
-            var check = this.hasNewParent();
-            if (!useWasUpdatedFlag) {
-                check = check || !this.isSynchronizedWithParent();
+        Node.prototype.isSynchronized = function () {
+            if (this._cache.parent != this._parentNode) {
+                this._cache.parent = this._parentNode;
+                return false;
             }
-            else if (this._parentNode) {
-                check = this._parentNode._worldMatrixWasUpdated;
+            if (this._parentNode) {
+                if (!this.isSynchronizedWithParent()) {
+                    return false;
+                }
             }
-            check = check || !this._isSynchronized();
-            return !check;
-        };
-        /** @hidden */
-        Node.prototype.hasNewParent = function () {
-            if (this._cache.parent === this._parentNode)
-                return false;
-            this._cache.parent = this._parentNode;
-            return true;
+            return this._isSynchronized();
         };
         /**
          * Is this node ready to be used/rendered
@@ -18129,10 +18121,9 @@ var BABYLON;
         /**
          * Computes the world matrix of the node
          * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
-         * @param useWasUpdatedFlag defines a reserved property
          * @returns the world matrix
          */
-        Node.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
+        Node.prototype.computeWorldMatrix = function (force) {
             if (!this._worldMatrix) {
                 this._worldMatrix = BABYLON.Matrix.Identity();
             }
@@ -19317,14 +19308,13 @@ var BABYLON;
         /**
          * Computes the world matrix of the node
          * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
-         * @param useWasUpdatedFlag defines a reserved property
          * @returns the world matrix
          */
-        TransformNode.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
+        TransformNode.prototype.computeWorldMatrix = function (force) {
             if (this._isWorldMatrixFrozen) {
                 return this._worldMatrix;
             }
-            if (!force && this.isSynchronized(useWasUpdatedFlag)) {
+            if (!force && this.isSynchronized()) {
                 this._currentRenderId = this.getScene().getRenderId();
                 return this._worldMatrix;
             }
@@ -19336,7 +19326,6 @@ var BABYLON;
             this._currentRenderId = this.getScene().getRenderId();
             this._childRenderId = this.getScene().getRenderId();
             this._isDirty = false;
-            this._worldMatrixWasUpdated = true;
             // Scaling
             BABYLON.Matrix.ScalingToRef(this.scaling.x * this.scalingDeterminant, this.scaling.y * this.scalingDeterminant, this.scaling.z * this.scalingDeterminant, BABYLON.Tmp.Matrix[1]);
             // Rotation
@@ -27460,26 +27449,6 @@ var BABYLON;
             this._activeMeshesFrozen = false;
             return this;
         };
-        Scene.prototype._computeAllWorldMatricesforBranch = function (node) {
-            node.computeWorldMatrix(false, true);
-            var children = node.getChildren();
-            if (children) {
-                for (var _i = 0, children_2 = children; _i < children_2.length; _i++) {
-                    var child = children_2[_i];
-                    this._computeAllWorldMatricesforBranch(child);
-                }
-            }
-            node._worldMatrixWasUpdated = false;
-        };
-        /**
-         * This function will traverse the scene graph and makes sure that all worldMatrix are up to date
-         */
-        Scene.prototype.computeAllWorldMatrices = function () {
-            for (var _i = 0, _a = this.rootNodes; _i < _a.length; _i++) {
-                var node = _a[_i];
-                this._computeAllWorldMatricesforBranch(node);
-            }
-        };
         Scene.prototype._evaluateActiveMeshes = function () {
             if (this._activeMeshesFrozen && this._activeMeshes.length) {
                 return;
@@ -27499,8 +27468,6 @@ var BABYLON;
                 var step = _a[_i];
                 step.action();
             }
-            // World matrices
-            this.computeAllWorldMatrices();
             // Determine mesh candidates
             var meshes = this.getActiveMeshCandidates();
             // Check each mesh
@@ -27514,6 +27481,7 @@ var BABYLON;
                 if (!mesh.isReady() || !mesh.isEnabled()) {
                     continue;
                 }
+                mesh.computeWorldMatrix();
                 // Intersections
                 if (mesh.actionManager && mesh.actionManager.hasSpecificTriggers2(BABYLON.ActionManager.OnIntersectionEnterTrigger, BABYLON.ActionManager.OnIntersectionExitTrigger)) {
                     this._meshesForIntersections.pushNoDuplicate(mesh);
@@ -48889,17 +48857,15 @@ var BABYLON;
         /**
          * Computes the world matrix of the node
          * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
-         * @param useWasUpdatedFlag defines a reserved property
          * @returns the world matrix
          */
-        ShadowLight.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
-            if (!force && this.isSynchronized(useWasUpdatedFlag)) {
+        ShadowLight.prototype.computeWorldMatrix = function (force) {
+            if (!force && this.isSynchronized()) {
                 this._currentRenderId = this.getScene().getRenderId();
                 return this._worldMatrix;
             }
             this._updateCache();
             this._cache.position.copyFrom(this.position);
-            this._worldMatrixWasUpdated = true;
             if (!this._worldMatrix) {
                 this._worldMatrix = BABYLON.Matrix.Identity();
             }

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

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

文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/gui/babylon.gui.min.js.map


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

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

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

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

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

@@ -1,6 +1,6 @@
 /*BabylonJS Inspector*/
 // Dependencies for this module:
-//   ../../../../Tools/Gulp/babylonjs
+//   ../../../../Tools/gulp/babylonjs
 
 declare module 'babylonjs-inspector' {
     export * from 'babylonjs-inspector/adapters';
@@ -1340,7 +1340,7 @@ declare module 'babylonjs-inspector/treetools/SoundInteractions' {
 
 /*BabylonJS Inspector*/
 // Dependencies for this module:
-//   ../../../../Tools/Gulp/babylonjs
+//   ../../../../Tools/gulp/babylonjs
 declare module INSPECTOR {
 }
 declare module INSPECTOR {

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

@@ -4,8 +4,8 @@
 declare module "babylonjs-loaders"{ export=BABYLON;}
 // Generated by dts-bundle v0.7.3
 // Dependencies for this module:
-//   ../../../../../Tools/Gulp/babylonjs
-//   ../../../../../Tools/Gulp/babylonjs-loaders
+//   ../../../../../Tools/gulp/babylonjs
+//   ../../../../../Tools/gulp/babylonjs-loaders
 declare module BabylonViewer {
     /**
         * BabylonJS Viewer
@@ -168,11 +168,11 @@ declare module BabylonViewer {
                 * Mainly used for help and errors
                 * @param subScreen the name of the subScreen. Those can be defined in the configuration object
                 */
-            showOverlayScreen(subScreen: string): Promise<Template> | Promise<string>;
+            showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
             /**
                 * Hide the overlay screen.
                 */
-            hideOverlayScreen(): Promise<Template> | Promise<string>;
+            hideOverlayScreen(): Promise<string> | Promise<Template>;
             /**
                 * show the viewer (in case it was hidden)
                 *
@@ -189,11 +189,11 @@ declare module BabylonViewer {
                 * Show the loading screen.
                 * The loading screen can be configured using the configuration object
                 */
-            showLoadingScreen(): Promise<Template> | Promise<string>;
+            showLoadingScreen(): Promise<string> | Promise<Template>;
             /**
                 * Hide the loading screen
                 */
-            hideLoadingScreen(): Promise<Template> | Promise<string>;
+            hideLoadingScreen(): Promise<string> | Promise<Template>;
             dispose(): void;
             protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
     }
@@ -515,167 +515,10 @@ declare module BabylonViewer {
     }
 }
 declare module BabylonViewer {
-    /**
-        * The current state of the model
-        */
-    export enum ModelState {
-            INIT = 0,
-            LOADING = 1,
-            LOADED = 2,
-            ENTRY = 3,
-            ENTRYDONE = 4,
-            COMPLETE = 5,
-            CANCELED = 6,
-            ERROR = 7
-    }
-    /**
-        * The viewer model is a container for all assets representing a sngle loaded model.
-        */
-    export class ViewerModel implements BABYLON.IDisposable {
-            /**
-                * The loader used to load this model.
-                */
-            loader: BABYLON.ISceneLoaderPlugin | BABYLON.ISceneLoaderPluginAsync;
-            /**
-                * This model's root mesh (the parent of all other meshes).
-                * This mesh does not(!) exist in the meshes array.
-                */
-            rootMesh: BABYLON.AbstractMesh;
-            /**
-                * ParticleSystems connected to this model
-                */
-            particleSystems: Array<BABYLON.IParticleSystem>;
-            /**
-                * Skeletons defined in this model
-                */
-            skeletons: Array<BABYLON.Skeleton>;
-            /**
-                * The current model animation.
-                * On init, this will be undefined.
-                */
-            currentAnimation: IModelAnimation;
-            /**
-                * Observers registered here will be executed when the model is done loading
-                */
-            onLoadedObservable: BABYLON.Observable<ViewerModel>;
-            /**
-                * Observers registered here will be executed when the loader notified of a progress event
-                */
-            onLoadProgressObservable: BABYLON.Observable<BABYLON.SceneLoaderProgressEvent>;
-            /**
-                * Observers registered here will be executed when the loader notified of an error.
-                */
-            onLoadErrorObservable: BABYLON.Observable<{
-                    message: string;
-                    exception: any;
-            }>;
-            /**
-                * Will be executed after the model finished loading and complete, including entry animation and lod
-                */
-            onCompleteObservable: BABYLON.Observable<ViewerModel>;
-            /**
-                * Observers registered here will be executed every time the model is being configured.
-                * This can be used to extend the model's configuration without extending the class itself
-                */
-            onAfterConfigure: BABYLON.Observable<ViewerModel>;
-            /**
-                * The current model state (loaded, error, etc)
-                */
-            state: ModelState;
-            /**
-                * A loadID provided by the modelLoader, unique to ths (Abstract)Viewer instance.
-                */
-            loadId: number;
-            loadInfo: BABYLON.GLTF2.IAsset;
-            constructor(_observablesManager: ObservablesManager, modelConfiguration: IModelConfiguration, _configurationContainer?: ConfigurationContainer | undefined);
-            shadowsRenderedAfterLoad: boolean;
-            getViewerId(): string | undefined;
-            /**
-             * Set whether this model is enabled or not.
-             */
-            enabled: boolean;
-            loaderDone: boolean;
-            /**
-                * Add a mesh to this model.
-                * Any mesh that has no parent will be provided with the root mesh as its new parent.
-                *
-                * @param mesh the new mesh to add
-                * @param triggerLoaded should this mesh trigger the onLoaded observable. Used when adding meshes manually.
-                */
-            addMesh(mesh: BABYLON.AbstractMesh, triggerLoaded?: boolean): Promise<ViewerModel> | undefined;
-            /**
-                * get the list of meshes (excluding the root mesh)
-                */
-            readonly meshes: BABYLON.AbstractMesh[];
-            /**
-             * (Re-)set the model's entire configuration
-             * @param newConfiguration the new configuration to replace the new one
-             */
-            configuration: IModelConfiguration;
-            /**
-                * Update the current configuration with new values.
-                * Configuration will not be overwritten, but merged with the new configuration.
-                * Priority is to the new configuration
-                * @param newConfiguration the configuration to be merged into the current configuration;
-                */
-            updateConfiguration(newConfiguration: Partial<IModelConfiguration>): void;
-            /**
-                * Add a new animation group to this model.
-                * @param animationGroup the new animation group to be added
-                */
-            addAnimationGroup(animationGroup: BABYLON.AnimationGroup): void;
-            /**
-                * Get the ModelAnimation array
-                */
-            getAnimations(): Array<IModelAnimation>;
-            /**
-                * Get the animations' names. Using the names you can play a specific animation.
-                */
-            getAnimationNames(): Array<string>;
-            /**
-                * Get an animation by the provided name. Used mainly when playing n animation.
-                * @param name the name of the animation to find
-                */
-            protected _getAnimationByName(name: string): BABYLON.Nullable<IModelAnimation>;
-            /**
-                * Choose an initialized animation using its name and start playing it
-                * @param name the name of the animation to play
-                * @returns The model aniamtion to be played.
-                */
-            playAnimation(name: string): IModelAnimation;
-            setCurrentAnimationByName(name: string): IModelAnimation;
-            /**
-                * Apply a material configuration to a material
-                * @param material BABYLON.Material to apply configuration to
-                * @hidden
-                */
-            _applyModelMaterialConfiguration(material: BABYLON.Material): void;
-            /**
-             * Begin @animations with the specified @easingFunction
-             * @param animations The BABYLON Animations to begin
-             * @param duration of transition, in seconds
-             * @param easingFunction An easing function to apply
-             * @param easingMode A easing mode to apply to the easingFunction
-             * @param onAnimationEnd Call back trigger at the end of the animation.
-             */
-            transitionTo(animations: BABYLON.Animation[], duration: number, easingFunction: any, easingMode: number | undefined, onAnimationEnd: () => void): void;
-            /**
-                * Stops and removes all animations that have been applied to the model
-                */
-            stopAllAnimations(): void;
-            /**
-                * Will remove this model from the viewer (but NOT dispose it).
-                */
-            remove(): void;
-            /**
-                * Dispose this model, including all of its associated assets.
-                */
-            dispose(): void;
-    }
 }
 declare module BabylonViewer {
     /**
-        * BABYLON.Animation play mode enum - is the animation looping or playing once
+        * Animation play mode enum - is the animation looping or playing once
         */
     export const enum AnimationPlayMode {
             ONCE = 0,
@@ -757,7 +600,7 @@ declare module BabylonViewer {
                 */
             readonly currentFrame: number;
             /**
-                * BABYLON.Animation's FPS value
+                * Animation's FPS value
                 */
             readonly fps: number;
             /**
@@ -924,7 +767,7 @@ declare module BabylonViewer {
       * @param name the name of the custom optimizer configuration
       * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
       */
-    export function getCustomOptimizerByName(name: string, upgrade?: boolean): typeof extendedUpgrade;
+    export function getCustomOptimizerByName(name: string, upgrade?: boolean): (sceneManager: SceneManager) => boolean;
     export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
 }
 declare module BabylonViewer {
@@ -1558,20 +1401,6 @@ declare module BabylonViewer {
     export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
 }
 declare module BabylonViewer {
-    /**
-        * A custom upgrade-oriented function configuration for the scene optimizer.
-        *
-        * @param viewer the viewer to optimize
-        */
-    export function extendedUpgrade(sceneManager: SceneManager): boolean;
-    /**
-        * A custom degrade-oriented function configuration for the scene optimizer.
-        *
-        * @param viewer the viewer to optimize
-        */
-    export function extendedDegrade(sceneManager: SceneManager): boolean;
-}
-declare module BabylonViewer {
 }
 declare module BabylonViewer {
     export interface IEnvironmentMapConfiguration {

文件差異過大導致無法顯示
+ 2 - 2
dist/preview release/viewer/babylon.viewer.js


文件差異過大導致無法顯示
+ 5 - 5
dist/preview release/viewer/babylon.viewer.max.js


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

@@ -5,8 +5,8 @@ declare module "babylonjs-loaders"{ export=BABYLON;}
 
 // Generated by dts-bundle v0.7.3
 // Dependencies for this module:
-//   ../../../../../Tools/Gulp/babylonjs
-//   ../../../../../Tools/Gulp/babylonjs-loaders
+//   ../../../../../Tools/gulp/babylonjs
+//   ../../../../../Tools/gulp/babylonjs-loaders
 
 declare module 'babylonjs-viewer' {
     import { mapperManager } from 'babylonjs-viewer/configuration/mappers';
@@ -200,11 +200,11 @@ declare module 'babylonjs-viewer/viewer/defaultViewer' {
                 * Mainly used for help and errors
                 * @param subScreen the name of the subScreen. Those can be defined in the configuration object
                 */
-            showOverlayScreen(subScreen: string): Promise<Template> | Promise<string>;
+            showOverlayScreen(subScreen: string): Promise<string> | Promise<Template>;
             /**
                 * Hide the overlay screen.
                 */
-            hideOverlayScreen(): Promise<Template> | Promise<string>;
+            hideOverlayScreen(): Promise<string> | Promise<Template>;
             /**
                 * show the viewer (in case it was hidden)
                 *
@@ -221,11 +221,11 @@ declare module 'babylonjs-viewer/viewer/defaultViewer' {
                 * Show the loading screen.
                 * The loading screen can be configured using the configuration object
                 */
-            showLoadingScreen(): Promise<Template> | Promise<string>;
+            showLoadingScreen(): Promise<string> | Promise<Template>;
             /**
                 * Hide the loading screen
                 */
-            hideLoadingScreen(): Promise<Template> | Promise<string>;
+            hideLoadingScreen(): Promise<string> | Promise<Template>;
             dispose(): void;
             protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
     }
@@ -566,169 +566,7 @@ declare module 'babylonjs-viewer/loader/modelLoader' {
 }
 
 declare module 'babylonjs-viewer/model/viewerModel' {
-    import { ISceneLoaderPlugin, ISceneLoaderPluginAsync, AnimationGroup, AbstractMesh, Observable, SceneLoaderProgressEvent, IParticleSystem, Skeleton, IDisposable, Nullable, Animation, Material } from "babylonjs";
-    import { GLTF2 } from "babylonjs-loaders";
-    import { IModelConfiguration } from "babylonjs-viewer/configuration/interfaces/modelConfiguration";
-    import { IModelAnimation } from "babylonjs-viewer/model/modelAnimation";
-    import { ObservablesManager } from "babylonjs-viewer/managers/observablesManager";
-    import { ConfigurationContainer } from "babylonjs-viewer/configuration/configurationContainer";
-    /**
-        * The current state of the model
-        */
-    export enum ModelState {
-            INIT = 0,
-            LOADING = 1,
-            LOADED = 2,
-            ENTRY = 3,
-            ENTRYDONE = 4,
-            COMPLETE = 5,
-            CANCELED = 6,
-            ERROR = 7
-    }
-    /**
-        * The viewer model is a container for all assets representing a sngle loaded model.
-        */
-    export class ViewerModel implements IDisposable {
-            /**
-                * The loader used to load this model.
-                */
-            loader: ISceneLoaderPlugin | ISceneLoaderPluginAsync;
-            /**
-                * This model's root mesh (the parent of all other meshes).
-                * This mesh does not(!) exist in the meshes array.
-                */
-            rootMesh: AbstractMesh;
-            /**
-                * ParticleSystems connected to this model
-                */
-            particleSystems: Array<IParticleSystem>;
-            /**
-                * Skeletons defined in this model
-                */
-            skeletons: Array<Skeleton>;
-            /**
-                * The current model animation.
-                * On init, this will be undefined.
-                */
-            currentAnimation: IModelAnimation;
-            /**
-                * Observers registered here will be executed when the model is done loading
-                */
-            onLoadedObservable: Observable<ViewerModel>;
-            /**
-                * Observers registered here will be executed when the loader notified of a progress event
-                */
-            onLoadProgressObservable: Observable<SceneLoaderProgressEvent>;
-            /**
-                * Observers registered here will be executed when the loader notified of an error.
-                */
-            onLoadErrorObservable: Observable<{
-                    message: string;
-                    exception: any;
-            }>;
-            /**
-                * Will be executed after the model finished loading and complete, including entry animation and lod
-                */
-            onCompleteObservable: Observable<ViewerModel>;
-            /**
-                * Observers registered here will be executed every time the model is being configured.
-                * This can be used to extend the model's configuration without extending the class itself
-                */
-            onAfterConfigure: Observable<ViewerModel>;
-            /**
-                * The current model state (loaded, error, etc)
-                */
-            state: ModelState;
-            /**
-                * A loadID provided by the modelLoader, unique to ths (Abstract)Viewer instance.
-                */
-            loadId: number;
-            loadInfo: GLTF2.IAsset;
-            constructor(_observablesManager: ObservablesManager, modelConfiguration: IModelConfiguration, _configurationContainer?: ConfigurationContainer | undefined);
-            shadowsRenderedAfterLoad: boolean;
-            getViewerId(): string | undefined;
-            /**
-             * Set whether this model is enabled or not.
-             */
-            enabled: boolean;
-            loaderDone: boolean;
-            /**
-                * Add a mesh to this model.
-                * Any mesh that has no parent will be provided with the root mesh as its new parent.
-                *
-                * @param mesh the new mesh to add
-                * @param triggerLoaded should this mesh trigger the onLoaded observable. Used when adding meshes manually.
-                */
-            addMesh(mesh: AbstractMesh, triggerLoaded?: boolean): Promise<ViewerModel> | undefined;
-            /**
-                * get the list of meshes (excluding the root mesh)
-                */
-            readonly meshes: AbstractMesh[];
-            /**
-             * (Re-)set the model's entire configuration
-             * @param newConfiguration the new configuration to replace the new one
-             */
-            configuration: IModelConfiguration;
-            /**
-                * Update the current configuration with new values.
-                * Configuration will not be overwritten, but merged with the new configuration.
-                * Priority is to the new configuration
-                * @param newConfiguration the configuration to be merged into the current configuration;
-                */
-            updateConfiguration(newConfiguration: Partial<IModelConfiguration>): void;
-            /**
-                * Add a new animation group to this model.
-                * @param animationGroup the new animation group to be added
-                */
-            addAnimationGroup(animationGroup: AnimationGroup): void;
-            /**
-                * Get the ModelAnimation array
-                */
-            getAnimations(): Array<IModelAnimation>;
-            /**
-                * Get the animations' names. Using the names you can play a specific animation.
-                */
-            getAnimationNames(): Array<string>;
-            /**
-                * Get an animation by the provided name. Used mainly when playing n animation.
-                * @param name the name of the animation to find
-                */
-            protected _getAnimationByName(name: string): Nullable<IModelAnimation>;
-            /**
-                * Choose an initialized animation using its name and start playing it
-                * @param name the name of the animation to play
-                * @returns The model aniamtion to be played.
-                */
-            playAnimation(name: string): IModelAnimation;
-            setCurrentAnimationByName(name: string): IModelAnimation;
-            /**
-                * Apply a material configuration to a material
-                * @param material Material to apply configuration to
-                * @hidden
-                */
-            _applyModelMaterialConfiguration(material: Material): void;
-            /**
-             * Begin @animations with the specified @easingFunction
-             * @param animations The BABYLON Animations to begin
-             * @param duration of transition, in seconds
-             * @param easingFunction An easing function to apply
-             * @param easingMode A easing mode to apply to the easingFunction
-             * @param onAnimationEnd Call back trigger at the end of the animation.
-             */
-            transitionTo(animations: Animation[], duration: number, easingFunction: any, easingMode: number | undefined, onAnimationEnd: () => void): void;
-            /**
-                * Stops and removes all animations that have been applied to the model
-                */
-            stopAllAnimations(): void;
-            /**
-                * Will remove this model from the viewer (but NOT dispose it).
-                */
-            remove(): void;
-            /**
-                * Dispose this model, including all of its associated assets.
-                */
-            dispose(): void;
-    }
+    
 }
 
 declare module 'babylonjs-viewer/model/modelAnimation' {
@@ -985,14 +823,13 @@ declare module 'babylonjs-viewer/templating/viewerTemplatePlugin' {
 }
 
 declare module 'babylonjs-viewer/optimizer/custom' {
-    import { extendedUpgrade } from "babylonjs-viewer/optimizer/custom/extended";
     import { SceneManager } from "babylonjs-viewer/managers/sceneManager";
     /**
       *
       * @param name the name of the custom optimizer configuration
       * @param upgrade set to true if you want to upgrade optimizer and false if you want to degrade
       */
-    export function getCustomOptimizerByName(name: string, upgrade?: boolean): typeof extendedUpgrade;
+    export function getCustomOptimizerByName(name: string, upgrade?: boolean): (sceneManager: SceneManager) => boolean;
     export function registerCustomOptimizer(name: string, optimizer: (sceneManager: SceneManager) => boolean): void;
 }
 
@@ -1663,22 +1500,6 @@ declare module 'babylonjs-viewer/loader/plugins' {
     export function addLoaderPlugin(name: string, plugin: ILoaderPlugin): void;
 }
 
-declare module 'babylonjs-viewer/optimizer/custom/extended' {
-    import { SceneManager } from 'babylonjs-viewer/managers/sceneManager';
-    /**
-        * A custom upgrade-oriented function configuration for the scene optimizer.
-        *
-        * @param viewer the viewer to optimize
-        */
-    export function extendedUpgrade(sceneManager: SceneManager): boolean;
-    /**
-        * A custom degrade-oriented function configuration for the scene optimizer.
-        *
-        * @param viewer the viewer to optimize
-        */
-    export function extendedDegrade(sceneManager: SceneManager): boolean;
-}
-
 declare module 'babylonjs-viewer/configuration/interfaces' {
     export * from 'babylonjs-viewer/configuration/interfaces/cameraConfiguration';
     export * from 'babylonjs-viewer/configuration/interfaces/colorGradingConfiguration';

+ 2 - 4
src/Lights/babylon.shadowLight.ts

@@ -318,18 +318,16 @@
         /**
          * Computes the world matrix of the node
          * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
-         * @param useWasUpdatedFlag defines a reserved property
          * @returns the world matrix
          */
-        public computeWorldMatrix(force?: boolean, useWasUpdatedFlag?: boolean): Matrix {
-            if (!force && this.isSynchronized(useWasUpdatedFlag)) {
+        public computeWorldMatrix(force?: boolean): Matrix {
+            if (!force && this.isSynchronized()) {
                 this._currentRenderId = this.getScene().getRenderId();
                 return this._worldMatrix;
             }
 
             this._updateCache();
             this._cache.position.copyFrom(this.position);
-            this._worldMatrixWasUpdated = true;
 
             if (!this._worldMatrix) {
                 this._worldMatrix = Matrix.Identity();

+ 2 - 4
src/Mesh/babylon.transformNode.ts

@@ -735,15 +735,14 @@ module BABYLON {
         /**
          * Computes the world matrix of the node
          * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
-         * @param useWasUpdatedFlag defines a reserved property
          * @returns the world matrix
          */
-        public computeWorldMatrix(force?: boolean, useWasUpdatedFlag?: boolean): Matrix {
+        public computeWorldMatrix(force?: boolean): Matrix {
             if (this._isWorldMatrixFrozen) {
                 return this._worldMatrix;
             }
 
-            if (!force && this.isSynchronized(useWasUpdatedFlag)) {
+            if (!force && this.isSynchronized()) {
                 this._currentRenderId = this.getScene().getRenderId();
                 return this._worldMatrix;
             }
@@ -756,7 +755,6 @@ module BABYLON {
             this._currentRenderId = this.getScene().getRenderId();
             this._childRenderId = this.getScene().getRenderId();
             this._isDirty = false;
-            this._worldMatrixWasUpdated = true;
 
             // Scaling
             Matrix.ScalingToRef(this.scaling.x * this.scalingDeterminant, this.scaling.y * this.scalingDeterminant, this.scaling.z * this.scalingDeterminant, Tmp.Matrix[1]);

+ 11 - 24
src/babylon.node.ts

@@ -105,9 +105,6 @@
         private _children: Node[];
 
         /** @hidden */
-        public _worldMatrixWasUpdated = false;
-
-        /** @hidden */
         public _worldMatrix = Matrix.Zero();
         /** @hidden */
         public _worldMatrixDeterminant = 0;        
@@ -389,28 +386,19 @@
         }
 
         /** @hidden */
-        public isSynchronized(useWasUpdatedFlag?: boolean): boolean {
-            var check = this.hasNewParent();
-
-            if (!useWasUpdatedFlag) {
-                check = check || !this.isSynchronizedWithParent();
-            } else if (this._parentNode) {
-                check = this._parentNode._worldMatrixWasUpdated; 
-            }
-
-            check = check || !this._isSynchronized();
-
-            return !check;
-        }
-
-        /** @hidden */
-        public hasNewParent(): boolean {
-            if (this._cache.parent === this._parentNode)
+        public isSynchronized(): boolean {
+            if (this._cache.parent != this._parentNode) {
+                this._cache.parent = this._parentNode;
                 return false;
+            }
 
-            this._cache.parent = this._parentNode;
+            if (this._parentNode) {
+                if (!this.isSynchronizedWithParent()) {
+                    return false;
+                }
+            }
 
-            return true;
+            return this._isSynchronized();
         }
 
         /**
@@ -659,10 +647,9 @@
         /**
          * Computes the world matrix of the node
          * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
-         * @param useWasUpdatedFlag defines a reserved property
          * @returns the world matrix
          */
-        public computeWorldMatrix(force?: boolean, useWasUpdatedFlag?: boolean): Matrix {
+        public computeWorldMatrix(force?: boolean): Matrix {
             if (!this._worldMatrix) {
                 this._worldMatrix = Matrix.Identity();
             }

+ 2 - 25
src/babylon.scene.ts

@@ -4067,28 +4067,6 @@
             return this;
         }
 
-        private _computeAllWorldMatricesforBranch(node: Node) {
-            node.computeWorldMatrix(false, true);
-            const children = node.getChildren();
-
-            if (children) {
-                for (var child of children) {
-                    this._computeAllWorldMatricesforBranch(child);
-                }
-            }
-            
-            node._worldMatrixWasUpdated = false;
-        }
-
-        /**
-         * This function will traverse the scene graph and makes sure that all worldMatrix are up to date
-         */
-        public computeAllWorldMatrices() {
-            for (var node of this.rootNodes) {
-                this._computeAllWorldMatricesforBranch(node);
-            }
-        }
-
         private _evaluateActiveMeshes(): void {
             if (this._activeMeshesFrozen && this._activeMeshes.length) {
                 return;
@@ -4111,9 +4089,6 @@
                 step.action();
             }
 
-            // World matrices
-            this.computeAllWorldMatrices();
-
             // Determine mesh candidates
             const meshes = this.getActiveMeshCandidates();
             
@@ -4131,6 +4106,8 @@
                     continue;
                 }
 
+                mesh.computeWorldMatrix();
+
                 // Intersections
                 if (mesh.actionManager && mesh.actionManager.hasSpecificTriggers2(ActionManager.OnIntersectionEnterTrigger, ActionManager.OnIntersectionExitTrigger)) {
                     this._meshesForIntersections.pushNoDuplicate(mesh);