diff --git a/code/ObjFileParser.cpp b/code/ObjFileParser.cpp index 41ae447ba..3b058f677 100644 --- a/code/ObjFileParser.cpp +++ b/code/ObjFileParser.cpp @@ -97,7 +97,30 @@ ObjFileParser::~ObjFileParser() { ObjFile::Model *ObjFileParser::GetModel() const { return m_pModel; } - +void ignoreNewLines(IOStreamBuffer &streamBuffer, std::vector &buffer) +{ + std::vector buf(buffer); + auto copyPosition = buffer.begin(); + auto curPosition = buf.cbegin(); + do + { + while (*curPosition != '\n'&&*curPosition != '\\') + { + ++curPosition; + } + if (*curPosition == '\\') + { + copyPosition = std::copy(buf.cbegin(), curPosition, copyPosition); + *(copyPosition++) = ' '; + do + { + streamBuffer.getNextLine(buf); + } while (buf[0] == '\n'); + curPosition = buf.cbegin(); + } + } while (*curPosition != '\n'); + std::copy(buf.cbegin(), curPosition, copyPosition); +} // ------------------------------------------------------------------- // File parsing method. void ObjFileParser::parseFile( IOStreamBuffer &streamBuffer ) { @@ -123,7 +146,7 @@ void ObjFileParser::parseFile( IOStreamBuffer &streamBuffer ) { progressCounter++; m_progress->UpdateFileRead( progressOffset + processed * 2, progressTotal ); } - + ignoreNewLines(streamBuffer, buffer); // parse line switch (*m_DataIt) { case 'v': // Parse a vertex texture coordinate