Package Exports
- pex-cam
 
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pex-cam) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
pex-cam
Camera models and controllers.
API
Perspective Camera
var createPerspectiveCamera = require('pex-cam/perspective')cam = createPerspectiveCamera(opts)
Creates new perspective camera
opts:object with one or more of the following optionsposition: vec3 - camera position,[0, 0, 3]target: vec3 - camera target,[0, 0, 0]up: vec3 - camera up direction,[0, 1, 0]fov: Number - vertical field of view,PI/3 (60 deg)aspect: Number - aspect ratio ,1near: Number - near clipping plane,0.1far: Number - far clipping plane,100
cam.set(opts)
opts: seecreatePerspectiveCamera
cam.getViewRay(x, y, windowWidth, windowHeight)
Create picking ray in view (camera) cooridinates
x: Number - mouse xy: Number - mouse ywindowWidth: NumberwindowHeight: Number
cam.getWorldRay(x, y, windowWidth, windowHeight)
Create picking ray in world coordinates
x: Number - mouse xy: Number - mouse ywindowWidth: NumberwindowHeight: Number
Orbiter
Orbiter controller
var createOrbiter = require('pex-cam/orbiter')orbiter = createOrbiter(opts)
Creates new orbiter controller
opts: object with one or more of the following optionscamera: PerspectiveCamera - camera to be controlledelement: DOM Element - mouse events target,windoweasing: Number, amount of intertia,0drag: Boolean - enable drag rotation,truezoom: Boolean - enable mouse wheel zooming,truepan: Boolean - enable shift + drag panning,truelat: Number - latitude of the orbiter position, defaults to camera.positionlon: Number - longitude of the orbiter position, defaults to camera.position
orbiter.set(opts)
opts: seecreateOrbiter
License
MIT, see LICENSE.md for details.