#ifndef SWIFT_MATHS_MAT4F_H
#define SWIFT_MATHS_MAT4F_H

#include <swift/stdlib.h>

#include <swift/maths/api.h>

typedef union swift_vec3f_t swift_vec3f_t;
typedef union swift_vec4f_t swift_vec4f_t;
typedef union swift_mat4f_t swift_mat4f_t;

union swift_mat4f_t {
	struct {
		float m00, m10, m20, m30; /* 0, 1, 2, 3*/
		float m01, m11, m21, m31; /* 4, 5, 6, 7*/
		float m02, m12, m22, m32; /* 8, 9, 10, 11*/
		float m03, m13, m23, m33; /* 12, 13, 14, 15*/
	}m;
	float data[4*4];
};

#define SWIFT_MAT4F(...) ((swift_mat4f_t){__VA_ARGS__})

SWIFT_MATHS_API swift_mat4f_t swift_mat4f_zero(void);
SWIFT_MATHS_API swift_mat4f_t swift_mat4f_identity(void);
SWIFT_MATHS_API swift_mat4f_t swift_mat4f_from_mat3f(swift_mat3f_t mat);
SWIFT_MATHS_API swift_mat4f_t swift_mat4f_translation(swift_vec3f_t vec);
SWIFT_MATHS_API swift_vec4f_t swift_mat4f_dot_vec4f(swift_mat4f_t lhs,
	swift_vec4f_t rhs);
SWIFT_MATHS_API swift_mat4f_t swift_mat4f_dot(swift_mat4f_t lhs,
	swift_mat4f_t rhs);
SWIFT_MATHS_API swift_mat4f_t swift_mat4f_translate(swift_mat4f_t mat,
	swift_vec3f_t vec);
SWIFT_MATHS_API swift_mat4f_t swift_mat4f_scale(swift_mat4f_t mat,
	swift_vec3f_t vec);
SWIFT_MATHS_API swift_mat4f_t swift_mat4f_rotate(swift_mat4f_t mat, float angle,
	swift_vec3f_t axis);
SWIFT_MATHS_API swift_mat4f_t swift_mat4f_ortho(float left, float right,
	float bottom, float top, float near, float far);
SWIFT_MATHS_API swift_mat4f_t swift_mat4f_frustum(float left, float right,
	float bottom, float top, float near, float far);
SWIFT_MATHS_API swift_mat4f_t swift_mat4f_perspective(float fovy, float aspect,
	float near, float far);
SWIFT_MATHS_API swift_mat4f_t swift_mat4f_look_at(swift_vec3f_t eye,
	swift_vec3f_t center, swift_vec3f_t up);
SWIFT_MATHS_API swift_mat4f_t swift_mat4f_mul_scalar(swift_mat4f_t mat,
	float scalar);
SWIFT_MATHS_API swift_mat4f_t swift_mat4f_add(swift_mat4f_t lhs,
	swift_mat4f_t rhs);

#endif /* SWIFT_MATHS_MAT4F_H */
