Base/core/exports/librr/linear_algebra.h

61 lines
1.1 KiB
C

#ifndef RR_MATH_H
#define RR_MATH_H
#include <librr/types.h>
typedef struct rr_vec2f
{
float x;
float y;
} rr_vec2f_s;
typedef struct rr_vec3
{
float x;
float y;
float z;
} rr_vec3f_s;
typedef struct rr_vec4f
{
float x;
float y;
float z;
float w;
} rr_vec4f_s;
typedef struct rr_mat2f
{
float values[2][2];
} rr_mat2f_s;
typedef struct rr_mat3f
{
float values[3][3];
} rr_mat3f_s;
typedef struct rr_mat4f
{
float values[4][4];
} rr_mat4f_s;
rr_mat2f_s rr_identity_mat2f();
rr_mat3f_s rr_identity_mat3f();
rr_mat4f_s rr_identity_mat4f();
rr_mat4f_s rr_mat4f_multiply(rr_mat4f_s first, rr_mat4f_s second);
rr_vec4f_s rr_mat4f_multiply_vec4f(rr_mat4f_s matrix, rr_vec4f_s vector);
void rr_mat4f_translate(rr_mat4f_s *matrix, rr_vec3f_s xyz);
rr_mat4f_s rr_mat4f_rotate_x(float radians);
rr_mat4f_s rr_mat4f_rotate_y(float radians);
rr_mat4f_s rr_mat4f_rotate_z(float radians);
rr_mat4f_s rr_mat4f_rotate_xyz(float x_rad, float y_rad, float z_rad);
rr_mat4f_s rr_mat4f_perspective(float fov, float near_plane, float far_plane, float aspect_ratio);
#endif // RR_MATH_H