You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-19 23:16:20 +00:00
Merge remote-tracking branch 'duckie/main' into merge-duckie-main-2026-05-06
# Conflicts: # packages/communication/src/messages/parser/room/unit/RoomUnitInfoParser.ts # packages/communication/src/messages/parser/user/data/UserProfileParser.ts # packages/events/src/session/RoomSessionUserFigureUpdateEvent.ts # packages/session/src/handler/RoomUsersHandler.ts
This commit is contained in:
@@ -415,36 +415,27 @@ export class FloorplanEditor
|
||||
|
||||
public getCurrentTilemapString(): string
|
||||
{
|
||||
const highestTile = this._tilemap[this._height - 1][this._width - 1];
|
||||
// always rescan bounds: bulk operations like toggleSelectAll / fillSquareSelection
|
||||
// mutate tile.height directly without updating _width/_height
|
||||
this._width = 0;
|
||||
this._height = 0;
|
||||
|
||||
if(highestTile.height === 'x')
|
||||
for(let y = MAX_NUM_TILE_PER_AXIS - 1; y >= 0; y--)
|
||||
{
|
||||
this._width = -1;
|
||||
this._height = -1;
|
||||
if(!this._tilemap[y]) continue;
|
||||
|
||||
for(let y = MAX_NUM_TILE_PER_AXIS - 1; y >= 0; y--)
|
||||
for(let x = MAX_NUM_TILE_PER_AXIS - 1; x >= 0; x--)
|
||||
{
|
||||
if(!this._tilemap[y]) continue;
|
||||
if(!this._tilemap[y][x]) continue;
|
||||
|
||||
for(let x = MAX_NUM_TILE_PER_AXIS - 1; x >= 0; x--)
|
||||
if(this._tilemap[y][x].height !== 'x')
|
||||
{
|
||||
if(!this._tilemap[y][x]) continue;
|
||||
|
||||
const tile = this._tilemap[y][x];
|
||||
|
||||
if(tile.height !== 'x')
|
||||
{
|
||||
if((x + 1) > this._width)
|
||||
this._width = x + 1;
|
||||
|
||||
if((y + 1) > this._height)
|
||||
this._height = y + 1;
|
||||
}
|
||||
if((x + 1) > this._width) this._width = x + 1;
|
||||
if((y + 1) > this._height) this._height = y + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const rows = [];
|
||||
|
||||
for(let y = 0; y < this._height; y++)
|
||||
|
||||
@@ -5,7 +5,7 @@ import { RoomObjectUpdateMessage } from './RoomObjectUpdateMessage';
|
||||
export class ObjectRoomMaskUpdateMessage extends RoomObjectUpdateMessage
|
||||
{
|
||||
public static ADD_MASK: string = 'RORMUM_ADD_MASK';
|
||||
public static REMOVE_MASK: string = 'RORMUM_ADD_MASK';
|
||||
public static REMOVE_MASK: string = 'RORMUM_REMOVE_MASK';
|
||||
public static DOOR: string = 'door';
|
||||
public static WINDOW: string = 'window';
|
||||
public static HOLE: string = 'hole';
|
||||
|
||||
@@ -1100,17 +1100,19 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement
|
||||
|
||||
if(sprite?.texture)
|
||||
{
|
||||
const currentDirection = this._avatarImage?.getDirection();
|
||||
const displayedDirection = this._avatarImage?.getDirection();
|
||||
const directionOffset = this._avatarImage?.getDirectionOffset() ?? 0;
|
||||
let oppositeTexture = sprite.texture;
|
||||
|
||||
if((currentDirection !== undefined) && this._avatarImage)
|
||||
if((displayedDirection !== undefined) && this._avatarImage)
|
||||
{
|
||||
const oppositeDirection = ((currentDirection + 4) % 8);
|
||||
const rawCurrent = ((displayedDirection - directionOffset) % 8 + 8) % 8;
|
||||
const rawOpposite = (rawCurrent + 4) % 8;
|
||||
const displayedOpposite = (displayedDirection + 4) % 8;
|
||||
|
||||
if(oppositeDirection !== currentDirection)
|
||||
if(displayedOpposite !== displayedDirection)
|
||||
{
|
||||
// Reuse the cached opposite texture if direction and base texture haven't changed
|
||||
if(this._reflectionOppositeTexture && (this._reflectionOppositeDirection === currentDirection) && (this._reflectionOppositeBaseTexture === sprite.texture))
|
||||
if(this._reflectionOppositeTexture && (this._reflectionOppositeDirection === displayedDirection) && (this._reflectionOppositeBaseTexture === sprite.texture))
|
||||
{
|
||||
oppositeTexture = this._reflectionOppositeTexture;
|
||||
}
|
||||
@@ -1118,7 +1120,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement
|
||||
{
|
||||
const highlightEnabled = ((this.object.model.getValue<number>(RoomObjectVariable.FIGURE_HIGHLIGHT_ENABLE) === 1) && (this.object.model.getValue<number>(RoomObjectVariable.FIGURE_HIGHLIGHT) === 1));
|
||||
|
||||
this._avatarImage.setDirection(AvatarSetType.FULL, oppositeDirection);
|
||||
this._avatarImage.setDirection(AvatarSetType.FULL, rawOpposite);
|
||||
|
||||
const renderedOpposite = (this._avatarImage.processAsTexture(AvatarSetType.FULL, highlightEnabled) || sprite.texture);
|
||||
|
||||
@@ -1129,14 +1131,10 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement
|
||||
}
|
||||
|
||||
this._reflectionOppositeTexture = this.cloneTexture(renderedOpposite);
|
||||
this._reflectionOppositeDirection = currentDirection;
|
||||
this._reflectionOppositeDirection = displayedDirection;
|
||||
this._reflectionOppositeBaseTexture = sprite.texture;
|
||||
|
||||
oppositeTexture = (this._reflectionOppositeTexture || renderedOpposite);
|
||||
|
||||
// Restore the live avatar direction and refresh the current texture so
|
||||
// movement updates do not keep showing the opposite-facing texture.
|
||||
this._avatarImage.setDirection(AvatarSetType.FULL, currentDirection);
|
||||
this._avatarImage.setDirection(AvatarSetType.FULL, rawCurrent);
|
||||
|
||||
sprite.texture = (this._avatarImage.processAsTexture(AvatarSetType.FULL, highlightEnabled) || sprite.texture);
|
||||
}
|
||||
|
||||
@@ -812,6 +812,24 @@ export class RoomPlane implements IRoomPlane
|
||||
layerContainer.destroy({ children: true });
|
||||
}
|
||||
|
||||
private applyPlaneSpriteMasksTo(container: Container): void
|
||||
{
|
||||
if(!this._planeSprite || !this._planeSprite.children) return;
|
||||
|
||||
for(const child of this._planeSprite.children)
|
||||
{
|
||||
if(child instanceof Sprite)
|
||||
{
|
||||
const maskClone = new Sprite(child.texture);
|
||||
maskClone.position.copyFrom(child.position);
|
||||
maskClone.scale.copyFrom(child.scale);
|
||||
container.addChild(maskClone);
|
||||
}
|
||||
}
|
||||
|
||||
if(this._maskFilter && (container.children.length > 1)) container.filters = [this._maskFilter];
|
||||
}
|
||||
|
||||
private renderBackgroundColor(): void
|
||||
{
|
||||
if(!this._planeTexture || this._landscapeBackgroundColor === null) return;
|
||||
@@ -828,6 +846,8 @@ export class RoomPlane implements IRoomPlane
|
||||
const colorContainer = new Container();
|
||||
colorContainer.addChild(colorGraphics);
|
||||
|
||||
this.applyPlaneSpriteMasksTo(colorContainer);
|
||||
|
||||
const transform = this.getMatrixForDimensions(canvasWidth, canvasHeight);
|
||||
|
||||
GetRenderer().render({
|
||||
@@ -869,6 +889,8 @@ export class RoomPlane implements IRoomPlane
|
||||
const colorContainer = new Container();
|
||||
colorContainer.addChild(colorGraphics);
|
||||
|
||||
this.applyPlaneSpriteMasksTo(colorContainer);
|
||||
|
||||
const transform = this.getMatrixForDimensions(canvasWidth, canvasHeight);
|
||||
|
||||
GetRenderer().render({
|
||||
|
||||
@@ -296,6 +296,8 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
const ls = plane.leftSide;
|
||||
const rs = plane.rightSide;
|
||||
|
||||
if(!loc || !ls || !rs) continue;
|
||||
|
||||
const corners = [
|
||||
new Vector3d(loc.x, loc.y, loc.z),
|
||||
new Vector3d(loc.x + rs.x, loc.y + rs.y, loc.z + rs.z),
|
||||
|
||||
Reference in New Issue
Block a user