Describe the bug
RGBELoader checks for magic token at the start of the file:
https://github.com/mrdoob/three.js/blob/1e161eaeedee694861ec480f04b632443f64dbb4/examples/jsm/loaders/RGBELoader.js#L149-L154
I have a file that has the said header:
Loader doesn't recognize the magic token though.
Here's what line
contents are when printed to console:
Now the curious part here is if you try to copy that and check the match again:
All looks good, however, if you try it on the line
directly, you will see this:
The problem is that there's a
at the end (carriage return):
A bit extra:
It looks like both 13 and 10 are interpreted as NEW_LINE char by the ingestion function fget
To Reproduce
Code
Live example
Expected behavior
I'm not sure, I believe this should be treated as a valid header. This problem did not occur when using r107, so it looks like a regression bug. But perhaps someone more familiar with the RGBE spec can clarify.
Screenshots
see above
Platform:
I can't find anything online that states the bytes that come after #?RADIANCE
should be restricted. This reference on the spec seems to indicate that it's enough for the first bytes be #?RADIANCE
and that a newline does not need to follow.
Changing magic_token_re
from this
magic_token_re = /^#\?(\S+)$/
to this
magic_token_re = /^#\?(\S+)/
seems like a fix.
@Usnul do you mind testing that fix?
Yes, this works.
Most helpful comment
I can't find anything online that states the bytes that come after
#?RADIANCE
should be restricted. This reference on the spec seems to indicate that it's enough for the first bytes be#?RADIANCE
and that a newline does not need to follow.Changing
magic_token_re
from thisto this
seems like a fix.