Crafter.Graphics
C++ graphics library using Wayland and Vulkan.
 
Loading...
Searching...
No Matches
Crafter::Camera Class Referenceexport

Camera with projection and view matrices. More...

Public Member Functions

 Camera (float fov, float aspectRatio, float near, float far)
 Constructs a camera.
 
void Update ()
 Calculates the projectionView matrix by multiplying the projection and view matricies.
 
Vector< float, 3 > ToRay (uint32_t x, uint32_t y)
 Converts screen-space coordinates to a 3D world-space ray.
 

Public Attributes

MatrixRowMajor< float, 4, 4, 1 > projection
 
MatrixRowMajor< float, 4, 4, 1 > view
 
MatrixRowMajor< float, 4, 4, 1 > projectionView
 
Event< void > onUpdate
 

Detailed Description

Camera with projection and view matrices.

Constructor & Destructor Documentation

◆ Camera()

Crafter::Camera::Camera ( float fov,
float aspectRatio,
float near,
float far )

Constructs a camera.

Parameters
fovField of view in radians.
aspectRatioAspect ratio of the camera (width / height).
nearNear clipping plane.
farFar clipping plane.

Member Function Documentation

◆ ToRay()

Vector< float, 3 > Crafter::Camera::ToRay ( uint32_t x,
uint32_t y )

Converts screen-space coordinates to a 3D world-space ray.

Parameters
xThe x-coordinate on the screen (in pixels).
yThe y-coordinate on the screen (in pixels).
Returns
A normalized 3D direction vector representing the ray from the camera.

The documentation for this class was generated from the following file: