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

Widget and viewer improvements #1674

Merged
merged 10 commits into from
May 5, 2014
Merged

Widget and viewer improvements #1674

merged 10 commits into from
May 5, 2014

Conversation

kring
Copy link
Member

@kring kring commented May 5, 2014

  • Add preRender and postRender events to CesiumWidget and mirror them in Viewer.
  • Make Viewer expose CesiumWidget's renderError event instead of creating its own.
  • Rename CesiumWidget.onRenderLoopError to renderLoopError. CHANGES.md says we did this in b23, but we lied.
  • Make viewerCesiumInspectorMixin use the postRender event instead of replacing the render loop entirely.

@pjcozzi
Copy link
Contributor

pjcozzi commented May 5, 2014

Why not put these events directly on Scene?

Given these new events, do we still need to allow custom render loops? Or given custom render loops, do we still need these events?

CC #648

@kring
Copy link
Member Author

kring commented May 5, 2014

Why not put these events directly on Scene?

I like that idea. It would be reasonable to move the renderLoopError event as well, right?

Given these new events, do we still need to allow custom render loops? Or given custom render loops, do we still need these events?

These events compose much better than custom render loops. My changes to viewerCesiumInspectorMixin.js are a good illustration of that, as are the changes that motivated this in the first place (coming soon). Can we now do without custom render loops? Maybe, but they give lots of flexibility at very little cost.

@pjcozzi
Copy link
Contributor

pjcozzi commented May 5, 2014

It would be reasonable to move the renderLoopError event as well, right?

Looks like it.

These events compose much better than custom render loops...

Sounds good.

@mramato
Copy link
Contributor

mramato commented May 5, 2014

@shunter and I have both talked about making changes like this for a while, so this all looks good to me. I agree with @pjcozzi recommendations so I'll wait for those changes to give this a complete look. Eventually we might want to get rid of Clock.onTick and replace it with Clock.timeChanged, but that can happen in another pull.

kring added 2 commits May 5, 2014 11:50
Also Viewer no longer has its own render loop, it just uses the one in
`CesiumWidget`.
@kring
Copy link
Member Author

kring commented May 5, 2014

This is ready. In addition to the changes discussed, I was able to remove the custom render loop from Viewer entirely. It just uses the CesiumWidget one now.

@pjcozzi
Copy link
Contributor

pjcozzi commented May 5, 2014

@mramato review and merge when ready.

* @param {Scene} scene The scene in which the render error occurred.
* @param {Error} error The error that occurred during rendering.
*/
CesiumWidget.prototype.handleRenderError = function(scene, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason this is public? We don't call it externally and I can't think of a reason as to why a user would either.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not anymore. Originally Viewer's render loop was going to call it, but then I got rid of Viewer's render loop. I'll clean it up.

if (!defined(time)) {
time = new JulianDate();
}
try {
Copy link
Contributor

Choose a reason for hiding this comment

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

try/catch causes optimizer bailouts in v8 for the entire function. factor out all this logic into a helper method to keep the scope of the try-catch as small as possible.

kring added 2 commits May 5, 2014 16:26
This way the try/catch won't disable optimization of the entire function.
@@ -328,20 +326,6 @@ define([
},

/**
* Gets the event that will be raised when an error is encountered during the default render loop.
* The widget instance and the generated exception are the only two parameters passed to the event handler.
* <code>useDefaultRenderLoop</code> will be set to false whenever an exception is generated and must
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be a good idea to move this documentation about useDefaultRenderLoop getting set to false somewhere else in this class.

@kring
Copy link
Member Author

kring commented May 5, 2014

Ready.

shunter added a commit that referenced this pull request May 5, 2014
…provements

Widget and viewer improvements
@shunter shunter merged commit 4273377 into master May 5, 2014
@shunter shunter deleted the widgetAndViewerImprovements branch May 5, 2014 21:28
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.

4 participants