LYGIA relies on #include "path/to/file.glsl"
which is defined by Khronos GLSL standard but it's up to the project developer to implement. Good news is that it's not that hard, it just requires a typical C-like MACRO pre-compiler, which is easy to implement with just basic string operations to resolve dependencies.
Here you can find some examples in different languages:
-
C#:
. GLSLIncludes a small utility to add the include feature to glsl by z0rg.
-
C++:
. VERA's routines for resolving GLSL dependencies.
-
Python:
-
JavaScript:
. vanilla JS (online resolver) This small file brings
resolveLygia()
which takes astring
orstring[]
and parses it, solving all the#include
dependencies into a singlestring
you can load on your shaders. It also has aresolveLygiaAsync()
version that resolves all the dependencies in parallel. Both support dependencies to previous versions of LYGIA by using this patternlygia/vX.X.X/...
on you dependency paths.. npm module (online resolver) by Eduardo Fossas. This is bring the same
resolveLygia()
andresolveLygiaAsync()
function but as a npm module.. vite glsl plugin (local bundle) by Ustym Ukhman. Imports
.glsl
local dependencies, or load inline shaders through vite.. esbuild glsl plugin (local bundle) by Ricardo Matias. Imports local
.glsl
dependencies through esbuild.. webpack glsl plugin (local bundle) by Ryan Grieve that imports local
.glsl
dependencies through webpack.