Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hughsk/basic-camera
A very basic camera for use in WebGL projects
https://github.com/hughsk/basic-camera
Last synced: 4 months ago
JSON representation
A very basic camera for use in WebGL projects
- Host: GitHub
- URL: https://github.com/hughsk/basic-camera
- Owner: hughsk
- Created: 2013-09-08T06:08:00.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-04-05T05:32:41.000Z (almost 11 years ago)
- Last Synced: 2024-10-17T16:39:47.021Z (4 months ago)
- Language: JavaScript
- Homepage: http://hughsk.github.io/basic-camera/
- Size: 315 KB
- Stars: 11
- Watchers: 4
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# basic-camera [](http://github.com/hughsk/stability-badges) #
A very basic camera for use in WebGL projects. Borrows a lot from
[mikolalysenko](https://github.com/mikolalysenko)'s
[orbit-camera](https://github.com/mikolalysenko/orbit-camera) module.[](https://nodei.co/npm/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](https://github.com/toji/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](https://github.com/toji/gl-matrix) `mat4`, which you
can then safely pass onto something like
[gl-shader](http://github.com/mikolalysenko/gl-shader) to handle the camera.