Improve performance of obj line break
parent
3f361ecc1f
commit
8b4e066ca5
|
@ -99,9 +99,8 @@ ObjFile::Model *ObjFileParser::GetModel() const {
|
|||
}
|
||||
void ignoreNewLines(IOStreamBuffer<char> &streamBuffer, std::vector<char> &buffer)
|
||||
{
|
||||
std::vector<char> buf(buffer);
|
||||
auto copyPosition = buffer.begin();
|
||||
auto curPosition = buf.cbegin();
|
||||
static std::vector<char> tempBuf;
|
||||
auto curPosition = buffer.begin();
|
||||
do
|
||||
{
|
||||
while (*curPosition!='\n'&&*curPosition!='\\')
|
||||
|
@ -110,16 +109,14 @@ void ignoreNewLines(IOStreamBuffer<char> &streamBuffer, std::vector<char> &buffe
|
|||
}
|
||||
if (*curPosition=='\\')
|
||||
{
|
||||
copyPosition = std::copy(buf.cbegin(), curPosition, copyPosition);
|
||||
*(copyPosition++) = ' ';
|
||||
do
|
||||
{
|
||||
streamBuffer.getNextLine(buf);
|
||||
} while (buf[0] == '\n');
|
||||
curPosition = buf.cbegin();
|
||||
streamBuffer.getNextLine(tempBuf);
|
||||
} while (tempBuf[0]=='\n');
|
||||
*curPosition = ' ';
|
||||
std::copy(tempBuf.cbegin(), tempBuf.cend(), ++curPosition);
|
||||
}
|
||||
} while (*curPosition!='\n');
|
||||
std::copy(buf.cbegin(), curPosition, copyPosition);
|
||||
}
|
||||
// -------------------------------------------------------------------
|
||||
// File parsing method.
|
||||
|
|
Loading…
Reference in New Issue