Skip to content

Commit a83f0de

Browse files
authored
optimised when shader uniforms are updated (#627)
2 parents 4bd9121 + 066cc36 commit a83f0de

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/core/CoreNode.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,8 @@ export class CoreNode extends EventEmitter {
742742
valid: false,
743743
};
744744
public textureCoords?: TextureCoords;
745-
public updateTextureCoords?: boolean = false;
745+
public updateTextureCoords: boolean = false;
746+
public updateShaderUniforms: boolean = false;
746747
public isRenderable = false;
747748
public renderState: CoreNodeRenderState = CoreNodeRenderState.Init;
748749

@@ -1184,7 +1185,7 @@ export class CoreNode extends EventEmitter {
11841185

11851186
this.premultipliedColorTl = merged;
11861187

1187-
if (same) {
1188+
if (same === true) {
11881189
this.premultipliedColorTr =
11891190
this.premultipliedColorBl =
11901191
this.premultipliedColorBr =
@@ -1230,6 +1231,11 @@ export class CoreNode extends EventEmitter {
12301231
updateType & UpdateType.RecalcUniforms &&
12311232
this.hasShaderUpdater === true
12321233
) {
1234+
this.updateShaderUniforms = true;
1235+
}
1236+
1237+
if (this.isRenderable === true && this.updateShaderUniforms === true) {
1238+
this.updateShaderUniforms = false;
12331239
//this exists because the boolean hasShaderUpdater === true
12341240
this.shader!.update!();
12351241
}

0 commit comments

Comments
 (0)