#pragma once

#include <Core/Common/CoreTypes.h>
#include <Juliet.h>
#include <math.h>

namespace Juliet
{
    struct Vector3
    {
        float x, y, z;

        Vector3 operator+(const Vector3& rhs) const { return { x + rhs.x, y + rhs.y, z + rhs.z }; }
        Vector3 operator-(const Vector3& rhs) const { return { x - rhs.x, y - rhs.y, z - rhs.z }; }
        Vector3 operator*(float s) const { return { x * s, y * s, z * s }; }
    };

    struct Vector4
    {
        float x, y, z, w;
    };

    inline Vector3 Normalize(const Vector3& v)
    {
        float len = sqrtf(v.x * v.x + v.y * v.y + v.z * v.z);
        if (len > 0.0001f)
        {
            return { v.x / len, v.y / len, v.z / len };
        }
        return v;
    }

    inline Vector3 Cross(const Vector3& a, const Vector3& b)
    {
        return { a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x };
    }

    inline float Dot(const Vector3& a, const Vector3& b) { return a.x * b.x + a.y * b.y + a.z * b.z; }
} // namespace Juliet
