#include <stdio.h>
#include <stdlib.h>

#define STB_IMAGE_IMPLEMENTATION
#include "stb_image/stb_image.h"
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image/stb_image_write.h"
#include "examples.h"
#include "cJSON.h"
#include <string.h>
#define MAXJSONSIZE (100 * 1024)
#include "structs.h"
#include "collision.h"
#include "raytrace.h"
int main() {
    int width = 720;
    int height = 720;
    int channels = 4;
    unsigned char *image = (unsigned char*)malloc(width * height * channels );

    FILE *fptr = fopen("C:/Users/ary/CLionProjects/Raytracer/CornellBox.gltf", "r");
    char *rawJSON = malloc(MAXJSONSIZE);
    char ch;
    for (int i = 0;(ch = fgetc(fptr)) != EOF;i++)
        rawJSON[i] = ch;
    cJSON *szene = cJSON_Parse(rawJSON);



    //example_color(width, height, channels, image);
    exampleCornell(width, height, channels, &image);


    stbi_write_png("C:/Users/ary/CLionProjects/Raytracer/test.png", width, height, channels, image, width * channels);
    free(image);

    return 0;
}