class.BaseController
API > BaseController
Class: BaseController
abstract
Base class for all camera controllers.
Extended By
Constructors
constructor
protected
new BaseController(input
):BaseController
Parameters
Parameter | Type | Description |
---|---|---|
input | ControllerInput | The input source for this controller. |
Returns
Source
@novorender/web_app/controller/base.ts:46
Properties
input
readonly
input:ControllerInput
The input source for this controller.
Source
@novorender/web_app/controller/base.ts:48
kind
readonly
abstract
kind:string
The controller type id.
Source
@novorender/web_app/controller/base.ts:15
projection
readonly
abstract
projection:undefined
|"pinhole"
|"orthographic"
The camera projection kind.
See
Source
@novorender/web_app/controller/base.ts:20
Accessors
axes
get axes():
ControllerAxes
The input axes
Returns
Source
@novorender/web_app/controller/base.ts:55
See
currentFlyTo
get currentFlyTo():
undefined
|Orientation
The current fly-to state, if any.
Returns
undefined
| Orientation
Source
@novorender/web_app/controller/base.ts:109
generation
get generation():
number
Camera controller state generation.
Returns
number
Source
@novorender/web_app/controller/base.ts:29
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.
hasShift
get hasShift():
boolean
The input shift button state.
Returns
boolean
Source
@novorender/web_app/controller/base.ts:104
See
height
get height():
number
The input element height.
Returns
number
Source
@novorender/web_app/controller/base.ts:76
See
moving
get moving():
boolean
Whether the camera is currently considered moving or not.
Returns
boolean
Source
@novorender/web_app/controller/base.ts:62
See
View.isIdleFrame
multiplier
get multiplier():
number
The input multiplier.
Returns
number
Source
@novorender/web_app/controller/base.ts:83
See
pointerTable
get pointerTable(): readonly
TouchContactPoint
[]
The input pointer table.
Returns
readonly TouchContactPoint
[]
Source
@novorender/web_app/controller/base.ts:97
See
width
get width():
number
The input element width.
Returns
number
Source
@novorender/web_app/controller/base.ts:69
See
zoomPos
get zoomPos():
number
[]
The input zoom position.
Returns
number
[]
Source
@novorender/web_app/controller/base.ts:90
See
Methods
animate
animate(
elapsedTime
):void
Apply time sensitive changes to controller state.
Parameters
Parameter | Type | Description |
---|---|---|
elapsedTime | number | The # of milliseconds elapsed since the last update. |
Returns
void
Source
@novorender/web_app/controller/base.ts:132
Remarks
Fly-to animations happens here, as well as motion based on keyboard pressed-state, such as the WASD keys.
attach
attach():
void
Attach this controller to the input object
Returns
void
Source
@novorender/web_app/controller/base.ts:189
autoFit
abstract
autoFit(center
,radius
):void
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
Source
@novorender/web_app/controller/base.ts:175
changed
protected
changed():void
Signal changes to internal state.
Returns
void
Source
@novorender/web_app/controller/base.ts:34
init
abstract
init(params
):void
Initialize controller from parameters.
Parameters
Parameter | Type |
---|---|
params | ControllerInitParams |
Returns
void
Source
@novorender/web_app/controller/base.ts:169
See
mouseButtonChanged
mouseButtonChanged(
event
):void
|Promise
\<void
>
Handler for mouse buttons events.
Parameters
Parameter | Type |
---|---|
event | MouseEvent |
Returns
void
| Promise
\< void
>
Source
@novorender/web_app/controller/base.ts:197
moveBegin
moveBegin(
event
):void
|Promise
\<void
>
Handler for mouse/touch move events.
Parameters
Parameter | Type |
---|---|
event | MouseEvent | TouchEvent |
Returns
void
| Promise
\< void
>
Source
@novorender/web_app/controller/base.ts:209
moveTo
moveTo(
targetPosition
,flyTime
=1000
,rotation
?):void
Move controller to specified position/rotation.
Parameters
Parameter | Type | Default value |
---|---|---|
targetPosition | ReadonlyVec3 | undefined |
flyTime | number | 1000 |
rotation ? | ReadonlyQuat | undefined |
Returns
void
Source
@novorender/web_app/controller/base.ts:217
renderStateChanges
renderStateChanges(
state
,elapsedTime
):undefined
|RecursivePartial
\<RenderState
>
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
>
Source
@novorender/web_app/controller/base.ts:232
serialize
abstract
serialize(includeDerived
?):ControllerInitParams
Serialize the state of this controller into init parameters.
Parameters
Parameter | Type | Description |
---|---|---|
includeDerived ? | boolean | Include derived state which may not be intrinsic to this controller, such as orbit controller position. |
Returns
Source
@novorender/web_app/controller/base.ts:164
See
setFlyTo
protected
setFlyTo(flyTo
):void
Initialize a fly-to transition.
Parameters
Parameter | Type | Description |
---|---|---|
flyTo | FlyToParams | The transition parameters |
Returns
void
Source
@novorender/web_app/controller/base.ts:116
stateChanges
abstract
stateChanges(state
?):Partial
\<RenderStateCamera
>
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
>
Source
@novorender/web_app/controller/base.ts:186
See
Remarks
If there are no changes, the returned object will be empty, i.e. {}.
touchChanged
touchChanged(
event
):void
|Promise
\<void
>
Handler for touch events.
Parameters
Parameter | Type |
---|---|
event | TouchEvent |
Returns
void
| Promise
\< void
>
Source
@novorender/web_app/controller/base.ts:203
update
abstract
update():void
Update internal controller state
Returns
void
Source
@novorender/web_app/controller/base.ts:178
zoomTo
zoomTo(
boundingSphere
,flyTime
=1000
):void
Bring the specified bounding sphere into view.
Parameters
Parameter | Type | Default value |
---|---|---|
boundingSphere | BoundingSphere | undefined |
flyTime | number | 1000 |
Returns
void
Source
@novorender/web_app/controller/base.ts:226
Remarks
This function will retain the current camera controller rotation.
getDistanceFromViewPlane
static
protected
getDistanceFromViewPlane(point
,cameraPosition
,cameraRotation
):number
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.