🆙 more optimization mem.

This commit is contained in:
duckietm
2026-04-03 10:48:13 +02:00
parent e57749bbbb
commit d63be7dd62
5 changed files with 58 additions and 8 deletions
@@ -117,12 +117,7 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager
TextureUtils.writeToTexture(container, renderTexture);
const image = await TextureUtils.generateImage(renderTexture);
container.destroy({ children: true });
renderTexture.destroy(true);
return image;
return await TextureUtils.generateImage(renderTexture);
}
public get effects(): Map<string, IRoomCameraWidgetEffect>
+6
View File
@@ -110,6 +110,12 @@ export class RoomMessageHandler
this._latestEntryTileEvent = null;
this._activeWiredUserMovements.clear();
this._activeRoomUserWalks.clear();
if(this._planeParser)
{
this._planeParser.dispose();
this._planeParser = null;
}
}
public setRoomId(id: number): void
@@ -105,6 +105,7 @@ export class IsometricImageFurniVisualization extends FurnitureAnimatedVisualiza
const sprite = this.getSprite(layerId);
if (sprite) {
sprite.texture = this._thumbnailTexture;
sprite.offsetY -= 1;
}
}
}
+38 -1
View File
@@ -39,7 +39,44 @@ export class RoomInstanceData
public dispose(): void
{
return;
if(this._selectedObject)
{
this._selectedObject.dispose();
this._selectedObject = null;
}
if(this._placedObject)
{
this._placedObject.dispose();
this._placedObject = null;
}
if(this._furnitureStackingHeightMap)
{
this._furnitureStackingHeightMap.dispose();
this._furnitureStackingHeightMap = null;
}
if(this._tileObjectMap)
{
this._tileObjectMap.dispose();
this._tileObjectMap = null;
}
if(this._legacyGeometry)
{
this._legacyGeometry = null;
}
if(this._roomCamera)
{
this._roomCamera = null;
}
this._floorStack.clear();
this._wallStack.clear();
this._mouseButtonCursorOwners = [];
this._modelName = null;
}
public setModelName(name: string): void
+12 -1
View File
@@ -3,7 +3,8 @@ import { Texture } from 'pixi.js';
export class TexturePool
{
private static MAX_IDLE: number = 3600;
private static MAX_IDLE: number = 1800;
private static MAX_POOL_SIZE: number = 200;
private _textures: { [index: string]: { [index: string]: Texture[] } } = {};
private _totalTextures: number = 0;
@@ -51,6 +52,16 @@ export class TexturePool
{
if(!texture) return;
if(this._totalTextures >= TexturePool.MAX_POOL_SIZE)
{
//@ts-ignore
delete texture.source.hitMap;
if(!texture.destroyed) texture.destroy(true);
return;
}
if(!this._textures[texture.width]) this._textures[texture.width] = {};
if(!this._textures[texture.width][texture.height]) this._textures[texture.width][texture.height] = [];