From 01f7bacce270b81239b83a693d1e4e6419752fc0 Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Wed, 4 Apr 2018 11:41:48 -0400 Subject: [PATCH 1/3] Added missing functions to ConstantSpline --- Source/Scene/ModelAnimationCache.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/Scene/ModelAnimationCache.js b/Source/Scene/ModelAnimationCache.js index 5a7c55ab800b..6f37b50a6768 100644 --- a/Source/Scene/ModelAnimationCache.js +++ b/Source/Scene/ModelAnimationCache.js @@ -114,6 +114,12 @@ define([ ConstantSpline.prototype.evaluate = function(time, result) { return this._value; }; + ConstantSpline.prototype.wrapTime = function(time) { + return 0.0; + }; + ConstantSpline.prototype.clampTime = function(time) { + return 0.0; + }; ModelAnimationCache.getAnimationSpline = function(model, animationName, animation, samplerName, sampler, input, path, output) { var key = getAnimationSplineKey(model, animationName, samplerName); From 221df42ec8e31e85888b34349f46c06bd1677b36 Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Wed, 25 Apr 2018 15:17:38 -0400 Subject: [PATCH 2/3] Added test --- Specs/Scene/ModelSpec.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Specs/Scene/ModelSpec.js b/Specs/Scene/ModelSpec.js index fa5dd7b1f87e..86e819330104 100644 --- a/Specs/Scene/ModelSpec.js +++ b/Specs/Scene/ModelSpec.js @@ -1605,6 +1605,34 @@ defineSuite([ expect(animations.update()).toEqual(false); }); + it('animates a single keyframe', function() { + return Resource.fetchJson(animBoxesUrl).then(function(gltf) { + gltf.accessors['animAccessor_0'].count = 1; + gltf.accessors['animAccessor_1'].count = 1; + + return loadModelJson(gltf).then(function(m) { + m.show = true; + var node = m.getNode('inner_box'); + var time = JulianDate.fromDate(new Date('January 1, 2014 12:00:00 UTC')); + var animations = m.activeAnimations; + animations.add({ + name : 'animation_0', + startTime : time + }); + + expect(node.matrix).toEqual(Matrix4.IDENTITY); + var previousMatrix = Matrix4.clone(node.matrix); + + for (var i = 1; i < 4; ++i) { + var t = JulianDate.addSeconds(time, i, new JulianDate()); + scene.renderForSpecs(t); + expect(node.matrix).toEqual(previousMatrix); + } + primitives.remove(m); + }); + }); + }); + /////////////////////////////////////////////////////////////////////////// it('renders riggedFigure without animation', function() { From de04ff466441d9e18ed5ad45db6254fc4fc64ac8 Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Wed, 25 Apr 2018 15:19:00 -0400 Subject: [PATCH 3/3] Updated CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 117594f4d835..8d4469258581 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -29,6 +29,7 @@ Change Log * Fixed crash bug in PolylineCollection when a polyline was updated and removed at the same time. [#6455](https://github.com/AnalyticalGraphicsInc/cesium/pull/6455) * Fixed Imagery Layers Texture Filters Sandcastle example. [#6472](https://github.com/AnalyticalGraphicsInc/cesium/pull/6472). * Fixed a bug causing Cesium 3D Tilesets to not clip properly when tiles were unloaded and reloaded. [#6484](https://github.com/AnalyticalGraphicsInc/cesium/issues/6484) +* Fixed crash when animating a glTF model with a single keyframe. [#6422](https://github.com/AnalyticalGraphicsInc/cesium/pull/6422) ### 1.44 - 2018-04-02