-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rmodels] tinyobj_loader_c.h
fails to load .mtl
if .obj
uses \r\n
as EOL
#3473
Comments
Ok, here is a better quick fix to be inserted here : raylib/src/external/tinyobj_loader_c.h Lines 1267 to 1275 in f721429
/* Fill line infos. */
for (i = 0; i < end_idx; i++) {
if (is_line_ending(buf, i, end_idx)) {
line_infos[line_no].pos = prev_pos;
line_infos[line_no].len = i - prev_pos;
// ---- QUICK BUG FIX : https://github.com/raysan5/raylib/issues/3473
if ( i > 0 && buf[i-1] == '\r' ) line_infos[line_no].len--;
// --------
prev_pos = i + 1;
line_no++;
}
} |
@SuperUserNameMan Actually, |
SuperUserNameMan
added a commit
to SuperUserNameMan/raylib
that referenced
this issue
Oct 27, 2023
temporary quickfix for issue raysan5#3473
@raysan5 : ok, done |
@SuperUserNameMan Merged! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
Before redirecting me to open an issue on tinyobjloader-c, please note that the version of
tinyobjloader-c
used by Raylib is outdated, and it can't be directly updated because of API changes.So, either
rmodels.h
needs to be updated alongsideexternal/tinyobj_loader_c.h
, either Raylib keeps the outdated version oftinyobj_loader_c.h
and we have to fix it ourselves.The bug :
Not sure if it's directly related to #3398, but i've just found a bug in the (outdated) version of
tinyobj_loader_c.h
used by Raylib regarding the end of lines format used in the.obj
and.mtl
files.I'm on Linux, and I exported my
.obj/.mtl
from Wings3D which (unexpectedly) uses the MS-Windows'\r\n
end of line format.It appears that this version of
tinyobj_loader_c.h
does not handle\r\n
correctly.The
filename
sent totinyobj_parse_and_index_mtl_file()
fromtinyobj_parse_obj()
will contains a\r
as the last character (before the\0
), which prevents the.mtl
file from loading.The obvious workaround is to convert
\r\n
to\n
in my.obj/.mtl
files.Edit : the quickfix i provided before this edit was not enough, there are other issues that leads to segfaults
The text was updated successfully, but these errors were encountered: