فهرست منبع

Allow sceneLoader to use only rootUrl

David Catuhe 7 سال پیش
والد
کامیت
6405fc2ef2

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1200 - 1199
Playground/babylon.d.txt


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 16 - 16
Viewer/dist/viewer.js


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 16 - 16
Viewer/dist/viewer.min.js


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 1075 - 1074
dist/preview release/babylon.d.ts


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 28 - 28
dist/preview release/babylon.js


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

@@ -15174,8 +15174,11 @@ var BABYLON;
             this._pivotMatrix = matrix.clone();
             this._cache.pivotMatrixUpdated = true;
             this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;
-            if (this._postMultiplyPivotMatrix) {
-                this._pivotMatrixInverse = BABYLON.Matrix.Invert(matrix);
+            if (!this._pivotMatrixInverse) {
+                this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
+            }
+            else {
+                this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
             }
             return this;
         };
@@ -15354,6 +15357,12 @@ var BABYLON;
             this._pivotMatrix.m[12] = -point.x;
             this._pivotMatrix.m[13] = -point.y;
             this._pivotMatrix.m[14] = -point.z;
+            if (!this._pivotMatrixInverse) {
+                this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
+            }
+            else {
+                this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
+            }
             this._cache.pivotMatrixUpdated = true;
             return this;
         };
@@ -15726,6 +15735,9 @@ var BABYLON;
             this._afterComputeWorldMatrix();
             // Absolute position
             this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);
