mirror of
https://github.com/CesiumGS/obj2gltf.git
synced 2025-01-31 03:53:13 -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) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,7 +218,7 @@ function parseMapOptions (texturePath, textureOptions) {
|
|||||||
var currPart = null;
|
var currPart = null;
|
||||||
|
|
||||||
mapOptions.reduce(function (p, part) {
|
mapOptions.reduce(function (p, part) {
|
||||||
if (/-/.test(part)) {
|
if (re.test('/'+part)) {
|
||||||
currPart = part;
|
currPart = part;
|
||||||
p[part] = [];
|
p[part] = [];
|
||||||
} else if (currPart) {
|
} else if (currPart) {
|
||||||
@ -235,8 +237,9 @@ function loadMaterialTexture(material, name, texturePath, textureOptions, mtlDir
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var mapOptions = {};
|
textureOptions = textureOptions || {};
|
||||||
var newTexturePath = parseMapOptions(texturePath, mapOptions);
|
|
||||||
|
var newTexturePath = parseMapOptions(texturePath, textureOptions);
|
||||||
// TODO: handle texture options
|
// TODO: handle texture options
|
||||||
// NOTE: this might not be a good place to do this
|
// NOTE: this might not be a good place to do this
|
||||||
texturePath = newTexturePath ? newTexturePath : texturePath;
|
texturePath = newTexturePath ? newTexturePath : texturePath;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user