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.

Typedefs

typedef bj_vec3 bj_mat3x3[3]
typedef bj_mat3x3 bj_mat3
typedef bj_vec2 bj_mat3x2[3]
typedef bj_vec4 bj_mat4x4[4]
typedef bj_mat4x4 bj_mat4
typedef bj_vec3 bj_mat4x3[4]

Functions

static void bj_mat3_identity (bj_mat3x3 m)
static void bj_mat3_copy (bj_mat3x3 to, const bj_mat3x3 from)
static void bj_mat3_row (bj_vec3 res, const bj_mat3x3 m, int r)
static void bj_mat3_col (bj_vec3 res, const bj_mat3x3 m, int c)
static void bj_mat3_transpose (bj_mat3x3 res, const bj_mat3x3 m)
static void bj_mat3_add (bj_mat3x3 res, const bj_mat3x3 a, const bj_mat3x3 b)
static void bj_mat3_sub (bj_mat3x3 res, const bj_mat3x3 a, const bj_mat3x3 b)
static void bj_mat3_scale (bj_mat3x3 res, const bj_mat3x3 m, bj_real k)
static void bj_mat3_mul (bj_real res[restrict static(3)][3], const bj_real lhs[restrict static(3)][3], const bj_real rhs[restrict static(3)][3])
static void bj_mat3_mul_vec3 (bj_real res[restrict static(3)], const bj_real m[restrict static(3)][3], const bj_real v[restrict static(3)])
static void bj_mat3_mul_point (bj_vec2 res, const bj_mat3x3 m, const bj_vec2 p)
static void bj_mat3_mul_vector2 (bj_vec2 res, const bj_mat3x3 m, const bj_vec2 v2)
static void bj_mat3_translation (bj_mat3x3 res, bj_real tx, bj_real ty)
static void bj_mat3_translation_inplace (bj_mat3x3 M, bj_real tx, bj_real ty)
static void bj_mat3_scale_xy (bj_mat3x3 res, bj_real sx, bj_real sy)
static void bj_mat3_shear (bj_mat3x3 res, bj_real shx, bj_real shy)
static void bj_mat3_rotate (bj_mat3x3 res, bj_real angle)
static void bj_mat3_inverse (bj_mat3x3 res, const bj_mat3x3 m)
static void bj_mat3_ortho (bj_real omat[restrict static(3)][3], bj_real l, bj_real r, bj_real b, bj_real t)
static void bj_mat3_viewport (bj_real vpmat[restrict static(3)][3], bj_real x, bj_real y, bj_real w, bj_real h)
static void bj_mat3x2_identity (bj_real m[restrict static(3)][2])
static void bj_mat3x2_translate (bj_real m[restrict static(3)][2], bj_real tx, bj_real ty)
static void bj_mat3x2_scale (bj_real m[restrict static(3)][2], bj_real sx, bj_real sy)
static void bj_mat3x2_rotate (bj_real m[restrict static(3)][2], bj_real angle)
static void bj_mat3x2_mul (bj_real res[restrict static(3)][2], const bj_real A[restrict static(3)][2], const bj_real B[restrict static(3)][2])
static void bj_mat3x2_mul_point (bj_real r[restrict static(2)], const bj_real m[restrict static(3)][2], const bj_real p[restrict static(2)])
static void bj_mat3x2_mul_dir (bj_real r[restrict static(2)], const bj_real m[restrict static(3)][2], const bj_real v[restrict static(2)])
static void bj_mat3_from_mat3x2 (bj_real out3x3[restrict static(3)][3], const bj_real a[restrict static(3)][2])
static void bj_mat3x2_from_mat3 (bj_real out3x2[restrict static(3)][2], const bj_real m[restrict static(3)][3])
static void bj_mat4_identity (bj_mat4x4 mat)
static void bj_mat4_copy (bj_mat4x4 to, const bj_mat4x4 from)
static void bj_mat4_row (bj_vec4 res, const bj_mat4x4 mat, int r)
static void bj_mat4_col (bj_vec4 res, const bj_mat4x4 mat, int c)
static void bj_mat4_transpose (bj_mat4x4 res, const bj_mat4x4 mat)
static void bj_mat4_add (bj_mat4x4 res, const bj_mat4x4 lhs, const bj_mat4x4 rhs)
static void bj_mat4_sub (bj_mat4x4 res, const bj_mat4x4 lhs, const bj_mat4x4 rhs)
static void bj_mat4_scale (bj_mat4x4 res, const bj_mat4x4 lhs, bj_real k)
static void bj_mat4_scale_xyz (bj_mat4x4 res, const bj_mat4x4 mat, bj_real x, bj_real y, bj_real z)
static void bj_mat4_mul (bj_real res[restrict static(4)][4], const bj_real lhs[restrict static(4)][4], const bj_real rhs[restrict static(4)][4])
static void bj_mat4_mul_vec4 (bj_real res[restrict static(4)], const bj_real mat[restrict static(4)][4], const bj_real v[restrict static(4)])
static void bj_mat4_translation (bj_mat4x4 res, bj_real x, bj_real y, bj_real z)
static void bj_mat4_translation_inplace (bj_mat4x4 M, bj_real x, bj_real y, bj_real z)
static void bj_mat4_mul_outer (bj_mat4x4 res, const bj_vec3 a, const bj_vec3 b)
static void bj_mat4_rotate (bj_mat4x4 res, const bj_mat4x4 mat, bj_real x, bj_real y, bj_real z, bj_real angle)
static void bj_mat4_rotate_x (bj_mat4x4 res, const bj_mat4x4 mat, bj_real angle)
static void bj_mat4_rotate_y (bj_mat4x4 res, const bj_mat4x4 mat, bj_real angle)
static void bj_mat4_rotate_z (bj_mat4x4 res, const bj_mat4x4 mat, bj_real angle)
static void bj_mat4_rotate_arcball (bj_mat4x4 R, const bj_mat4x4 M, bj_vec2 const _a, bj_vec2 const _b, bj_real s)
static void bj_mat4_inverse (bj_mat4x4 res, const bj_mat4x4 mat)
static void bj_mat4_orthonormalize (bj_mat4x4 res, const bj_mat4x4 mat)
static void bj_mat4_frustum (bj_real fmat[restrict static(4)][4], bj_real l, bj_real r, bj_real b, bj_real t, bj_real n, bj_real f)
static void bj_mat4_ortho (bj_real omat[restrict static(4)][4], bj_real l, bj_real r, bj_real b, bj_real t, bj_real n, bj_real f)
static void bj_mat4_perspective (bj_real pmat[restrict static(4)][4], bj_real y_fov, bj_real aspect, bj_real n, bj_real f)
static void bj_mat4_viewport (bj_real vpmat[restrict static(4)][4], bj_real x, bj_real y, bj_real w, bj_real h)
static void bj_mat4_lookat (bj_real m[restrict static(4)][4], const bj_vec3 eye, const bj_vec3 center, const bj_vec3 up)
static void bj_mat4x3_identity (bj_real m[restrict static(4)][3])
static void bj_mat4x3_translate (bj_real m[restrict static(4)][3], bj_real tx, bj_real ty, bj_real tz)
static void bj_mat4x3_scale (bj_real m[restrict static(4)][3], bj_real sx, bj_real sy, bj_real sz)
static void bj_mat4x3_rotate_x (bj_real m[restrict static(4)][3], bj_real angle)
static void bj_mat4x3_rotate_y (bj_real m[restrict static(4)][3], bj_real angle)
static void bj_mat4x3_rotate_z (bj_real m[restrict static(4)][3], bj_real angle)
static void bj_mat4x3_mul (bj_real res[restrict static(4)][3], const bj_real A[restrict static(4)][3], const bj_real B[restrict static(4)][3])
static void bj_mat4x3_mul_point (bj_real r[restrict static(3)], const bj_real m[restrict static(4)][3], const bj_real p[restrict static(3)])
static void bj_mat4x3_mul_dir (bj_real r[restrict static(3)], const bj_real m[restrict static(4)][3], const bj_real v[restrict static(3)])
static void bj_mat4_from_mat4x3 (bj_mat4x4 out, const bj_real a[restrict static(4)][3])
static void bj_mat4x3_from_mat4 (bj_real out43[restrict static(4)][3], const bj_mat4x4 m)
static void bj_mat4x3_lookat (bj_real m[restrict static(4)][3], const bj_real eye[restrict static(3)], const bj_real center[restrict static(3)], const bj_real up[restrict static(3)])

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.