mirror of
https://github.com/thisistherk/fast_obj.git
synced 2025-04-04 21:15:04 +00:00
Merge pull request #17 from Kuranes/patch-2
Add support for name with spaces
This commit is contained in:
commit
f12fb80c54
1 changed files with 10 additions and 6 deletions
16
fast_obj.h
16
fast_obj.h
|
@ -405,6 +405,11 @@ int is_whitespace(char c)
|
||||||
return (c == ' ' || c == '\t' || c == '\r');
|
return (c == ' ' || c == '\t' || c == '\r');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
int is_end_of_name(char c)
|
||||||
|
{
|
||||||
|
return (c == '\t' || c == '\r' || c == '\n');
|
||||||
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
int is_newline(char c)
|
int is_newline(char c)
|
||||||
|
@ -722,7 +727,7 @@ const char* parse_group(fastObjData* data, const char* ptr)
|
||||||
ptr = skip_whitespace(ptr);
|
ptr = skip_whitespace(ptr);
|
||||||
|
|
||||||
s = ptr;
|
s = ptr;
|
||||||
while (!is_whitespace(*ptr) && !is_newline(*ptr))
|
while (!is_end_of_name(*ptr))
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
e = ptr;
|
e = ptr;
|
||||||
|
@ -803,7 +808,7 @@ const char* parse_usemtl(fastObjData* data, const char* ptr)
|
||||||
|
|
||||||
/* Parse the material name */
|
/* Parse the material name */
|
||||||
s = ptr;
|
s = ptr;
|
||||||
while (!is_whitespace(*ptr) && !is_newline(*ptr))
|
while (!is_end_of_name(*ptr))
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
e = ptr;
|
e = ptr;
|
||||||
|
@ -901,7 +906,7 @@ const char* read_map(fastObjData* data, const char* ptr, fastObjTexture* map)
|
||||||
|
|
||||||
/* Read name */
|
/* Read name */
|
||||||
s = ptr;
|
s = ptr;
|
||||||
while (!is_whitespace(*ptr) && !is_newline(*ptr))
|
while (!is_end_of_name(*ptr))
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
e = ptr;
|
e = ptr;
|
||||||
|
@ -977,7 +982,7 @@ int read_mtllib(fastObjData* data, void* file)
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
s = p;
|
s = p;
|
||||||
while (!is_whitespace(*p) && !is_newline(*p))
|
while (!is_end_of_name(*p))
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
mtl.name = string_copy(s, p);
|
mtl.name = string_copy(s, p);
|
||||||
|
@ -1120,7 +1125,7 @@ const char* parse_mtllib(fastObjData* data, const char* ptr)
|
||||||
ptr = skip_whitespace(ptr);
|
ptr = skip_whitespace(ptr);
|
||||||
|
|
||||||
s = ptr;
|
s = ptr;
|
||||||
while (!is_whitespace(*ptr) && !is_newline(*ptr))
|
while (!is_end_of_name(*ptr))
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
e = ptr;
|
e = ptr;
|
||||||
|
@ -1404,4 +1409,3 @@ fastObjMesh* fast_obj_read(const char* path)
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue