diff --git a/libs/openFrameworks/gl/ofShader.cpp b/libs/openFrameworks/gl/ofShader.cpp index f4218dc8c6f..cf31aadfcd0 100644 --- a/libs/openFrameworks/gl/ofShader.cpp +++ b/libs/openFrameworks/gl/ofShader.cpp @@ -353,19 +353,19 @@ bool ofShader::setupShaderFromSource(ofShader::Source && source){ // parse for includes source.expandedSource = parseForIncludes( source.source, source.directoryPath ); - // parse and set defines - for(auto & define: source.intDefines){ - const auto & name = define.first; - const auto & value = define.second; - std::regex re_define("#define[ \t]+" + name + "[ \t]+(([1-9][0-9]*)|(0[xX][0-9a-fA-F]+))"); - source.expandedSource = std::regex_replace(source.expandedSource, re_define, "#define " + name + " " + std::to_string(value)); - } - - for(auto & define: source.floatDefines){ - const auto & name = define.first; - const auto & value = define.second; + // parse and set defines + for (auto& define : source.intDefines) { + const auto& name = define.first; + const auto& value = define.second; + std::regex re_define("#define[ \t]+" + name + "[ \t]+(([1-9][0-9]*)|(0([xX][0-9a-fA-F]+)?))"); + source.expandedSource = std::regex_replace(source.expandedSource, re_define, "#define " + name + " " + std::to_string(value)); + } + + for (auto& define : source.floatDefines) { + const auto& name = define.first; + const auto& value = define.second; std::regex re_define("#define[ \t]+" + name + "[ \t]+[0-9]*(\\.[0-9]*f?)?"); - source.expandedSource = std::regex_replace(source.expandedSource, re_define, "#define " + name + " " + std::to_string(value)); + source.expandedSource = std::regex_replace(source.expandedSource, re_define, "#define " + name + " " + std::to_string(value)); } // store source code (that's the expanded source with all includes copied in)