-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Use string templates(``) in example shaders #18524
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
Conversation
|
Related: #15506 Support for template literals (>93%, basically everywhere except IE11). As far as I know we already switched to template strings in src/. Seems like we should make the change in examples too. Or was there something holding this back previously? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
@yushijinhun Do you mind resolving the merge conflicts? I'd like to test the PR. https://raw.githack.com/yushijinhun/three.js/glsl/examples/index.html |
|
I don't think it's a good idea to implement template literals in |
Ah, fair point. We should wait until examples/js has been removed then. |
|
Yes... Sorry, closing this for now. |
|
@mrdoob Do you already have a point of time in mind until IE11 support will be stopped? |
|
I was actually thinking that we should add one legacy example that still works in IE11 (and point to it in the examples when js modules are not available). It's not only IE11, it's also KaiOS (which is stuck in an old version of Firefox): Today there were good news on that front though: |
We could (instead, or also) add a docs page "How to support outdated browsers" that gives a brief overview of bundling and transpiling. |
|
I agree with @looeee, here is an example of how the create-react-app team is doing it: https://github.com/facebook/create-react-app/tree/master/packages/react-app-polyfill Also we should move |
I like this idea since it allows the project to use more modern language features and APIs and still shows users how to produce a build than runs in (legacy) environments. |
|
Thanks but this obviously makes no sense now since the PR isn't merged anyway. Sorry. |
|
I can create a new PR when it's okay to introduce string templates, since it's definitely going to happen. BTW, if you are going to do transpiling, I think it's a good time to minify all GLSL code (not only those in .glsl.js files, but strings prefixed by |
Code is converted using yushijinhun/convert-shader with some manual fixes.
/* glsl */prefix is added, which should enable syntax highlighting (see Add syntax highlighting for glsl.js files #15473).