Documentation / @ripl/3d / Camera
Class: Camera
Defined in: 3d/src/core/camera.ts:105
An interactive camera controlling the 3D context's view and projection, with mouse/touch orbit, pan, and zoom.
Extends
Constructors
Constructor
new Camera(
context,options?):Camera
Defined in: 3d/src/core/camera.ts:190
Parameters
| Parameter | Type |
|---|---|
context | Context3D |
options? | CameraOptions |
Returns
Camera
Overrides
Properties
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
defaultKey | readonly | typeof defaultKey | The key under which resources are retained when no explicit key is provided. | Disposer.defaultKey | core/src/core/disposer.ts:11 |
Accessors
far
Get Signature
get far():
number
Defined in: 3d/src/core/camera.ts:171
The distance to the far clipping plane.
Returns
number
Set Signature
set far(
value):void
Defined in: 3d/src/core/camera.ts:175
Parameters
| Parameter | Type |
|---|---|
value | number |
Returns
void
fov
Get Signature
get fov():
number
Defined in: 3d/src/core/camera.ts:151
The vertical field of view in degrees.
Returns
number
Set Signature
set fov(
value):void
Defined in: 3d/src/core/camera.ts:155
Parameters
| Parameter | Type |
|---|---|
value | number |
Returns
void
near
Get Signature
get near():
number
Defined in: 3d/src/core/camera.ts:161
The distance to the near clipping plane.
Returns
number
Set Signature
set near(
value):void
Defined in: 3d/src/core/camera.ts:165
Parameters
| Parameter | Type |
|---|---|
value | number |
Returns
void
position
Get Signature
get position():
Vector3
Defined in: 3d/src/core/camera.ts:121
The camera's world-space position (eye point).
Returns
Set Signature
set position(
value):void
Defined in: 3d/src/core/camera.ts:125
Parameters
| Parameter | Type |
|---|---|
value | Vector3 |
Returns
void
projection
Get Signature
get projection():
"perspective"|"orthographic"
Defined in: 3d/src/core/camera.ts:181
The projection type, either 'perspective' or 'orthographic'.
Returns
"perspective" | "orthographic"
Set Signature
set projection(
value):void
Defined in: 3d/src/core/camera.ts:185
Parameters
| Parameter | Type |
|---|---|
value | "perspective" | "orthographic" |
Returns
void
target
Get Signature
get target():
Vector3
Defined in: 3d/src/core/camera.ts:131
The world-space point the camera looks at.
Returns
Set Signature
set target(
value):void
Defined in: 3d/src/core/camera.ts:135
Parameters
| Parameter | Type |
|---|---|
value | Vector3 |
Returns
void
up
Get Signature
get up():
Vector3
Defined in: 3d/src/core/camera.ts:141
The world-space up direction.
Returns
Set Signature
set up(
value):void
Defined in: 3d/src/core/camera.ts:145
Parameters
| Parameter | Type |
|---|---|
value | Vector3 |
Returns
void
Methods
dispose()
dispose():
void
Defined in: 3d/src/core/camera.ts:491
Disposes all resources under the given key, or all resources if no key is provided.
Returns
void
Overrides
flush()
flush():
void
Defined in: 3d/src/core/camera.ts:221
Flushes pending camera changes to the 3D context's view and projection matrices.
Returns
void
lookAt()
lookAt(
target):void
Defined in: 3d/src/core/camera.ts:312
Points the camera at a new world-space target.
Parameters
| Parameter | Type | Description |
|---|---|---|
target | Vector3 | The world-space point to look at. |
Returns
void
orbit()
orbit(
deltaTheta,deltaPhi):void
Defined in: 3d/src/core/camera.ts:253
Orbits the camera around its target on a sphere.
Parameters
| Parameter | Type | Description |
|---|---|---|
deltaTheta | number | The horizontal (azimuthal) rotation to apply, in radians. |
deltaPhi | number | The vertical (polar) rotation to apply, in radians. Clamped to avoid flipping over the poles. |
Returns
void
pan()
pan(
dx,dy):void
Defined in: 3d/src/core/camera.ts:278
Pans the camera and its target together across the view plane.
Parameters
| Parameter | Type | Description |
|---|---|---|
dx | number | The distance to move along the camera's right axis, in world units. |
dy | number | The distance to move along the camera's up axis, in world units. |
Returns
void
retain()
protectedretain(value,key?):void
Defined in: core/src/core/disposer.ts:14
Registers a disposable resource under an optional key for later cleanup.
Parameters
| Parameter | Type | Default value |
|---|---|---|
value | Disposable | undefined |
key | PropertyKey | Disposer.defaultKey |
Returns
void
Inherited from
zoom()
zoom(
delta):void
Defined in: 3d/src/core/camera.ts:298
Dollies the camera toward or away from its target along the view direction.
Parameters
| Parameter | Type | Description |
|---|---|---|
delta | number | The distance to move toward the target, in world units. Clamped so the camera never passes the target. |
Returns
void