mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2025-01-18 14:36:26 +01:00
More updates
This commit is contained in:
parent
0d6b02c8f8
commit
d40d0ed30f
@ -1,5 +1,4 @@
|
||||
import { AvatarDirectionAngle, IActionDefinition, IActiveActionData, IAssetAnimation, IAssetManager, IAvatarFigureContainer, IAvatarImage, IAvatarRenderManager, IFigureData, IFigurePartSet, IPartColor, IStructureData } from '@nitrots/api';
|
||||
import { EventDispatcher } from '@nitrots/events';
|
||||
import { Point } from 'pixi.js';
|
||||
import { AvatarImagePartContainer } from './AvatarImagePartContainer';
|
||||
import { AvatarRenderManager } from './AvatarRenderManager';
|
||||
@ -8,7 +7,7 @@ import { Animation, AnimationManager, AvatarAnimationLayerData } from './animati
|
||||
import { AvatarModelGeometry } from './geometry';
|
||||
import { AnimationAction, AvatarAnimationData, AvatarAnimationFrame, AvatarCanvas, FigureSetData, PartSetsData } from './structure';
|
||||
|
||||
export class AvatarStructure extends EventDispatcher
|
||||
export class AvatarStructure
|
||||
{
|
||||
private _renderManager: AvatarRenderManager;
|
||||
private _geometry: AvatarModelGeometry;
|
||||
@ -22,8 +21,6 @@ export class AvatarStructure extends EventDispatcher
|
||||
|
||||
constructor(renderManager: AvatarRenderManager)
|
||||
{
|
||||
super();
|
||||
|
||||
this._renderManager = renderManager;
|
||||
this._geometry = null;
|
||||
this._figureData = new FigureSetData();
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { IEventDispatcher, IRoomObjectEventHandler, IRoomObjectLogicFactory, RoomObjectLogicType } from '@nitrots/api';
|
||||
import { EventDispatcher, RoomObjectEvent } from '@nitrots/events';
|
||||
import { GetEventDispatcher, RoomObjectEvent } from '@nitrots/events';
|
||||
import { NitroLogger } from '@nitrots/utils';
|
||||
import { RoomObjectLogicBase } from '../../room';
|
||||
import { AvatarLogic, FurnitureAchievementResolutionLogic, FurnitureBadgeDisplayLogic, FurnitureChangeStateWhenStepOnLogic, FurnitureClothingChangeLogic, FurnitureCounterClockLogic, FurnitureCrackableLogic, FurnitureCraftingGizmoLogic, FurnitureCreditLogic, FurnitureCuckooClockLogic, FurnitureCustomStackHeightLogic, FurnitureDiceLogic, FurnitureEcotronBoxLogic, FurnitureEditableInternalLinkLogic, FurnitureEditableRoomLinkLogic, FurnitureEffectBoxLogic, FurnitureExternalImageLogic, FurnitureFireworksLogic, FurnitureFloorHoleLogic, FurnitureGroupForumTerminalLogic, FurnitureGuildCustomizedLogic, FurnitureHabboWheelLogic, FurnitureHighScoreLogic, FurnitureHockeyScoreLogic, FurnitureHweenLovelockLogic, FurnitureIceStormLogic, FurnitureInternalLinkLogic, FurnitureJukeboxLogic, FurnitureLogic, FurnitureLoveLockLogic, FurnitureMannequinLogic, FurnitureMonsterplantSeedLogic, FurnitureMultiHeightLogic, FurnitureMultiStateLogic, FurnitureMysteryBoxLogic, FurnitureMysteryTrophyLogic, FurnitureOneWayDoorLogic, FurniturePetCustomizationLogic, FurniturePlaceholderLogic, FurniturePlanetSystemLogic, FurniturePresentLogic, FurniturePurchaseableClothingLogic, FurniturePushableLogic, FurnitureRandomStateLogic, FurnitureRandomTeleportLogic, FurnitureRentableSpaceLogic, FurnitureRoomBackgroundColorLogic, FurnitureRoomBackgroundLogic, FurnitureRoomBillboardLogic, FurnitureRoomDimmerLogic, FurnitureScoreLogic, FurnitureSongDiskLogic, FurnitureSoundBlockLogic, FurnitureSoundMachineLogic, FurnitureStickieLogic, FurnitureTrophyLogic, FurnitureVoteCounterLogic, FurnitureVoteMajorityLogic, FurnitureWelcomeGiftLogic, FurnitureWindowLogic, FurnitureYoutubeLogic, PetLogic, RoomLogic, SelectionArrowLogic, TileCursorLogic } from './object';
|
||||
|
||||
export class RoomObjectLogicFactory implements IRoomObjectLogicFactory
|
||||
{
|
||||
private _events: IEventDispatcher = new EventDispatcher();
|
||||
private _events: IEventDispatcher = GetEventDispatcher();
|
||||
private _cachedEvents: Map<string, boolean> = new Map();
|
||||
private _registeredEvents: Map<string, boolean> = new Map();
|
||||
private _functions: ((event: RoomObjectEvent) => void)[] = [];
|
||||
|
@ -1166,7 +1166,7 @@ export class RoomPlaneParser
|
||||
private addWall(k: IVector3D, _arg_2: IVector3D, _arg_3: IVector3D, _arg_4: IVector3D, _arg_5: boolean, _arg_6: boolean, _arg_7: boolean): void
|
||||
{
|
||||
this.addPlane(RoomPlaneData.PLANE_WALL, k, _arg_2, _arg_3, [_arg_4]);
|
||||
//this.addPlane(RoomPlaneData.PLANE_LANDSCAPE, k, _arg_2, _arg_3, [_arg_4]);
|
||||
this.addPlane(RoomPlaneData.PLANE_LANDSCAPE, k, _arg_2, _arg_3, [_arg_4]);
|
||||
const _local_8: number = (RoomPlaneParser.WALL_THICKNESS * this._wallThicknessMultiplier);
|
||||
const _local_9: number = (RoomPlaneParser.FLOOR_THICKNESS * this._floorThicknessMultiplier);
|
||||
const _local_10: Vector3d = Vector3d.crossProduct(_arg_2, _arg_3);
|
||||
|
@ -36,6 +36,17 @@ export class RoomObjectSprite implements IRoomObjectSprite
|
||||
|
||||
public dispose(): void
|
||||
{
|
||||
if(this._spriteType !== RoomObjectSpriteType.DEFAULT)
|
||||
{
|
||||
if(this._texture)
|
||||
{
|
||||
//@ts-ignore
|
||||
if(this._texture?.source?.hitMap) this._texture.source.hitMap = null;
|
||||
|
||||
this._texture.destroy(true);
|
||||
}
|
||||
}
|
||||
|
||||
this._texture = null;
|
||||
this._width = 0;
|
||||
this._height = 0;
|
||||
|
@ -72,24 +72,24 @@ export class DirectionData
|
||||
existing.tag = tag;
|
||||
}
|
||||
|
||||
public getLayerInk(layerId: number): BLEND_MODES
|
||||
public getLayerBlendMode(layerId: number): BLEND_MODES
|
||||
{
|
||||
const existing = this.getLayer(layerId);
|
||||
|
||||
if(!existing) return LayerData.DEFAULT_INK;
|
||||
if(!existing) return LayerData.DEFAULT_BLEND_MODE;
|
||||
|
||||
return existing.ink;
|
||||
return existing.blendMode;
|
||||
}
|
||||
|
||||
public setLayerInk(layerId: number, ink: BLEND_MODES): void
|
||||
public setLayerBlendMode(layerId: number, blendMode: BLEND_MODES): void
|
||||
{
|
||||
const existing = this.getLayer(layerId);
|
||||
|
||||
if(!existing) return;
|
||||
|
||||
if(!ink || !ink.length) return;
|
||||
if(!blendMode || !blendMode.length) return;
|
||||
|
||||
existing.ink = ink;
|
||||
existing.blendMode = blendMode;
|
||||
}
|
||||
|
||||
public getLayerAlpha(layerId: number): number
|
||||
|
@ -5,7 +5,7 @@ export class LayerData
|
||||
public static DEFAULT_COUNT: number = 0;
|
||||
public static DEFAULT_DIRECTION: number = 0;
|
||||
public static DEFAULT_TAG: string = '';
|
||||
public static DEFAULT_INK: BLEND_MODES = 'normal';
|
||||
public static DEFAULT_BLEND_MODE: BLEND_MODES = 'normal';
|
||||
public static DEFAULT_ALPHA: number = 255;
|
||||
public static DEFAULT_IGNORE_MOUSE: boolean = false;
|
||||
public static DEFAULT_XOFFSET: number = 0;
|
||||
@ -13,7 +13,7 @@ export class LayerData
|
||||
public static DEFAULT_ZOFFSET: number = 0;
|
||||
|
||||
private _tag: string = LayerData.DEFAULT_TAG;
|
||||
private _ink: BLEND_MODES = LayerData.DEFAULT_INK;
|
||||
private _blendMode: BLEND_MODES = LayerData.DEFAULT_BLEND_MODE;
|
||||
private _alpha: number = LayerData.DEFAULT_ALPHA;
|
||||
private _ignoreMouse: boolean = LayerData.DEFAULT_IGNORE_MOUSE;
|
||||
private _xOffset: number = LayerData.DEFAULT_XOFFSET;
|
||||
@ -25,7 +25,7 @@ export class LayerData
|
||||
if(!layer) return;
|
||||
|
||||
this._tag = layer.tag;
|
||||
this._ink = layer.ink;
|
||||
this._blendMode = layer.blendMode;
|
||||
this._alpha = layer.alpha;
|
||||
this._ignoreMouse = layer.ignoreMouse;
|
||||
this._xOffset = layer.xOffset;
|
||||
@ -43,14 +43,14 @@ export class LayerData
|
||||
this._tag = tag;
|
||||
}
|
||||
|
||||
public get ink(): BLEND_MODES
|
||||
public get blendMode(): BLEND_MODES
|
||||
{
|
||||
return this._ink;
|
||||
return this._blendMode;
|
||||
}
|
||||
|
||||
public set ink(ink: BLEND_MODES)
|
||||
public set blendMode(value: BLEND_MODES)
|
||||
{
|
||||
this._ink = ink;
|
||||
this._blendMode = value;
|
||||
}
|
||||
|
||||
public get alpha(): number
|
||||
|
@ -145,7 +145,7 @@ export class SizeData
|
||||
if(layerId < 0 || (layerId >= this._layerCount)) return false;
|
||||
|
||||
// TODO: check the .nitro files for inks
|
||||
if(layer.ink !== undefined) directionData.setLayerInk(layerId, (layer.ink?.toLowerCase() as BLEND_MODES));
|
||||
if(layer.ink !== undefined) directionData.setLayerBlendMode(layerId, (layer.ink?.toLowerCase() as BLEND_MODES));
|
||||
|
||||
if(layer.tag !== undefined) directionData.setLayerTag(layerId, layer.tag);
|
||||
|
||||
@ -215,13 +215,13 @@ export class SizeData
|
||||
return directionData.getLayerTag(layerId);
|
||||
}
|
||||
|
||||
public getLayerInk(direction: number, layerId: number): BLEND_MODES
|
||||
public getLayerBlendMode(direction: number, layerId: number): BLEND_MODES
|
||||
{
|
||||
const directionData = this.getDirectionData(direction);
|
||||
|
||||
if(!directionData) return LayerData.DEFAULT_INK;
|
||||
if(!directionData) return LayerData.DEFAULT_BLEND_MODE;
|
||||
|
||||
return directionData.getLayerInk(layerId);
|
||||
return directionData.getLayerBlendMode(layerId);
|
||||
}
|
||||
|
||||
public getLayerAlpha(direction: number, layerId: number): number
|
||||
|
@ -31,7 +31,7 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization
|
||||
protected _updatedLayers: boolean[];
|
||||
protected _assetNames: string[];
|
||||
protected _spriteTags: string[];
|
||||
protected _spriteInks: BLEND_MODES[];
|
||||
protected _spriteBlendModes: BLEND_MODES[];
|
||||
protected _spriteAlphas: number[];
|
||||
protected _spriteColors: number[];
|
||||
protected _spriteMouseCaptures: boolean[];
|
||||
@ -66,7 +66,7 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization
|
||||
this._updatedLayers = [];
|
||||
this._assetNames = [];
|
||||
this._spriteTags = [];
|
||||
this._spriteInks = [];
|
||||
this._spriteBlendModes = [];
|
||||
this._spriteAlphas = [];
|
||||
this._spriteColors = [];
|
||||
this._spriteMouseCaptures = [];
|
||||
@ -97,7 +97,7 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization
|
||||
this._updatedLayers = null;
|
||||
this._assetNames = null;
|
||||
this._spriteTags = null;
|
||||
this._spriteInks = null;
|
||||
this._spriteBlendModes = null;
|
||||
this._spriteAlphas = null;
|
||||
this._spriteColors = null;
|
||||
this._spriteMouseCaptures = null;
|
||||
@ -116,7 +116,7 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization
|
||||
this._updatedLayers = [];
|
||||
this._assetNames = [];
|
||||
this._spriteTags = [];
|
||||
this._spriteInks = [];
|
||||
this._spriteBlendModes = [];
|
||||
this._spriteAlphas = [];
|
||||
this._spriteColors = [];
|
||||
this._spriteMouseCaptures = [];
|
||||
@ -134,7 +134,7 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization
|
||||
this._updatedLayers = [];
|
||||
this._assetNames = [];
|
||||
this._spriteTags = [];
|
||||
this._spriteInks = [];
|
||||
this._spriteBlendModes = [];
|
||||
this._spriteAlphas = [];
|
||||
this._spriteColors = [];
|
||||
this._spriteMouseCaptures = [];
|
||||
@ -297,7 +297,7 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization
|
||||
sprite.color = this.getLayerColor(scale, layerId, this._selectedColor);
|
||||
sprite.offsetX = (assetData.offsetX + this.getLayerXOffset(scale, this._direction, layerId));
|
||||
sprite.offsetY = (assetData.offsetY + this.getLayerYOffset(scale, this._direction, layerId));
|
||||
sprite.blendMode = this.getLayerInk(scale, this._direction, layerId);
|
||||
sprite.blendMode = this.getLayerBlendMode(scale, this._direction, layerId);
|
||||
sprite.alphaTolerance = (this.getLayerIgnoreMouse(scale, this._direction, layerId) ? AlphaTolerance.MATCH_NOTHING : AlphaTolerance.MATCH_OPAQUE_PIXELS);
|
||||
|
||||
relativeDepth = this.getLayerZOffset(scale, this._direction, layerId);
|
||||
@ -418,19 +418,19 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization
|
||||
return tag;
|
||||
}
|
||||
|
||||
protected getLayerInk(scale: number, direction: number, layerId: number): BLEND_MODES
|
||||
protected getLayerBlendMode(scale: number, direction: number, layerId: number): BLEND_MODES
|
||||
{
|
||||
const existing = this._spriteInks[layerId];
|
||||
const existing = this._spriteBlendModes[layerId];
|
||||
|
||||
if(existing !== undefined) return existing;
|
||||
|
||||
if(!this._data) return LayerData.DEFAULT_INK;
|
||||
if(!this._data) return LayerData.DEFAULT_BLEND_MODE;
|
||||
|
||||
const ink = this._data.getLayerInk(scale, direction, layerId);
|
||||
const blendMode = this._data.getLayerBlendMode(scale, direction, layerId);
|
||||
|
||||
this._spriteInks[layerId] = ink;
|
||||
this._spriteBlendModes[layerId] = blendMode;
|
||||
|
||||
return ink;
|
||||
return blendMode;
|
||||
}
|
||||
|
||||
protected getLayerAlpha(scale: number, direction: number, layerId: number): number
|
||||
|
@ -211,13 +211,13 @@ export class FurnitureVisualizationData implements IObjectVisualizationData
|
||||
return size.getLayerTag(direction, layerId);
|
||||
}
|
||||
|
||||
public getLayerInk(scale: number, direction: number, layerId: number): BLEND_MODES
|
||||
public getLayerBlendMode(scale: number, direction: number, layerId: number): BLEND_MODES
|
||||
{
|
||||
const size = this.getSizeData(scale);
|
||||
|
||||
if(!size) return LayerData.DEFAULT_INK;
|
||||
if(!size) return LayerData.DEFAULT_BLEND_MODE;
|
||||
|
||||
return size.getLayerInk(direction, layerId);
|
||||
return size.getLayerBlendMode(direction, layerId);
|
||||
}
|
||||
|
||||
public getLayerAlpha(scale: number, direction: number, layerId: number): number
|
||||
|
@ -106,6 +106,10 @@ export class RoomPlane implements IRoomPlane
|
||||
this._cornerC = null;
|
||||
this._cornerD = null;
|
||||
|
||||
if(this._planeSprite) this._planeSprite.destroy();
|
||||
|
||||
if(this._planeTexture) this._planeTexture = null;
|
||||
|
||||
this._disposed = true;
|
||||
}
|
||||
|
||||
@ -113,16 +117,16 @@ export class RoomPlane implements IRoomPlane
|
||||
{
|
||||
if(!geometry || this._disposed) return false;
|
||||
|
||||
let geometryChanged = false;
|
||||
let needsUpdate = false;
|
||||
|
||||
if(this._geometryUpdateId != geometry.updateId) geometryChanged = true;
|
||||
if(this._geometryUpdateId !== geometry.updateId) needsUpdate = true;
|
||||
|
||||
if(!geometryChanged || !this._canBeVisible)
|
||||
if(!needsUpdate || !this._canBeVisible)
|
||||
{
|
||||
if(!this.visible) return false;
|
||||
}
|
||||
|
||||
if(geometryChanged)
|
||||
if(needsUpdate)
|
||||
{
|
||||
let cosAngle = 0;
|
||||
|
||||
@ -177,15 +181,23 @@ export class RoomPlane implements IRoomPlane
|
||||
this._relativeDepth = relativeDepth;
|
||||
this._isVisible = true;
|
||||
this._geometryUpdateId = geometry.updateId;
|
||||
}
|
||||
|
||||
if(geometryChanged)
|
||||
{
|
||||
Randomizer.setSeed(this._randomSeed);
|
||||
|
||||
let width = (this._leftSide.length * RoomPlane.PLANE_GEOMETRY.scale);
|
||||
let height = (this._rightSide.length * RoomPlane.PLANE_GEOMETRY.scale);
|
||||
const normal = RoomPlane.PLANE_GEOMETRY.getCoordinatePosition(this._normal);
|
||||
let width = (this._leftSide.length * geometry.scale);
|
||||
let height = (this._rightSide.length * geometry.scale);
|
||||
const normal = geometry.getCoordinatePosition(this._normal);
|
||||
|
||||
const getRandomColor = () =>
|
||||
{
|
||||
const letters = '0123456789ABCDEF';
|
||||
let color = '0x';
|
||||
for(let i = 0; i < 6; i++)
|
||||
{
|
||||
color += letters[Math.floor(Math.random() * 16)];
|
||||
}
|
||||
return parseInt(color, 16);
|
||||
};
|
||||
|
||||
const getTextureAndColorForPlane = (planeId: string, planeType: number) =>
|
||||
{
|
||||
@ -193,24 +205,14 @@ export class RoomPlane implements IRoomPlane
|
||||
|
||||
const roomCollection = GetAssetManager().getCollection('room');
|
||||
const planeVisualizationData = roomCollection?.data?.roomVisualization?.[dataType];
|
||||
const planeVisualization = planeVisualizationData?.planes?.find(plane => (plane.id === planeId))?.visualizations?.[0];
|
||||
const plane = planeVisualizationData?.planes?.find(plane => (plane.id === planeId));
|
||||
const planeVisualization = (dataType === 'landscapeData') ? plane?.animatedVisualization?.[0] : plane?.visualizations?.[0];
|
||||
const planeLayer = planeVisualization?.allLayers?.[0] as IAssetPlaneVisualizationLayer;
|
||||
const planeMaterialId = planeLayer?.materialId;
|
||||
const planeColor = planeLayer?.color;
|
||||
const planeAssetName = planeVisualizationData?.textures?.find(texture => (texture.id === planeMaterialId))?.bitmaps?.[0]?.assetName;
|
||||
const texture = GetAssetManager().getAsset(planeAssetName)?.texture;
|
||||
|
||||
const getRandomColor = () =>
|
||||
{
|
||||
const letters = '0123456789ABCDEF';
|
||||
let color = '0x';
|
||||
for(let i = 0; i < 6; i++)
|
||||
{
|
||||
color += letters[Math.floor(Math.random() * 16)];
|
||||
}
|
||||
return parseInt(color, 16);
|
||||
};
|
||||
|
||||
return { texture, color: planeColor };
|
||||
};
|
||||
|
||||
@ -301,14 +303,13 @@ export class RoomPlane implements IRoomPlane
|
||||
|
||||
this._planeSprite = new TilingSprite({
|
||||
texture,
|
||||
width: width,
|
||||
height: height,
|
||||
width,
|
||||
height,
|
||||
tilePosition: {
|
||||
x: renderOffsetX,
|
||||
y: renderOffsetY
|
||||
},
|
||||
tint: planeData.color,
|
||||
applyAnchorToTexture: true
|
||||
tint: getRandomColor()
|
||||
});
|
||||
break;
|
||||
}
|
||||
@ -316,8 +317,7 @@ export class RoomPlane implements IRoomPlane
|
||||
this._planeSprite = new TilingSprite({
|
||||
texture: Texture.WHITE,
|
||||
width: width,
|
||||
height: height,
|
||||
applyAnchorToTexture: true
|
||||
height: height
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -325,13 +325,11 @@ export class RoomPlane implements IRoomPlane
|
||||
this._planeSprite.allowChildren = true;
|
||||
}
|
||||
|
||||
const maskChanged = this._maskChanged;
|
||||
|
||||
if(maskChanged)
|
||||
if(needsUpdate || this._maskChanged)
|
||||
{
|
||||
this._planeSprite.removeChildren();
|
||||
|
||||
this.updateMask(this._planeSprite, geometry);
|
||||
|
||||
needsUpdate = true;
|
||||
}
|
||||
|
||||
if(this._planeTexture)
|
||||
@ -346,12 +344,11 @@ export class RoomPlane implements IRoomPlane
|
||||
|
||||
if(!this._planeTexture) this._planeTexture = TextureUtils.createRenderTexture(this._width, this._height);
|
||||
|
||||
if(geometryChanged || maskChanged)
|
||||
if(needsUpdate)
|
||||
{
|
||||
GetRenderer().render({
|
||||
target: this._planeTexture,
|
||||
container: this._planeSprite,
|
||||
clear: true,
|
||||
transform: this.getMatrixForDimensions(this._planeSprite.width, this._planeSprite.height)
|
||||
});
|
||||
}
|
||||
@ -484,58 +481,11 @@ export class RoomPlane implements IRoomPlane
|
||||
return false;
|
||||
}
|
||||
|
||||
private updateMaskChangeStatus(): void
|
||||
private updateMask(container: Container, geometry: IRoomGeometry): boolean
|
||||
{
|
||||
if(!this._maskChanged) return;
|
||||
if(container.children?.length) container.removeChildren();
|
||||
|
||||
let maskChanged = true;
|
||||
|
||||
if(this._bitmapMasks.length === this._bitmapMasksOld.length)
|
||||
{
|
||||
for(const mask of this._bitmapMasks)
|
||||
{
|
||||
if(!mask) continue;
|
||||
|
||||
let _local_6 = false;
|
||||
|
||||
for(const plane of this._bitmapMasksOld)
|
||||
{
|
||||
if(!plane) continue;
|
||||
|
||||
if(((plane.type === mask.type) && (plane.leftSideLoc === mask.leftSideLoc)) && (plane.rightSideLoc === mask.rightSideLoc))
|
||||
{
|
||||
_local_6 = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!_local_6)
|
||||
{
|
||||
maskChanged = false;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
maskChanged = false;
|
||||
}
|
||||
|
||||
if(this._rectangleMasks.length > this._rectangleMasksOld.length) maskChanged = false;
|
||||
|
||||
if(maskChanged) this._maskChanged = false;
|
||||
}
|
||||
|
||||
private updateMask(container: Container, geometry: IRoomGeometry): void
|
||||
{
|
||||
if(!container || !geometry || !this._useMask || (!this._bitmapMasks.length && !this._rectangleMasks.length) || !this._maskManager) return;
|
||||
|
||||
this.updateMaskChangeStatus();
|
||||
|
||||
this._bitmapMasksOld = [];
|
||||
this._rectangleMasksOld = [];
|
||||
if(!container || !geometry || !this._useMask || (!this._bitmapMasks.length && !this._rectangleMasks.length) || !this._maskManager) return false;
|
||||
|
||||
const normal = geometry.getCoordinatePosition(this._normal);
|
||||
|
||||
@ -555,7 +505,6 @@ export class RoomPlane implements IRoomPlane
|
||||
posY = (container.height - ((container.height * mask.rightSideLoc) / this._rightSide.length));
|
||||
|
||||
this._maskManager.addMaskToContainer(container, type, geometry.scale, normal, posX, posY);
|
||||
this._bitmapMasksOld.push(new RoomPlaneBitmapMask(type, mask.leftSideLoc, mask.rightSideLoc));
|
||||
}
|
||||
|
||||
i++;
|
||||
@ -580,11 +529,9 @@ export class RoomPlane implements IRoomPlane
|
||||
maskSprite.tint = 0x000000;
|
||||
maskSprite.width = wd;
|
||||
maskSprite.height = ht;
|
||||
maskSprite.position.set((posX - wd), (posY - ht));
|
||||
maskSprite.position.set(Math.trunc((posX - wd)), Math.trunc((posY - ht)));
|
||||
|
||||
container.addChild(maskSprite);
|
||||
|
||||
this._rectangleMasksOld.push(new RoomPlaneRectangleMask(rectMask.leftSideLength, rectMask.rightSideLoc, rectMask.leftSideLength, rectMask.rightSideLength));
|
||||
}
|
||||
|
||||
i++;
|
||||
@ -595,6 +542,8 @@ export class RoomPlane implements IRoomPlane
|
||||
container.filterArea = container.getBounds().rectangle;
|
||||
|
||||
container.filters = [ new PlaneMaskFilter({}) ];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get canBeVisible(): boolean
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ToInt32, Vector3d } from '@nitrots/utils';
|
||||
import { Rectangle } from 'pixi.js';
|
||||
import { Rectangle, Texture } from 'pixi.js';
|
||||
import { AlphaTolerance, IObjectVisualizationData, IPlaneVisualization, IRoomGeometry, IRoomObjectModel, IRoomObjectSprite, IRoomPlane, RoomObjectSpriteType, RoomObjectVariable } from '../../../../../api';
|
||||
import { RoomMapData } from '../../RoomMapData';
|
||||
import { RoomMapMaskData } from '../../RoomMapMaskData';
|
||||
@ -139,8 +139,6 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements
|
||||
|
||||
if(this.updateMasks(objectModel)) needsUpdate = true;
|
||||
|
||||
if(!needsUpdate) return;
|
||||
|
||||
if(this.updatePlaneTexturesAndVisibilities(objectModel)) needsUpdate = true;
|
||||
|
||||
if(this.updatePlanes(geometry, geometryUpdate, time)) needsUpdate = true;
|
||||
@ -259,7 +257,13 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements
|
||||
const wallVisibility = (model.getValue<number>(RoomObjectVariable.ROOM_WALL_VISIBILITY) === 1);
|
||||
const landscapeVisibility = (model.getValue<number>(RoomObjectVariable.ROOM_LANDSCAPE_VISIBILITY) === 1);
|
||||
|
||||
return (this.updatePlaneTypes(floorType, wallType, landscapeType) || this.updatePlaneVisibility(floorVisibility, wallVisibility, landscapeVisibility));
|
||||
let result = false;
|
||||
|
||||
result = this.updatePlaneTypes(floorType, wallType, landscapeType);
|
||||
|
||||
result = this.updatePlaneVisibility(floorVisibility, wallVisibility, landscapeVisibility) ? true : result;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private updateMasks(model: IRoomObjectModel): boolean
|
||||
@ -559,13 +563,13 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements
|
||||
return true;
|
||||
}
|
||||
|
||||
private updatePlaneVisibility(k: boolean, _arg_2: boolean, _arg_3: boolean): boolean
|
||||
private updatePlaneVisibility(floorVisibility: boolean, wallVisibility: boolean, landscapeVisibility: boolean): boolean
|
||||
{
|
||||
if((k === this._typeVisibility[RoomPlane.TYPE_FLOOR]) && (_arg_2 === this._typeVisibility[RoomPlane.TYPE_WALL]) && (_arg_3 === this._typeVisibility[RoomPlane.TYPE_LANDSCAPE])) return false;
|
||||
if((floorVisibility === this._typeVisibility[RoomPlane.TYPE_FLOOR]) && (wallVisibility === this._typeVisibility[RoomPlane.TYPE_WALL]) && (landscapeVisibility === this._typeVisibility[RoomPlane.TYPE_LANDSCAPE])) return false;
|
||||
|
||||
this._typeVisibility[RoomPlane.TYPE_FLOOR] = k;
|
||||
this._typeVisibility[RoomPlane.TYPE_WALL] = _arg_2;
|
||||
this._typeVisibility[RoomPlane.TYPE_LANDSCAPE] = _arg_3;
|
||||
this._typeVisibility[RoomPlane.TYPE_FLOOR] = floorVisibility;
|
||||
this._typeVisibility[RoomPlane.TYPE_WALL] = wallVisibility;
|
||||
this._typeVisibility[RoomPlane.TYPE_LANDSCAPE] = landscapeVisibility;
|
||||
|
||||
this._visiblePlanes = [];
|
||||
this._visiblePlaneSpriteNumbers = [];
|
||||
@ -777,7 +781,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements
|
||||
sprite.offsetY = -(offset.y);
|
||||
sprite.relativeDepth = relativeDepth;
|
||||
sprite.color = plane.color;
|
||||
sprite.texture = plane.planeTexture;
|
||||
sprite.texture = plane.planeTexture ?? Texture.EMPTY;
|
||||
sprite.name = ((_arg_3 + '_') + this._assetUpdateCounter);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user