aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-09-26 11:32:44 +0000
committerrodri <rgl@antares-labs.eu>2024-09-26 11:32:44 +0000
commit78739a666a7031db16648c7d629f567442ea16bd (patch)
treea8bf6b462421b71aab64f3a88e7b64f0f7599141
parent4742c552904c44bc77604b7cf03ed7b14e2e7ef4 (diff)
downloadlibobj-78739a666a7031db16648c7d629f567442ea16bd.tar.gz
libobj-78739a666a7031db16648c7d629f567442ea16bd.tar.bz2
libobj-78739a666a7031db16648c7d629f567442ea16bd.zip
add an opacity parameter in OBJColor to discard non-colors.
-rw-r--r--obj.c4
-rw-r--r--obj.h2
2 files changed, 5 insertions, 1 deletions
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