97 lines
2.3 KiB
C
97 lines
2.3 KiB
C
|
|
#ifndef TC_MATH_H
|
|
#define TC_MATH_H
|
|
|
|
#include <utility/utility.h>
|
|
|
|
typedef struct tc_vec4f tc_vec4f_s;
|
|
typedef struct tc_vec3f tc_vec3f_s;
|
|
typedef struct tc_vec2f tc_vec2f_s;
|
|
|
|
typedef struct tc_vec4i tc_vec4i_s;
|
|
typedef struct tc_vec3i tc_vec3i_s;
|
|
typedef struct tc_vec2i tc_vec2i_s;
|
|
|
|
typedef struct tc_mat4f tc_mat4f_s;
|
|
typedef struct tc_mat3f tc_mat3f_s;
|
|
|
|
struct tc_vec4f
|
|
{
|
|
f32_t x;
|
|
f32_t y;
|
|
f32_t z;
|
|
f32_t w;
|
|
};
|
|
|
|
struct tc_vec3f
|
|
{
|
|
f32_t x;
|
|
f32_t y;
|
|
f32_t z;
|
|
};
|
|
|
|
struct tc_vec2f
|
|
{
|
|
f32_t x;
|
|
f32_t y;
|
|
};
|
|
|
|
struct tc_vec4i
|
|
{
|
|
i32_t x;
|
|
i32_t y;
|
|
i32_t z;
|
|
i32_t w;
|
|
};
|
|
|
|
struct tc_vec3i
|
|
{
|
|
i32_t x;
|
|
i32_t y;
|
|
i32_t z;
|
|
};
|
|
|
|
struct tc_vec2i
|
|
{
|
|
i32_t x;
|
|
i32_t y;
|
|
};
|
|
|
|
|
|
|
|
struct tc_mat4f
|
|
{
|
|
f32_t values[4][4];
|
|
};
|
|
|
|
struct tc_mat3f
|
|
{
|
|
f32_t values[3][3];
|
|
};
|
|
|
|
f32_t tc_deg_to_rad (f32_t degrees);
|
|
f32_t tc_rad_to_deg (f32_t radians);
|
|
|
|
bool_t tc_vec4f_equ (tc_vec4f_s vector_1, tc_vec4f_s vector_2);
|
|
bool_t tc_vec3f_equ (tc_vec3f_s vector_1, tc_vec3f_s vector_2);
|
|
bool_t tc_vec2f_equ (tc_vec2f_s vector_1, tc_vec2f_s vector_2);
|
|
|
|
bool_t tc_vec4i_equ (tc_vec4i_s vector_1, tc_vec4i_s vector_2);
|
|
bool_t tc_vec3i_equ (tc_vec3i_s vector_1, tc_vec3i_s vector_2);
|
|
bool_t tc_vec2i_equ (tc_vec2i_s vector_1, tc_vec2i_s vector_2);
|
|
|
|
tc_mat4f_s tc_mat4f_identity ();
|
|
tc_mat3f_s tc_mat3f_identity ();
|
|
|
|
tc_mat4f_s tc_mat4_rotate_x (tc_mat4f_s matrix, float radians);
|
|
tc_mat4f_s tc_mat4_rotate_y (tc_mat4f_s matrix, float radians);
|
|
tc_mat4f_s tc_mat4_rotate_z (tc_mat4f_s matrix, float radians);
|
|
|
|
tc_mat4f_s tc_mat4f_translate (tc_mat4f_s matrix, tc_vec3f_s translation);
|
|
tc_mat3f_s tc_mat3f_translate (tc_mat3f_s matrix, tc_vec3f_s translation);
|
|
|
|
tc_mat4f_s tc_mat4f_perspective (float fov, float aspect_ratio, float near, float far);
|
|
|
|
#endif // TC_MATH_H
|
|
|