Constructor
new RectilinearView(paramsopt, limiteropt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
RectilinearViewParams |
<optional> |
The initial view parameters. If
unspecified, defaults to |
limiter |
RectilinearViewLimiter |
<optional> |
The view limiter. If unspecified, no view limiting is applied. See RectilinearView.limit for commonly used limiters. |
- Implements:
Namespaces
Members
type
The view type, used by the Stage to determine the appropriate renderer for a given geometry and view.
Known values are "rectilinear"
and "flat"
.
See also Stage#registerRenderer.
Properties:
Type | Description |
---|---|
string |
- Implements:
Methods
coordinatesToPerspectiveTransform(coords, radius, extraTransforms) → {string}
Calculate the perspective transform required to position an element with perspective.
Parameters:
Name | Type | Description |
---|---|---|
coords |
RectilinearViewCoords | The view coordinates. |
radius |
number | Radius of the sphere embedding the element. |
extraTransforms |
string | Extra transformations to be applied after the element is positioned. This may be used to rotate the element. |
Returns:
The CSS 3D transform to be applied to the element.
- Type
- string
coordinatesToScreen(coords, resultopt) → {Coords}
Convert view parameters into screen position. If a result argument is provided, it is filled in and returned. Otherwise, a fresh object is filled in and returned.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
coords |
RectilinearViewCoords | The view coordinates. |
|
result |
Coords |
<optional> |
The result argument for the screen coordinates. |
Returns:
- Type
- Coords
destroy()
Destructor.
fov() → {number}
Get the fov value.
Returns:
- Type
- number
height() → {number}
Get the viewport height.
Returns:
- Type
- number
intersects(rectangle)
Return whether the view frustum intersects the given rectangle.
This function may return false positives, but never false negatives. It is used for frustum culling, i.e., excluding invisible tiles from the rendering process.
Parameters:
Name | Type | Description |
---|---|---|
rectangle |
Array.<vec2> | The vertices of the rectangle. |
inverseProjection() → {mat4}
Returns the inverse projection matrix for the current view.
Returns:
- Type
- mat4
limiter() → (nullable) {RectilinearViewLimiter}
Get the view limiter, or null if unset.
Returns:
normalizeToClosest(coords, result)
Normalize view coordinates so that they are the closest to the current view. Useful for tweening the view through the shortest path. If a result argument is supplied, it is filled in with the result and returned. Otherwise, a fresh object is filled in and returned.
Parameters:
Name | Type | Description |
---|---|---|
coords |
RectilinearViewCoords | The view coordinates. |
result |
RectilinearViewCoords | The result argument for the normalized view coordinates. |
offsetFov(fovOffset)
Add fovOffset to the current fov value.
Parameters:
Name | Type | Description |
---|---|---|
fovOffset |
number |
offsetPitch(pitchOffset)
Add pitchOffset to the current pitch value.
Parameters:
Name | Type | Description |
---|---|---|
pitchOffset |
number |
offsetRoll(rollOffset)
Add rollOffset to the current roll value.
Parameters:
Name | Type | Description |
---|---|---|
rollOffset |
number |
offsetYaw(yawOffset)
Add yawOffset to the current yaw value.
Parameters:
Name | Type | Description |
---|---|---|
yawOffset |
number |
parameters(objopt) → {RectilinearViewParams}
Get the view parameters. If an argument is supplied, it is filled in with the result and returned. Otherwise, a fresh object is filled in and returned.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
obj |
RectilinearViewParams |
<optional> |
Returns:
pitch() → {number}
Get the pitch angle.
Returns:
- Type
- number
projection() → {mat4}
Returns the projection matrix for the current view.
Returns:
- Type
- mat4
roll() → {number}
Get the roll angle.
Returns:
- Type
- number
screenToCoordinates(coords, resultopt) → {RectilinearViewCoords}
Convert screen coordinates into view coordinates. If a result argument is provided, it is filled in with the result and returned. Otherwise, a fresh object is filled in and returned.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
coords |
Coords | The screen coordinates. |
|
result |
RectilinearViewCoords |
<optional> |
The view coordinates. |
Returns:
selectLevel(levelList) → {Level}
Select the level that should be used to render the view.
Parameters:
Name | Type | Description |
---|---|---|
levelList |
Array.<Level> | the list of levels from which to select. |
Returns:
the selected level.
- Type
- Level
setFov(fov)
Set the fov value.
Parameters:
Name | Type | Description |
---|---|---|
fov |
number |
setLimiter(limiternullable)
Set the view limiter.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
limiter |
RectilinearViewLimiter |
<nullable> |
The new limiter, or null to unset. |
setParameters(params)
Set the view parameters. Unspecified parameters are left unchanged.
Parameters:
Name | Type | Description |
---|---|---|
params |
RectilinearViewParameters |
setPitch(pitch)
Set the pitch angle.
Parameters:
Name | Type | Description |
---|---|---|
pitch |
number |
setRoll(roll)
Set the roll angle.
Parameters:
Name | Type | Description |
---|---|---|
roll |
number |
setSize(size)
Set the viewport dimensions.
Parameters:
Name | Type | Description |
---|---|---|
size |
Size |
setYaw(yaw)
Set the yaw angle.
Parameters:
Name | Type | Description |
---|---|---|
yaw |
number |
size(sizeopt) → {Size}
Get the viewport dimensions. If an argument is supplied, it is filled in with the result and returned. Otherwise, a fresh object is filled in and returned.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
size |
Size |
<optional> |
Returns:
- Type
- Size
width() → {number}
Get the viewport width.
Returns:
- Type
- number
yaw() → {number}
Get the yaw angle.
Returns:
- Type
- number