glsl-rectangular-function

1.0.1 • Public • Published

glsl-rectangular-function

Glsl implementation of the rectangular function.

Install

npm install glsl-rectangular-function

Usage

#pragma glslify: rectangularFunction require(glsl-rectangular-function) 
 
void main() {
    vec2 p = gl_FragCoord.xy / resolution.xy;
 
    float center = 0.5;
    float width = 0.25;
    float y = rectangularFunction(p.x, center, width);
 
    gl_FragColor = vec4(vec3(y), 1.0);
}

Package Sidebar

Install

npm i glsl-rectangular-function

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

3.64 kB

Total Files

6

Last publish

Collaborators

  • riccardoscalco