From 9bbf71b53a4887415390738058238ac1ad0aa6a8 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 12 May 2011 12:28:43 +0000 Subject: [PATCH] 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." --- examples/osg2cpp/osg2cpp.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/osg2cpp/osg2cpp.cpp b/examples/osg2cpp/osg2cpp.cpp index 9cb4592c0..33357af2c 100644 --- a/examples/osg2cpp/osg2cpp.cpp +++ b/examples/osg2cpp/osg2cpp.cpp @@ -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;