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