Constructor
new Camera(optionsopt)
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | Object | <optional> | Camera options: Properties
|
- Source
- EventsHandler
#event:viewchange - EventsHandler
#event:moveend
Methods
_init(optionsopt)
Camera initialization.
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | Object | <optional> | Camera options: Properties
|
- Source
_setProj(angle, aspect)
Sets up camera projection
Name | Type | Description |
---|---|---|
angle | number | Camera view angle |
aspect | number | Screen aspect ratio |
- Source
getAspectRatio() → {number}
Returns aspect ratio
- Source
- Aspect ratio
- Type:
- number
getInverseProjectionMatrix() → {Mat4}
Returns inverse projection matrix.
- Source
- Inverse projection-view matrix.
- Type:
- Mat4
getInverseProjectionViewMatrix() → {Mat4}
Returns inverse projection and model matrix product.
- Source
- Inverse projection-view matrix.
- Type:
- Mat4
getNormalMatrix() → {NumberArray9}
Returns normal matrix.
- Source
- Normal matrix.
- Type:
- NumberArray9
getProjectionMatrix() → {Mat4}
Returns projection matrix.
- Source
- Projection matrix.
- Type:
- Mat4
getProjectionViewMatrix() → {Mat4}
Returns projection and model matrix product.
- Source
- Projection-view matrix.
- Type:
- Mat4
getProjectionViewRTEMatrix() → {Mat4}
Returns projection and model RTE matrix product.
- Source
- Projection-view matrix.
- Type:
- Mat4
getRotation()
Returns camera quaternion
- Source
getViewAngle() → {number}
Gets camera view angle in degrees
- Source
angle -
- Type:
- number
getViewMatrix() → {NumberArray16}
Returns model matrix.
- Source
- View matrix.
- Type:
- NumberArray16
look(look, upopt)
Sets camera look point
Name | Type | Attributes | Description |
---|---|---|---|
look | Vec3 | Look point | |
up | Vec3 | <optional> | Camera up vector otherwise camera current up vector(this._u) |
- Source
project(x, y, z) → {Vec2}
Gets projected 3d point to the 2d screen coordinates
Name | Type | Description |
---|---|---|
x | number | X coordinate |
y | number | Y coordinate |
z | number | Z coordinate |
- Source
- Screen point coordinates
- Type:
- Vec2
project3v(v) → {Vec2}
Gets projected 3d point to the 2d screen coordinates
Name | Type | Description |
---|---|---|
v | Vec3 | Cartesian 3d coordinates |
- Source
- Screen point coordinates
- Type:
- Vec2
projectedSize(p, r) → {number}
Gets 3d size factor. Uses in LOD distance calculation.
- Source
- Size factor.
- Type:
- number
refresh()
Refresh camera matrices
- Source
rotateAround(angle, isArcopt, centeropt, upopt)
Rotates camera around center point
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
angle | number | Rotation angle in radians | ||
isArc | boolean | <optional> | false | If true camera up vector gets from current up vector every frame, otherwise up is always input parameter. |
center | Vec3 | <optional> | Point that the camera rotates around | |
up | Vec3 | <optional> | Camera up vector |
- Source
rotateHorizontal(angle, isArcopt, centeropt, upopt)
Rotates camera around center point by horizontal.
Name | Type | Attributes | Description |
---|---|---|---|
angle | number | Rotation angle in radians. | |
isArc | boolean | <optional> | If true camera up vector gets from current up vector every frame, otherwise up is always input parameter. |
center | Vec3 | <optional> | Point that the camera rotates around. |
up | Vec3 | <optional> | Camera up vector. |
- Source
rotateVertical(angle, centeropt)
Rotates camera around center point by vertical.
Name | Type | Attributes | Description |
---|---|---|---|
angle | number | Rotation angle in radians. | |
center | Vec3 | <optional> | Point that the camera rotates around. |
- Source
set(eye, look, up) → {Camera}
Sets camera to eye position
- Source
- This camera
- Type:
- Camera
setPitch(angle)
Pitch the camera to the angle in radians
Name | Type | Description |
---|---|---|
angle | number | Delta pitch angle in radians |
- Source
setRoll(angle)
Roll the camera to the angle in radians
Name | Type | Description |
---|---|---|
angle | number | Delta roll angle in radians |
- Source
setViewAngle(angle)
Sets camera view angle in degrees
Name | Type | Description |
---|---|---|
angle | number | View angle |
- Source
setYaw(angle)
Yaw the camera to the angle in radians
Name | Type | Description |
---|---|---|
angle | number | Delta yaw angle in radians |
- Source
slide(du, dv, dn)
Slides camera to vector d - (du, dv, dn)
Name | Type | Description |
---|---|---|
du | number | delta X |
dv | number | delta Y |
dn | number | delta Z |
- Source
unproject(x, y) → {Vec3}
Returns normal vector direction to the unprojected screen point from camera eye
Name | Type | Description |
---|---|---|
x | number | Screen X coordinate |
y | number | Screen Y coordinate |
- Source
- Direction vector
- Type:
- Vec3
unproject2v(pos) → {Vec3}
Returns normal vector direction to the unprojected screen point from camera eye
Name | Type | Description |
---|---|---|
pos | Vec2 | Screen X coordinate |
- Source
- Direction vector
- Type:
- Vec3
(abstract) update()
Updates camera view space
- Source