Skip to content

Functions designed to avoid conditionals ported to glslify

License

Notifications You must be signed in to change notification settings

ayamflow/glsl-conditionals

 
 

Repository files navigation

glsl-conditionals experimental

Daniel Holden's functions designed to avoid conditionals in GLSL, available as a module for glslify.

Usage

NPM

// Comparisons
#pragma glslify: when_eq = require(glsl-conditionals/when_eq)
#pragma glslify: when_neq = require(glsl-conditionals/when_neq)

#pragma glslify: when_gt = require(glsl-conditionals/when_gt)
#pragma glslify: when_lt = require(glsl-conditionals/when_lt)

#pragma glslify: when_ge = require(glsl-conditionals/when_ge)
#pragma glslify: when_le = require(glsl-conditionals/when_le)

// Logical operators
#pragma glslify: when_and = require(glsl-conditionals/when_and)
#pragma glslify: when_or = require(glsl-conditionals/when_or)
#pragma glslify: when_xor = require(glsl-conditionals/when_xor)
#pragma glslify: when_not = require(glsl-conditionals/when_not)
attribute float x;

// ...

y += 5 * when_eq(x, 0)

License

MIT. See license file.

About

Functions designed to avoid conditionals ported to glslify

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • GLSL 100.0%