#ifndef __RENDER
#define __RENDER
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include "matrix.h"


#define TARGETFPS 1000
#define TARGETTPS 60


enum VBOS {
    VBO_VERTICES,
    VBO_NORMALS,
    VBO_COLORS,
    VBO_UV,
    VBO_INDICES
};

struct __renderHandles {
        GLuint VAO;
        GLuint VBOs[5]; // vertices, normals, colors, uv, indices
        GLuint shaderProgram;
};

struct object {
    struct __renderHandles handle;
    GLfloat *vertices, *normals, *colors,*UV_coords;
    GLfloat *unindexed_vertices;
    GLuint *textures;
    char** textureNames;
    int* texture_counts;
    unsigned int* indices;
    int vertices_size, normals_size, indices_size, UV_coords_size, textures_size;

    vec4 position;
    vec4 rotation; // in radians
};

extern GLFWwindow* main_window;
void initializeRenderer();
void destroyRenderer();
void renderWorld();
void reloadShaders();
struct object* loadAsset(const char* filename);
#endif