Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/riccardoscalco/glsl-rectangular-function

Glsl implementation of the rectangular function.
https://github.com/riccardoscalco/glsl-rectangular-function

glsl glslify math rectangular step webgl

Last synced: 2 days ago
JSON representation

Glsl implementation of the rectangular function.

Awesome Lists containing this project

README

        

# glsl-rectangular-function

Glsl implementation of the [rectangular function](https://en.wikipedia.org/wiki/Rectangular_function).

## Install

```sh
npm install glsl-rectangular-function
```

## Usage

```glsl
#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);
}
```