#pragma once
#include <array>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <string>
#include <Utils.h>

struct shader_data_t
{
public:
    std::array<float, 4> camera_position = { 0, 0, 0, 0 };
    std::array<float, 4> camera_rotation = { 0, 0, 0, 0 };
    std::array<float, 2> _PixelOffset = { 0.5f, 0.5f };
    std::array<int, 2> screenSize = { 0, 0 };
    int iterations = 5;
    float _Seed = getRand();
    int objectcount = 0;
    int _sample = 1;
    int samples = 1;
    float dt = .000001f;
    std::array<float, 2> mouse_movement = {0, 0};
    void UpdateSeed();
    void UpdateWindowSize(int width, int height);
    void GetWindowSize(int& width, int& height);
    int GetWidth();
    int GetHeight();
};
struct CameraData {
    std::array<float, 3> velocity = { 0, 0, 0 };
    std::array<float, 3> max_v = { 30, 30, 30};
    std::array<float, 3> position = { 0, 0, 0 };
    std::array<float, 3> rotation = { 0, 0, 0 };
    std::array<float, 3> acceleration = { 0, 0, 0 };
    float friction = 30.0f;
    float acc_mul = 50.0f;
    bool m_changed = false;
    bool breakk = false;
    float sensitivity = 3.0f;
    int m_width, m_height;
    void accCamera(float acc[3], float time);
    void rotateCamera(float dx, float dy);
    void CopyData(shader_data_t& shader_data);

    bool HasChanged();

    void SetChanged(bool ch);

    float temp[2];

    void updateCameraData(float time, GLFWwindow* window);
    void updateCameraData(float time);
    void UpdateWindowSize(int width, int height);
};

//struct SceneObject {
//    std::array<float, 4> position = { 0, 0, 0, 0 };
//    std::array<float, 4> size = { 1, 1, 1, 1 };
//    std::array<float, 4> orientation = { 0, 0, 0, 0 };
//    std::array<float, 4> albedo = { 1, 1, 1, 1 };
//    std::array<float, 4> specular = { 0, 0, 0, 0 };
//    std::array<float, 4> emission = { 0, 0, 0, 0 };
//    //0 - diffuse
//    //1 - specular
//    //2 - normal
//    //3 - emission
//    std::array<int, 4> texture_id = { 0, 0, 0, 0 };
//    float refractive_index = 1;
//    float transparency = 0;
//    float smoothness = 0;
//    int type = 0;
//    int offset = 0;
//    int vert_num = 0;
//    std::array<int, 2> padding;
//};
struct SceneObject {
    std::array<float, 4> position = { 0, 0, 0, 0 };
};