mirror of
https://github.com/CesiumGS/obj2gltf.git
synced 2025-01-30 19:42:59 -05:00
better regexp for #109
This commit is contained in:
parent
ac756bed05
commit
3ec919e9c4
@ -205,7 +205,9 @@ loadMtl._createMaterial = function(materialOptions, options) {
|
||||
*/
|
||||
function parseMapOptions (texturePath, textureOptions) {
|
||||
|
||||
if (!/-(bm|t|s|o|blendu|blendv|boost|mm|texres|clamp|imfchan|type)\s+/.test(texturePath)) {
|
||||
var re = /[\\\/]-(bm|t|s|o|blendu|blendv|boost|mm|texres|clamp|imfchan|type)/;
|
||||
|
||||
if (!re.test(texturePath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -216,7 +218,7 @@ function parseMapOptions (texturePath, textureOptions) {
|
||||
var currPart = null;
|
||||
|
||||
mapOptions.reduce(function (p, part) {
|
||||
if (/-/.test(part)) {
|
||||
if (re.test('/'+part)) {
|
||||
currPart = part;
|
||||
p[part] = [];
|
||||
} else if (currPart) {
|
||||
@ -235,8 +237,9 @@ function loadMaterialTexture(material, name, texturePath, textureOptions, mtlDir
|
||||
return;
|
||||
}
|
||||
|
||||
var mapOptions = {};
|
||||
var newTexturePath = parseMapOptions(texturePath, mapOptions);
|
||||
textureOptions = textureOptions || {};
|
||||
|
||||
var newTexturePath = parseMapOptions(texturePath, textureOptions);
|
||||
// TODO: handle texture options
|
||||
// NOTE: this might not be a good place to do this
|
||||
texturePath = newTexturePath ? newTexturePath : texturePath;
|
||||
|
Loading…
x
Reference in New Issue
Block a user