Switch to using transformation matrices
This commit is contained in:
@@ -39,6 +39,25 @@ typedef struct {
|
||||
f32 w;
|
||||
} vec4f_t;
|
||||
|
||||
typedef struct {
|
||||
vec3f_t row0;
|
||||
vec3f_t row1;
|
||||
vec3f_t row2;
|
||||
} mat3x3f_t;
|
||||
|
||||
typedef struct {
|
||||
vec4f_t row0;
|
||||
vec4f_t row1;
|
||||
vec4f_t row2;
|
||||
} mat3x4f_t;
|
||||
|
||||
typedef struct {
|
||||
vec4f_t row0;
|
||||
vec4f_t row1;
|
||||
vec4f_t row2;
|
||||
vec4f_t row3;
|
||||
} mat4x4f_t;
|
||||
|
||||
#define vec_add(T, v1, v2) vec_add_##T(v1, v2)
|
||||
#define vec_sub(T, v1, v2) vec_sub_##T(v1, v2)
|
||||
#define vec_mul(T, v1, v2) vec_mul_##T(v1, v2)
|
||||
@@ -103,4 +122,12 @@ f32 vec_dot_vec4f_t(vec4f_t v1, vec4f_t v2);
|
||||
f32 vec_magnitude_vec4f_t(vec4f_t v);
|
||||
vec4f_t vec_unit_vec4f_t(vec4f_t v);
|
||||
|
||||
mat4x4f_t get_translation_matrix(vec3f_t translation);
|
||||
mat4x4f_t get_rotation_matrix(vec3f_t rotation);
|
||||
mat4x4f_t get_scaling_matrix(vec3f_t scale);
|
||||
mat3x3f_t get_rotation_mat3x3f(vec3f_t rotation);
|
||||
vec3f_t mul_mat3x4f_by_vec4f(mat3x4f_t mat, vec4f_t vec);
|
||||
mat3x4f_t mul_mat3x4f_by_mat4x4f(mat3x4f_t mat1, mat4x4f_t mat2);
|
||||
mat4x4f_t mul_mat4x4f(mat4x4f_t mat1, mat4x4f_t mat2);
|
||||
|
||||
#endif // !VEC_H
|
||||
|
||||
Reference in New Issue
Block a user