NAME
ttypt/lam-cam.h - 3D Camera, matrix math, and perspective projection for liblamina.
SYNOPSIS
#include <stdint.h>
#include <stdbool.h>
Functions
Initialize matrix to 4x4 identity.
Multiply two 4x4 matrices: out = a * b.
Apply translation to matrix m.
Apply scaling to matrix m.
Rotate matrix m around X axis by angle in radians.
Rotate matrix m around Y axis by angle in radians.
Rotate matrix m around Z axis by angle in radians.
Construct standard perspective projection matrix.
Construct standard orthographic projection matrix.
Construct view matrix looking from eye towards target with given up vector.
Invert a 4x4 matrix. Returns true on success, false if singular.
Configure and activate the 3D camera.
Restore classic 2D orthographic rendering mode.
Check if 3D camera mode is currently active.
Get pointer to active camera state.
Copy the current View-Projection matrix into out.
Get the camera right vector in world coordinates.
Cast a ray from screen coordinates and find intersection with ground plane Z=0.
Detailed Description
3D Camera, matrix math, and perspective projection for liblamina.
Provides a lightweight 3D pipeline for 2.5D tilted-camera and full 3D views, including 4x4 matrix operations, camera setup, ray-plane unprojecting, ground tiles, and billboard sprites.
Function Documentation
void lam_cam_set_3d (float target_x, float target_y, float distance, float pitch_deg, float yaw_deg, float fov_deg)
Configure and activate the 3D camera.
Parameters
target_x,target_y Target world coordinates on the ground plane
distance Camera distance / zoom
pitch_deg Camera tilt angle in degrees (e.g. 45..60)
yaw_deg Camera yaw rotation angle in degrees
fov_deg Field of view in degrees (e.g. 45.0)
int lam_unproject_ground (int32_t screen_x, int32_t screen_y, float * out_x, float * out_y)
Cast a ray from screen coordinates and find intersection with ground plane Z=0.
Parameters
screen_x,screen_y Screen pixel coordinates
out_x,out_y Output world coordinates on the ground plane
Returns
1 on intersection, 0 if parallel or pointing away
Author
Generated automatically by Doxygen for liblamina from the source code.