new Camera
The camera is defined by a position, orientation, and view frustum.
The orientation forms an orthonormal basis with a view, up and right = view x up unit vectors.
The viewing frustum is defined by 6 planes.
Each plane is represented by a {Cartesian4} object, where the x, y, and z components
define the unit vector normal to the plane, and the w component is the distance of the
plane from the origin/camera position.
Throws:
Example
// Create a camera looking down the negative z-axis, positioned at the origin, // with a field of view of 60 degrees, and 1:1 aspect ratio. var camera = new Camera(canvas); camera.position = new Cartesian3(); camera.direction = Cartesian3.UNIT_Z.negate(); camera.up = Cartesian3.UNIT_Y; camera.frustum.fovy = CesiumMath.PI_OVER_THREE; camera.frustum.near = 1.0; camera.frustum.far = 2.0;
Demo:
Source:
Members
-
controller :CameraController
-
Defines camera behavior. The controller can be used to perform common camera manipulations.
- Default Value:
- CameraController(this)
-
direction :Cartesian3
-
The view direction of the camera.
-
frustum :Frustum
-
The region of space in view.
- Default Value:
- PerspectiveFrustum()
See:
-
position :Cartesian3
-
The position of the camera.
-
right :Cartesian3
-
The right direction of the camera.
-
transform :Matrix4
-
Modifies the camera's reference frame. The inverse of this transformation is appended to the view matrix.
- Default Value:
See:
-
up :Cartesian3
-
The up direction of the camera.
Methods
-
cameraToWorldCoordinates
-
Transform a vector or point from the camera's reference frame to world coordinates.
Parameters:
Name Type Argument Description vector
Cartesian4 The vector or point to transform. result
Cartesian4 <optional>
The object onto which to store the result. Throws:
DeveloperError : cartesian is required.Returns:
Cartesian4 The transformed vector or point. -
clone
-
Returns a duplicate of a Camera instance.
Returns:
Camera A new copy of the Camera instance. -
getInverseTransform
-
DOC_TBA
Returns:
Matrix4 DOC_TBA -
getInverseViewMatrix
-
DOC_TBA
-
getViewMatrix
-
Returns the view matrix.
Returns:
Matrix4 The view matrix.- UniformState#getView
- UniformState#setView
- czm_view
See:
-
worldToCameraCoordinates
-
Transform a vector or point from world coordinates to the camera's reference frame.
Parameters:
Name Type Argument Description cartesian
Cartesian4 The vector or point to transform. result
Cartesian4 <optional>
The object onto which to store the result. Throws:
DeveloperError : cartesian is required.Returns:
Cartesian4 The transformed vector or point. -
<static> prototype.getDirectionWC
-
The view direction of the camera in world coordinates.
-
<static> prototype.getPositionWC
-
The position of the camera in world coordinates.
-
<static> prototype.getRightWC
-
The right direction of the camera in world coordinates.
-
<static> prototype.getUpWC
-
The up direction of the camera in world coordinates.