Implements a 3d Camera object.
Kind: global class
Frustum
Vector3
Matrix
Matrix
Vector3
Create the camera.
Param | Type | Description |
---|---|---|
gfx | Gfx |
The gfx manager instance. |
Camera projection matrix. You can set it manually, or use ‘orthographicOffset’ / ‘orthographic’ / ‘perspective’ helper functions.
Kind: instance property of Camera3D
Camera view matrix. You can set it manually, or use ‘setViewLookat’ helper function.
Kind: instance property of Camera3D
Frustum
Calc and return the currently-visible view frustum, based on active camera.
Kind: instance method of Camera3D
Returns: Frustum
- Visible frustum.
Set camera view matrix from source position and lookat.
Kind: instance method of Camera3D
Param | Type | Description |
---|---|---|
[eyePosition] | Vector3 |
Camera source position. |
[lookAt] | Vector3 |
Camera look-at target. |
Vector3
Get 3d direction vector of this camera.
Kind: instance method of Camera3D
Returns: Vector3
- 3D direction vector.
Matrix
Get view projection matrix.
Kind: instance method of Camera3D
Returns: Matrix
- View-projection matrix.
Matrix
Get projection view matrix.
Kind: instance method of Camera3D
Returns: Matrix
- Projection-view matrix.
Make this camera a perspective camera.
Kind: instance method of Camera3D
Param | Type | Description |
---|---|---|
fieldOfView | \* |
Field of view angle in radians. |
aspectRatio | \* |
Aspect ratio. |
near | \* |
Near clipping plane. |
far | \* |
Far clipping plane. |
Vector3
Unproject a 2d vector into 3D space. You can use this method to get the 3D direction the user points on with the mouse.
Kind: instance method of Camera3D
Returns: Vector3
- Unprojected point in 3D space.
Param | Type | Default | Description |
---|---|---|---|
point | Vector2 |
Vector to unproject. | |
zDistance | Number |
0 |
Distance from camera to locate the 3D point at (0 = near plane, 1 = far plane). |