Documentation / @ripl/3d / Camera
Class: Camera ​
Defined in: 3d/src/core/camera.ts:82
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:167
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:148
The distance to the far clipping plane.
Returns ​
number
Set Signature ​
set far(
value):void
Defined in: 3d/src/core/camera.ts:152
Parameters ​
| Parameter | Type |
|---|---|
value | number |
Returns ​
void
fov ​
Get Signature ​
get fov():
number
Defined in: 3d/src/core/camera.ts:128
The vertical field of view in degrees.
Returns ​
number
Set Signature ​
set fov(
value):void
Defined in: 3d/src/core/camera.ts:132
Parameters ​
| Parameter | Type |
|---|---|
value | number |
Returns ​
void
near ​
Get Signature ​
get near():
number
Defined in: 3d/src/core/camera.ts:138
The distance to the near clipping plane.
Returns ​
number
Set Signature ​
set near(
value):void
Defined in: 3d/src/core/camera.ts:142
Parameters ​
| Parameter | Type |
|---|---|
value | number |
Returns ​
void
position ​
Get Signature ​
get position():
Vector3
Defined in: 3d/src/core/camera.ts:98
The camera's world-space position (eye point).
Returns ​
Set Signature ​
set position(
value):void
Defined in: 3d/src/core/camera.ts:102
Parameters ​
| Parameter | Type |
|---|---|
value | Vector3 |
Returns ​
void
projection ​
Get Signature ​
get projection():
"perspective"|"orthographic"
Defined in: 3d/src/core/camera.ts:158
The projection type, either 'perspective' or 'orthographic'.
Returns ​
"perspective" | "orthographic"
Set Signature ​
set projection(
value):void
Defined in: 3d/src/core/camera.ts:162
Parameters ​
| Parameter | Type |
|---|---|
value | "perspective" | "orthographic" |
Returns ​
void
target ​
Get Signature ​
get target():
Vector3
Defined in: 3d/src/core/camera.ts:108
The world-space point the camera looks at.
Returns ​
Set Signature ​
set target(
value):void
Defined in: 3d/src/core/camera.ts:112
Parameters ​
| Parameter | Type |
|---|---|
value | Vector3 |
Returns ​
void
up ​
Get Signature ​
get up():
Vector3
Defined in: 3d/src/core/camera.ts:118
The world-space up direction.
Returns ​
Set Signature ​
set up(
value):void
Defined in: 3d/src/core/camera.ts:122
Parameters ​
| Parameter | Type |
|---|---|
value | Vector3 |
Returns ​
void
Methods ​
dispose() ​
dispose():
void
Defined in: 3d/src/core/camera.ts:500
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:198
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:297
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:230
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:260
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:280
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. Positive zooms in, negative zooms out. Clamped so the target never crosses the near plane, which would empty the frustum. |
Returns ​
void