mirror of
https://github.com/thisistherk/fast_obj.git
synced 2025-04-06 14:05:02 +00:00
Merge pull request #45 from zeux/master
Mark materials that weren't loaded from mtllib as fallback
This commit is contained in:
commit
e24d2c5533
1 changed files with 7 additions and 1 deletions
|
@ -65,6 +65,9 @@ typedef struct
|
|||
float d; /* Disolve (alpha) */
|
||||
int illum; /* Illumination model */
|
||||
|
||||
/* Set for materials that don't come from the associated mtllib */
|
||||
int fallback;
|
||||
|
||||
/* Texture maps */
|
||||
fastObjTexture map_Ka;
|
||||
fastObjTexture map_Kd;
|
||||
|
@ -323,7 +326,7 @@ unsigned long file_size(void* file, void* user_data)
|
|||
long p;
|
||||
long n;
|
||||
(void)(user_data);
|
||||
|
||||
|
||||
f = (FILE*)(file);
|
||||
|
||||
p = ftell(f);
|
||||
|
@ -872,6 +875,8 @@ fastObjMaterial mtl_default(void)
|
|||
mtl.d = 1.0;
|
||||
mtl.illum = 1;
|
||||
|
||||
mtl.fallback = 0;
|
||||
|
||||
mtl.map_Ka = map_default();
|
||||
mtl.map_Kd = map_default();
|
||||
mtl.map_Ks = map_default();
|
||||
|
@ -919,6 +924,7 @@ const char* parse_usemtl(fastObjData* data, const char* ptr)
|
|||
{
|
||||
fastObjMaterial new_mtl = mtl_default();
|
||||
new_mtl.name = string_copy(s, e);
|
||||
new_mtl.fallback = 1;
|
||||
array_push(data->mesh->materials, new_mtl);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue