mirror of
https://github.com/motajs/template.git
synced 2026-10-06 03:30:18 +08:00
fix(04-09): adapt map render consumers to new texture interface
- hero.ts: hero texture literal builds tileType: TileType.Unknown (D-45) - vertex.ts updateMoving: tileType destructure + autotile.render(tile, connection) (D-43/D-44) - renderer.ts: autotile taken from manager.autotile; drop unused AutotileProcessor import (D-46)
This commit is contained in:
parent
93ed3115fc
commit
d90c09f0a7
@ -6,13 +6,14 @@ import {
|
||||
IObjectMoverHooks,
|
||||
ObjectAnimDirection,
|
||||
ObjectMoveStep,
|
||||
ObjectMoveType
|
||||
ObjectMoveType,
|
||||
TileType
|
||||
} from '@user/data-common';
|
||||
import { IHeroLocation, IHeroLocationHooks, IMapLayer } from '@user/data-base';
|
||||
import { IMapRenderer, IMapRendererTicker, IMovingBlock } from '../types';
|
||||
import { isNil } from 'lodash-es';
|
||||
import { IFaceHandler, IHookController, logger } from '@motajs/common';
|
||||
import { BlockCls, IMaterialFramedData } from '@user/client-base';
|
||||
import { IMaterialFramedData } from '@user/client-base';
|
||||
import { ITexture, ITextureSplitter, TextureRowSplitter } from '@motajs/render';
|
||||
import { IMapHeroRenderer } from './types';
|
||||
import { ExcitationCurve2D } from '@motajs/animate';
|
||||
@ -164,7 +165,7 @@ export class MapHeroRenderer implements IMapHeroRenderer {
|
||||
const data: IMaterialFramedData = {
|
||||
offset: dirImage.width / 4,
|
||||
texture: dirImage,
|
||||
cls: BlockCls.Unknown,
|
||||
tileType: TileType.Unknown,
|
||||
frames: 4,
|
||||
defaultFrame: 0
|
||||
};
|
||||
|
||||
@ -6,7 +6,6 @@ import {
|
||||
Transform
|
||||
} from '@motajs/render';
|
||||
import {
|
||||
AutotileProcessor,
|
||||
BlockCls,
|
||||
IAutotileProcessor,
|
||||
IMaterialFramedData,
|
||||
@ -231,7 +230,7 @@ export class MapRenderer
|
||||
);
|
||||
this.contextData = data;
|
||||
this.vertex = new MapVertexGenerator(this, data);
|
||||
this.autotile = new AutotileProcessor(manager, manager.state);
|
||||
this.autotile = manager.autotile;
|
||||
this.tick = this.tick.bind(this);
|
||||
this.viewport = new MapViewport(this);
|
||||
this.tileAnimater = new TextureColumnAnimater();
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { IMapLayer } from '@user/data-base';
|
||||
import { TileType } from '@user/data-common';
|
||||
import {
|
||||
IBlockData,
|
||||
IBlockSplitter,
|
||||
@ -849,7 +850,7 @@ export class MapVertexGenerator
|
||||
|
||||
updateMoving(block: IMovingBlock, updateTexture: boolean): void {
|
||||
if (!this.renderer.hasMoving(block)) return;
|
||||
const { cls, frames, offset, texture } = block.texture;
|
||||
const { tileType, frames, offset, texture } = block.texture;
|
||||
const vertex: IMapVertexData = {
|
||||
instancedArray: this.dynamicInstancedArray
|
||||
};
|
||||
@ -869,9 +870,9 @@ export class MapVertexGenerator
|
||||
const update = updateTexture
|
||||
? VertexUpdate.NoFrame
|
||||
: VertexUpdate.Position;
|
||||
if (cls === BlockCls.Autotile) {
|
||||
if (tileType === TileType.Autotile) {
|
||||
// 自动元件使用全部不连接
|
||||
const renderable = this.renderer.autotile.renderWithoutCheck(
|
||||
const renderable = this.renderer.autotile.render(
|
||||
block.texture,
|
||||
0b0000_0000
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user