Skip to content

Commit

Permalink
Merge pull request #6422 from AnalyticalGraphicsInc/constant-spline
Browse files Browse the repository at this point in the history
Added missing functions to ConstantSpline
  • Loading branch information
emackey authored Apr 28, 2018
2 parents 5f56208 + bcf412d commit 3ef9dad
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Change Log
* `BingMapsImageryProvider` is no longer the default base imagery layer.
* `BingMapsGeocoderService` is no longer the default geocoder service.
* Cesium no longer ships with a demo Bing Maps API key.
* `ClippingPlaneCollection` now uses `ClippingPlane` objects instead of`Plane` objects. [#6498](https://github.com/AnalyticalGraphicsInc/cesium/pull/6498)
* `ClippingPlaneCollection` now uses `ClippingPlane` objects instead of`Plane` objects. [#6498](https://github.com/AnalyticalGraphicsInc/cesium/pull/6498)

##### Deprecated :hourglass_flowing_sand:
* `Particle.size`, `ParticleSystem.rate`, `ParticleSystem.lifeTime`, `ParticleSystem.life`, `ParticleSystem.minimumLife`, and `ParticleSystem.maximumLife` have been renamed to `Particle.imageSize`, `ParticleSystem.emissionRate`, `ParticleSystem.lifetime`, `ParticleSystem.particleLife`, `ParticleSystem.minimumParticleLife`, and `ParticleSystem.maximumParticleLife`. Use of the `size`, `rate`, `lifeTime`, `life`, `minimumLife`, and `maximumLife` parameters is deprecated and will be removed in Cesium 1.46.
Expand Down Expand Up @@ -49,6 +49,7 @@ Change Log
* Fixed a bug causing crashes when setting colors on un-pickable models. [$6442](https://github.com/AnalyticalGraphicsInc/cesium/issues/6442)
* Fix flicker when adding, removing, or modifying entities. [#3945](https://github.com/AnalyticalGraphicsInc/cesium/issues/3945)
* 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 crash when animating a glTF model with a single keyframe. [#6422](https://github.com/AnalyticalGraphicsInc/cesium/pull/6422)
* 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)
* Improved rendering of glTF models that don't contain normals with a temporary unlit shader workaround. [#6501](https://github.com/AnalyticalGraphicsInc/cesium/pull/6501)
Expand Down
6 changes: 6 additions & 0 deletions Source/Scene/ModelAnimationCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
28 changes: 28 additions & 0 deletions Specs/Scene/ModelSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1606,6 +1606,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() {
Expand Down

0 comments on commit 3ef9dad

Please sign in to comment.