Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/OBJFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ class OBJFile {
for (let i = 0; i < lines.length; i += 1) {
const line = _stripComments(lines[i]);

const lineItems = line.replace(/\s+/g, ' ').trim().split(' ');
// splitting by blanks. For mtllib entry, balanced quote (single or double) around referreed file is stripped and file name having blanks is supported.
let lineItems;
let mtllibMatch = line.match(/^\s*(mtllib)\s+(['"]?)(.*?)\2\s*$/i);

if (mtllibMatch) {
lineItems = [mtllibMatch[1].toLowerCase(), mtllibMatch[3]];
} else {
lineItems = line.replace(/\s+/g, ' ').trim().split(' ');
}

switch (lineItems[0].toLowerCase()) {
case 'o': // Start A New Model
Expand Down