Gama C Library
Gama C API Documentation
camera.h
Go to the documentation of this file.
1/**
2 * @file camera.h
3 * @brief Defines the 3D camera structure for scene projection.
4 */
5#pragma once
6
7/**
8 * @brief Represents a camera in a 3D scene, used for projection.
9 */
10typedef struct {
11 double focal; /**< The focal length of the camera, affecting perspective. */
12 double near; /**< The distance to the near clipping plane. Objects closer than this are clipped. */
13 double far; /**< The distance to the far clipping plane. Objects farther than this are clipped. */
14} gm3Camera;
15
16/**
17 * @brief A default `gm3Camera` instance.
18 *
19 * Initializes a camera with a typical focal length and clipping planes.
20 */
22 .far = 100,
23 .near = 0.01,
24 .focal = 1.3,
25};
26
27/**
28 * @brief Initializes a `gm3Camera` struct with default values.
29 * @param c A pointer to the `gm3Camera` struct to initialize.
30 * @return 0 on success, -1 if `c` is NULL.
31 */
33 if (!c)
34 return -1;
36 return 0;
37}
const gm3Camera gm3_default_camera
A default gm3Camera instance.
Definition camera.h:21
int gm3_camera_create(gm3Camera *c)
Initializes a gm3Camera struct with default values.
Definition camera.h:32
Represents a camera in a 3D scene, used for projection.
Definition camera.h:10
double near
Definition camera.h:12
double focal
Definition camera.h:11
double far
Definition camera.h:13