mirror of
https://github.com/motajs/template.git
synced 2026-10-13 00:00:19 +08:00
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)
This commit is contained in:
parent
d90c09f0a7
commit
88a21bf740
@ -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 {
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user