Banjo API 0.0.1
C99 game development API
Loading...
Searching...
No Matches
mat.h File Reference
#include <banjo/api.h>
#include <banjo/math.h>
#include <banjo/vec.h>
Include dependency graph for mat.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  bj_mat3x3_t
struct  bj_mat3x2_t
struct  bj_mat4x4_t
struct  bj_mat4x3_t

Macros

#define BJ_M3(c, r)
#define BJ_M32(c, r)
#define BJ_M4(c, r)
#define BJ_M43(c, r)

Typedefs

typedef struct bj_mat3x3_t bj_mat3x3
typedef struct bj_mat3x3_t bj_mat3
typedef struct bj_mat3x2_t bj_mat3x2
typedef struct bj_mat4x4_t bj_mat4x4
typedef struct bj_mat4x4_t bj_mat4
typedef struct bj_mat4x3_t bj_mat4x3

Functions

static void bj_mat3_set_identity (bj_mat3 *restrict M)
static void bj_mat3_copy (bj_mat3 *restrict dst, const bj_mat3 *restrict src)
static bj_vec3 bj_mat3_row (const bj_mat3 *restrict M, int r)
static bj_vec3 bj_mat3_col (const bj_mat3 *restrict M, int c)
static void bj_mat3_transpose (bj_mat3 *restrict out, const bj_mat3 *restrict A)
static void bj_mat3_add (bj_mat3 *restrict out, const bj_mat3 *restrict A, const bj_mat3 *restrict B)
static void bj_mat3_sub (bj_mat3 *restrict out, const bj_mat3 *restrict A, const bj_mat3 *restrict B)
static void bj_mat3_mul_scalar (bj_mat3 *restrict out, const bj_mat3 *restrict A, bj_real k)
static void bj_mat3_mul (bj_mat3 *restrict out, const bj_mat3 *restrict A, const bj_mat3 *restrict B)
static bj_vec3 bj_mat3_transform_vec3 (const bj_mat3 *restrict M, bj_vec3 v)
static bj_vec2 bj_mat3_transform_point (const bj_mat3 *restrict M, bj_vec2 p)
static void bj_mat3_set_translation (bj_mat3 *restrict M, bj_real tx, bj_real ty)
static void bj_mat3_translate (bj_mat3 *restrict M, bj_real tx, bj_real ty)
static void bj_mat3_set_scaling_xy (bj_mat3 *restrict M, bj_real sx, bj_real sy)
static void bj_mat3_set_shear_xy (bj_mat3 *restrict M, bj_real shx, bj_real shy)
static void bj_mat3_set_rotation_z (bj_mat3 *restrict M, bj_real angle)
static bj_real bj_mat3_determinant (const bj_mat3 *restrict A)
static bj_bool bj_mat3_invert (bj_mat3 *restrict out, const bj_mat3 *restrict A)
static void bj_mat3_invert_unsafe (bj_mat3 *restrict out, const bj_mat3 *restrict A)
static void bj_mat3_set_ortho (bj_mat3 *restrict M, bj_real l, bj_real r, bj_real b, bj_real t)
static void bj_mat3_set_viewport (bj_mat3 *restrict M, bj_real x, bj_real y, bj_real w, bj_real h)
static void bj_mat3x2_set_identity (bj_mat3x2 *restrict M)
static void bj_mat3x2_set_translation (bj_mat3x2 *restrict M, bj_real tx, bj_real ty)
static void bj_mat3x2_set_scaling_xy (bj_mat3x2 *restrict M, bj_real sx, bj_real sy)
static void bj_mat3x2_set_rotation_z (bj_mat3x2 *restrict M, bj_real angle)
static void bj_mat3x2_mul (bj_mat3x2 *restrict out, const bj_mat3x2 *restrict A, const bj_mat3x2 *restrict B)
static bj_vec2 bj_mat3x2_transform_point (const bj_mat3x2 *restrict M, bj_vec2 p)
static bj_vec2 bj_mat3x2_transform_dir (const bj_mat3x2 *restrict M, bj_vec2 v)
static void bj_mat3_from_mat3x2 (bj_mat3 *restrict M, const bj_mat3x2 *restrict A)
static void bj_mat3x2_from_mat3 (bj_mat3x2 *restrict M, const bj_mat3 *restrict A)
static void bj_mat4_set_identity (bj_mat4 *restrict M)
static void bj_mat4_copy (bj_mat4 *restrict dst, const bj_mat4 *restrict src)
static bj_vec4 bj_mat4_row (const bj_mat4 *restrict M, int r)
static bj_vec4 bj_mat4_col (const bj_mat4 *restrict M, int c)
static void bj_mat4_transpose (bj_mat4 *restrict out, const bj_mat4 *restrict A)
static void bj_mat4_add (bj_mat4 *restrict out, const bj_mat4 *restrict A, const bj_mat4 *restrict B)
static void bj_mat4_sub (bj_mat4 *restrict out, const bj_mat4 *restrict A, const bj_mat4 *restrict B)
static void bj_mat4_mul_scalar (bj_mat4 *restrict out, const bj_mat4 *restrict A, bj_real k)
static void bj_mat4_scale_axes (bj_mat4 *restrict out, const bj_mat4 *restrict A, bj_real sx, bj_real sy, bj_real sz)
static void bj_mat4_mul (bj_mat4 *restrict out, const bj_mat4 *restrict A, const bj_mat4 *restrict B)
static bj_vec4 bj_mat4_transform_vec4 (const bj_mat4 *restrict M, bj_vec4 v)
static void bj_mat4_set_translation (bj_mat4 *restrict M, bj_real x, bj_real y, bj_real z)
static void bj_mat4_translate (bj_mat4 *restrict M, bj_real x, bj_real y, bj_real z)
static void bj_mat4_set_outer_product (bj_mat4 *restrict out, bj_vec3 a, bj_vec3 b)
static void bj_mat4_rotate_axis_andle (bj_mat4 *restrict out, const bj_mat4 *restrict M, bj_vec3 axis, bj_real angle)
static void bj_mat4_rotate_x (bj_mat4 *restrict out, const bj_mat4 *restrict M, bj_real a)
static void bj_mat4_rotate_y (bj_mat4 *restrict out, const bj_mat4 *restrict M, bj_real a)
static void bj_mat4_rotate_z (bj_mat4 *restrict out, const bj_mat4 *restrict M, bj_real a)
static void bj_mat4_rotate_arcball (bj_mat4 *restrict R, const bj_mat4 *restrict M, bj_vec2 a, bj_vec2 b, bj_real s)
static bj_bool bj_mat4_invert (bj_mat4 *restrict out, const bj_mat4 *restrict M)
static void bj_mat4_invert_unsafe (bj_mat4 *restrict out, const bj_mat4 *restrict M)
static void bj_mat4_orthonormalize (bj_mat4 *restrict out, const bj_mat4 *restrict A)
static void bj_mat4_set_frustum (bj_mat4 *restrict M, bj_real l, bj_real r, bj_real b, bj_real t, bj_real n, bj_real f)
static void bj_mat4_set_ortho (bj_mat4 *restrict M, bj_real l, bj_real r, bj_real b, bj_real t, bj_real n, bj_real f)
static void bj_mat4_set_perspective (bj_mat4 *restrict M, bj_real y_fov, bj_real aspect, bj_real n, bj_real f)
static void bj_mat4_set_viewport (bj_mat4 *restrict M, bj_real x, bj_real y, bj_real w, bj_real h)
static void bj_mat4_set_lookat (bj_mat4 *restrict M, bj_vec3 eye, bj_vec3 center, bj_vec3 up)
static void bj_mat4x3_set_identity (bj_mat4x3 *restrict M)
static void bj_mat4x3_set_translation (bj_mat4x3 *restrict M, bj_real tx, bj_real ty, bj_real tz)
static void bj_mat4x3_set_scaling_xyz (bj_mat4x3 *restrict M, bj_real sx, bj_real sy, bj_real sz)
static void bj_mat4x3_set_rotation_x (bj_mat4x3 *restrict M, bj_real a)
static void bj_mat4x3_set_rotation_y (bj_mat4x3 *restrict M, bj_real a)
static void bj_mat4x3_set_rotation_z (bj_mat4x3 *restrict M, bj_real a)
static void bj_mat4x3_mul (bj_mat4x3 *restrict out, const bj_mat4x3 *restrict A, const bj_mat4x3 *restrict B)
static bj_vec3 bj_mat4x3_transform_point (const bj_mat4x3 *restrict M, bj_vec3 p)
static bj_vec3 bj_mat4x3_transform_dir (const bj_mat4x3 *restrict M, bj_vec3 v)
static void bj_mat4_from_mat4x3 (bj_mat4 *restrict M, const bj_mat4x3 *restrict A)
static void bj_mat4x3_from_mat4 (bj_mat4x3 *restrict M, const bj_mat4 *restrict A)

Detailed Description

C99 math shim with bj_real precision type and scalar utilities.

Column-major storage: elements are addressed as m[col][row].

Matrix utilities for 2D and 3D transforms using bj_real and bj_vec*.

Vectors are treated as column vectors and are multiplied on the right: res = M * v.

Provides creation, copy, transpose, arithmetic, products, inversion, orthonormalization, and common projection/viewport helpers for 3×3, 3×2, 4×4, 4×3.