mirror of
https://github.com/CesiumGS/obj2gltf.git
synced 2025-01-30 19:42:59 -05:00
Fix texture options ending up in texture filename #109
This happens when in `*.mtl` a relative texture path does not have a `./` prefix. eg: map_bump -bm 0.1 foo.jpg
This commit is contained in:
parent
3cff129933
commit
3e41cdc7f6
@ -211,6 +211,15 @@ function parseMapOptions (texturePath, textureOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (re.test('/'+path.basename(texturePath))) {
|
||||
// options ended up in filename, eg: map_bump -bm 0.1 foo.jpg
|
||||
// assume no spaces in texture filename
|
||||
var parts = path.basename(texturePath).split(/\s+/);
|
||||
var texture = parts.pop();
|
||||
// handle options below
|
||||
texturePath = path.join(path.dirname(texturePath), parts.join(' '), texture);
|
||||
}
|
||||
|
||||
var pathParts = texturePath.split(/[\\\/]/);
|
||||
|
||||
if (pathParts.length && pathParts.length > 2) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user