Interface: CameraManager
Defined in: packages/camera-manager/src/CameraManager.ts:22
Interface for manager responsible for all manipulations to the camera,
including animations and modification of state. Implementations are responsible for
providing a THREE.PerspectiveCamera
instance to the viewer. Implementations
must trigger the cameraChange
-event when camera is changed.
The default implementation is DefaultCameraManager.
Extended by
Methods
activate()
activate(
cameraManager?
):void
Defined in: packages/camera-manager/src/CameraManager.ts:61
Set this manager as active and enable controls.
Should update CameraManager.enabled to reflect the state of the manager. Note that this is called automatically when a new CameraManager is set on the viewer.
Parameters
cameraManager?
CameraManager
Previously used camera manager.
Returns
void
deactivate()
deactivate():
void
Defined in: packages/camera-manager/src/CameraManager.ts:69
Deactivate this manager and disable controls.
Should update CameraManager.enabled to reflect the state of the manager. Note that this is called automatically when a new CameraManager is set on the viewer.
Returns
void
dispose()
dispose():
void
Defined in: packages/camera-manager/src/CameraManager.ts:109
Returns
void
Obvious
fitCameraToBoundingBox()
fitCameraToBoundingBox(
boundingBox
,duration?
,radiusFactor?
):void
Defined in: packages/camera-manager/src/CameraManager.ts:97
Moves camera to a place where the content of a bounding box is visible to the camera.
Parameters
boundingBox
Box3
The bounding box in world space.
duration?
number
The duration of the animation moving the camera.
radiusFactor?
number
The ratio of the distance from camera to center of box and radius of the box.
Returns
void
getCamera()
getCamera():
PerspectiveCamera
Defined in: packages/camera-manager/src/CameraManager.ts:29
Returns the camera used for rendering the viewer.
Note that the camera will not be modified directly by Reveal.
Implementations must trigger the cameraChange
-event whenever the
camera changes.
Returns
PerspectiveCamera
getCameraState()
getCameraState():
Required
<CameraState
>
Defined in: packages/camera-manager/src/CameraManager.ts:52
Get camera's state
Returns
Required
<CameraState
>
Camera state: position, target and rotation.
off()
Call Signature
off(
event
,callback
):void
Defined in: packages/camera-manager/src/CameraManager.ts:87
Unsubscribes from changes of the camera event.
Parameters
event
"cameraChange"
The event type.
callback
Callback function to be unsubscribed.
Returns
void
Call Signature
off(
event
,callback
):void
Defined in: packages/camera-manager/src/CameraManager.ts:88
Parameters
event
"cameraStop"
callback
Returns
void
Call Signature
off(
event
,callback
):void
Defined in: packages/camera-manager/src/CameraManager.ts:89
Parameters
event
"cameraChange"
| "cameraStop"
callback
Returns
void
on()
Call Signature
on(
event
,callback
):void
Defined in: packages/camera-manager/src/CameraManager.ts:78
Subscribes to events on this camera manager. There are several event types: 'cameraChange' - Subscribes to changes of the camera. This is used by Reveal to react on changes of the camera. 'cameraStop' - Subscribes to events indicating the camera has stopped
Parameters
event
"cameraChange"
The event type.
callback
Callback to be called when the event is fired.
Returns
void
Call Signature
on(
event
,callback
):void
Defined in: packages/camera-manager/src/CameraManager.ts:79
Parameters
event
"cameraStop"
callback
Returns
void
Call Signature
on(
event
,callback
):void
Defined in: packages/camera-manager/src/CameraManager.ts:80
Parameters
event
"cameraChange"
| "cameraStop"
callback
Returns
void
setCameraState()
setCameraState(
state
):void
Defined in: packages/camera-manager/src/CameraManager.ts:46
Set camera's state. Rotation and target can't be set at the same time as they could conflict, should throw an error if both are passed with non-zero value inside state.
Parameters
state
Camera state, all fields are optional.
Returns
void
Example
// store position, target
const { position, target } = cameraManager.getCameraState();
// restore position, target
cameraManager.setCameraState({ position, target });
update()
update(
deltaTime
,boundingBox
):void
Defined in: packages/camera-manager/src/CameraManager.ts:105
Updates internal state of camera manager. Expected to update visual state of the camera
as well as it's near and far planes if needed. Called in requestAnimationFrame
-loop.
Reveal performance affects frequency with which this method is called.
Parameters
deltaTime
number
Delta time since last update in seconds.
boundingBox
Box3
Global bounding box of the model(s) and any custom objects added to the scene.
Returns
void