From 78739a666a7031db16648c7d629f567442ea16bd Mon Sep 17 00:00:00 2001 From: rodri Date: Thu, 26 Sep 2024 11:32:44 +0000 Subject: add an opacity parameter in OBJColor to discard non-colors. --- obj.c | 4 ++++ obj.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/obj.c b/obj.c index aa52515..95fa11f 100644 --- a/obj.c +++ b/obj.c @@ -425,6 +425,7 @@ objmtlparse(char *file) m->Ka.g = strtod(f[2], nil); m->Ka.b = strtod(f[3], nil); } + m->Ka.a = 1; }else if(strcmp(f[0], "Kd") == 0){ if(nf != 2 && nf != 4){ mterror("syntax error"); @@ -441,6 +442,7 @@ objmtlparse(char *file) m->Kd.g = strtod(f[2], nil); m->Kd.b = strtod(f[3], nil); } + m->Kd.a = 1; }else if(strcmp(f[0], "Ks") == 0){ if(nf != 2 && nf != 4){ mterror("syntax error"); @@ -457,6 +459,7 @@ objmtlparse(char *file) m->Ks.g = strtod(f[2], nil); m->Ks.b = strtod(f[3], nil); } + m->Ks.a = 1; }else if(strcmp(f[0], "Ke") == 0){ if(nf != 2 && nf != 4){ mterror("syntax error"); @@ -473,6 +476,7 @@ objmtlparse(char *file) m->Ke.g = strtod(f[2], nil); m->Ke.b = strtod(f[3], nil); } + m->Ke.a = 1; }else if(strcmp(f[0], "Ns") == 0){ if(nf != 2){ mterror("syntax error"); diff --git a/obj.h b/obj.h index c819e8f..1a28613 100644 --- a/obj.h +++ b/obj.h @@ -48,7 +48,7 @@ union OBJVertex struct OBJColor { - double r, g, b; + double r, g, b, a; }; struct OBJVertexArray -- cgit v1.2.3