@novorender/api / OrbitController
Class: OrbitController
Defined in: @novorender/src/web_app/controller/orbit.ts:20
A camera controller for orbiting around a point of interest.
Extends
Accessors
axes
Get Signature
get axes(): ControllerAxes;
Defined in: @novorender/src/web_app/controller/base.ts:59
The input axes
See
Returns
Inherited from
currentFlyTo
Get Signature
get currentFlyTo(): undefined | Orientation;
Defined in: @novorender/src/web_app/controller/base.ts:113
The current fly-to state, if any.
Returns
undefined
| Orientation
Inherited from
distance
Get Signature
get distance(): number;
Defined in: @novorender/src/web_app/controller/orbit.ts:96
The distance from the pivot point, in meters.
Returns
number
Set Signature
set distance(value): void;
Defined in: @novorender/src/web_app/controller/orbit.ts:99
Parameters
Parameter | Type |
---|---|
value | number |
Returns
void
fov
Get Signature
get fov(): number;
Defined in: @novorender/src/web_app/controller/orbit.ts:105
The camera vertical field of view angle, in degrees.
Returns
number
Set Signature
set fov(value): void;
Defined in: @novorender/src/web_app/controller/orbit.ts:108
Parameters
Parameter | Type |
---|---|
value | number |
Returns
void
generation
Get Signature
get generation(): number;
Defined in: @novorender/src/web_app/controller/base.ts:34
Camera controller state generation.
Remarks
If the controller state changes, the generation count will be incremented once every call to renderStateChanges. This can be used to detect changes by comparing to a local generation count. The count is wrapped at 0xffffffff, so make sure you use != comparison and not < comparison.
Returns
number
Inherited from
hasShift
Get Signature
get hasShift(): boolean;
Defined in: @novorender/src/web_app/controller/base.ts:108
The input shift button state.
See
Returns
boolean
Inherited from
height
Get Signature
get height(): number;
Defined in: @novorender/src/web_app/controller/base.ts:80
The input element height.
See
Returns
number
Inherited from
moving
Get Signature
get moving(): boolean;
Defined in: @novorender/src/web_app/controller/base.ts:66
Whether the camera is currently considered moving or not.
See
View.isIdleFrame
Returns
boolean
Inherited from
multiplier
Get Signature
get multiplier(): number;
Defined in: @novorender/src/web_app/controller/base.ts:87
The input multiplier.
See
Returns
number
Inherited from
parameters
Get Signature
get parameters(): OrbitControllerParams;
Defined in: @novorender/src/web_app/controller/orbit.ts:44
The current controller parameters.
Returns
pitch
Get Signature
get pitch(): number;
Defined in: @novorender/src/web_app/controller/orbit.ts:69
The pitch angle around the pivot point, in degrees.
Returns
number
Set Signature
set pitch(value): void;
Defined in: @novorender/src/web_app/controller/orbit.ts:72
Parameters
Parameter | Type |
---|---|
value | number |
Returns
void
pivot
Get Signature
get pivot(): ReadonlyVec3;
Defined in: @novorender/src/web_app/controller/orbit.ts:87
The pivot point to orbit around, in world space.
Returns
ReadonlyVec3
Set Signature
set pivot(value): void;
Defined in: @novorender/src/web_app/controller/orbit.ts:90
Parameters
Parameter | Type |
---|---|
value | ReadonlyVec3 |
Returns
void
pointerTable
Get Signature
get pointerTable(): readonly TouchContactPoint[];
Defined in: @novorender/src/web_app/controller/base.ts:101
The input pointer table.
See
Returns
readonly TouchContactPoint
[]
Inherited from
position
Get Signature
get position(): vec3;
Defined in: @novorender/src/web_app/controller/orbit.ts:52
Computed position, in world space.
Remarks
This position is derived from pivot point, distance, rotated around pitch and yaw angles.
Returns
vec3
rotation
Get Signature
get rotation(): ReadonlyQuat;
Defined in: @novorender/src/web_app/controller/orbit.ts:64
Computed rotation quaternion, in world space.
Remarks
This rotation is derived from pitch and yaw angles.
Returns
ReadonlyQuat
width
Get Signature
get width(): number;
Defined in: @novorender/src/web_app/controller/base.ts:73
The input element width.
See
Returns
number
Inherited from
yaw
Get Signature
get yaw(): number;
Defined in: @novorender/src/web_app/controller/orbit.ts:78
The yaw angle around the pivot point, in degrees.
Returns
number
Set Signature
set yaw(value): void;
Defined in: @novorender/src/web_app/controller/orbit.ts:81
Parameters
Parameter | Type |
---|---|
value | number |
Returns
void
zoomPos
Get Signature
get zoomPos(): number[];
Defined in: @novorender/src/web_app/controller/base.ts:94
The input zoom position.
See
Returns
number
[]
Inherited from
Constructors
Constructor
new OrbitController(input, params?): OrbitController;
Defined in: @novorender/src/web_app/controller/orbit.ts:38
Parameters
Parameter | Type | Description |
---|---|---|
input | ControllerInput | The input source. |
params? | Partial <OrbitControllerParams > | Optional initialization parameters. |
Returns
OrbitController
Overrides
Methods
animate()
animate(elapsedTime): void;
Defined in: @novorender/src/web_app/controller/base.ts:140
Apply time sensitive changes to controller state.
Parameters
Parameter | Type | Description |
---|---|---|
elapsedTime | number | The # of milliseconds elapsed since the last update. |
Returns
void
Remarks
Fly-to animations happens here, as well as motion based on keyboard pressed-state, such as the WASD keys.
Inherited from
attach()
attach(): void;
Defined in: @novorender/src/web_app/controller/base.ts:198
Attach this controller to the input object
Returns
void
Inherited from
autoFit()
autoFit(center, radius): void;
Defined in: @novorender/src/web_app/controller/orbit.ts:172
Attempt to fit controller position such that the specified bounding sphere is brought into view.
Parameters
Parameter | Type | Description |
---|---|---|
center | ReadonlyVec3 | The center of the bounding sphere, in world space. |
radius | number | The radius of the bounding sphere, in world space. |
Returns
void
Overrides
changed()
protected changed(): void;
Defined in: @novorender/src/web_app/controller/base.ts:39
Signal changes to internal state.
Returns
void
Inherited from
init()
init(params): void;
Defined in: @novorender/src/web_app/controller/orbit.ts:133
Initialize controller from parameters.
Parameters
Parameter | Type |
---|---|
params | ControllerInitParams |
Returns
void
See
Overrides
mouseButtonChanged()
mouseButtonChanged(_event): void | Promise<void>;
Defined in: @novorender/src/web_app/controller/orbit.ts:273
Handler for mouse buttons events.
Parameters
Parameter | Type |
---|---|
_event | MouseEvent |
Returns
void
| Promise
<void
>
Overrides
BaseController
.mouseButtonChanged
moveBegin()
moveBegin(_event): void | Promise<void>;
Defined in: @novorender/src/web_app/controller/orbit.ts:277
Handler for mouse/touch move events.
Parameters
Parameter | Type |
---|---|
_event | MouseEvent | TouchEvent |
Returns
void
| Promise
<void
>
Overrides
moveTo()
moveTo(
_targetPosition,
_flyTime,
_rotation?): void;
Defined in: @novorender/src/web_app/controller/orbit.ts:279
Move controller to specified position/rotation.
Parameters
Parameter | Type | Default value |
---|---|---|
_targetPosition | ReadonlyVec3 | undefined |
_flyTime | number | 1000 |
_rotation? | ReadonlyQuat | undefined |
Returns
void
Overrides
renderStateChanges()
renderStateChanges(state, elapsedTime):
| undefined
| RecursivePartial<RenderState>;
Defined in: @novorender/src/web_app/controller/base.ts:247
Retrieve the state changes to be applied to the specified render state.
Parameters
Parameter | Type | Description |
---|---|---|
state | RenderStateCamera | The baseline render state. |
elapsedTime | number | The time elapsed since last call, in milliseconds. |
Returns
| undefined
| RecursivePartial
<RenderState
>
Inherited from
BaseController
.renderStateChanges
resetFlyTo()
protected resetFlyTo(): void;
Defined in: @novorender/src/web_app/controller/base.ts:117
Returns
void
Inherited from
serialize()
serialize(includeDerived): ControllerInitParams;
Defined in: @novorender/src/web_app/controller/orbit.ts:120
Serialize the state of this controller into init parameters.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
includeDerived | boolean | false | Include derived state which may not be intrinsic to this controller, such as orbit controller position. |
Returns
See
Overrides
setFlyTo()
protected setFlyTo(flyTo): void;
Defined in: @novorender/src/web_app/controller/base.ts:124
Initialize a fly-to transition.
Parameters
Parameter | Type | Description |
---|---|---|
flyTo | FlyToParams | The transition parameters |
Returns
void
Inherited from
stateChanges()
stateChanges(state?): Partial<RenderStateCamera>;
Defined in: @novorender/src/web_app/controller/orbit.ts:234
Retrieve changes to render state from derived class, if any.
Parameters
Parameter | Type | Description |
---|---|---|
state? | RenderStateCamera | The baseline state to apply changes to. |
Returns
Partial
<RenderStateCamera
>
See
Remarks
If there are no changes, the returned object will be empty, i.e. .
Overrides
touchChanged()
touchChanged(_event): void | Promise<void>;
Defined in: @novorender/src/web_app/controller/orbit.ts:275
Handler for touch events.
Parameters
Parameter | Type |
---|---|
_event | TouchEvent |
Returns
void
| Promise
<void
>
Overrides
update()
update(): void;
Defined in: @novorender/src/web_app/controller/orbit.ts:182
Update internal controller state
Returns
void
Overrides
updateParams()
updateParams(params): void;
Defined in: @novorender/src/web_app/controller/orbit.ts:116
Update controller parameters.
Parameters
Parameter | Type | Description |
---|---|---|
params | Partial <OrbitControllerParams > | Set of parameters to change. |
Returns
void
zoomTo()
zoomTo(_boundingSphere, _flyTime): void;
Defined in: @novorender/src/web_app/controller/orbit.ts:285
Bring the specified bounding sphere into view.
Parameters
Parameter | Type | Default value |
---|---|---|
_boundingSphere | BoundingSphere | undefined |
_flyTime | number | 1000 |
Returns
void
Remarks
This function will retain the current camera controller rotation.
Overrides
assert()
static assert(controller): asserts controller is OrbitController;
Defined in: @novorender/src/web_app/controller/orbit.ts:265
OrbitController type assert function.
Parameters
Parameter | Type | Description |
---|---|---|
controller | BaseController | The controller to type assert. |
Returns
asserts controller is OrbitController
getDistanceFromViewPlane()
protected static getDistanceFromViewPlane(
point,
cameraPosition,
cameraRotation): number;
Defined in: @novorender/src/web_app/controller/base.ts:281
Compute the distance to a point from the specified view plane.
Parameters
Parameter | Type | Description |
---|---|---|
point | ReadonlyVec3 | The point to measure distance too |
cameraPosition | ReadonlyVec3 | The position of the camera/view plane. |
cameraRotation | ReadonlyQuat | The rotation of the camera/view plane. |
Returns
number
A signed distance from the point to the view plane, i.e. positive for points in front of the plane and negative otherwise.
Inherited from
BaseController
.getDistanceFromViewPlane
is()
static is(controller): controller is OrbitController;
Defined in: @novorender/src/web_app/controller/orbit.ts:258
OrbitController type guard function.
Parameters
Parameter | Type | Description |
---|---|---|
controller | BaseController | The controller to type guard. |
Returns
controller is OrbitController
Properties
input
readonly input: ControllerInput;
Defined in: @novorender/src/web_app/controller/base.ts:53
The input source for this controller.
Inherited from
kind
kind: "orbit";
Defined in: @novorender/src/web_app/controller/orbit.ts:21
The controller type id.
Overrides
projection
projection: "pinhole";
Defined in: @novorender/src/web_app/controller/orbit.ts:22
The camera projection kind.