Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ricardomatias/esbuild-plugin-glsl-include
A plugin for esbuild to import local shader fragments via #include pragma from GLSL files with .glsl, .vert, .frag, .vs, .fs extensions.
https://github.com/ricardomatias/esbuild-plugin-glsl-include
esbuild glsl regl threejs webgl
Last synced: 4 months ago
JSON representation
A plugin for esbuild to import local shader fragments via #include pragma from GLSL files with .glsl, .vert, .frag, .vs, .fs extensions.
- Host: GitHub
- URL: https://github.com/ricardomatias/esbuild-plugin-glsl-include
- Owner: ricardomatias
- License: mit
- Created: 2021-09-07T15:06:14.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-09-07T17:20:08.000Z (over 3 years ago)
- Last Synced: 2024-09-29T05:23:21.875Z (4 months ago)
- Topics: esbuild, glsl, regl, threejs, webgl
- Language: JavaScript
- Homepage:
- Size: 205 KB
- Stars: 14
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# esbuild-plugin-glsl-include
A plugin for [esbuild](https://esbuild.github.io/) to import local shader fragments via `#include` pragma from GLSL files with `.glsl, .vert, .frag, .vs, .fs` extensions.
## Installation
```sh
npm install -D esbuild-plugin-glsl-include
```## Usage
```js
import { build } from 'esbuild';
import { glsl } from 'esbuild-plugin-glsl-include';build({
entryPoints: ['src/app.js'],
outfile: 'build/index.js',
bundle: true,
plugins: [
glsl()
]
}).catch(() => process.exit(1));
```## Example GLSL
```glsl
precision mediump float;uniform sampler2D tex0;
uniform float uTime;varying vec2 v_texCoord0;
#include "checkers.glsl"
#include "noise/classic/3d.glsl"
#include "easings/cubic-in-out.glsl"void main() {
vec2 uv = v_texCoord0;
float n = perlin(vec3(uv * 2.5 + uTime * 0.01, uTime * 0.2)) * 0.5 + 0.5;float patt = checker(uv * easing(n), 6.0);
vec3 col = mix(vec3(0.173, 0.216, 0.278),vec3(0.792, 0.282, 0.478), vec3(patt)) * (n + 0.1);
gl_FragColor = vec4(col, 1.0);
}
```