|
@@ -301,8 +301,8 @@ export class ShaderProcessor {
|
|
}
|
|
}
|
|
|
|
|
|
private static _ProcessIncludes(sourceCode: string, options: ProcessingOptions, callback: (data: any) => void): void {
|
|
private static _ProcessIncludes(sourceCode: string, options: ProcessingOptions, callback: (data: any) => void): void {
|
|
- var regex = /#include<(.+)>(\((.*)\))*(\[(.*)\])*/g;
|
|
|
|
- var match = regex.exec(sourceCode);
|
|
|
|
|
|
+ const regexShaderInclude = /#include\s?<(.+)>(\((.*)\))*(\[(.*)\])*/g;
|
|
|
|
+ var match = regexShaderInclude.exec(sourceCode);
|
|
|
|
|
|
var returnValue = new String(sourceCode);
|
|
var returnValue = new String(sourceCode);
|
|
var keepProcessing = false;
|
|
var keepProcessing = false;
|
|
@@ -371,7 +371,10 @@ export class ShaderProcessor {
|
|
// Replace
|
|
// Replace
|
|
returnValue = returnValue.replace(match[0], includeContent);
|
|
returnValue = returnValue.replace(match[0], includeContent);
|
|
|
|
|
|
- keepProcessing = keepProcessing || includeContent.indexOf("#include<") >= 0;
|
|
|
|
|
|
+ keepProcessing =
|
|
|
|
+ keepProcessing ||
|
|
|
|
+ includeContent.indexOf("#include<") >= 0 ||
|
|
|
|
+ includeContent.indexOf("#include <") >= 0;
|
|
} else {
|
|
} else {
|
|
var includeShaderUrl = options.shadersRepository + "ShadersInclude/" + includeFile + ".fx";
|
|
var includeShaderUrl = options.shadersRepository + "ShadersInclude/" + includeFile + ".fx";
|
|
|
|
|
|
@@ -382,7 +385,7 @@ export class ShaderProcessor {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- match = regex.exec(sourceCode);
|
|
|
|
|
|
+ match = regexShaderInclude.exec(sourceCode);
|
|
}
|
|
}
|
|
|
|
|
|
if (keepProcessing) {
|
|
if (keepProcessing) {
|
|
@@ -406,4 +409,4 @@ export class ShaderProcessor {
|
|
public static _FileToolsLoadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (ev: ProgressEvent) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: LoadFileError) => void): IFileRequest {
|
|
public static _FileToolsLoadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (ev: ProgressEvent) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: LoadFileError) => void): IFileRequest {
|
|
throw _DevTools.WarnImport("FileTools");
|
|
throw _DevTools.WarnImport("FileTools");
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+}
|