Camera class
Abstract base class for cameras.
This class should always be inherited when you build a new camera.
It is an Abstract base class for cameras.
Constructor Camera()
This constructor sets the following properties to the correct type:
matrixWorldInverse and projectionMatrix.
This constructor sets the following properties to the correct type:
1- .matrixWorldInverse and
This is the inverse of matrixWorld. MatrixWorld contains the Matrix which has the world transform of the Camera.
[property:Matrix4 matrixWorldInverse]
This is the inverse of matrixWorld. MatrixWorld contains the Matrix which has the world transform of the Camera.
2- .projectionMatrix.
.projectionMatrix
This is the matrix which contains the projection.
[property:Matrix4 projectionMatrix]
This is the matrix which contains the projection.
Methods
.lookAt ( vector )
vector — point to look at
This makes the camera look at the vector position in
the global space as long as the parent of this camera is
the scene or at position (0,0,0).
CubeCamera class
CubeCamera class: Creates 6 cameras that render to a WebGLRenderTargetCube.
Constructor
Constructor CubeCamera(near, far, cubeResolution)
near -- The near clipping distance.
far -- The far clipping distance
cubeResolution -- Sets the width of the cube.
CubeCamera constructor Constructs a CubeCamera that contains 6 PerspectiveCameras that then render
to a WebGLRenderTargetCube
Properties
.renderTarget
The cube texture that gets generated.
Methods
.updateCubeMap (renderer, scene)
renderer -- The current WebGL renderer scene -- The current scene
Call this to update the renderTarget.
Camera with orthographic projection.
Example
var camera = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, 1, 1000 );
scene.add( camera );
Constructor
OrthographicCamera( left, right, top, bottom, near, far )
( [page:Float left], [page:Float right],
[page:Float top], [page:Float bottom],
[page:Float near], [page:Float far] )
left: Camera frustum left plane.
right: Camera frustum right plane.
top: Camera frustum top plane.
bottom: Camera frustum bottom plane.
near: Camera frustum near plane.
far: Camera frustum far plane.
Properties
[property:Float left]
Camera frustum left plane.
[property:Float right]
Camera frustum right plane.
[property:Float top]
Camera frustum top plane.
[property:Float bottom]
Camera frustum bottom plane.
[property:Float near]
Camera frustum near plane.
[property:Float far]
Camera frustum far plane.
Methods
[ updateProjectionMatrix]()
Updates the camera projection matrix.
Must be called after change of parameters.
.updateProjectionMatrix ()
Camera with perspective projection
var camera = new THREE.PerspectiveCamera( 45, width / height, 1, 1000 );
scene.add( camera );
Constructor
PerspectiveCamera( [page:Float fov], [page:Float aspect], [page:Float near], [page:Float far] )
PerspectiveCamera( fov, aspect, near, far )
fov: Camera frustum vertical field of view.
aspect: Camera frustum aspect ratio.
near: Camera frustum near plane.
far: Camera frustum far plane.
Properties
[property:Float fov]
Camera frustum vertical field of view, from bottom to top of view, in degrees.
[property:Float aspect]
Camera frustum aspect ratio, window width divided by window height.
[property:Float near]
Camera frustum near plane.
[property:Float far]
Camera frustum far plane.
Methods
[method:null setLens]( [page:Float focalLength], [page:Float frameSize] )
setLens ( focalLength, frameSize )
focalLength — focal length
frameSize — frame size
Uses focal length (in mm) to estimate and set FOV 35mm
(fullframe) camera is used if frame size is not specified.
Formula based on
[link:http://www.bobatkins.com/photography/technical/field_of_view.html]
[method:null setViewOffset]( [page:Float fullWidth], [page:Float fullHeight], [page:Float x], [page:Float y], [page:Float width], [page:Float height] )
setViewOffset ( fullWidth, fullHeight, x, y, width, height )
fullWidth — full width of multiview setup
fullHeight — full height of multiview setup
x — horizontal offset of subcamera
y — vertical offset of subcamera
width — width of subcamera
height — height of subcamera
Note there is no reason monitors have to be the same size or in a grid.
#
For example, if you have 3x2 monitors and
each monitor is 1920x1080 and the monitors are in grid
like this:
+---+---+---+
| A | B | C |
+---+---+---+
| D | E | F |
+---+---+---+
then for each monitor you would call it like this:
Sets an offset in a larger frustum.
This is useful for multi-window or multi-monitor/multi-machine setups.
var w = 1920;
var h = 1080;
var fullWidth = w * 3;
var fullHeight = h * 2;
// A
camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );
// B
camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );
// C
camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );
// D
camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );
// E
camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );
// F
camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );
[method:null updateProjectionMatrix]()
.updateProjectionMatrix ()
Updates the camera projection matrix. Must be called after change of parameters.
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]