Skip to content

Commit

Permalink
Merge pull request #12668 from BlakeOne/master
Browse files Browse the repository at this point in the history
Add params scene, mesh to function getAttributes
  • Loading branch information
sebavan committed Jun 21, 2022
2 parents 493810b + 2d3baab commit 2746fca
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/dev/core/src/Materials/PBR/pbrBaseMaterial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,7 @@ export abstract class PBRBaseMaterial extends PushMaterial {
this._eventInfo.samplers = samplers;
this._eventInfo.uniformBuffersNames = uniformBuffers;
this._eventInfo.customCode = undefined;
this._eventInfo.mesh = mesh;
this._callbackPluginEventGeneric(MaterialPluginEvent.PrepareEffect, this._eventInfo);

PrePassConfiguration.AddUniforms(uniforms);
Expand Down
4 changes: 3 additions & 1 deletion packages/dev/core/src/Materials/materialPluginBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,11 @@ export class MaterialPluginBase {
/**
* Gets the attributes used by the plugin.
* @param attributes list that the attribute names should be added to.
* @param scene the scene that the material belongs to.
* @param mesh the mesh being rendered.
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public getAttributes(attributes: string[]): void {}
public getAttributes(attributes: string[], scene: Scene, mesh: AbstractMesh): void {}

/**
* Gets the uniform buffers names added by the plugin.
Expand Down
1 change: 1 addition & 0 deletions packages/dev/core/src/Materials/materialPluginEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export type MaterialPluginPrepareEffect = {
uniforms: string[];
samplers: string[];
uniformBuffersNames: string[];
mesh: AbstractMesh;
};

/** @hidden */
Expand Down
2 changes: 1 addition & 1 deletion packages/dev/core/src/Materials/materialPluginManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export class MaterialPluginManager {
const eventData = info as MaterialPluginPrepareEffect;
for (const plugin of this._activePlugins) {
eventData.fallbackRank = plugin.addFallbacks(eventData.defines, eventData.fallbacks, eventData.fallbackRank);
plugin.getAttributes(eventData.attributes);
plugin.getAttributes(eventData.attributes, this._scene, eventData.mesh);
}
if (this._uniformList.length > 0) {
eventData.uniforms.push(...this._uniformList);
Expand Down
1 change: 1 addition & 0 deletions packages/dev/core/src/Materials/standardMaterial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,7 @@ export class StandardMaterial extends PushMaterial {
this._eventInfo.samplers = samplers;
this._eventInfo.uniformBuffersNames = uniformBuffers;
this._eventInfo.customCode = undefined;
this._eventInfo.mesh = mesh;
this._callbackPluginEventGeneric(MaterialPluginEvent.PrepareEffect, this._eventInfo);

PrePassConfiguration.AddUniforms(uniforms);
Expand Down

0 comments on commit 2746fca

Please sign in to comment.