When I try to compile my code it throws 66 errors and all the errors are just about mat4.h
errors(repeating lines). I tried Include guards, #pragma once
.
Code
mat4.h
#pragma once
#include "vec3.h"
#include "vec4.h"
#include "maths_func.h"
namespace sparky { namespace maths {
struct mat4
{
union
{
float elements[4 * 4];
vec4 columns[4];
};
mat4();
mat4(float diagonal);
static mat4 identity();
mat4& multiply(const mat4& other);
friend mat4 operator*(mat4 left, const mat4& right);
mat4& operator*=(const mat4& other);
mat4& Invert();
static mat4 orthographic(float left, float right, float bottom, float top, float near, float far);
static mat4 perspective(float fov, float aspectRatio, float near, float far);
static mat4 translation(const vec3& translation);
static mat4 rotation(float angle, const vec3& axis);
static mat4 scale(const vec3& scale);
};
} }
mat4.cpp File is too big so I will post it on pastebin. https://pastebin.com/FYSZV9ZX