Comments (1)
Shouldn't be a problem. You just need to resolve the #include
dependencies. For that you can do it locally, so before you bundle you regl app. For that depends on what you are using, there is a vite plugin, webpack and esbuild that support's it.
The other way to do it is dynamically when loading the shaders (it's slower and depends on https://lygia.xyz server) for it add this to your HTML (note this is the way P5.js examples for LYGIA are working):
<!-- as a JavaScript source -->
<script src="https://lygia.xyz/resolve.js"></script>
<!-- Or as a ES6 module -->
<script type="module">
import resolveLygia from "https://lygia.xyz/resolve.esm.js"
</script>
And then in JS when loading a shader as a string call resolveLygia()
functions which return a string resolved:
// 1. FIRST
// Sync resolver, one include at a time
vertSource = resolveLygia(vertSource);
fragSource = resolveLygia(fragSource);
// OR.
// ASync resolver, all includes in parallel calls
vertSource = resolveLygiaAsync(vertSource);
fragSource = resolveLygiaAsync(fragSource);
// 2. SECOND
// Use the resolved source code
shdr = createShader(vertSource, fragSource);
If all this fail, you can drag&drop a shader file (.glsl, .frag, .vert) with dependencies to #include "lygia/something/something.glsl"
and will return it (will automatically download on your computer) with all dependencies resolved.
from lygia.
Related Issues (20)
- Can't use mixbox within Unity. HOT 1
- Error when using gaussianBlur HOT 2
- typo in greaterThan.hlsl wont compile HOT 1
- [Unity] - Delete Lygia.asmdef HOT 1
- discord server link expirred HOT 2
- OKLAB conversions to/from RGB are actually linear sRGB HOT 3
- glsl shader output threshold (question) HOT 2
- Return types are not always clear HOT 2
- f0 parameter of a PBR material HOT 5
- Shadows on Safari - p5 tested HOT 2
- How to use LYGIA locally HOT 1
- Triangular tiles - triTile HOT 2
- psrdnoise HOT 6
- Update NPM package? HOT 2
- Shader Error: "sample: Illegal use of reserved word on WebGL 2.0"
- compatibility with ogl HOT 4
- A new integration example HOT 1
- Add gear curve SDF?
- Koch curve? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lygia.