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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user