perf: entity

This commit is contained in:
cha0s 2024-09-22 02:32:34 -05:00
parent 73b7a9e0a5
commit f1d3ad6a6d

View File

@ -54,6 +54,8 @@ export default class Entity {
this.debug.removeChild(this.interactionAabb);
}
this.interactionAabb = undefined;
this.diffuse.rotation = 0;
this.normals.rotation = 0;
}
setDebug(isDebugging) {
if (isDebugging) {
@ -141,7 +143,9 @@ export default class Entity {
this.entity.Sprite.animation,
this.entity.Sprite.frame,
);
diffuse.texture = texture;
if (diffuse.texture !== texture) {
diffuse.texture = texture;
}
if (asset.data.meta.normals) {
const {pathname} = new URL(
Sprite.source
@ -157,17 +161,14 @@ export default class Entity {
this.entity.Sprite.animation,
this.entity.Sprite.frame,
);
normals.texture = texture;
if (normals.texture !== texture) {
normals.texture = texture;
}
});
}
});
}
}
if (!this.attached) {
const {diffuse, normals} = this;
diffuse.rotation = 0;
normals.rotation = 0;
}
if (Direction) {
const {diffuse, normals} = this;
if (!this.attached || 'direction' in Direction) {