From 88a21bf74068ff2965a83d82ffb8cf7875e97066 Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Wed, 23 Sep 2026 15:41:16 +0800 Subject: [PATCH] fix(04-09): complete texture interface adaptation in vertex/renderer - vertex.ts: updateAutotile calls render; autotile checks use tileType; drop BlockCls import (D-43/D-44) - renderer.ts: background autotile branches use tileType + render; add TileType import; drop BlockCls import (D-43/D-44) --- packages-user/client-modules/src/render/map/renderer.ts | 8 ++++---- packages-user/client-modules/src/render/map/vertex.ts | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages-user/client-modules/src/render/map/renderer.ts b/packages-user/client-modules/src/render/map/renderer.ts index 9a08a4c..32da0c6 100644 --- a/packages-user/client-modules/src/render/map/renderer.ts +++ b/packages-user/client-modules/src/render/map/renderer.ts @@ -6,7 +6,6 @@ import { Transform } from '@motajs/render'; import { - BlockCls, IAutotileProcessor, IMaterialFramedData, ITextureManager, @@ -36,6 +35,7 @@ import { IMapLayerHookController, IMapLayerHooks } from '@user/data-base'; +import { TileType } from '@user/data-common'; import { IHookController, logger } from '@motajs/common'; import { compileProgramWith } from '@motajs/client-base'; import { isNil, maxBy } from 'lodash-es'; @@ -1248,8 +1248,8 @@ export class MapRenderer this.backgroundFrameCount = tex.frames; if (tex.frames === 1) { // 对于一帧图块,只需要传递一个纹理 - if (tex.cls === BlockCls.Autotile) { - const renderable = this.autotile.renderWithoutCheck( + if (tex.tileType === TileType.Autotile) { + const renderable = this.autotile.render( tex, 0b1111_1111 )!; @@ -1259,7 +1259,7 @@ export class MapRenderer } } else { // 多帧图块 - if (tex.cls === BlockCls.Autotile) { + if (tex.tileType === TileType.Autotile) { const gen = this.autotile.renderAnimated(tex, 0b1111_1111); return this.useDynamicBackground(gl, data, [...gen]); } else { diff --git a/packages-user/client-modules/src/render/map/vertex.ts b/packages-user/client-modules/src/render/map/vertex.ts index 61586ed..0a345f6 100644 --- a/packages-user/client-modules/src/render/map/vertex.ts +++ b/packages-user/client-modules/src/render/map/vertex.ts @@ -25,7 +25,7 @@ import { } from '../../shared'; import { BlockSplitter } from './block'; import { clamp, isNil } from 'lodash-es'; -import { BlockCls, IMaterialFramedData } from '@user/client-base'; +import { IMaterialFramedData } from '@user/client-base'; import { IRect } from '@motajs/render'; import { INSTANCED_COUNT } from './constant'; @@ -459,7 +459,7 @@ export class MapVertexGenerator this.mapWidth ); // 使用不带检查的版本可以减少分支数量,提升性能 - const renderable = autotile.renderWithoutCheck(tile, connection); + const renderable = autotile.render(tile, connection); if (!renderable) return; const assetIndex = this.renderer.getAssetSourceIndex(renderable.source); const offsetIndex = this.renderer.getOffsetIndex(tile.offset); @@ -515,7 +515,7 @@ export class MapVertexGenerator blockIndex: by * block.width + bx }; const tile = this.renderer.manager.getTile(mapArray[newIndex.mapIndex]); - if (!tile || tile.cls !== BlockCls.Autotile) return; + if (!tile || tile.tileType !== TileType.Autotile) return; this.updateAutotile( mapArray, vertex, @@ -559,7 +559,7 @@ export class MapVertexGenerator } // todo: 这样的话,如果更新了指定分块,那么本来设置的帧数也会重置为默认帧数,如何修改? - if (tile.cls === BlockCls.Autotile) { + if (tile.tileType === TileType.Autotile) { // 如果图块是自动元件 this.updateAutotile( mapArray,