Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikolalysenko/extract-frustum-planes
Extracts the planes for a WebGL viewing frustum
https://github.com/mikolalysenko/extract-frustum-planes
Last synced: about 2 months ago
JSON representation
Extracts the planes for a WebGL viewing frustum
- Host: GitHub
- URL: https://github.com/mikolalysenko/extract-frustum-planes
- Owner: mikolalysenko
- License: mit
- Created: 2013-10-10T23:28:43.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-06-19T15:22:01.000Z (over 10 years ago)
- Last Synced: 2024-10-20T14:26:11.445Z (2 months ago)
- Language: JavaScript
- Size: 117 KB
- Stars: 6
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
extract-frustum-planes
======================
Returns a list of frustum planes from a given WebGL matrix (assuming the matrix is stored in the same format as used by [gl-matrix](https://github.com/toji/gl-matrix)).## Install
npm install extract-frustum-planes
## Example
```javascript
var getPlanes = require("extract-frustum-planes")var glm = require("gl-matrix")
var m = glm.mat4.perspective()
```## API
### `require("extract-frustum-planes")(worldToClip[, zNear, zFar])`
Extracts the frustum planes of the combined world to clip coordinate matrix for WebGL* `worldToClip` is the concatenated model-view-projection matrix in the same format as expected by WebGL (ie compatible with gl-matrix)
* `zNear` is the near clip plane distance as set by `gl.depthRange` (default 0.0)
* `zFar` is the far clip plane distance as set by `gl.depthRange`**Returns** An array of 6 planes encoding the view frustum stored in the order:
* `left`
* `right`
* `top`
* `bottom`
* `near`
* `far`## Credits
(c) 2013 Mikola Lysenko. MIT License