Skip to content

Commit

Permalink
#8962 fixes glTf animations in tileset
Browse files Browse the repository at this point in the history
  • Loading branch information
ErixenCruz committed Jun 22, 2020
1 parent 23111a7 commit e1ac264
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 6 additions & 0 deletions Source/Scene/Batched3DModel3DTileContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import Cesium3DTileFeatureTable from "./Cesium3DTileFeatureTable.js";
import ClassificationModel from "./ClassificationModel.js";
import Model from "./Model.js";
import ModelUtility from "./ModelUtility.js";
import ModelAnimationLoop from "./ModelAnimationLoop.js";

/**
* Represents the contents of a
Expand Down Expand Up @@ -432,6 +433,11 @@ function initialize(content, arrayBuffer, byteOffset) {
sphericalHarmonicCoefficients: tileset.sphericalHarmonicCoefficients,
specularEnvironmentMaps: tileset.specularEnvironmentMaps,
});
content._model.readyPromise.then(function (model) {
model.activeAnimations.addAll({
loop: ModelAnimationLoop.REPEAT,
});
});
} else {
// This transcodes glTF to an internal representation for geometry so we can take advantage of the re-batching of vector data.
// For a list of limitations on the input glTF, see the documentation for classificationType of Cesium3DTileset.
Expand Down
13 changes: 10 additions & 3 deletions Source/Scene/ModelInstanceCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import ModelInstance from "./ModelInstance.js";
import ModelUtility from "./ModelUtility.js";
import SceneMode from "./SceneMode.js";
import ShadowMode from "./ShadowMode.js";
import ModelAnimationLoop from "./ModelAnimationLoop.js";

var LoadState = {
NEEDS_LOAD: 0,
Expand Down Expand Up @@ -997,9 +998,15 @@ ModelInstanceCollection.prototype.update = function (frameState) {
this._instancingSupported = context.instancedArrays;
createModel(this, context);
var that = this;
this._model.readyPromise.otherwise(function (error) {
that._state = LoadState.FAILED;
that._readyPromise.reject(error);
this._model.readyPromise.then(function (model) {
model.activeAnimations
.addAll({
loop: ModelAnimationLoop.REPEAT,
})
.otherwise(function (error) {
that._state = LoadState.FAILED;
that._readyPromise.reject(error);
});
});
}

Expand Down

0 comments on commit e1ac264

Please sign in to comment.