|
@@ -52,6 +52,7 @@ export class PBRCustomMaterial extends PBRMaterial {
|
|
_newUniforms: string[];
|
|
_newUniforms: string[];
|
|
_newUniformInstances: any[];
|
|
_newUniformInstances: any[];
|
|
_newSamplerInstances: Texture[];
|
|
_newSamplerInstances: Texture[];
|
|
|
|
+ _customAttributes: string[];
|
|
|
|
|
|
public FragmentShader: string;
|
|
public FragmentShader: string;
|
|
public VertexShader: string;
|
|
public VertexShader: string;
|
|
@@ -101,7 +102,7 @@ export class PBRCustomMaterial extends PBRMaterial {
|
|
return arr;
|
|
return arr;
|
|
}
|
|
}
|
|
|
|
|
|
- public Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: PBRMaterialDefines): string {
|
|
|
|
|
|
+ public Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: PBRMaterialDefines, attributes?: string[]): string {
|
|
|
|
|
|
if (this._isCreatedShader) {
|
|
if (this._isCreatedShader) {
|
|
return this._createdShaderName;
|
|
return this._createdShaderName;
|
|
@@ -111,6 +112,10 @@ export class PBRCustomMaterial extends PBRMaterial {
|
|
PBRCustomMaterial.ShaderIndexer++;
|
|
PBRCustomMaterial.ShaderIndexer++;
|
|
var name: string = "custom_" + PBRCustomMaterial.ShaderIndexer;
|
|
var name: string = "custom_" + PBRCustomMaterial.ShaderIndexer;
|
|
|
|
|
|
|
|
+ if (attributes && this._customAttributes && this._customAttributes.length > 0) {
|
|
|
|
+ attributes.push(...this._customAttributes);
|
|
|
|
+ }
|
|
|
|
+
|
|
this.ReviewUniform("uniform", uniforms);
|
|
this.ReviewUniform("uniform", uniforms);
|
|
this.ReviewUniform("sampler", samplers);
|
|
this.ReviewUniform("sampler", samplers);
|
|
|
|
|
|
@@ -180,6 +185,16 @@ export class PBRCustomMaterial extends PBRMaterial {
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public AddAttribute(name: string): PBRCustomMaterial {
|
|
|
|
+ if (!this._customAttributes) {
|
|
|
|
+ this._customAttributes = [];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this._customAttributes.push(name);
|
|
|
|
+
|
|
|
|
+ return this;
|
|
|
|
+ }
|
|
|
|
+
|
|
public Fragment_Begin(shaderPart: string): PBRCustomMaterial {
|
|
public Fragment_Begin(shaderPart: string): PBRCustomMaterial {
|
|
this.CustomParts.Fragment_Begin = shaderPart;
|
|
this.CustomParts.Fragment_Begin = shaderPart;
|
|
return this;
|
|
return this;
|