Socket
Book a DemoInstallSign in
Socket

glsl-turntable-camera

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-turntable-camera

Convenience module for GLSL raytracing that provides a turntable camera for your scene.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

glsl-turntable-camera

stable

Convenience module for GLSL raytracing that provides a turntable camera for your scene.

If you're looking for more flexibility, you might want to check out glsl-camera-ray.

Usage

NPM

camera(float angle, float height, float dist, vec2 resolution, out vec3 ro, out vec3 rd).

  • angle is the camera's rotation around the origin in radians.
  • height is the camera's height relative to the origin.
  • dist is the distance the camera is placed from the origin.
  • ro is the ray origin, which gets set as a result of calling this function.
  • rd is the ray direction, a unit vector which gets set as a result of calling this function.
vec2 doModel(vec3 p);

#pragma glslify: raytrace = require('glsl-raytrace', map = doModel, steps = 50)
#pragma glslify: camera   = require('glsl-turntable-camera')

void main() {
  // Determine the ray origin/direction:
  vec3 ro, rd;
  camera(iGlobalTime * 0.8, 3.0, 3.5, iResolution.xy, ro, rd);

  // Trace the scene:
  vec2 t = raytrace(ro, rd);
  if (t.x > -0.5) {
    // ...
  }
}

Contributing

See stackgl/contributing for details.

License

MIT. See LICENSE.md for details.

Keywords

ecosystem:stackgl

FAQs

Package last updated on 28 Mar 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