Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikolalysenko/perspective-camera-controller
Perspective matrix controller for WebGL cameras
https://github.com/mikolalysenko/perspective-camera-controller
Last synced: 6 days ago
JSON representation
Perspective matrix controller for WebGL cameras
- Host: GitHub
- URL: https://github.com/mikolalysenko/perspective-camera-controller
- Owner: mikolalysenko
- License: mit
- Created: 2015-02-10T00:20:34.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-02-10T00:20:53.000Z (almost 10 years ago)
- Last Synced: 2024-12-16T22:35:25.928Z (9 days ago)
- Language: JavaScript
- Size: 102 KB
- Stars: 3
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
perspective-camera-controller
=============================
An interface for generating a perspective matrix from a set of input variables.# Install
```
npm i perspective-camera-controller
```# API
## Constructor
#### `var controller = require('perspective-camera-controller')(options)`
Constructs the perspective matrix controller* `options.width` initial width
* `options.height` initial height
* `options.fovx` initial horizontal fov
* `options.fovy` initial vertical fov
* `options.znear` initial near clip distance
* `options.zfar` initial far clip distance**Returns** A new controller object
## Properties
#### `controller.width`
The width of the view port for the camera#### `controller.height`
The height of the view port for the camera#### `controller.fovy`
Vertical fov angle in radians#### `controller.fovx`
Horizontal fov angle in radians#### `controller.near`
Near clip plane distance#### `controller.far`
Far clip plane distance## Methods
#### `controller.get(matrix)`
Retrieves the current camera matrix* `matrix` gets the result of the camera matrix
**Returns** `matrix`
#### `controller.dirty()`
**Returns** `true` if the state of the matrix has changed since last call to `get`#### `controller.setNear(zn)`
Sets near clip plane distance#### `controller.setFar(zn)`
Sets far clip plane distance#### `controller.setFOVX(fov)`
Sets horizontal fov angle#### `controller.setFOVY(fov)`
Sets vertical fov angle#### `controller.setWidth(w)`
Sets camera width#### `controller.setHeight(h)`
Sets camera height# License
(c) 2015 Mikola Lysenko. MIT License