Merge branch 'master' into text_improvements

This commit is contained in:
Robert Osfield
2017-10-20 14:14:14 +01:00
25 changed files with 622 additions and 138 deletions

View File

@@ -89,6 +89,19 @@ struct NoneOf
const char* _str;
};
// Replaces all occurrences of "from" with the contents of "to"
// It does only one pass, i.e. new matches created in a position before the current match are not replaced
void replaceAll(std::string& str, const std::string& from, const std::string& to)
{
std::string::size_type pos = 0;
while ((pos = str.find(from, pos)) != std::string::npos)
{
str.replace(pos, from.length(), to);
pos += to.length();
}
}
}
using namespace osg;
@@ -642,6 +655,8 @@ void Shader::PerContextShader::compileShader(osg::State& state)
}
else
{
// Convert all windows line endings to \n
replaceAll(source, "\r\n", " \n");
std::string versionLine;
unsigned int lineNum = 0;