27 public static string GetIncludeText(
string shaderText,
string includefname,
bool external) {
28 string includeText =
string.Empty;
29 string shaderTextTemp;
34 StreamReader streamReader =
new(stream);
35 shaderTextTemp = streamReader.ReadToEnd();
38 if (includefname.Contains(
".txt")) {
39 includefname = includefname.Split(
'.')[0];
43 shaderTextTemp =
GetFast(includefname);
46 if (shaderTextTemp ==
string.Empty) {
49 shaderTextTemp = shaderTextTemp.Replace(
"\n",
"$");
50 string[] lines = shaderTextTemp.Split([
'$'], StringSplitOptions.RemoveEmptyEntries);
51 for (
int l = 0; l < lines.Length; l++) {
52 lines[l] = lines[l].Trim();
53 if (lines[l].StartsWith(
"//")) {
54 string text = lines[l].Substring(2).TrimStart();
55 if (text.StartsWith(
'<')
56 && text.EndsWith(
"/>")) {
57 includeText += $
"{lines[l]}\n";
61 string[] arline = lines[l].Replace(
"//",
"$").Split(
'$');
62 if (arline.Length > 0) {
65 if (lines[l].StartsWith(
"#include")) {
66 Regex regex =
new(
"\"[^\"]*\"");
67 string fname = regex.Match(lines[l]).Value.Replace(
"\"",
"");
71 includeText += $
"{lines[l]}\n";
74 shaderText += includeText;