LibGame  v0.4.0
The LG Game Engine - Copyright (C) 2024 ETMSoftware
math_3d.h File Reference

Math 3D v1.0 - by Stephan Soller steph.nosp@m.an.s.nosp@m.oller.nosp@m.@hel.nosp@m.ionwe.nosp@m.b.de and Tobias Malmsheimer. More...

Go to the source code of this file.

Data Structures

struct  vec3_t
 
union  mat4_t
 

Macros

#define M_PI   3.14159265358979323846
 

Functions

mat4_t m4_rotation (float angle_in_rad, vec3_t axis)
 
mat4_t m4_ortho (float left, float right, float bottom, float top, float back, float front)
 
mat4_t m4_perspective (float vertical_field_of_view_in_deg, float aspect_ratio, float near_view_distance, float far_view_distance)
 
mat4_t m4_frustum (float left, float right, float bottom, float top, float near, float far)
 
mat4_t m4_look_at (vec3_t from, vec3_t to, vec3_t up)
 
mat4_t m4_invert_affine (mat4_t matrix)
 
vec3_t m4_mul_pos (mat4_t matrix, vec3_t position)
 
vec3_t m4_mul_dir (mat4_t matrix, vec3_t direction)
 
void m4_print (mat4_t matrix)
 
void m4_printp (mat4_t matrix, int width, int precision)
 
void m4_fprint (FILE *stream, mat4_t matrix)
 
void m4_fprintp (FILE *stream, mat4_t matrix, int width, int precision)
 
void m4_print2 (mat4_t matrix, const char *line_start)
 
void m4_printp2 (mat4_t matrix, int width, int precision, const char *line_start)
 
void m4_fprint2 (FILE *stream, mat4_t matrix, const char *line_start)
 
void m4_fprintp2 (FILE *stream, mat4_t matrix, int width, int precision, const char *line_start)
 

Detailed Description

Math 3D v1.0 - by Stephan Soller steph.nosp@m.an.s.nosp@m.oller.nosp@m.@hel.nosp@m.ionwe.nosp@m.b.de and Tobias Malmsheimer.

Licensed under the MIT license

See: https://github.com/arkanis/single-header-file-c-libs/blob/master/math_3d.h

A few minor changes by Emmanuel Thomas-Maurin manu@.nosp@m.etms.nosp@m.oftwa.nosp@m.re.n.nosp@m.et

  • m4_frustum() added
  • Some new matrix info functions
  • Indentation and coding style changes

Last change on 2024-09-20