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

Make Cesium's shaders editable with the SpectorJS shader editor #8608

Merged
merged 5 commits into from
Mar 27, 2020

Conversation

kring
Copy link
Member

@kring kring commented Feb 12, 2020

Live, on-the-fly editing of shaders. Next best thing to an actual shader debugger.

shader-editor

I hacked up CesiumJS to make this work while I was working on the log depth stuff, and found it super useful. So I thought I'd clean it up slightly and make it an official feature.

I considered wrapping the SpectorJS-code in pragmas.debug, but it's pretty low impact so I decided against it in the end.

Fixes #5279

@cesium-concierge
Copy link

Thanks for the pull request @kring!

  • ✔️ Signed CLA found.
  • ❔ Unit tests were not updated.
    • Make sure you've updated tests to reflect your changes, added tests for any new code, and ran the code coverage tool.

Reviewers, don't forget to make sure that:

  • Cesium Viewer works.
  • Works in 2D/CV.
  • Works (or fails gracefully) in IE11.

@kring
Copy link
Member Author

kring commented Feb 12, 2020

By the way, requestRenderMode makes it slightly awkward to use the editor (you have to force Cesium to render again before the change is shown), so best to turn it off when you're editing shaders.

var vertexShaderText = options.vertexShaderText;
var fragmentShaderText = options.fragmentShaderText;

if (window.spector) {
Copy link
Contributor

Choose a reason for hiding this comment

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

While we don't do a good job of it everywhere, in general this should be typeof spector !== 'undefined' instead using window, since window doesn't exist in all contexts (workers/node/etc..) it's a more robust check for a global spector variable

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

@cesium-concierge
Copy link

Thanks again for your contribution @kring!

No one has commented on this pull request in 30 days. Maintainers, can you review, merge or close to keep things tidy?

I'm going to re-bump this in 30 days. If you'd like me to stop, just comment with @cesium-concierge stop. If you want me to start again, just delete the comment.

@lilleyse
Copy link
Contributor

lilleyse commented Mar 27, 2020

Works perfectly for me. I confirmed that shader changes work and errors get propagated correctly.

@lilleyse lilleyse merged commit 51485d2 into master Mar 27, 2020
@lilleyse lilleyse deleted the spector-editor branch March 27, 2020 03:10
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.

Evaluate SpectorJS
4 participants