parsen von der szene JSON parser
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user