Socket
Book a DemoInstallSign in
Socket

glsl-sdf-box

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glsl-sdf-box

GLSL SDF function for generating a sphere.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

glsl-sdf-box

stable

GLSL SDF function for generating a box. Determines the distance between a point and the surface of a box at the origin.

view demo

Originally sourced from Modeling with Distance Functions by Iñigo Quílez.

Usage

NPM

float box(vec3 position, vec3 dimensions)

Returns the signed distanced between position and a box at the origin with a given set of dimensions. For example, to draw a 2x2x2 box in a raytracing shader:

#pragma glslify: box = require('glsl-sdf-box')

vec2 doModel(vec3 p) {
  float dist   = box(p, vec3(2.0));
  float id     = 1.0;

  return vec2(dist, id);
}

Contributing

See stackgl/contributing for details.

License

MIT. See LICENSE.md for details.

Keywords

ecosystem:stackgl

FAQs

Package last updated on 04 Apr 2015

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