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

Update Viewer on preUpdate instead of clock tick #7069

Merged
merged 4 commits into from
Sep 26, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions Source/Scene/Scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -3249,6 +3249,10 @@ define([
var us = context.uniformState;
var frameState = this._frameState;

// Update with previous frame's time, assuming that render is called before picking.
this._preUpdate.raiseEvent(this, frameState.time);
this._postUpdate.raiseEvent(this, frameState.time);

var view = this._defaultView;
this._view = view;

Expand Down
6 changes: 2 additions & 4 deletions Source/Widgets/Viewer/Viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to

var eventHelper = new EventHelper();

eventHelper.add(clock.onTick, Viewer.prototype._onTick, this);
eventHelper.add(scene.preUpdate, Viewer.prototype._onUpdate, this);
eventHelper.add(scene.morphStart, Viewer.prototype._clearTrackedObject, this);

// Selection Indicator
Expand Down Expand Up @@ -1586,9 +1586,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to
/**
* @private
*/
Viewer.prototype._onTick = function(clock) {
var time = clock.currentTime;

Viewer.prototype._onUpdate = function(scene, time) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we name this _onPreUpdate just so it's more obvious.

var isUpdated = this._dataSourceDisplay.update(time);
if (this._allowDataSourcesToSuspendAnimation) {
this._clockViewModel.canAnimate = isUpdated;
Expand Down