87 std::string vertex, fragment;
89 const auto token =
"#type";
90 const auto len = std::strlen(token);
92 auto pos = src.find(token, 0);
93 while (pos != std::string::npos)
95 const auto eol = src.find_first_of(
"\r\n", pos);
96 const auto begin = pos + len + 1;
98 auto type = src.substr(begin, eol - begin);
100 if (type ==
"vertex" || type ==
"fragment")
102 const auto next_line = src.find_first_not_of(
"\r\n", eol);
103 pos = src.find(token, next_line);
105 if (type ==
"vertex")
107 vertex = (pos == std::string::npos) ? src.substr(next_line) : src.substr(next_line, pos - next_line);
111 fragment = (pos == std::string::npos) ? src.substr(next_line) : src.substr(next_line, pos - next_line);
123 return parse(vertex, fragment);