From Wang Rui, "A Chinese engineer (named Beilei Geng) reports a possible bug in the

osg2cpp application to me today. The conversion result may become
incorrect if there are quotation marks ( " ) in the shader file, which
will mostly appear in comment lines.

Replace all " into \" before writing to cpp files will solve the
problem, as the attached file shows."
This commit is contained in:
Robert Osfield
2011-05-12 12:28:43 +00:00
parent 48dad2d171
commit 9bbf71b53a

View File

@@ -28,7 +28,8 @@ void writeShader(osg::Shader* shader, const std::string& cppFileName, const std:
std::string shaderSource = shader->getShaderSource();
searchAndReplace(shaderSource, "\r\n", "\n");
searchAndReplace(shaderSource, "\r", "\n");
searchAndReplace(shaderSource, "\"", "\\\"");
std::string variableString = std::string("char ")+variableName+std::string("[] = ");
std::string::size_type startOfLine = 0;