You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-19 23:16:20 +00:00
🆙 more optimization mem.
This commit is contained in:
@@ -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] = [];
|
||||
|
||||
Reference in New Issue
Block a user