|
@@ -20704,7 +20704,7 @@ var BABYLON;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
// Animations
|
|
// Animations
|
|
- var deltaTime = Math.max(Scene.MinDeltaTime, Math.min(this._engine.getDeltaTime(), Scene.MaxDeltaTime));
|
|
|
|
|
|
+ var deltaTime = this.useConstantAnimationDeltaTime ? 16 : Math.max(Scene.MinDeltaTime, Math.min(this._engine.getDeltaTime(), Scene.MaxDeltaTime));
|
|
this._animationRatio = deltaTime * (60.0 / 1000.0);
|
|
this._animationRatio = deltaTime * (60.0 / 1000.0);
|
|
this._animate();
|
|
this._animate();
|
|
this.onAfterAnimationsObservable.notifyObservers(this);
|
|
this.onAfterAnimationsObservable.notifyObservers(this);
|
|
@@ -79644,27 +79644,63 @@ var BABYLON;
|
|
(function (BABYLON) {
|
|
(function (BABYLON) {
|
|
var GLTFLoaderCoordinateSystemMode;
|
|
var GLTFLoaderCoordinateSystemMode;
|
|
(function (GLTFLoaderCoordinateSystemMode) {
|
|
(function (GLTFLoaderCoordinateSystemMode) {
|
|
- // Automatically convert the glTF right-handed data to the appropriate system based on the current coordinate system mode of the scene (scene.useRightHandedSystem).
|
|
|
|
- // NOTE: When scene.useRightHandedSystem is false, an additional transform will be added to the root to transform the data from right-handed to left-handed.
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Automatically convert the glTF right-handed data to the appropriate system based on the current coordinate system mode of the scene.
|
|
|
|
+ */
|
|
GLTFLoaderCoordinateSystemMode[GLTFLoaderCoordinateSystemMode["AUTO"] = 0] = "AUTO";
|
|
GLTFLoaderCoordinateSystemMode[GLTFLoaderCoordinateSystemMode["AUTO"] = 0] = "AUTO";
|
|
- // The glTF right-handed data is not transformed in any form and is loaded directly.
|
|
|
|
- GLTFLoaderCoordinateSystemMode[GLTFLoaderCoordinateSystemMode["PASS_THROUGH"] = 1] = "PASS_THROUGH";
|
|
|
|
- // Sets the useRightHandedSystem flag on the scene.
|
|
|
|
- GLTFLoaderCoordinateSystemMode[GLTFLoaderCoordinateSystemMode["FORCE_RIGHT_HANDED"] = 2] = "FORCE_RIGHT_HANDED";
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Sets the useRightHandedSystem flag on the scene.
|
|
|
|
+ */
|
|
|
|
+ GLTFLoaderCoordinateSystemMode[GLTFLoaderCoordinateSystemMode["FORCE_RIGHT_HANDED"] = 1] = "FORCE_RIGHT_HANDED";
|
|
})(GLTFLoaderCoordinateSystemMode = BABYLON.GLTFLoaderCoordinateSystemMode || (BABYLON.GLTFLoaderCoordinateSystemMode = {}));
|
|
})(GLTFLoaderCoordinateSystemMode = BABYLON.GLTFLoaderCoordinateSystemMode || (BABYLON.GLTFLoaderCoordinateSystemMode = {}));
|
|
|
|
+ var GLTFLoaderAnimationStartMode;
|
|
|
|
+ (function (GLTFLoaderAnimationStartMode) {
|
|
|
|
+ /**
|
|
|
|
+ * No animation will start.
|
|
|
|
+ */
|
|
|
|
+ GLTFLoaderAnimationStartMode[GLTFLoaderAnimationStartMode["NONE"] = 0] = "NONE";
|
|
|
|
+ /**
|
|
|
|
+ * The first animation will start.
|
|
|
|
+ */
|
|
|
|
+ GLTFLoaderAnimationStartMode[GLTFLoaderAnimationStartMode["FIRST"] = 1] = "FIRST";
|
|
|
|
+ /**
|
|
|
|
+ * All animations will start.
|
|
|
|
+ */
|
|
|
|
+ GLTFLoaderAnimationStartMode[GLTFLoaderAnimationStartMode["ALL"] = 2] = "ALL";
|
|
|
|
+ })(GLTFLoaderAnimationStartMode = BABYLON.GLTFLoaderAnimationStartMode || (BABYLON.GLTFLoaderAnimationStartMode = {}));
|
|
var GLTFFileLoader = /** @class */ (function () {
|
|
var GLTFFileLoader = /** @class */ (function () {
|
|
function GLTFFileLoader() {
|
|
function GLTFFileLoader() {
|
|
- // V2 options
|
|
|
|
|
|
+ // #endregion
|
|
|
|
+ // #region V2 options
|
|
|
|
+ /**
|
|
|
|
+ * The coordinate system mode (AUTO, FORCE_RIGHT_HANDED).
|
|
|
|
+ */
|
|
this.coordinateSystemMode = GLTFLoaderCoordinateSystemMode.AUTO;
|
|
this.coordinateSystemMode = GLTFLoaderCoordinateSystemMode.AUTO;
|
|
|
|
+ /**
|
|
|
|
+ * The animation start mode (NONE, FIRST, ALL).
|
|
|
|
+ */
|
|
|
|
+ this.animationStartMode = GLTFLoaderAnimationStartMode.FIRST;
|
|
|
|
+ /**
|
|
|
|
+ * Set to true to compile materials before raising the success callback.
|
|
|
|
+ */
|
|
this.compileMaterials = false;
|
|
this.compileMaterials = false;
|
|
- this.compileShadowGenerators = false;
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Set to true to also compile materials with clip planes.
|
|
|
|
+ */
|
|
this.useClipPlane = false;
|
|
this.useClipPlane = false;
|
|
|
|
+ /**
|
|
|
|
+ * Set to true to compile shadow generators before raising the success callback.
|
|
|
|
+ */
|
|
|
|
+ this.compileShadowGenerators = false;
|
|
this.name = "gltf";
|
|
this.name = "gltf";
|
|
this.extensions = {
|
|
this.extensions = {
|
|
".gltf": { isBinary: false },
|
|
".gltf": { isBinary: false },
|
|
".glb": { isBinary: true }
|
|
".glb": { isBinary: true }
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
+ /**
|
|
|
|
+ * Disposes the loader, releases resources during load, and cancels any outstanding requests.
|
|
|
|
+ */
|
|
GLTFFileLoader.prototype.dispose = function () {
|
|
GLTFFileLoader.prototype.dispose = function () {
|
|
if (this._loader) {
|
|
if (this._loader) {
|
|
this._loader.dispose();
|
|
this._loader.dispose();
|
|
@@ -79856,9 +79892,10 @@ var BABYLON;
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
};
|
|
};
|
|
- // V1 options
|
|
|
|
- GLTFFileLoader.HomogeneousCoordinates = false;
|
|
|
|
|
|
+ // #endregion
|
|
|
|
+ // #region V1 options
|
|
GLTFFileLoader.IncrementalLoading = true;
|
|
GLTFFileLoader.IncrementalLoading = true;
|
|
|
|
+ GLTFFileLoader.HomogeneousCoordinates = false;
|
|
return GLTFFileLoader;
|
|
return GLTFFileLoader;
|
|
}());
|
|
}());
|
|
BABYLON.GLTFFileLoader = GLTFFileLoader;
|
|
BABYLON.GLTFFileLoader = GLTFFileLoader;
|
|
@@ -82286,21 +82323,38 @@ var BABYLON;
|
|
}
|
|
}
|
|
return skeletons;
|
|
return skeletons;
|
|
};
|
|
};
|
|
- GLTFLoader.prototype._getAnimationTargets = function () {
|
|
|
|
- var targets = new Array();
|
|
|
|
|
|
+ GLTFLoader.prototype._startAnimations = function () {
|
|
var animations = this._gltf.animations;
|
|
var animations = this._gltf.animations;
|
|
- if (animations) {
|
|
|
|
- for (var _i = 0, animations_1 = animations; _i < animations_1.length; _i++) {
|
|
|
|
- var animation = animations_1[_i];
|
|
|
|
- targets.push.apply(targets, animation.targets);
|
|
|
|
- }
|
|
|
|
|
|
+ if (!animations) {
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
- return targets;
|
|
|
|
- };
|
|
|
|
- GLTFLoader.prototype._startAnimations = function () {
|
|
|
|
- for (var _i = 0, _a = this._getAnimationTargets(); _i < _a.length; _i++) {
|
|
|
|
- var target = _a[_i];
|
|
|
|
- this._babylonScene.beginAnimation(target, 0, Number.MAX_VALUE, true);
|
|
|
|
|
|
+ switch (this._parent.animationStartMode) {
|
|
|
|
+ case BABYLON.GLTFLoaderAnimationStartMode.NONE: {
|
|
|
|
+ // do nothing
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ case BABYLON.GLTFLoaderAnimationStartMode.FIRST: {
|
|
|
|
+ var animation = animations[0];
|
|
|
|
+ for (var _i = 0, _a = animation.targets; _i < _a.length; _i++) {
|
|
|
|
+ var target = _a[_i];
|
|
|
|
+ this._babylonScene.beginAnimation(target, 0, Number.MAX_VALUE, true);
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ case BABYLON.GLTFLoaderAnimationStartMode.ALL: {
|
|
|
|
+ for (var _b = 0, animations_1 = animations; _b < animations_1.length; _b++) {
|
|
|
|
+ var animation = animations_1[_b];
|
|
|
|
+ for (var _c = 0, _d = animation.targets; _c < _d.length; _c++) {
|
|
|
|
+ var target = _d[_c];
|
|
|
|
+ this._babylonScene.beginAnimation(target, 0, Number.MAX_VALUE, true);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ default: {
|
|
|
|
+ BABYLON.Tools.Error("Invalid animation start mode " + this._parent.animationStartMode);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
};
|
|
};
|
|
GLTFLoader.prototype._loadDefaultScene = function (nodeNames) {
|
|
GLTFLoader.prototype._loadDefaultScene = function (nodeNames) {
|
|
@@ -82311,6 +82365,7 @@ var BABYLON;
|
|
this._loadScene("#/scenes/" + scene.index, scene, nodeNames);
|
|
this._loadScene("#/scenes/" + scene.index, scene, nodeNames);
|
|
};
|
|
};
|
|
GLTFLoader.prototype._loadScene = function (context, scene, nodeNames) {
|
|
GLTFLoader.prototype._loadScene = function (context, scene, nodeNames) {
|
|
|
|
+ var _this = this;
|
|
this._rootNode = { babylonMesh: new BABYLON.Mesh("__root__", this._babylonScene) };
|
|
this._rootNode = { babylonMesh: new BABYLON.Mesh("__root__", this._babylonScene) };
|
|
switch (this._parent.coordinateSystemMode) {
|
|
switch (this._parent.coordinateSystemMode) {
|
|
case BABYLON.GLTFLoaderCoordinateSystemMode.AUTO: {
|
|
case BABYLON.GLTFLoaderCoordinateSystemMode.AUTO: {
|
|
@@ -82321,10 +82376,6 @@ var BABYLON;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- case BABYLON.GLTFLoaderCoordinateSystemMode.PASS_THROUGH: {
|
|
|
|
- // do nothing
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
case BABYLON.GLTFLoaderCoordinateSystemMode.FORCE_RIGHT_HANDED: {
|
|
case BABYLON.GLTFLoaderCoordinateSystemMode.FORCE_RIGHT_HANDED: {
|
|
this._babylonScene.useRightHandedSystem = true;
|
|
this._babylonScene.useRightHandedSystem = true;
|
|
break;
|
|
break;
|
|
@@ -82350,6 +82401,7 @@ var BABYLON;
|
|
this._traverseNodes(context, nodeIndices, function (node) {
|
|
this._traverseNodes(context, nodeIndices, function (node) {
|
|
if (nodeNames.indexOf(node.name) !== -1) {
|
|
if (nodeNames.indexOf(node.name) !== -1) {
|
|
filteredNodeIndices_1.push(node.index);
|
|
filteredNodeIndices_1.push(node.index);
|
|
|
|
+ node.parent = _this._rootNode;
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
@@ -83574,10 +83626,6 @@ var BABYLON;
|
|
};
|
|
};
|
|
GLTFLoader.prototype._compileMaterialAsync = function (babylonMaterial, babylonMesh, onSuccess) {
|
|
GLTFLoader.prototype._compileMaterialAsync = function (babylonMaterial, babylonMesh, onSuccess) {
|
|
var _this = this;
|
|
var _this = this;
|
|
- if (!this._parent.compileMaterials) {
|
|
|
|
- onSuccess();
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
if (this._parent.useClipPlane) {
|
|
if (this._parent.useClipPlane) {
|
|
babylonMaterial.forceCompilation(babylonMesh, function () {
|
|
babylonMaterial.forceCompilation(babylonMesh, function () {
|
|
babylonMaterial.forceCompilation(babylonMesh, function () {
|
|
babylonMaterial.forceCompilation(babylonMesh, function () {
|