public class PerspectiveCamera extends Camera implements HasNearFar
PerspectiveCamera camera = new PerspectiveCamera( 45, width / height, 1, 1000 );
Object3D.ObjectHandler, Object3D.Traverse
Modifier and Type | Field and Description |
---|---|
double |
zoom |
__webglActive, __webglInit, _modelViewMatrix, _normalMatrix, DefaultUp
EVENT_BUS
Constructor and Description |
---|
PerspectiveCamera()
Perspective Camera default constructor.
|
PerspectiveCamera(double fieldOfView,
double aspectRatio,
double near,
double far)
Perspective Camera constructor
|
Modifier and Type | Method and Description |
---|---|
PerspectiveCamera |
clone()
Creates a new clone of this object and all descendants.
|
double |
getAspect()
Gets Camera frustum aspect ratio.
|
double |
getFar()
Gets Camera frustum far plane.
|
double |
getFov()
Gets Camera frustum vertical field of view.
|
int |
getFullHeight() |
int |
getFullWidth() |
int |
getHeight() |
double |
getNear()
Gets Camera frustum near plane.
|
int |
getWidth() |
double |
getX() |
double |
getY() |
void |
onResize(ViewportResizeEvent event) |
void |
setAspect(double aspect)
Sets Camera frustum aspect ratio.
|
void |
setFar(double far)
Sets Camera frustum far plane.
|
void |
setFov(double fov)
Sets Camera frustum vertical field of view.
|
void |
setFullHeight(int fullHeight) |
void |
setFullWidth(int fullWidth) |
void |
setHeight(int height) |
void |
setLens(int focalLength) |
void |
setLens(int focalLength,
int frameHeight)
Uses Focal Length (in mm) to estimate and set FOV 35mm (fullframe) camera
is used if frame size is not specified.
|
void |
setNear(double near)
Sets Camera frustum near plane.
|
void |
setViewOffset(int fullWidth,
int fullHeight,
double x,
double y,
int width,
int height)
Sets an offset in a larger frustum.
|
void |
setWidth(int width) |
void |
setX(double x) |
void |
setY(double y) |
void |
updateProjectionMatrix()
Updates the camera projection matrix.
|
addViewportResizeHandler, clone, getMatrixWorldInverse, getProjectionMatrix, getWorldDirection, getWorldDirection, lookAt, setMatrixWorldInverse, setProjectionMatrix
add, add, applyMatrix, clone, clone, getChildren, getChildrenByClass, getId, getMatrix, getMatrixWorld, getName, getObjectById, getObjectByName, getParent, getPosition, getQuaternion, getRenderDepth, getRotation, getScale, getUp, getWorldPosition, getWorldPosition, getWorldQuaternion, getWorldQuaternion, getWorldRotation, getWorldRotation, getWorldScale, getWorldScale, isCastShadow, isFrustumCulled, isMatrixAutoUpdate, isMatrixWorldNeedsUpdate, isReceiveShadow, isRotationAutoUpdate, isVisible, localToWorld, remove, remove, rotateOnAxis, rotateX, rotateY, rotateZ, setCastShadow, setChildren, setFrustumCulled, setHandler, setMatrix, setMatrixAutoUpdate, setMatrixWorld, setMatrixWorldNeedsUpdate, setName, setParent, setPosition, setQuaternion, setReceiveShadow, setRenderDepth, setRotation, setRotationAutoUpdate, setRotationFromAxisAngle, setRotationFromEuler, setRotationFromMatrix, setRotationFromQuaternion, setScale, setUp, setVisible, toString, translateOnAxis, translateX, translateY, translateZ, traverse, traverseVisible, updateMatrix, updateMatrixWorld, worldToLocal
public PerspectiveCamera()
public PerspectiveCamera(double fieldOfView, double aspectRatio, double near, double far)
fieldOfView
- Camera frustum vertical field of view.aspectRatio
- Camera frustum aspect ratio.near
- Camera frustum near plane.far
- Camera frustum far plane.public void onResize(ViewportResizeEvent event)
onResize
in interface ViewportResizeHandler
onResize
in class Camera
public double getFov()
public void setFov(double fov)
public double getAspect()
public void setAspect(double aspect)
public double getNear()
getNear
in interface HasNearFar
public void setNear(double near)
setNear
in interface HasNearFar
public double getFar()
getFar
in interface HasNearFar
public void setFar(double far)
setFar
in interface HasNearFar
public int getFullWidth()
public void setFullWidth(int fullWidth)
public int getFullHeight()
public void setFullHeight(int fullHeight)
public double getX()
public void setX(double x)
public double getY()
public void setY(double y)
public int getWidth()
public void setWidth(int width)
public int getHeight()
public void setHeight(int height)
public void setLens(int focalLength)
focalLength
- the focal lengthsetLens(int, int)
public void setLens(int focalLength, int frameHeight)
focalLength
- the focal lengthframeHeight
- the frame sizepublic void setViewOffset(int fullWidth, int fullHeight, double x, double y, int width, int height)
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
double w = 1920;
double h = 1080;
double fullWidth = w * 3;
double fullHeight = h * 2;
--A--
camera.setOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );
--B--
camera.setOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );
--C--
camera.setOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );
--D--
camera.setOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );
--E--
camera.setOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );
--F--
camera.setOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );
Note there is no reason monitors have to be the same size or in a grid.fullWidth
- the full width of multiview setupfullHeight
- the full height of multiview setupx
- the horizontal offset of subcameray
- the vertical offset of subcamerawidth
- the width of subcameraheight
- the height of subcamerapublic void updateProjectionMatrix()
Must be called after change of parameters.
public PerspectiveCamera clone()
Object3D