1.1.0 • Published 10 years ago

basic-camera v1.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
10 years ago

basic-camera experimental

A very basic camera for use in WebGL projects. Borrows a lot from mikolalysenko's orbit-camera module.

basic-camera

Usage

camera = require('basic-camera')([pos])

Creates a new camera: optionally, you can pass in pos to set the initial position.

camera.position

A gl-matrix vec3 representing the position of the camera. It's array-like, so you can just set the [0], [1] and [2] indices to change the position.

camera.rotateX(radians)

Rotates the camera along the x-axis by radians.

camera.rotateY(radians)

Rotates the camera along the y-axis by radians.

camera.rotateZ(radians)

Rotates the camera along the z-axis by radians.

camera.getCameraVector(v)

Sets a vec3 to a vector corresponding to the camera's direction.

camera.view([output])

Returns a new gl-matrix mat4, which you can then safely pass onto something like gl-shader to handle the camera.

1.1.0

10 years ago

1.0.0

10 years ago

0.0.1

10 years ago

0.0.0

11 years ago