From 4be404e96d671d136081c2387a9b2708ce4558b3 Mon Sep 17 00:00:00 2001 From: Bill Date: Mon, 2 Aug 2021 23:50:15 -0400 Subject: [PATCH] Updates --- src/nitro/avatar/AvatarImage.ts | 25 ++++++----- .../avatar/AvatarImageBodyPartContainer.ts | 3 +- src/nitro/avatar/AvatarStructure.ts | 2 +- src/nitro/avatar/IAvatarImage.ts | 5 ++- src/nitro/avatar/cache/AvatarImageCache.ts | 10 +++-- src/nitro/avatar/cache/ImageData.ts | 4 +- src/nitro/avatar/structure/AvatarCanvas.ts | 2 +- .../structure/animation/AnimationAction.ts | 2 +- src/nitro/camera/IRoomCameraWidgetEffect.ts | 2 +- src/nitro/camera/RoomCameraWidgetEffect.ts | 2 +- src/nitro/camera/RoomCameraWidgetManager.ts | 14 +++---- .../camera/RenderRoomMessageComposer.ts | 2 +- src/nitro/room/IGetImageListener.ts | 2 +- src/nitro/room/IRoomEngine.ts | 4 +- src/nitro/room/ImageResult.ts | 4 +- src/nitro/room/RoomContentLoader.ts | 10 +++-- src/nitro/room/RoomEngine.ts | 41 ++++++++++++------- 17 files changed, 81 insertions(+), 53 deletions(-) diff --git a/src/nitro/avatar/AvatarImage.ts b/src/nitro/avatar/AvatarImage.ts index 96e695fd..a09400d7 100644 --- a/src/nitro/avatar/AvatarImage.ts +++ b/src/nitro/avatar/AvatarImage.ts @@ -1,4 +1,9 @@ -import { Container, filters, Rectangle, RenderTexture, Sprite, Texture } from 'pixi.js'; +import { RenderTexture, Texture } from '@pixi/core'; +import { Container } from '@pixi/display'; +import { ColorMatrixFilter } from '@pixi/filter-color-matrix'; +import { Rectangle } from '@pixi/math'; +import { Sprite } from '@pixi/sprite'; +import { NitroContainer, NitroSprite } from '../../core'; import { AdvancedMap } from '../../core/utils/AdvancedMap'; import { IGraphicAsset } from '../../room/object/visualization/utils/IGraphicAsset'; import { TextureUtils } from '../../room/utils/TextureUtils'; @@ -335,7 +340,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener this._image = null; - const container = new Container(); + const container = new NitroContainer(); let isCachable = true; let partCount = (_local_6.length - 1); @@ -370,7 +375,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener point.x += avatarCanvas.regPoint.x; point.y += avatarCanvas.regPoint.y; - const partContainer = new Container(); + const partContainer = new NitroContainer(); partContainer.addChild(partCacheContainer); @@ -452,8 +457,8 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener if(!avatarCanvas) return null; const setTypes = this.getBodyParts(setType, this._mainAction.definition.geometryType, this._mainDirection); - const container = new Sprite(); - const sprite = new Sprite(Texture.EMPTY); + const container = new NitroSprite(); + const sprite = new NitroSprite(Texture.EMPTY); sprite.width = avatarCanvas.width; sprite.height = avatarCanvas.height; @@ -490,7 +495,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener point.x += avatarCanvas.regPoint.x; point.y += avatarCanvas.regPoint.y; - const partContainer = new Container(); + const partContainer = new NitroContainer(); partContainer.addChild(partCacheContainer); @@ -517,8 +522,8 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener if(!avatarCanvas) return null; const setTypes = this.getBodyParts(setType, this._mainAction.definition.geometryType, this._mainDirection); - const container = new Container(); - const sprite = new Sprite(Texture.EMPTY); + const container = new NitroContainer(); + const sprite = new NitroSprite(Texture.EMPTY); sprite.width = avatarCanvas.width; sprite.height = avatarCanvas.height; @@ -555,7 +560,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener point.x += avatarCanvas.regPoint.x; point.y += avatarCanvas.regPoint.y; - const partContainer = new Container(); + const partContainer = new NitroContainer(); partContainer.addChild(partCacheContainer); @@ -1014,7 +1019,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener break; } - const colorFilter = new filters.ColorMatrixFilter(); + const colorFilter = new ColorMatrixFilter(); colorFilter.matrix = [_local_3, _local_4, _local_5, 0, 0, _local_3, _local_4, _local_5, 0, 0, _local_3, _local_4, _local_5, 0, 0, 0, 0, 0, 1, 0]; diff --git a/src/nitro/avatar/AvatarImageBodyPartContainer.ts b/src/nitro/avatar/AvatarImageBodyPartContainer.ts index a4efc020..9c1f8ed1 100644 --- a/src/nitro/avatar/AvatarImageBodyPartContainer.ts +++ b/src/nitro/avatar/AvatarImageBodyPartContainer.ts @@ -1,4 +1,5 @@ -import { Container, Point } from 'pixi.js'; +import { Container } from '@pixi/display'; +import { Point } from '@pixi/math'; export class AvatarImageBodyPartContainer { diff --git a/src/nitro/avatar/AvatarStructure.ts b/src/nitro/avatar/AvatarStructure.ts index df8a43c6..1ebe4a2c 100644 --- a/src/nitro/avatar/AvatarStructure.ts +++ b/src/nitro/avatar/AvatarStructure.ts @@ -1,4 +1,4 @@ -import { Point } from 'pixi.js'; +import { Point } from '@pixi/math'; import { IAssetManager } from '../../core/asset/IAssetManager'; import { IAssetAnimation } from '../../core/asset/interfaces'; import { EventDispatcher } from '../../core/events/EventDispatcher'; diff --git a/src/nitro/avatar/IAvatarImage.ts b/src/nitro/avatar/IAvatarImage.ts index b88bade6..a0dd8d64 100644 --- a/src/nitro/avatar/IAvatarImage.ts +++ b/src/nitro/avatar/IAvatarImage.ts @@ -1,4 +1,5 @@ -import { RenderTexture, Sprite } from 'pixi.js'; +import { RenderTexture } from '@pixi/core'; +import { Sprite } from '@pixi/sprite'; import { IDisposable } from '../../core/common/disposable/IDisposable'; import { IGraphicAsset } from '../../room/object/visualization/utils/IGraphicAsset'; import { IAnimationLayerData } from './animation/IAnimationLayerData'; @@ -34,4 +35,4 @@ export interface IAvatarImage extends IDisposable animationHasResetOnToggle: boolean; resetAnimationFrameCounter(): void; mainAction: string; -} \ No newline at end of file +} diff --git a/src/nitro/avatar/cache/AvatarImageCache.ts b/src/nitro/avatar/cache/AvatarImageCache.ts index 520829f1..9154d39b 100644 --- a/src/nitro/avatar/cache/AvatarImageCache.ts +++ b/src/nitro/avatar/cache/AvatarImageCache.ts @@ -1,4 +1,6 @@ -import { Container, Matrix, Point, Rectangle, Sprite, Texture } from 'pixi.js'; +import { Texture } from '@pixi/core'; +import { Matrix, Point, Rectangle } from '@pixi/math'; +import { NitroContainer, NitroSprite } from '../../../core'; import { RoomObjectSpriteData } from '../../../room/data/RoomObjectSpriteData'; import { Nitro } from '../../Nitro'; import { IActiveActionData } from '../actions/IActiveActionData'; @@ -478,9 +480,9 @@ export class AvatarImageCache for(const data of k) data && bounds.enlarge(data.offsetRect); const point = new Point(-(bounds.x), -(bounds.y)); - const container = new Container(); + const container = new NitroContainer(); - const sprite = new Sprite(Texture.EMPTY); + const sprite = new NitroSprite(Texture.EMPTY); sprite.width = bounds.width; sprite.height = bounds.height; @@ -514,7 +516,7 @@ export class AvatarImageCache this._matrix.ty = (regPoint.y - data.rect.y); } - const sprite = new Sprite(texture); + const sprite = new NitroSprite(texture); sprite.tint = color; sprite.transform.setFromMatrix(this._matrix); diff --git a/src/nitro/avatar/cache/ImageData.ts b/src/nitro/avatar/cache/ImageData.ts index 571da19a..7686a9ee 100644 --- a/src/nitro/avatar/cache/ImageData.ts +++ b/src/nitro/avatar/cache/ImageData.ts @@ -1,4 +1,6 @@ -import { Container, Point, Rectangle, Resource, Texture } from 'pixi.js'; +import { Resource, Texture } from '@pixi/core'; +import { Container } from '@pixi/display'; +import { Point, Rectangle } from '@pixi/math'; export class ImageData { diff --git a/src/nitro/avatar/structure/AvatarCanvas.ts b/src/nitro/avatar/structure/AvatarCanvas.ts index 3e539afa..ad40e2b5 100644 --- a/src/nitro/avatar/structure/AvatarCanvas.ts +++ b/src/nitro/avatar/structure/AvatarCanvas.ts @@ -1,4 +1,4 @@ -import { Point } from 'pixi.js'; +import { Point } from '@pixi/math'; import { AvatarScaleType } from '../enum/AvatarScaleType'; export class AvatarCanvas diff --git a/src/nitro/avatar/structure/animation/AnimationAction.ts b/src/nitro/avatar/structure/animation/AnimationAction.ts index c635f7fb..c5ceceec 100644 --- a/src/nitro/avatar/structure/animation/AnimationAction.ts +++ b/src/nitro/avatar/structure/animation/AnimationAction.ts @@ -1,4 +1,4 @@ -import { Point } from 'pixi.js'; +import { Point } from '@pixi/math'; import { AnimationActionPart } from './AnimationActionPart'; export class AnimationAction diff --git a/src/nitro/camera/IRoomCameraWidgetEffect.ts b/src/nitro/camera/IRoomCameraWidgetEffect.ts index 5cdfdf0b..321a26b9 100644 --- a/src/nitro/camera/IRoomCameraWidgetEffect.ts +++ b/src/nitro/camera/IRoomCameraWidgetEffect.ts @@ -1,5 +1,5 @@ +import { Resource, Texture } from '@pixi/core'; import { ColorMatrix } from '@pixi/filter-color-matrix'; -import { Resource, Texture } from 'pixi.js'; export interface IRoomCameraWidgetEffect { diff --git a/src/nitro/camera/RoomCameraWidgetEffect.ts b/src/nitro/camera/RoomCameraWidgetEffect.ts index a1083ec9..d66987b0 100644 --- a/src/nitro/camera/RoomCameraWidgetEffect.ts +++ b/src/nitro/camera/RoomCameraWidgetEffect.ts @@ -1,5 +1,5 @@ +import { Resource, Texture } from '@pixi/core'; import { ColorMatrix } from '@pixi/filter-color-matrix'; -import { Resource, Texture } from 'pixi.js'; import { IRoomCameraWidgetEffect } from './IRoomCameraWidgetEffect'; export class RoomCameraWidgetEffect implements IRoomCameraWidgetEffect diff --git a/src/nitro/camera/RoomCameraWidgetManager.ts b/src/nitro/camera/RoomCameraWidgetManager.ts index ce95bf58..7b104f10 100644 --- a/src/nitro/camera/RoomCameraWidgetManager.ts +++ b/src/nitro/camera/RoomCameraWidgetManager.ts @@ -1,6 +1,6 @@ -import { ColorMatrix } from '@pixi/filter-color-matrix'; -import { Container, filters, Sprite, Texture } from 'pixi.js'; -import { EventDispatcher, IEventDispatcher } from '../../core'; +import { Texture } from '@pixi/core'; +import { ColorMatrix, ColorMatrixFilter } from '@pixi/filter-color-matrix'; +import { EventDispatcher, IEventDispatcher, NitroContainer, NitroSprite } from '../../core'; import { TextureUtils } from '../../room'; import { Nitro } from '../Nitro'; import { RoomCameraWidgetManagerEvent } from './events/RoomCameraWidgetManagerEvent'; @@ -55,9 +55,9 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager public applyEffects(image: HTMLImageElement, selectedEffects: IRoomCameraWidgetSelectedEffect[], isZoomed: boolean): HTMLImageElement { - const container = new Container(); + const container = new NitroContainer(); const texture = Texture.from(image); - const sprite = new Sprite(texture); + const sprite = new NitroSprite(texture); container.addChild(sprite); @@ -69,7 +69,7 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager if(effect.colorMatrix) { - const filter = new filters.ColorMatrixFilter(); + const filter = new ColorMatrixFilter(); filter.matrix = effect.colorMatrix; filter.alpha = selectedEffect.alpha; @@ -80,7 +80,7 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager } else { - const effectSprite = new Sprite(effect.texture); + const effectSprite = new NitroSprite(effect.texture); effectSprite.alpha = selectedEffect.alpha; effectSprite.blendMode = effect.blendMode; diff --git a/src/nitro/communication/messages/outgoing/camera/RenderRoomMessageComposer.ts b/src/nitro/communication/messages/outgoing/camera/RenderRoomMessageComposer.ts index 4513527d..ae130f61 100644 --- a/src/nitro/communication/messages/outgoing/camera/RenderRoomMessageComposer.ts +++ b/src/nitro/communication/messages/outgoing/camera/RenderRoomMessageComposer.ts @@ -1,4 +1,4 @@ -import { RenderTexture } from 'pixi.js'; +import { RenderTexture } from '@pixi/core'; import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer'; import { TextureUtils } from '../../../../../room'; diff --git a/src/nitro/room/IGetImageListener.ts b/src/nitro/room/IGetImageListener.ts index 615f988b..ad2592ef 100644 --- a/src/nitro/room/IGetImageListener.ts +++ b/src/nitro/room/IGetImageListener.ts @@ -1,4 +1,4 @@ -import { RenderTexture } from 'pixi.js'; +import { RenderTexture } from '@pixi/core'; export interface IGetImageListener { diff --git a/src/nitro/room/IRoomEngine.ts b/src/nitro/room/IRoomEngine.ts index 9adf7b74..35d8946f 100644 --- a/src/nitro/room/IRoomEngine.ts +++ b/src/nitro/room/IRoomEngine.ts @@ -1,4 +1,6 @@ -import { DisplayObject, Point, Rectangle, RenderTexture } from 'pixi.js'; +import { RenderTexture } from '@pixi/core'; +import { DisplayObject } from '@pixi/display'; +import { Point, Rectangle } from '@pixi/math'; import { INitroManager } from '../../core/common/INitroManager'; import { IRoomObject } from '../../room'; import { IRoomManager } from '../../room/IRoomManager'; diff --git a/src/nitro/room/ImageResult.ts b/src/nitro/room/ImageResult.ts index 0a67c2bd..a2e0ab3c 100644 --- a/src/nitro/room/ImageResult.ts +++ b/src/nitro/room/ImageResult.ts @@ -1,4 +1,4 @@ -import { RenderTexture } from 'pixi.js'; +import { RenderTexture } from '@pixi/core'; import { TextureUtils } from '../../room/utils/TextureUtils'; export class ImageResult @@ -15,4 +15,4 @@ export class ImageResult return TextureUtils.generateImage(this.data); } -} \ No newline at end of file +} diff --git a/src/nitro/room/RoomContentLoader.ts b/src/nitro/room/RoomContentLoader.ts index 04dc6798..428edbc4 100644 --- a/src/nitro/room/RoomContentLoader.ts +++ b/src/nitro/room/RoomContentLoader.ts @@ -1,4 +1,6 @@ -import { BaseTexture, ILoaderResource, Loader, LoaderResource, Resource, Spritesheet, Texture } from 'pixi.js'; +import { BaseTexture, Resource, Texture } from '@pixi/core'; +import { Loader, LoaderResource } from '@pixi/loaders'; +import { Spritesheet } from '@pixi/spritesheet'; import { IAssetData } from '../../core/asset/interfaces'; import { NitroBundle } from '../../core/asset/NitroBundle'; import { INitroLogger } from '../../core/common/logger/INitroLogger'; @@ -492,7 +494,7 @@ export class RoomContentLoader implements IFurnitureDataListener const totalToDownload = assetUrls.length; let totalDownloaded = 0; - const onDownloaded = (loader: Loader, resource: ILoaderResource, flag: boolean) => + const onDownloaded = (loader: Loader, resource: LoaderResource, flag: boolean) => { if(loader) loader.destroy(); @@ -529,7 +531,7 @@ export class RoomContentLoader implements IFurnitureDataListener crossOrigin: 'anonymous', xhrType: url.endsWith('.nitro') ? LoaderResource.XHR_RESPONSE_TYPE.BUFFER : LoaderResource.XHR_RESPONSE_TYPE.JSON }) - .use((resource: ILoaderResource, next: Function) => + .use((resource: LoaderResource, next: Function) => { this.assetLoader(loader, resource, onDownloaded); @@ -541,7 +543,7 @@ export class RoomContentLoader implements IFurnitureDataListener return true; } - private assetLoader(loader: Loader, resource: ILoaderResource, onDownloaded: Function): void + private assetLoader(loader: Loader, resource: LoaderResource, onDownloaded: Function): void { if(!resource || resource.error) { diff --git a/src/nitro/room/RoomEngine.ts b/src/nitro/room/RoomEngine.ts index a54661a5..9d9425aa 100644 --- a/src/nitro/room/RoomEngine.ts +++ b/src/nitro/room/RoomEngine.ts @@ -1,4 +1,7 @@ -import { Container, DisplayObject, Matrix, Point, Rectangle, RenderTexture, Resource, Sprite, Texture } from 'pixi.js'; +import { RenderTexture, Resource, Texture } from '@pixi/core'; +import { Container, DisplayObject } from '@pixi/display'; +import { Matrix, Point, Rectangle } from '@pixi/math'; +import { NitroSprite } from '../../core'; import { IDisposable } from '../../core/common/disposable/IDisposable'; import { IUpdateReceiver } from '../../core/common/IUpdateReceiver'; import { NitroLogger } from '../../core/common/logger/NitroLogger'; @@ -589,7 +592,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato if(displayObject) { - const overlay = Sprite.from(Texture.EMPTY); + const overlay = new NitroSprite(Texture.EMPTY); overlay.name = RoomEngine.OVERLAY; overlay.interactive = false; @@ -2737,7 +2740,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato this._roomObjectEventHandler.cancelRoomObjectInsert(this._activeRoomId); } - private addOverlayIconSprite(k: Sprite, _arg_2: string, _arg_3: Texture, scale: number = 1): Sprite + private addOverlayIconSprite(k: NitroSprite, _arg_2: string, _arg_3: Texture, scale: number = 1): NitroSprite { if(!k || !_arg_3) return; @@ -2745,7 +2748,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato if(sprite) return null; - sprite = Sprite.from(_arg_3); + sprite = new NitroSprite(_arg_3); sprite.name = _arg_2; @@ -3305,22 +3308,32 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato this.removeOverlayIconSprite(sprite, RoomEngine.OBJECT_ICON_SPRITE); } - private getRenderingCanvasOverlay(k: IRoomRenderingCanvas): Sprite + private getRenderingCanvasOverlay(k: IRoomRenderingCanvas): NitroSprite { if(!k) return null; - const displayObject = k.master as Container; + const displayObject = (k.master as Container); if(!displayObject) return null; - const sprite = displayObject.getChildByName(RoomEngine.OVERLAY) as Sprite; + let index = (displayObject.children.length - 1); - if(!sprite) return null; + while(index >= 0) + { + const child = (displayObject.getChildAt(index) as NitroSprite); - return sprite; + if(child) + { + if(child.name === RoomEngine.OVERLAY) return child; + } + + index--; + } + + return null; } - private removeOverlayIconSprite(k: Sprite, _arg_2: string): boolean + private removeOverlayIconSprite(k: NitroSprite, _arg_2: string): boolean { if(!k) return false; @@ -3328,7 +3341,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato while(index >= 0) { - const child = k.getChildAt(index) as Sprite; + const child = (k.getChildAt(index) as NitroSprite); if(child) { @@ -3338,7 +3351,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato if(child.children.length) { - const firstChild = child.getChildAt(0) as Sprite; + const firstChild = (child.getChildAt(0) as NitroSprite); firstChild.parent.removeChild(firstChild); @@ -3355,7 +3368,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato return false; } - private getOverlayIconSprite(k: Sprite, _arg_2: string): Sprite + private getOverlayIconSprite(k: NitroSprite, _arg_2: string): NitroSprite { if(!k) return null; @@ -3363,7 +3376,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato while(index >= 0) { - const child = k.getChildAt(index) as Sprite; + const child = (k.getChildAt(index) as NitroSprite); if(child) {