|
scimesh 0.3.2
Headless CPU-only 3D software renderer for scientific mesh visualization
|
A virtual camera that defines the viewpoint for rendering. More...
#include <camera.h>
Public Member Functions | |
| Mat4 | get_view_matrix () const |
| Compute the view matrix (world → camera space). | |
| Mat4 | get_projection_matrix (float aspect_ratio, float near_plane, float far_plane) const |
| Compute the projection matrix (camera → clip space). | |
Public Attributes | |
| Vec3 | eye = Vec3(0.0f, 0.0f, 10.0f) |
| Camera position in world space. | |
| Vec3 | center = Vec3(0.0f, 0.0f, 0.0f) |
| The point the camera looks at. | |
| Vec3 | up = Vec3(0.0f, 1.0f, 0.0f) |
| The camera's "up" direction. | |
| ProjectionType | projection = ProjectionType::PERSPECTIVE |
| Which projection type to use. | |
| float | fov_degrees = 45.0f |
| Vertical field of view in degrees (perspective only). | |
A virtual camera that defines the viewpoint for rendering.
A camera is defined by three things:
eye): where the camera sits in 3D space.center): what the camera is pointing at.up): which way is "up" on screen (usually +Y).Together these define a view matrix that transforms world coordinates into camera coordinates.
The projection matrix (orthographic or perspective) then maps camera coordinates to clip space, which the rasterizer converts to screen pixels.
You rarely need to set all fields manually. Use one of the convenience functions:
| Mat4 scimesh::Camera::get_projection_matrix | ( | float | aspect_ratio, |
| float | near_plane, | ||
| float | far_plane | ||
| ) | const |
Compute the projection matrix (camera → clip space).
| aspect_ratio | Image width / height (e.g., 800/600 = 1.333). |
| near_plane | Distance to the near clipping plane. |
| far_plane | Distance to the far clipping plane. |
Definition at line 13 of file camera.cpp.
| Mat4 scimesh::Camera::get_view_matrix | ( | ) | const |
Compute the view matrix (world → camera space).
This is a standard look-at matrix. You typically don't need to call this yourself — the renderer does it internally.
Definition at line 9 of file camera.cpp.
| float scimesh::Camera::fov_degrees = 45.0f |
| ProjectionType scimesh::Camera::projection = ProjectionType::PERSPECTIVE |