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 clamped and asynchronous loop handling for multiple animations #6004

Merged
merged 3 commits into from
Nov 28, 2017

Conversation

likangning93
Copy link
Contributor

Fixes #5694

@cesium-concierge
Copy link

Signed CLA is on file.

@likangning93, thanks for the pull request! Maintainers, we have a signed CLA from @likangning93, so you can review this at any time.


I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome.

🌍 🌎 🌏

Copy link
Contributor

@lilleyse lilleyse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Tested on a few different models with no issues.

* @function
*
* @param {Number} time The time.
* @return {Number} the time, wrapped around to the updated animation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For all these change to The time

*/
Spline.prototype.wrapTime = function(time) {
//>>includeStart('debug', pragmas.debug);
if (!defined(time)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Check.typeOf.number for these.

}
//>>includeEnd('debug');

// wrap
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and // clamp aren't needed.

@@ -179,6 +181,14 @@ define([
*/
runAnimations : createPropertyDescriptor('runAnimations'),

/**
* Gets or sets the boolean Property specifying if glTF animations should hold the last pose when no frames are specified.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency make sure that these descriptions are the same. This and above are slightly different.

return function(localAnimationTime) {
if (defined(spline)) {
runtimeNode[targetPath] = spline.evaluate(spline.clampTime(localAnimationTime), runtimeNode[targetPath]);
runtimeNode.dirtyNumber = model._maxDirtyNumber;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the two cases be an if-else in the same function? That way someone would be able to change the clampAnimation property dynamically. I don't think there would be much of a performance hit. this._clampAnimations could then become this.clampAnimations and be a public property.

@@ -7,6 +7,8 @@ Change Log
* Added ability to support touch event in Imagery Layers Split demo application. [#5948](https://github.com/AnalyticalGraphicsInc/cesium/pull/5948)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be simple enough to add to czml too. The only changes would be in CzmlDataSource.

CHANGES.md Outdated
@@ -7,6 +7,8 @@ Change Log
* Added ability to support touch event in Imagery Layers Split demo application. [#5948](https://github.com/AnalyticalGraphicsInc/cesium/pull/5948)
* Fixed `Invalid asm.js: Invalid member of stdlib` console error by recompiling crunch.js with latest emscripten toolchain. [#5847](https://github.com/AnalyticalGraphicsInc/cesium/issues/5847)
* Added CZML support for `polyline.depthFailMaterial`, `label.scaleByDistance`, `distanceDisplayCondition`, and `disableDepthTestDistance`. [#5986](https://github.com/AnalyticalGraphicsInc/cesium/pull/5986)
* Fixed a bug where models with animations of different lengths would cause an error. [#5694](https://github.com/AnalyticalGraphicsInc/cesium/issues/5694)
* Added a `clampAnimations` parameter to `Model`. Setting this to false allows different length animations to loop asynchronously.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also mention that clampAnimations is added to Entity.model.

@@ -326,6 +326,7 @@ define([
* @param {Boolean} [options.allowPicking=true] When <code>true</code>, each glTF mesh and primitive is pickable with {@link Scene#pick}.
* @param {Boolean} [options.incrementallyLoadTextures=true] Determine if textures may continue to stream in after the model is loaded.
* @param {Boolean} [options.asynchronous=true] Determines if model WebGL resource creation will be spread out over several frames or block until completion once all glTF files are loaded.
* @param {Boolean} [options.clampAnimations=true] Determines if the model's animations should hold a pose over frames where no keyframes are specified.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this parameter to Model.fromGltf as well.

@likangning93
Copy link
Contributor Author

@lilleyse updated!

@lilleyse
Copy link
Contributor

Looks good. I added a few tweaks in 8d458cb.

@lilleyse lilleyse merged commit cb632d8 into CesiumGS:master Nov 28, 2017
@lilleyse lilleyse deleted the multipleAnimations branch November 28, 2017 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants