Camera
This class is not intended to be used directly. Use PerspectiveCamera or OrthographicCamera unless you are defining your own camera, in which case it should inherit from this class.
INFO
Derives from Node and inherits all public properties and methods.
Properties
Projection matrix that maps camera-space coordinates to clip space.
Matrix4 projection_matrix {Matrix4::Identity()};View matrix that maps world space to camera space.
Matrix4 view_matrix {Matrix4::Identity()};Functions
Computes a Frustum from the combined projection and view matrices.
Used for applying frustum culling to renderable nodes.
Frustum Camera::GetFrustum();GetNodeType() Node::Type virtual
Identifies this node as Node::Type::Camera.
Type vglx::Camera::GetNodeType() const override;LookAt() void virtual
Overrides Node::LookAt to orient the camera toward a world-space target.
Accounts for the camera’s -Z viewing direction so the camera faces the given point.
void Camera::LookAt(const Vector3& target) override;| Parameter | Description |
|---|---|
| target | World-space position for the camera to look at. |
Resize() void pure virtual
Updates projection_matrix to reflect the current viewport size.
Must be implemented by derived cameras to apply the appropriate projection logic.
virtual void Camera::Resize(int width, int height)=0;| Parameter | Description |
|---|---|
| width | Viewport width in pixels. |
| height | Viewport height in pixels. |
UpdateViewMatrix() void
Sets view_matrix to the inverse of the camera's world transform.
Called internally by the renderer before rendering a frame; manual calls are rarely necessary.
void Camera::UpdateViewMatrix();