glslify / glsl-turntable-camera

Convenience module for GLSL raytracing that provides a turntable camera for your scene.
http://glslify.github.io/glsl-turntable-camera/
Other
7 stars 0 forks source link

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).

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.