|
SBgl 0.1.0
A graphics framework in C99
|
Camera system and batch collision math for SBgl. More...
#include "sbgl_math.h"

Go to the source code of this file.
Data Structures | |
| struct | sbgl_Camera |
| Stateful camera representation. More... | |
| struct | sbgl_Ray |
| Mathematical ray. More... | |
| struct | sbgl_AABB |
| Axis-Aligned Bounding Box (AABB). More... | |
| struct | sbgl_Sphere |
| Bounding sphere. More... | |
| struct | sbgl_HitResult |
| Intersection result for batch testing. More... | |
Enumerations | |
| enum | sbgl_CameraType { SBGL_CAMERA_PERSPECTIVE , SBGL_CAMERA_ORTHOGRAPHIC } |
| Camera projection types. More... | |
Functions | |
| static sbgl_Camera | sbgl_CameraPerspective (float fov_y_rad, float aspect, float near_p, float far_p) |
| Initializes a camera with perspective projection. | |
| static sbgl_Camera | sbgl_CameraOrthographic (sbgl_OrthoParams p) |
| Initializes a camera with orthographic projection. | |
| static sbgl_Mat4 | sbgl_CameraGetView (const sbgl_Camera *cam) |
| Computes the view matrix for the given camera. | |
| static sbgl_Mat4 | sbgl_CameraGetProjection (const sbgl_Camera *cam) |
| Computes the projection matrix for the given camera. | |
| static void | sbgl_RaySphereIntersectBatch (sbgl_Ray ray, const sbgl_Sphere *spheres, sbgl_HitResult *results, uint32_t count) |
| Performs a batch ray-sphere intersection test. | |
| static void | sbgl_RayAABBIntersectBatch (sbgl_Ray ray, const sbgl_AABB *boxes, sbgl_HitResult *results, uint32_t count) |
| Performs a batch ray-AABB intersection test. | |
Camera system and batch collision math for SBgl.
Provides a stateful camera system supporting both perspective and orthographic projections, alongside data-oriented collision testing for rays, spheres, and axis-aligned bounding boxes.
Definition in file sbgl_camera.h.
| enum sbgl_CameraType |
Camera projection types.
| Enumerator | |
|---|---|
| SBGL_CAMERA_PERSPECTIVE | |
| SBGL_CAMERA_ORTHOGRAPHIC | |
Definition at line 18 of file sbgl_camera.h.
|
inlinestatic |
Computes the projection matrix for the given camera.
Generates either a perspective or orthographic matrix based on the internal camera type and its associated parameters.
Definition at line 136 of file sbgl_camera.h.
|
inlinestatic |
Computes the view matrix for the given camera.
Generates a look-at matrix based on the current position, target, and up vectors of the camera state.
Definition at line 126 of file sbgl_camera.h.
|
inlinestatic |
Initializes a camera with orthographic projection.
Sets the camera to use a parallel projection defined by the viewport boundaries and clipping planes.
Definition at line 105 of file sbgl_camera.h.
|
inlinestatic |
Initializes a camera with perspective projection.
Sets the camera to use a perspective frustum defined by the field of view, aspect ratio, and clipping planes.
Definition at line 86 of file sbgl_camera.h.
|
inlinestatic |
Performs a batch ray-AABB intersection test.
Tests a single ray against an array of axis-aligned bounding boxes using the slab method. Populates the results array with intersection data.
Definition at line 195 of file sbgl_camera.h.
|
inlinestatic |
Performs a batch ray-sphere intersection test.
Tests a single ray against an array of spheres, populating the results array with hit information for each sphere.
Definition at line 155 of file sbgl_camera.h.