|
@@ -109,7 +109,18 @@ export class PBRCustomMaterial extends PBRMaterial {
|
|
return arr;
|
|
return arr;
|
|
}
|
|
}
|
|
|
|
|
|
- public Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: MaterialDefines | string[], attributes?: string[]): string {
|
|
|
|
|
|
+ public Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: MaterialDefines | string[], attributes?: string[], options?: BABYLON.ICustomShaderNameResolveOptions): string {
|
|
|
|
+ if (options) {
|
|
|
|
+ options.processFinalCode = (type: string, code: string) => {
|
|
|
|
+ if (type === "vertex") {
|
|
|
|
+ return code;
|
|
|
|
+ }
|
|
|
|
+ const sci = new BABYLON.ShaderCodeInliner(code);
|
|
|
|
+ sci.inlineToken = "#define pbr_inline";
|
|
|
|
+ sci.processCode();
|
|
|
|
+ return sci.code;
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
|
|
if (attributes && this._customAttributes && this._customAttributes.length > 0) {
|
|
if (attributes && this._customAttributes && this._customAttributes.length > 0) {
|
|
attributes.push(...this._customAttributes);
|
|
attributes.push(...this._customAttributes);
|