|
@@ -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; }
|