refactor: 贴图存储方式

This commit is contained in:
AncTe committed 2026-09-22 21:11:21 +08:00
1 parent 3bcba48f48
commit d36ea69066
12 files changed
+627 -585

No files matched your search

+7 -4
View File
@@ -12,7 +12,7 @@ import { IRenderTreeRoot, MotaRenderer } from '@motajs/render';
import {
ITextureManager,
IAutotileProcessor,
MaterialManager,
TextureManager,
AutotileProcessor,
ISaveSystem,
SaveSystem
@@ -48,7 +48,6 @@ export class ClientCore extends CoreState implements IClientCore {
// Layer 5 渲染顶层
readonly materials: ITextureManager;
readonly autotile: IAutotileProcessor;
readonly rafExcitation: IExcitation<number>;
readonly excitationDivider: IExcitationDivider<number>;
@@ -81,8 +80,12 @@ export class ClientCore extends CoreState implements IClientCore {
//#region 素材系统
this.materials = new MaterialManager(this);
this.autotile = new AutotileProcessor(this.materials, this);
this.materials = new TextureManager(
this,
this.tileStore,
config.tilesetReserve,
config.tilesetUnit
);
//#endregion
+6 -1
View File
@@ -3,4 +3,9 @@ import { ClientCore } from './client';
// TODO: 逐渐弱化 ClientCore 的单例概念,每个接口都通过参数传入 IClientCore 对象
/** 客户端实例 */
export const client = new ClientCore();
export const client = new ClientCore({
clientURL: 'placeholder',
// 这两个值不要随意调整,若需要调整,务必先在编辑器中调整“额外素材预留”与“额外素材单位”,否则必定会导致游戏出错
tilesetReserve: 100000,
tilesetUnit: 5000
});
@@ -1261,7 +1261,7 @@ export class MapRenderer
} else {
// 多帧图块
if (tex.cls === BlockCls.Autotile) {
const gen = this.autotile.renderAnimatedWith(tex, 0b1111_1111);
const gen = this.autotile.renderAnimated(tex, 0b1111_1111);
return this.useDynamicBackground(gl, data, [...gen]);
} else {
const gen = this.tileAnimater.once(tex.texture, tex.frames);
@@ -4,6 +4,10 @@ import { IMapExtensionManager, IMapRenderer } from './render/map';
export interface IClientCoreConfig {
/** 渲染端数据配置文件路径,相对于 `src/content` */
readonly clientURL: string;
/** Tileset 预留数量 */
readonly tilesetReserve: number;
/** Tileset 单元数量 */
readonly tilesetUnit: number;
}
export interface IClientCore extends IClientSystem {