new ViewOrbital( [camera] [, controller])
Creates a new camera view.
If the camera parameter is given, its position and field of view will be
automatically set whenever the view changes.
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
camera |
THREE.Camera |
<optional> |
The camera to keep updated. |
controller |
PD.ViewController |
<optional> |
The view controller to keep updated. |
Extends
Members
-
:THREE.Vector3
_tempVec
-
A temporary vector used in some methods.
Type
- THREE.Vector3
-
:number
altitude
-
The altitude angle of the camera relative to the view target, in degrees (-90 to 90).
The altitude angle is measure vertically above the horizontal plane.
Type
- number
- Inherited From:
- Overrides:
-
:number
azimuth
-
The azimuth angle of the camera relative to the view target, in degrees (-180 to 180).
The azimuth angle is measured in an anti-clockwise direction from the positive X axis.
Type
- number
- Inherited From:
- Overrides:
-
:THREE.Camera|null
camera
-
The camera to keep updated.
Type
- THREE.Camera | null
-
:THREE.Vector3
cameraPos
-
The position of the camera in model space.
Type
- THREE.Vector3
- Inherited From:
- Overrides:
-
:PD.ViewController|null
controller
-
The view controller to keep updated.
Type
- PD.ViewController | null
-
:number
distance
-
The distance between the camera and view target, in model units.
Type
- number
-
:function
easing
-
A
PD.Easingfunction to use when interpolating between views.Type
- function
-
:number
fov
-
The field of view angle of the camera, in degrees (0.1 to 160).
Type
- number
- Inherited From:
- Overrides:
-
:number
fovFactor
-
The calculated field of view compensation factor.
Type
- number
-
:boolean
isTransitioning <readonly>
-
Determines whether or not the view transition needs to be updated.
Type
- boolean
-
:boolean
isViewAngles <readonly>
-
A flag identifying this object as a view angles instance.
Type
- boolean
- Inherited From:
- Overrides:
-
:boolean
isViewOrbital <readonly>
-
A flag identifying this object as an orbital view.
Type
- boolean
-
:boolean
lockCamera
-
Maintain relative camera/target vector when moving the target position.
Type
- boolean
- Inherited From:
- Overrides:
-
:number
minDistance
-
The minimum allowable distance between camera and target.
Type
- number
-
:number
referenceViewDist
-
Stores the reference distance between camera and target.
This is the actual distance with the
fovFactormultiplier applied.Type
- number
-
:THREE.Vector3
targetPos
-
The position of the look-at point in model space.
Type
- THREE.Vector3
- Inherited From:
- Overrides:
-
:THREE.Vector3
vectorToCamera
-
The normalised view vector from the target to the camera.
Type
- THREE.Vector3
-
:number
zoom
-
Stores the relative view zoom as a multiplier factor.
Type
- number
- Inherited From:
- Overrides:
Methods
-
copyViewAnglesFrom(data)
-
Copies data from the given instance to this instance.
Parameters:
Name Type Description dataPD.ViewAngles | object The view state instance to copy data from.
- Inherited From:
- Overrides:
Returns:
Returns this view angles instance to support method chaining.
- Type
- PD.ViewAngles
-
copyViewAnglesTo(data)
-
Copies data from this instance to another given instance.
Parameters:
Name Type Description dataPD.ViewAngles | object The object instance to copy data to.
- Inherited From:
- Overrides:
Returns:
Returns this view angles instance to support method chaining.
- Type
- PD.ViewAngles
-
fromJSON(data)
-
Safely copy properties from a source object.
See the
PD.Base#fromJSONmethod for more details.Parameters:
Name Type Description dataobject The source object containing data to copy.
- Inherited From:
- Overrides:
Returns:
Returns this instance to support method chaining.
- Type
- PD.View
-
moveView(direction, distance)
-
Instantly change the view by the distance in the given direction.
Parameters:
Name Type Description directionTHREE.Vector3 The vector direction to travel in.
distancenumber The zoom factor to apply to the view distance.
Returns:
Returns this camera controller to support method chaining.
- Type
- PD.ViewOrbital
-
setFOV(fov)
-
Sets the field of view of the camera.
Parameters:
Name Type Description fovnumber The new camera field of view, in decimal degrees (0.1 to 160).
Returns:
Returns this scene manager to support method chaining.
- Type
- PD.SceneManager
-
setFromPositions(cameraPos [, targetPos])
-
Instantly change the view to the given camera and target positions.
Parameters:
Name Type Argument Description cameraPosTHREE.Vector3 The new position of the camera.
targetPosTHREE.Vector3 <optional>
The new position of the view center.
Returns:
Returns this camera controller to support method chaining.
- Type
- PD.ViewOrbital
-
setViewFromAngles(azimuth, altitude)
-
Instantly change the view to the given view angles.
Parameters:
Name Type Description azimuthnumber The new camera azimuth angle in degrees.
altitudenumber The new camera altitude angle in degrees.
Returns:
Returns this camera controller to support method chaining.
- Type
- PD.ViewOrbital
-
setViewFromVector(vector)
-
Instantly change the view to the given vector.
Parameters:
Name Type Description vectorTHREE.Vector3 The new camera view vector.
Returns:
Returns this camera controller to support method chaining.
- Type
- PD.ViewOrbital
-
toJSON( [data])
-
Converts the object instance to a simple POJO for JSON storage.
This method is used to copy, store and save the data for ths object, so the returned object must have all the properties required be able to rebuild this instance in its entirety when passed to the class constructor.
See the
PD.Base#toJSONmethod for more details.Parameters:
Name Type Argument Description dataobject <optional>
An optional parent object to append this data to.
- Inherited From:
Returns:
Returns a JSON object.
- Type
- object
-
transition( [fraction])
-
Smoothly interpolate between the stored views.
If no fractional value is given, the transition attempts to complete within the number of milliseconds in the
PD.GlobalState.transitionSpeedproperty.Parameters:
Name Type Argument Description fractionnumber <optional>
The fractional value between 'from' and 'to' (0 to 1).
Returns:
Returns this camera controller to support method chaining.
- Type
- PD.ViewOrbital
-
transitionFieldOfView(fov)
-
Initialises a transition to a new field of view angle.
Parameters:
Name Type Description fovnumber The new field of view angle, in degrees (0.1 to 160.0).
Returns:
Returns this camera controller to support method chaining.
- Type
- PD.ViewOrbital
-
transitionHeight(dz [, animate])
-
Moves the camera and target position by the given height.
Parameters:
Name Type Argument Default Description dznumber The height difference.
animateboolean <optional>
true Whether to animate the transition, defaults to true.
Returns:
Returns this camera controller to support method chaining.
- Type
- PD.ViewOrbital
-
transitionToAngles(azimuth, altitude [, distance] [, targetPos] [, fov])
-
Initialises a transition to a new set of spherical coordinates.
Parameters:
Name Type Argument Description azimuthnumber The new azimuth angle in degrees.
altitudenumber The new altitude angle in degrees.
distancenumber <optional>
The new view distance in model units.
targetPosTHREE.Vector3 <optional>
The new position of the view center.
fovnumber <optional>
The new field of view angle, in degrees (0.01 to 160.0).
Returns:
Returns this camera controller to support method chaining.
- Type
- PD.ViewOrbital
-
transitionToFit(distance [, targetPos] [, callback])
-
Initialises a transition to a new target distance.
Parameters:
Name Type Argument Description distancenumber The new view distance in model units.
targetPosTHREE.Vector3 <optional>
The new position of the view center.
callbackfunction <optional>
An optional callback function to invoke when transition is complete.
Returns:
Returns this camera controller to support method chaining.
- Type
- PD.ViewOrbital
-
transitionToHorizontal()
-
Initialises a transition to a horizontal view at the default eye height.
Returns:
Returns this camera controller to support method chaining.
- Type
- PD.ViewOrbital
-
transitionToPosition(cameraPos [, targetPos] [, fov])
-
Initialises a transition to a new camera and target position.
Parameters:
Name Type Argument Description cameraPosTHREE.Vector3 The new position of the camera.
targetPosTHREE.Vector3 <optional>
The new position of the view center.
fovnumber <optional>
The new field of view angle, in degrees (0.01 to 160.0).
Returns:
Returns this camera controller to support method chaining.
- Type
- PD.ViewOrbital
-
transitionToSelection(extents [, normal] [, center] [, fov])
-
Initialises a transition to straight-on at the given selection.
Parameters:
Name Type Argument Description extentsnumber The bounding box defining the view area.
normalTHREE.Vector3 <optional>
An optional surface normal to align with.
centerTHREE.Vector3 <optional>
An optional new look-at target position.
fovnumber <optional>
An optional new field of view angle, in degrees (0.01 to 160.0).
Returns:
Returns this camera controller to support method chaining.
- Type
- PD.ViewOrbital
-
transitionToVector(vector [, distance] [, targetPos] [, fov])
-
Initialises a transition to a new camera vector.
Parameters:
Name Type Argument Description vectorTHREE.Vector3 The new camera view vector.
distancenumber <optional>
The new view distance in model units.
targetPosTHREE.Vector3 <optional>
The new position of the view center.
fovnumber <optional>
The new field of view angle, in degrees (0.1 to 160.0).
Returns:
Returns this camera controller to support method chaining.
- Type
- PD.ViewOrbital
-
transitionToView(view)
-
Switches towards the given view.
Parameters:
Name Type Description viewPD.View The target view to interpolate towards.
Returns:
Returns this camera controller to support method chaining.
- Type
- PD.ViewOrbital
-
updateView()
-
Compute the camera position relative to target using spherical coordinates.
Returns:
Returns this camera controller to support method chaining.
- Type
- PD.ViewOrbital
-
zoomByRay(ray, factor)
-
Instantly change the view by the distance in the given direction.
Parameters:
Name Type Description rayTHREE.Ray The ray direction to travel in.
factornumber The zoom factor to apply to the view distance.
Returns:
Returns this camera controller to support method chaining.
- Type
- PD.ViewOrbital