Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added missing functions to ConstantSpline #6422

Merged
merged 5 commits into from
Apr 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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