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

Usage with lygia #41

Closed
bravokiloecho opened this issue Nov 14, 2022 · 3 comments
Closed

Usage with lygia #41

bravokiloecho opened this issue Nov 14, 2022 · 3 comments

Comments

@bravokiloecho
Copy link

Hello! I'm having using shader functions from lygia... It doesn't seem possible with glsify (as it's currently setup) to load shader parts with the #include method.

This vite GLSL loader looks promising and I tried to swap out your hot-shader-reload.js with the vite plugin, but I got an error when hot-reloading:

node:internal/errors:466
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined
    at utimes (node:fs:2000:10)
    at file:///Users/ben/Documents/personal-repos/fragment/node_modules/vite-plugin-glsl/src/watchShader.js:60:7

So it's clearly not as straightforward as a one-to-one replacement.

Do you think there's a way of getting #include to work in a shader (or any other means of loading in lygia files)?

@raphaelameaume
Copy link
Owner

Hello! Thanks for raising that issue and trying the vite GLSL loader! It's actually on the roadmap as I'm looking into lygia as well and thought it would be great to have that. I haven't had the time yet to put some work on it, and that error doesn't tell me much. I'll have a look at it!

@bravokiloecho
Copy link
Author

Ah that's great to hear! Thank you :)

You're right the error isn't super helpful! I think the plugin was working initially, it just threw that error when trying to hot reload...

@raphaelameaume
Copy link
Owner

The common-used #include directives (also used by Lygia) are now supported in shader files since https://github.com/raphaelameaume/fragment/releases/tag/v0.1.14

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

No branches or pull requests

2 participants