Load and render head.obj
This commit is contained in:
parent
e266879a4f
commit
c2adf07a1d
16
src/main.c
16
src/main.c
@ -1,6 +1,7 @@
|
||||
#include "img.h"
|
||||
#include "mem_arena.h"
|
||||
#include "mem_utils.h"
|
||||
#include "obj.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -9,6 +10,7 @@ enum {
|
||||
TINY_EXIT_SUCCESS,
|
||||
TINY_EXIT_ARENA_INIT_FAILED,
|
||||
TINY_EXIT_IMAGE_INIT_FAILED,
|
||||
TINY_EXIT_MODEL_LOAD_FAILED,
|
||||
};
|
||||
|
||||
int main(void) {
|
||||
@ -18,14 +20,20 @@ int main(void) {
|
||||
return TINY_EXIT_ARENA_INIT_FAILED;
|
||||
}
|
||||
|
||||
Colour cyan = {.r = 0, .g = 255, .b = 255, .a = 255};
|
||||
Colour red = {.r = 255, .g = 0, .b = 0, .a = 255};
|
||||
Image img = {.width = 200, .height = 200};
|
||||
Colour bg = {.r = 42, .g = 45, .b = 52, .a = 255};
|
||||
Colour wireframe = {.r = 242, .g = 100, .b = 48, .a = 255};
|
||||
Image img = {.width = 1200, .height = 1200};
|
||||
if (!init_image(arena, &img)) {
|
||||
return TINY_EXIT_IMAGE_INIT_FAILED;
|
||||
}
|
||||
|
||||
clear_image(&img, cyan);
|
||||
Model model = load_obj_file(arena, "resources/head.obj");
|
||||
if (IS_NULL_MODEL(model)) {
|
||||
return TINY_EXIT_MODEL_LOAD_FAILED;
|
||||
}
|
||||
|
||||
clear_image(&img, bg);
|
||||
render_wireframe_model(&model, &img, wireframe);
|
||||
save_image(&img, "result.pam");
|
||||
|
||||
wapp_mem_arena_destroy(&arena);
|
||||
|
Loading…
Reference in New Issue
Block a user