parsen von der szene JSON parser

This commit is contained in:
any
2026-07-19 21:04:22 +02:00
parent ff8c8a2bdc
commit 211a1260b6
6 changed files with 4063 additions and 2 deletions
+11 -1
View File
@@ -6,12 +6,22 @@
#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)
int main() {
int width = 1280;
int height = 780;
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);
stbi_write_png("C:/Users/ary/CLionProjects/Raytracer/test.png", width, height, channels, image, width * channels);
free(image);