stdlib/cameraView source ↗
camera
27 items · generated by scribe fromstdlib/camera.fd· synced 2026-11-15
Contents
- Camera2D (struct)
- camera2d_create (function)
- camera2d_follow (function)
- camera2d_set_bounds (function)
- camera2d_set_zoom (function)
- camera2d_zoom_at (function)
- camera2d_shake (function)
- camera2d_update (function)
- camera2d_screen_to_world (function)
- camera2d_world_to_screen (function)
- camera2d_view_offset (function)
- camera2d_is_visible (function)
- Camera3D (struct)
- camera3d_create (function)
- camera3d_update (function)
- camera3d_view_matrix (function)
- camera3d_projection (function)
- camera3d_view_proj (function)
- camera3d_forward (function)
- camera3d_right (function)
- camera3d_orbit (function)
- camera3d_move_forward (function)
- camera3d_move_right (function)
- camera3d_set_aspect (function)
- Ray3D (struct)
- camera3d_screen_to_ray (function)
- camera3d_fps_update (function)
Camera2D
pub struct Camera2D {Fields:
| Name | Type |
|---|---|
x | f64 |
y | f64 |
zoom | f64 |
rotation | f64 |
viewport_w | i64 |
viewport_h | i64 |
target_x | f64 |
target_y | f64 |
follow_speed | f64 |
shake_x | f64 |
shake_y | f64 |
shake_amount | f64 |
shake_decay | f64 |
min_x | f64 |
min_y | f64 |
max_x | f64 |
max_y | f64 |
has_bounds | bool |
Defined at line 25
camera2d_create
Create a 2D camera centered at (x, y).
pub fn camera2d_create(viewport_w: i64, viewport_h: i64) -> Camera2D {Parameters:
viewport_w:i64viewport_h:i64
Returns: Camera2D
Defined at line 58
camera2d_follow
Set the camera follow target.
pub fn camera2d_follow(cam: & mut Camera2D, tx: f64, ty: f64) -> void {Parameters:
cam:& mut Camera2Dtx:f64ty:f64
Returns: void
Defined at line 65
camera2d_set_bounds
Set camera bounds (clamps position).
pub fn camera2d_set_bounds(cam: & mut Camera2D, min_x: f64, min_y: f64, max_x: f64, max_y: f64) -> void {Parameters:
cam:& mut Camera2Dmin_x:f64min_y:f64max_x:f64max_y:f64
Returns: void
Defined at line 71
camera2d_set_zoom
Set zoom level.
pub fn camera2d_set_zoom(cam: & mut Camera2D, zoom: f64) -> void {Parameters:
cam:& mut Camera2Dzoom:f64
Returns: void
Defined at line 80
camera2d_zoom_at
Zoom toward a world point (keeps the point under the cursor).
pub fn camera2d_zoom_at(cam: & mut Camera2D, world_x: f64, world_y: f64, factor: f64) -> void {Parameters:
cam:& mut Camera2Dworld_x:f64world_y:f64factor:f64
Returns: void
Defined at line 89
camera2d_shake
Trigger screen shake.
pub fn camera2d_shake(cam: & mut Camera2D, amount: f64) -> void {Parameters:
cam:& mut Camera2Damount:f64
Returns: void
Defined at line 101
camera2d_update
Update camera (smooth follow, shake decay).
pub fn camera2d_update(cam: & mut Camera2D, dt: f64) -> void {Parameters:
cam:& mut Camera2Ddt:f64
Returns: void
Defined at line 106
camera2d_screen_to_world
Convert screen coordinates to world coordinates.
pub fn camera2d_screen_to_world(cam: & Camera2D, sx: i64, sy: i64) -> vec2 {Parameters:
cam:& Camera2Dsx:i64sy:i64
Returns: vec2
Defined at line 150
camera2d_world_to_screen
Convert world coordinates to screen coordinates.
pub fn camera2d_world_to_screen(cam: & Camera2D, wx: f64, wy: f64) -> vec2 {Parameters:
cam:& Camera2Dwx:f64wy:f64
Returns: vec2
Defined at line 157
camera2d_view_offset
Get the camera’s view offset for rendering (top-left corner in world space).
pub fn camera2d_view_offset(cam: & Camera2D) -> vec2 {Parameters:
cam:& Camera2D
Returns: vec2
Defined at line 164
camera2d_is_visible
Check if a world-space rectangle is visible on screen.
pub fn camera2d_is_visible(cam: & Camera2D, wx: f64, wy: f64, ww: f64, wh: f64) -> bool {Parameters:
cam:& Camera2Dwx:f64wy:f64ww:f64wh:f64
Returns: bool
Defined at line 171
Camera3D
pub struct Camera3D {Fields:
| Name | Type |
|---|---|
position | vec3 |
target | vec3 |
up | vec3 |
fov | f64 |
aspect | f64 |
near | f64 |
far | f64 |
yaw | f64 |
pitch | f64 |
view_matrix | mat4 |
proj_matrix | mat4 |
dirty | bool |
Defined at line 180
camera3d_create
Create a 3D camera.
pub fn camera3d_create(pos: vec3, target: vec3, fov_deg: f64, aspect: f64, near: f64, far: f64) -> Camera3D {Parameters:
pos:vec3target:vec3fov_deg:f64aspect:f64near:f64far:f64
Returns: Camera3D
Defined at line 200
camera3d_update
Update the camera’s view and projection matrices.
pub fn camera3d_update(cam: & mut Camera3D) -> void {Parameters:
cam:& mut Camera3D
Returns: void
Defined at line 207
camera3d_view_matrix
Get the view matrix.
pub fn camera3d_view_matrix(cam: & Camera3D) -> mat4 {Parameters:
cam:& Camera3D
Returns: mat4
Defined at line 214
camera3d_projection
Get the projection matrix.
pub fn camera3d_projection(cam: & Camera3D) -> mat4 {Parameters:
cam:& Camera3D
Returns: mat4
Defined at line 219
camera3d_view_proj
Get the combined view-projection matrix.
pub fn camera3d_view_proj(cam: & Camera3D) -> mat4 {Parameters:
cam:& Camera3D
Returns: mat4
Defined at line 224
camera3d_forward
Get the camera’s forward direction.
pub fn camera3d_forward(cam: & Camera3D) -> vec3 {Parameters:
cam:& Camera3D
Returns: vec3
Defined at line 229
camera3d_right
Get the camera’s right direction.
pub fn camera3d_right(cam: & Camera3D) -> vec3 {Parameters:
cam:& Camera3D
Returns: vec3
Defined at line 234
camera3d_orbit
Orbit the camera around the target by (delta_yaw, delta_pitch).
pub fn camera3d_orbit(cam: & mut Camera3D, dyaw: f64, dpitch: f64) -> void {Parameters:
cam:& mut Camera3Ddyaw:f64dpitch:f64
Returns: void
Defined at line 240
camera3d_move_forward
Move the camera forward/backward by distance.
pub fn camera3d_move_forward(cam: & mut Camera3D, dist: f64) -> void {Parameters:
cam:& mut Camera3Ddist:f64
Returns: void
Defined at line 260
camera3d_move_right
Move the camera right/left by distance.
pub fn camera3d_move_right(cam: & mut Camera3D, dist: f64) -> void {Parameters:
cam:& mut Camera3Ddist:f64
Returns: void
Defined at line 268
camera3d_set_aspect
Set aspect ratio (call on window resize).
pub fn camera3d_set_aspect(cam: & mut Camera3D, aspect: f64) -> void {Parameters:
cam:& mut Camera3Daspect:f64
Returns: void
Defined at line 276
Ray3D
pub struct Ray3D {Fields:
| Name | Type |
|---|---|
origin | vec3 |
direction | vec3 |
Defined at line 281
camera3d_screen_to_ray
Convert a screen point (0..1) to a 3D ray (origin + direction).
pub fn camera3d_screen_to_ray(cam: & Camera3D, ndc_x: f64, ndc_y: f64) -> Ray3D {Parameters:
cam:& Camera3Dndc_x:f64ndc_y:f64
Returns: Ray3D
Defined at line 287
camera3d_fps_update
Update camera position based on yaw/pitch (FPS-style).
pub fn camera3d_fps_update(cam: & mut Camera3D) -> void {Parameters:
cam:& mut Camera3D
Returns: void
Defined at line 309
Generated by scribe, the Fides documentation generator