diff --git a/packages/assets/src/AssetManager.ts b/packages/assets/src/AssetManager.ts index 4c6d2a2a..8b1544fd 100644 --- a/packages/assets/src/AssetManager.ts +++ b/packages/assets/src/AssetManager.ts @@ -19,6 +19,8 @@ export class AssetManager implements IAssetManager { if(!name || !texture) return; + texture.label = name; + this._textures.set(name, texture); } @@ -147,6 +149,8 @@ export class AssetManager implements IAssetManager spritesheet = new Spritesheet(texture, data.spritesheet); await spritesheet.parse(); + + spritesheet.textureSource.label = data.name ?? null; } this.createCollection(data, spritesheet); diff --git a/packages/room/src/object/visualization/RoomObjectSpriteVisualization.ts b/packages/room/src/object/visualization/RoomObjectSpriteVisualization.ts index 982fe257..4a6315ba 100644 --- a/packages/room/src/object/visualization/RoomObjectSpriteVisualization.ts +++ b/packages/room/src/object/visualization/RoomObjectSpriteVisualization.ts @@ -43,7 +43,7 @@ export class RoomObjectSpriteVisualization implements IRoomObjectSpriteVisualiza if(sprite) sprite.dispose(); - this._sprites.pop(); + this._sprites.shift(); } this._sprites = null; diff --git a/packages/room/src/object/visualization/room/RoomPlane.ts b/packages/room/src/object/visualization/room/RoomPlane.ts index 539aabd3..60c07e1a 100644 --- a/packages/room/src/object/visualization/room/RoomPlane.ts +++ b/packages/room/src/object/visualization/room/RoomPlane.ts @@ -108,7 +108,14 @@ export class RoomPlane implements IRoomPlane if(this._planeSprite) this._planeSprite.destroy(); - if(this._planeTexture) this._planeTexture = null; + if(this._planeTexture) + { + //@ts-ignore + if(this._planeTexture.source?.hitMap) this._planeTexture.source.hitMap = null; + this._planeTexture.destroy(true); + + this._planeTexture = null; + } this._disposed = true; } @@ -344,12 +351,15 @@ export class RoomPlane implements IRoomPlane if(!this._planeTexture) this._planeTexture = TextureUtils.createRenderTexture(this._width, this._height); + this._planeTexture.source.label = `room_plane_${ this._uniqueId.toString() }`; + if(needsUpdate) { GetRenderer().render({ target: this._planeTexture, container: this._planeSprite, - transform: this.getMatrixForDimensions(this._planeSprite.width, this._planeSprite.height) + transform: this.getMatrixForDimensions(this._planeSprite.width, this._planeSprite.height), + clear: true }); } diff --git a/packages/room/src/object/visualization/room/RoomVisualization.ts b/packages/room/src/object/visualization/room/RoomVisualization.ts index 09178de8..87f0780f 100644 --- a/packages/room/src/object/visualization/room/RoomVisualization.ts +++ b/packages/room/src/object/visualization/room/RoomVisualization.ts @@ -317,11 +317,10 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements if(plane) plane.dispose(); - this._planes.pop(); + this._planes.shift(); } this._planes = []; - this._planes = []; } this._isPlaneSet = false; diff --git a/packages/room/src/object/visualization/room/mask/PlaneMaskManager.ts b/packages/room/src/object/visualization/room/mask/PlaneMaskManager.ts index 53f3c71b..fefbfba2 100644 --- a/packages/room/src/object/visualization/room/mask/PlaneMaskManager.ts +++ b/packages/room/src/object/visualization/room/mask/PlaneMaskManager.ts @@ -155,7 +155,7 @@ export class PlaneMaskManager if(!texture) return true; - const point = new Point((posX + asset.offsetX), (posY + asset.offsetY)); + const point = new Point(Math.round(posX) + asset.offsetX, Math.round(posY) + asset.offsetY); const matrix = new Matrix();