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