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:
DeveloperError
: context is required.
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(context); camera.position = new Cartesian3(); camera.direction = Cartesian3.negate(Cartesian3.UNIT_Z); camera.up = Cartesian3.clone(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:
- Transforms
- Camera#inverseTransform
See:
-
up :Cartesian3
-
The up direction of the camera.
-
<static> directionWC :Cartesian3
-
The view direction of the camera in world coordinates.
-
<static> inverseTransform :Matrix4
-
Gets the inverse camera transform.
- Default Value:
See:
-
<static> inverseViewMatrix :Matrix4
-
The inverse view matrix.
- UniformState#getInverseView
- czm_inverseView
- Camera#viewMatrix
See:
-
<static> positionWC :Cartesian3
-
The position of the camera in world coordinates.
-
<static> rightWC :Cartesian3
-
The right direction of the camera in world coordinates.
-
<static> upWC :Cartesian3
-
The up direction of the camera in world coordinates.
-
<static> viewMatrix :Matrix4
-
The view matrix.
- UniformState#getView
- czm_view
- Camera#inverseViewMatrix
See:
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. -
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.