mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2024-12-25 19:28:28 +00:00
[engine] 为动态图集管理器增加一些实用接口(getUnusedAtlas, deleteAtlas, destroyUnusedAtlases)
This commit is contained in:
parent
4000e01fa9
commit
2a97bc3a57
@ -366,6 +366,36 @@ let dynamicAtlasManager = {
|
||||
_atlases[i].update();
|
||||
}
|
||||
},
|
||||
|
||||
getUnusedAtlas() {
|
||||
if (!this.enabled) return null;
|
||||
|
||||
for (let i = 0; i <= _atlasIndex; i++) {
|
||||
if (_atlases[i].isEmpty()) {
|
||||
return _atlases[i];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
deleteAtlas(index) {
|
||||
if (!this.enabled) return;
|
||||
|
||||
_atlases[index].destroy();
|
||||
_atlases.splice(index, 1);
|
||||
_atlasIndex--;
|
||||
},
|
||||
|
||||
destroyUnusedAtlases() {
|
||||
if (!this.enabled) return;
|
||||
|
||||
for (let i = 0; i <= _atlasIndex; i++) {
|
||||
if (_atlases[i].isEmpty()) {
|
||||
_atlases[i].destroy();
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -623,6 +623,8 @@ export class Atlas {
|
||||
|
||||
/**
|
||||
* 销毁
|
||||
*
|
||||
* 请勿直接调用
|
||||
*/
|
||||
destroy() {
|
||||
this.reset();
|
||||
|
@ -61,10 +61,11 @@ export class MultiBatcher {
|
||||
|
||||
|
||||
/**
|
||||
* 重置多纹理材质数组,再次使用请先初始化
|
||||
* 重置
|
||||
*/
|
||||
reset() {
|
||||
this.handlers.length = 0;
|
||||
this.nextHandler = null!;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user