Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add params scene, mesh to function getAttributes #12668

Merged
merged 3 commits into from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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