+            if (this._pivotMatrixInverse) {
+                BABYLON.Vector3.TransformCoordinatesToRef(this._absolutePosition, this._pivotMatrixInverse, this._absolutePosition);
+            }
             // Callbacks
             this.onAfterWorldMatrixUpdateObservable.notifyObservers(this);
             if (!this._poseMatrix) {
@@ -58031,6 +58043,7 @@ var BABYLON;
         * @param onError a callback with the scene, a message, and possibly an exception when import fails
         */
         SceneLoader.ImportMesh = function (meshNames, rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {
+            var _this = this;
             if (onSuccess === void 0) { onSuccess = null; }
             if (onProgress === void 0) { onProgress = null; }
             if (onError === void 0) { onError = null; }
@@ -58079,6 +58092,11 @@ var BABYLON;
                 if (plugin.rewriteRootURL) {
                     rootUrl = plugin.rewriteRootURL(rootUrl, responseURL);
                 }
+                if (sceneFilename === "") {
+                    if (sceneFilename === "") {
+                        rootUrl = _this._StripFilenameFromRootUrl(rootUrl);
+                    }
+                }
                 if (plugin.importMesh) {
                     var syncedPlugin = plugin;
                     var meshes = new Array();
@@ -58125,6 +58143,7 @@ var BABYLON;
         * @param onError a callback with the scene, a message, and possibly an exception when import fails
         */
         SceneLoader.Append = function (rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {
+            var _this = this;
             if (onSuccess === void 0) { onSuccess = null; }
             if (onProgress === void 0) { onProgress = null; }
             if (onError === void 0) { onError = null; }
@@ -58173,6 +58192,9 @@ var BABYLON;
                 scene._removePendingData(loadingToken);
             };
             return SceneLoader._loadData(rootUrl, sceneFilename, scene, function (plugin, data, responseURL) {
+                if (sceneFilename === "") {
+                    rootUrl = _this._StripFilenameFromRootUrl(rootUrl);
+                }
                 if (plugin.load) {
                     var syncedPlugin = plugin;
                     if (!syncedPlugin.load(scene, data, rootUrl, errorHandler)) {
@@ -58195,6 +58217,14 @@ var BABYLON;
                 }
             }, progressHandler, errorHandler, disposeHandler, pluginExtension);
         };
+        SceneLoader._StripFilenameFromRootUrl = function (rootUrl) {
+            // We need to strip the filename off from the rootUrl
+            var lastSlash = rootUrl.lastIndexOf("/");
+            if (lastSlash > -1) {
+                rootUrl = rootUrl.substr(0, lastSlash + 1);
+            }
+            return rootUrl;
+        };
         SceneLoader.LoadAssetContainer = function (rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {
             if (onSuccess === void 0) { onSuccess = null; }
             if (onProgress === void 0) { onProgress = null; }

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 28 - 28
dist/preview release/babylon.worker.js


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 2668 - 2667
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 28 - 28
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 32 - 2
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -15174,8 +15174,11 @@ var BABYLON;
             this._pivotMatrix = matrix.clone();
             this._cache.pivotMatrixUpdated = true;
             this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;
-            if (this._postMultiplyPivotMatrix) {
-                this._pivotMatrixInverse = BABYLON.Matrix.Invert(matrix);
+            if (!this._pivotMatrixInverse) {
+                this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
+            }
+            else {
+                this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
             }
             return this;
         };
@@ -15354,6 +15357,12 @@ var BABYLON;
             this._pivotMatrix.m[12] = -point.x;
             this._pivotMatrix.m[13] = -point.y;
             this._pivotMatrix.m[14] = -point.z;
+            if (!this._pivotMatrixInverse) {
+                this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
+            }
+            else {
+                this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
+            }
             this._cache.pivotMatrixUpdated = true;
             return this;
         };
@@ -15726,6 +15735,9 @@ var BABYLON;
             this._afterComputeWorldMatrix();
             // Absolute position
             this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);
+            if (this._pivotMatrixInverse) {
+                BABYLON.Vector3.TransformCoordinatesToRef(this._absolutePosition, this._pivotMatrixInverse, this._absolutePosition);
+            }
             // Callbacks
             this.onAfterWorldMatrixUpdateObservable.notifyObservers(this);
             if (!this._poseMatrix) {
@@ -57825,6 +57837,7 @@ var BABYLON;
         * @param onError a callback with the scene, a message, and possibly an exception when import fails
         */
         SceneLoader.ImportMesh = function (meshNames, rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {
+            var _this = this;
             if (onSuccess === void 0) { onSuccess = null; }
             if (onProgress === void 0) { onProgress = null; }
             if (onError === void 0) { onError = null; }
@@ -57873,6 +57886,11 @@ var BABYLON;
                 if (plugin.rewriteRootURL) {
                     rootUrl = plugin.rewriteRootURL(rootUrl, responseURL);
                 }
+                if (sceneFilename === "") {
+                    if (sceneFilename === "") {
+                        rootUrl = _this._StripFilenameFromRootUrl(rootUrl);
+                    }
+                }
                 if (plugin.importMesh) {
                     var syncedPlugin = plugin;
                     var meshes = new Array();
@@ -57919,6 +57937,7 @@ var BABYLON;
         * @param onError a callback with the scene, a message, and possibly an exception when import fails
         */
         SceneLoader.Append = function (rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {
+            var _this = this;
             if (onSuccess === void 0) { onSuccess = null; }
             if (onProgress === void 0) { onProgress = null; }
             if (onError === void 0) { onError = null; }
@@ -57967,6 +57986,9 @@ var BABYLON;
                 scene._removePendingData(loadingToken);
             };
             return SceneLoader._loadData(rootUrl, sceneFilename, scene, function (plugin, data, responseURL) {
+                if (sceneFilename === "") {
+                    rootUrl = _this._StripFilenameFromRootUrl(rootUrl);
+                }
                 if (plugin.load) {
                     var syncedPlugin = plugin;
                     if (!syncedPlugin.load(scene, data, rootUrl, errorHandler)) {
@@ -57989,6 +58011,14 @@ var BABYLON;
                 }
             }, progressHandler, errorHandler, disposeHandler, pluginExtension);
         };
+        SceneLoader._StripFilenameFromRootUrl = function (rootUrl) {
+            // We need to strip the filename off from the rootUrl
+            var lastSlash = rootUrl.lastIndexOf("/");
+            if (lastSlash > -1) {
+                rootUrl = rootUrl.substr(0, lastSlash + 1);
+            }
+            return rootUrl;
+        };
         SceneLoader.LoadAssetContainer = function (rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {
             if (onSuccess === void 0) { onSuccess = null; }
             if (onProgress === void 0) { onProgress = null; }

+ 32 - 2
dist/preview release/customConfigurations/minimalGLTFViewer/es6.js

@@ -15160,8 +15160,11 @@ var BABYLON;
             this._pivotMatrix = matrix.clone();
             this._cache.pivotMatrixUpdated = true;
             this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;
-            if (this._postMultiplyPivotMatrix) {
-                this._pivotMatrixInverse = BABYLON.Matrix.Invert(matrix);
+            if (!this._pivotMatrixInverse) {
+                this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
+            }
+            else {
+                this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
             }
             return this;
         };
@@ -15340,6 +15343,12 @@ var BABYLON;
             this._pivotMatrix.m[12] = -point.x;
             this._pivotMatrix.m[13] = -point.y;
             this._pivotMatrix.m[14] = -point.z;
+            if (!this._pivotMatrixInverse) {
+                this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
+            }
+            else {
+                this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
+            }
             this._cache.pivotMatrixUpdated = true;
             return this;
         };
@@ -15712,6 +15721,9 @@ var BABYLON;
             this._afterComputeWorldMatrix();
             // Absolute position
             this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);
+            if (this._pivotMatrixInverse) {
+                BABYLON.Vector3.TransformCoordinatesToRef(this._absolutePosition, this._pivotMatrixInverse, this._absolutePosition);
+            }
             // Callbacks
             this.onAfterWorldMatrixUpdateObservable.notifyObservers(this);
             if (!this._poseMatrix) {
@@ -57811,6 +57823,7 @@ var BABYLON;
         * @param onError a callback with the scene, a message, and possibly an exception when import fails
         */
         SceneLoader.ImportMesh = function (meshNames, rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {
+            var _this = this;
             if (onSuccess === void 0) { onSuccess = null; }
             if (onProgress === void 0) { onProgress = null; }
             if (onError === void 0) { onError = null; }
@@ -57859,6 +57872,11 @@ var BABYLON;
                 if (plugin.rewriteRootURL) {
                     rootUrl = plugin.rewriteRootURL(rootUrl, responseURL);
                 }
+                if (sceneFilename === "") {
+                    if (sceneFilename === "") {
+                        rootUrl = _this._StripFilenameFromRootUrl(rootUrl);
+                    }
+                }
                 if (plugin.importMesh) {
                     var syncedPlugin = plugin;
                     var meshes = new Array();
@@ -57905,6 +57923,7 @@ var BABYLON;
         * @param onError a callback with the scene, a message, and possibly an exception when import fails
         */
         SceneLoader.Append = function (rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {
+            var _this = this;
             if (onSuccess === void 0) { onSuccess = null; }
             if (onProgress === void 0) { onProgress = null; }
             if (onError === void 0) { onError = null; }
@@ -57953,6 +57972,9 @@ var BABYLON;
                 scene._removePendingData(loadingToken);
             };
             return SceneLoader._loadData(rootUrl, sceneFilename, scene, function (plugin, data, responseURL) {
+                if (sceneFilename === "") {
+                    rootUrl = _this._StripFilenameFromRootUrl(rootUrl);
+                }
                 if (plugin.load) {
                     var syncedPlugin = plugin;
                     if (!syncedPlugin.load(scene, data, rootUrl, errorHandler)) {
@@ -57975,6 +57997,14 @@ var BABYLON;
                 }
             }, progressHandler, errorHandler, disposeHandler, pluginExtension);
         };
+        SceneLoader._StripFilenameFromRootUrl = function (rootUrl) {
+            // We need to strip the filename off from the rootUrl
+            var lastSlash = rootUrl.lastIndexOf("/");
+            if (lastSlash > -1) {
+                rootUrl = rootUrl.substr(0, lastSlash + 1);
+            }
+            return rootUrl;
+        };
         SceneLoader.LoadAssetContainer = function (rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {
             if (onSuccess === void 0) { onSuccess = null; }
             if (onProgress === void 0) { onProgress = null; }

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

@@ -15160,8 +15160,11 @@ var BABYLON;
             this._pivotMatrix = matrix.clone();
             this._cache.pivotMatrixUpdated = true;
             this._postMultiplyPivotMatrix = postMultiplyPivotMatrix;
-            if (this._postMultiplyPivotMatrix) {
-                this._pivotMatrixInverse = BABYLON.Matrix.Invert(matrix);
+            if (!this._pivotMatrixInverse) {
+                this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
+            }
+            else {
+                this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
             }
             return this;
         };
@@ -15340,6 +15343,12 @@ var BABYLON;
             this._pivotMatrix.m[12] = -point.x;
             this._pivotMatrix.m[13] = -point.y;
             this._pivotMatrix.m[14] = -point.z;
+            if (!this._pivotMatrixInverse) {
+                this._pivotMatrixInverse = BABYLON.Matrix.Invert(this._pivotMatrix);
+            }
+            else {
+                this._pivotMatrix.invertToRef(this._pivotMatrixInverse);
+            }
             this._cache.pivotMatrixUpdated = true;
             return this;
         };
@@ -15712,6 +15721,9 @@ var BABYLON;
             this._afterComputeWorldMatrix();
             // Absolute position
             this._absolutePosition.copyFromFloats(this._worldMatrix.m[12], this._worldMatrix.m[13], this._worldMatrix.m[14]);
+            if (this._pivotMatrixInverse) {
+                BABYLON.Vector3.TransformCoordinatesToRef(this._absolutePosition, this._pivotMatrixInverse, this._absolutePosition);
+            }
             // Callbacks
             this.onAfterWorldMatrixUpdateObservable.notifyObservers(this);
             if (!this._poseMatrix) {
@@ -58017,6 +58029,7 @@ var BABYLON;
         * @param onError a callback with the scene, a message, and possibly an exception when import fails
         */
         SceneLoader.ImportMesh = function (meshNames, rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {
+            var _this = this;
             if (onSuccess === void 0) { onSuccess = null; }
             if (onProgress === void 0) { onProgress = null; }
             if (onError === void 0) { onError = null; }
@@ -58065,6 +58078,11 @@ var BABYLON;
                 if (plugin.rewriteRootURL) {
                     rootUrl = plugin.rewriteRootURL(rootUrl, responseURL);
                 }
+                if (sceneFilename === "") {
+                    if (sceneFilename === "") {
+                        rootUrl = _this._StripFilenameFromRootUrl(rootUrl);
+                    }
+                }
                 if (plugin.importMesh) {
                     var syncedPlugin = plugin;
                     var meshes = new Array();
@@ -58111,6 +58129,7 @@ var BABYLON;
         * @param onError a callback with the scene, a message, and possibly an exception when import fails
         */
         SceneLoader.Append = function (rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {
+            var _this = this;
             if (onSuccess === void 0) { onSuccess = null; }
             if (onProgress === void 0) { onProgress = null; }
             if (onError === void 0) { onError = null; }
@@ -58159,6 +58178,9 @@ var BABYLON;
                 scene._removePendingData(loadingToken);
             };
             return SceneLoader._loadData(rootUrl, sceneFilename, scene, function (plugin, data, responseURL) {
+                if (sceneFilename === "") {
+                    rootUrl = _this._StripFilenameFromRootUrl(rootUrl);
+                }
                 if (plugin.load) {
                     var syncedPlugin = plugin;
                     if (!syncedPlugin.load(scene, data, rootUrl, errorHandler)) {
@@ -58181,6 +58203,14 @@ var BABYLON;
                 }
             }, progressHandler, errorHandler, disposeHandler, pluginExtension);
         };
+        SceneLoader._StripFilenameFromRootUrl = function (rootUrl) {
+            // We need to strip the filename off from the rootUrl
+            var lastSlash = rootUrl.lastIndexOf("/");
+            if (lastSlash > -1) {
+                rootUrl = rootUrl.substr(0, lastSlash + 1);
+            }
+            return rootUrl;
+        };
         SceneLoader.LoadAssetContainer = function (rootUrl, sceneFilename, scene, onSuccess, onProgress, onError, pluginExtension) {
             if (onSuccess === void 0) { onSuccess = null; }
             if (onProgress === void 0) { onProgress = null; }

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 16 - 16
dist/preview release/viewer/babylon.viewer.js


+ 21 - 0
src/Loading/babylon.sceneLoader.ts

@@ -336,6 +336,12 @@
                     rootUrl = plugin.rewriteRootURL(rootUrl, responseURL);
                 }
 
+                if (sceneFilename === "") {
+                    if (sceneFilename === "") {
+                        rootUrl = this._StripFilenameFromRootUrl(rootUrl);
+                    }
+                }
+
                 if ((<any>plugin).importMesh) {
                     var syncedPlugin = <ISceneLoaderPlugin>plugin;
                     var meshes = new Array<AbstractMesh>();
@@ -434,6 +440,10 @@
             };
 
             return SceneLoader._loadData(rootUrl, sceneFilename, scene, (plugin, data, responseURL) => {
+                if (sceneFilename === "") {
+                    rootUrl = this._StripFilenameFromRootUrl(rootUrl);
+                }
+
                 if ((<any>plugin).load) {
                     var syncedPlugin = <ISceneLoaderPlugin>plugin;
                     if (!syncedPlugin.load(scene, data, rootUrl, errorHandler)) {
@@ -457,6 +467,17 @@
                 }
             }, progressHandler, errorHandler, disposeHandler, pluginExtension);
         }
+
+        private static _StripFilenameFromRootUrl(rootUrl: string): string {
+            // We need to strip the filename off from the rootUrl
+            let lastSlash = rootUrl.lastIndexOf("/");
+
+            if (lastSlash > -1) {
+                rootUrl = rootUrl.substr(0, lastSlash + 1);
+            }
+
+            return rootUrl;
+        }
         
         public static LoadAssetContainer(
             rootUrl: string,