1.0.0 • Published 6 years ago

glsl-y-compare v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

glsl-y-compare

A GLSL Module which is substitution for comparison operators.

Recommend using glslify and glslify-import.

Usage

NPM

These are function-like macros.

#pragma glslify: import(glsl-y-compare);
// In case of a macro redefined
// #pragma glslify: import(glsl-y-compare/guard);

void main(void) {
  float value;

  // 1.0 if x <= y, else 0.0
  value = le(x, y);

  // 1.0 if x < y, else 0.0
  value = lt(x, y);

  // 1.0 if x >= y, else 0.0
  value = ge(x, y);

  // 1.0 if x > y, else 0.0
  value = gt(x, y);

  // 1.0 if x == y, else 0.0
  value = eq(x, y);

  // 1.0 if x != y, else 0.0
  value = ne(x, y);
}

Demo

http://glslsandbox.com/e#46610.1