Socket
Socket
Sign inDemoInstall

glsl-out-of-range

Package Overview
Dependencies
Maintainers
23
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glsl-out-of-range

Functions to test if a point is outside ranges, namely useful for 3D/2D scenes that may have reversed bounds


Version published
Weekly downloads
26K
increased by2.61%
Maintainers
23
Weekly downloads
 
Created
Source

glsl-out-of-range

Tests if a point is outside ranges. It could be useful in vertex & fragment shaders to support reversed ranges (bounds) in 3D/2D scenes.

Function prototypes:

bool outOfRange(float a, float b, float p);

bool outOfRange(vec2 a, vec2 b, vec2 p);

bool outOfRange(vec3 a, vec3 b, vec3 p);

bool outOfRange(vec4 a, vec4 b, vec4 p);

Please note that in the case of vec4 input arguments, only 3 tests are made i.e. for xyz and not for w.

Example

#pragma glslify: outOfRange = require(glsl-out-of-range)

void main() {
  if (outOfRange(bounds[0], bounds[1], position)) discard;

  gl_FragColor = vec4(1.0, 0.5, 0.25, 1.0);
}

Usage

Install with npm:

npm install glsl-out-of-range

Then use with glslify.

API

#pragma glslify: outOfRange = require(glsl-out-of-range)

Creators

GithubTwitter
Alex C. Johnson@alexcjohnson
Étienne Tétreault-Pinard@etpinard@etpinard
Mojtaba Samimi@archmoj

Code and documentation copyright 2018 Plotly, Inc.

Code released under the MIT license.

Docs released under the Creative Commons license.

Keywords

FAQs

Package last updated on 31 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc