rendlib/dev.c

42 lines
1019 B
C

#include <stdlib.h>
#include <stdio.h>
#include "include/rendlib.h"
#include "include/camera.h"
#include "include/object.h"
int main(int argc, char *argv[]) {
int ret = rendlib_start_window(argc, argv);
if (ret < 0) {
fprintf(stderr, "--error: %d\n", ret);
return EXIT_FAILURE;
}
struct model *m = load_model("assets/models/sphere.obj");
if (m == NULL) {
fprintf(stderr, "--error: loading model\n");
return EXIT_FAILURE;
}
struct object *o = create_object(&objects, 100.0f, m);
if (o == NULL) {
fprintf(stderr, "--error: creating object\n");
return EXIT_FAILURE;
}
struct camera *c = create_camera(CAMERA_PERSPECTIVE);
if (c == NULL) {
fprintf(stderr, "--error: creating camera\n");
return EXIT_FAILURE;
}
ret = rendlib_render();
if (ret < 0) {
fprintf(stderr, "--error: %d\n", ret);
return EXIT_FAILURE;
}
fprintf(stdout, "--rendering\n");
return EXIT_SUCCESS;
}