From 44628e689575cd0009124151830dd2395de2ed91 Mon Sep 17 00:00:00 2001 From: Krow Savcik Date: Sun, 21 Jan 2024 01:33:01 +0200 Subject: feature: new option in .obj files --- draw.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'draw.c') diff --git a/draw.c b/draw.c index 9b703be..936ff41 100644 --- a/draw.c +++ b/draw.c @@ -41,7 +41,8 @@ add_obj(const char *path, Point off) int pc = 0; int a, b, c; float mult = 1; - unsigned int col; + unsigned int col, defcol; + defcol = 0x808080ff; if ((f = fopen(path, "r")) == NULL) { printf("%s:%d add_obj(...): Error opening file %s\n", __FILE__, __LINE__, path); @@ -62,7 +63,7 @@ add_obj(const char *path, Point off) break; case 'f': sscanf(s, "%*c %d%d%d", &a, &b, &c); - add_triangle(v[a-1], v[b-1], v[c-1], 0x808080ff); + add_triangle(v[a-1], v[b-1], v[c-1], defcol); t[0] = v[a-1]; t[0].y = 0; t[1] = v[b-1]; t[1].y = 0; t[2] = v[c-1]; t[2].y = 0; @@ -70,6 +71,9 @@ add_obj(const char *path, Point off) add_triangle(t[0], t[1], t[2], shadowcol); #endif break; + case 'C': + sscanf(s, "%*c %x", &defcol); + break; case 'F': sscanf(s, "%*c %d%d%d%x", &a, &b, &c, &col); add_triangle(v[a-1], v[b-1], v[c-1], col); -- cgit v1.2.3