Skip to main content

@novorender/web_app / BaseController

Class: abstract BaseController

Base class for all camera controllers.

Extended by

Accessors

axes

get axes(): ControllerAxes

The input axes

See

ControllerInput.axes

Returns

ControllerAxes

Defined in

@novorender/web_app/controller/base.ts:55


currentFlyTo

get currentFlyTo(): undefined | Orientation

The current fly-to state, if any.

Returns

undefined | Orientation

Defined in

@novorender/web_app/controller/base.ts:109


generation

get generation(): number

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

Defined in

@novorender/web_app/controller/base.ts:29


hasShift

get hasShift(): boolean

The input shift button state.

See

ControllerInput.hasShift

Returns

boolean

Defined in

@novorender/web_app/controller/base.ts:104


height

get height(): number

The input element height.

See

ControllerInput.height

Returns

number

Defined in

@novorender/web_app/controller/base.ts:76


moving

get moving(): boolean

Whether the camera is currently considered moving or not.

See

View.isIdleFrame

Returns

boolean

Defined in

@novorender/web_app/controller/base.ts:62


multiplier

get multiplier(): number

The input multiplier.

See

ControllerInput.multiplier

Returns

number

Defined in

@novorender/web_app/controller/base.ts:83


pointerTable

get pointerTable(): readonly TouchContactPoint[]

The input pointer table.

See

ControllerInput.touchPoints

Returns

readonly TouchContactPoint[]

Defined in

@novorender/web_app/controller/base.ts:97


width

get width(): number

The input element width.

See

ControllerInput.width

Returns

number

Defined in

@novorender/web_app/controller/base.ts:69


zoomPos

get zoomPos(): number[]

The input zoom position.

See

ControllerInput.zoomPos

Returns

number[]

Defined in

@novorender/web_app/controller/base.ts:90

Constructors

new BaseController()

protected new BaseController(input): BaseController

Parameters

ParameterTypeDescription
inputControllerInputThe input source for this controller.

Returns

BaseController

Defined in

@novorender/web_app/controller/base.ts:46

Methods

animate()

animate(elapsedTime): void

Apply time sensitive changes to controller state.

Parameters

ParameterTypeDescription
elapsedTimenumberThe # 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.

Defined in

@novorender/web_app/controller/base.ts:136


attach()

attach(): void

Attach this controller to the input object

Returns

void

Defined in

@novorender/web_app/controller/base.ts:193


autoFit()

abstract autoFit(center, radius): void

Attempt to fit controller position such that the specified bounding sphere is brought into view.

Parameters

ParameterTypeDescription
centerReadonlyVec3The center of the bounding sphere, in world space.
radiusnumberThe radius of the bounding sphere, in world space.

Returns

void

Defined in

@novorender/web_app/controller/base.ts:179


changed()

protected changed(): void

Signal changes to internal state.

Returns

void

Defined in

@novorender/web_app/controller/base.ts:34


init()

abstract init(params): void

Initialize controller from parameters.

Parameters

ParameterType
paramsControllerInitParams

Returns

void

See

serialize

Defined in

@novorender/web_app/controller/base.ts:173


mouseButtonChanged()

mouseButtonChanged(event): void | Promise<void>

Handler for mouse buttons events.

Parameters

ParameterType
eventMouseEvent

Returns

void | Promise<void>

Defined in

@novorender/web_app/controller/base.ts:201


moveBegin()

moveBegin(event): void | Promise<void>

Handler for mouse/touch move events.

Parameters

ParameterType
eventMouseEvent | TouchEvent

Returns

void | Promise<void>

Defined in

@novorender/web_app/controller/base.ts:213


moveTo()

moveTo(
targetPosition,
flyTime,
rotation?): void

Move controller to specified position/rotation.

Parameters

ParameterTypeDefault value
targetPositionReadonlyVec3undefined
flyTimenumber1000
rotation?ReadonlyQuatundefined

Returns

void

Defined in

@novorender/web_app/controller/base.ts:221


renderStateChanges()

renderStateChanges(state, elapsedTime): undefined | RecursivePartial<RenderState>

Retrieve the state changes to be applied to the specified render state.

Parameters

ParameterTypeDescription
stateRenderStateCameraThe baseline render state.
elapsedTimenumberThe time elapsed since last call, in milliseconds.

Returns

undefined | RecursivePartial<RenderState>

Defined in

@novorender/web_app/controller/base.ts:236


resetFlyTo()

protected resetFlyTo(): void

Returns

void

Defined in

@novorender/web_app/controller/base.ts:113


serialize()

abstract serialize(includeDerived?): ControllerInitParams

Serialize the state of this controller into init parameters.

Parameters

ParameterTypeDescription
includeDerived?booleanInclude derived state which may not be intrinsic to this controller, such as orbit controller position.

Returns

ControllerInitParams

See

init

Defined in

@novorender/web_app/controller/base.ts:168


setFlyTo()

protected setFlyTo(flyTo): void

Initialize a fly-to transition.

Parameters

ParameterTypeDescription
flyToFlyToParamsThe transition parameters

Returns

void

Defined in

@novorender/web_app/controller/base.ts:120


stateChanges()

abstract stateChanges(state?): Partial<RenderStateCamera>

Retrieve changes to render state from derived class, if any.

Parameters

ParameterTypeDescription
state?RenderStateCameraThe baseline state to apply changes to.

Returns

Partial<RenderStateCamera>

See

View.modifyRenderState

Remarks

If there are no changes, the returned object will be empty, i.e. .

Defined in

@novorender/web_app/controller/base.ts:190


touchChanged()

touchChanged(event): void | Promise<void>

Handler for touch events.

Parameters

ParameterType
eventTouchEvent

Returns

void | Promise<void>

Defined in

@novorender/web_app/controller/base.ts:207


update()

abstract update(): void

Update internal controller state

Returns

void

Defined in

@novorender/web_app/controller/base.ts:182


zoomTo()

zoomTo(boundingSphere, flyTime): void

Bring the specified bounding sphere into view.

Parameters

ParameterTypeDefault value
boundingSphereBoundingSphereundefined
flyTimenumber1000

Returns

void

Remarks

This function will retain the current camera controller rotation.

Defined in

@novorender/web_app/controller/base.ts:230


getDistanceFromViewPlane()

protected static getDistanceFromViewPlane(
point,
cameraPosition,
cameraRotation): number

Compute the distance to a point from the specified view plane.

Parameters

ParameterTypeDescription
pointReadonlyVec3The point to measure distance too
cameraPositionReadonlyVec3The position of the camera/view plane.
cameraRotationReadonlyQuatThe 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.

Defined in

@novorender/web_app/controller/base.ts:262

Properties

input

readonly input: ControllerInput;

The input source for this controller.

Defined in

@novorender/web_app/controller/base.ts:48


kind

abstract readonly kind: string;

The controller type id.

Defined in

@novorender/web_app/controller/base.ts:15


projection

abstract readonly projection: undefined | "pinhole" | "orthographic";

The camera projection kind.

See

RenderStateCamera.kind.

Defined in

@novorender/web_app/controller/base.ts:20