|
@@ -56,6 +56,7 @@ export class CustomMaterial extends StandardMaterial {
|
|
|
_newUniforms: string[];
|
|
|
_newUniformInstances: any[];
|
|
|
_newSamplerInstances: Texture[];
|
|
|
+ _customAttributes: string[];
|
|
|
|
|
|
public FragmentShader: string;
|
|
|
public VertexShader: string;
|
|
@@ -105,7 +106,7 @@ export class CustomMaterial extends StandardMaterial {
|
|
|
return arr;
|
|
|
}
|
|
|
|
|
|
- public Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: StandardMaterialDefines): string {
|
|
|
+ public Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: StandardMaterialDefines, attributes?: string[]): string {
|
|
|
|
|
|
if (this._isCreatedShader) {
|
|
|
return this._createdShaderName;
|
|
@@ -115,6 +116,10 @@ export class CustomMaterial extends StandardMaterial {
|
|
|
CustomMaterial.ShaderIndexer++;
|
|
|
var name: string = "custom_" + CustomMaterial.ShaderIndexer;
|
|
|
|
|
|
+ if (attributes && this._customAttributes && this._customAttributes.length > 0) {
|
|
|
+ attributes.push(...this._customAttributes);
|
|
|
+ }
|
|
|
+
|
|
|
this.ReviewUniform("uniform", uniforms);
|
|
|
this.ReviewUniform("sampler", samplers);
|
|
|
|
|
@@ -182,6 +187,16 @@ export class CustomMaterial extends StandardMaterial {
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
+ public AddAttribute(name: string): CustomMaterial {
|
|
|
+ if (!this._customAttributes) {
|
|
|
+ this._customAttributes = [];
|
|
|
+ }
|
|
|
+
|
|
|
+ this._customAttributes.push(name);
|
|
|
+
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
public Fragment_Begin(shaderPart: string): CustomMaterial {
|
|
|
this.CustomParts.Fragment_Begin = shaderPart;
|
|
|
return this;
|