This commit is contained in:
Bill 2021-08-02 23:50:15 -04:00
parent 4e4c4e4ce6
commit 4be404e96d
17 changed files with 81 additions and 53 deletions

View File

@ -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 { AdvancedMap } from '../../core/utils/AdvancedMap';
import { IGraphicAsset } from '../../room/object/visualization/utils/IGraphicAsset'; import { IGraphicAsset } from '../../room/object/visualization/utils/IGraphicAsset';
import { TextureUtils } from '../../room/utils/TextureUtils'; import { TextureUtils } from '../../room/utils/TextureUtils';
@ -335,7 +340,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
this._image = null; this._image = null;
const container = new Container(); const container = new NitroContainer();
let isCachable = true; let isCachable = true;
let partCount = (_local_6.length - 1); let partCount = (_local_6.length - 1);
@ -370,7 +375,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
point.x += avatarCanvas.regPoint.x; point.x += avatarCanvas.regPoint.x;
point.y += avatarCanvas.regPoint.y; point.y += avatarCanvas.regPoint.y;
const partContainer = new Container(); const partContainer = new NitroContainer();
partContainer.addChild(partCacheContainer); partContainer.addChild(partCacheContainer);
@ -452,8 +457,8 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
if(!avatarCanvas) return null; if(!avatarCanvas) return null;
const setTypes = this.getBodyParts(setType, this._mainAction.definition.geometryType, this._mainDirection); const setTypes = this.getBodyParts(setType, this._mainAction.definition.geometryType, this._mainDirection);
const container = new Sprite(); const container = new NitroSprite();
const sprite = new Sprite(Texture.EMPTY); const sprite = new NitroSprite(Texture.EMPTY);
sprite.width = avatarCanvas.width; sprite.width = avatarCanvas.width;
sprite.height = avatarCanvas.height; sprite.height = avatarCanvas.height;
@ -490,7 +495,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
point.x += avatarCanvas.regPoint.x; point.x += avatarCanvas.regPoint.x;
point.y += avatarCanvas.regPoint.y; point.y += avatarCanvas.regPoint.y;
const partContainer = new Container(); const partContainer = new NitroContainer();
partContainer.addChild(partCacheContainer); partContainer.addChild(partCacheContainer);
@ -517,8 +522,8 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
if(!avatarCanvas) return null; if(!avatarCanvas) return null;
const setTypes = this.getBodyParts(setType, this._mainAction.definition.geometryType, this._mainDirection); const setTypes = this.getBodyParts(setType, this._mainAction.definition.geometryType, this._mainDirection);
const container = new Container(); const container = new NitroContainer();
const sprite = new Sprite(Texture.EMPTY); const sprite = new NitroSprite(Texture.EMPTY);
sprite.width = avatarCanvas.width; sprite.width = avatarCanvas.width;
sprite.height = avatarCanvas.height; sprite.height = avatarCanvas.height;
@ -555,7 +560,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
point.x += avatarCanvas.regPoint.x; point.x += avatarCanvas.regPoint.x;
point.y += avatarCanvas.regPoint.y; point.y += avatarCanvas.regPoint.y;
const partContainer = new Container(); const partContainer = new NitroContainer();
partContainer.addChild(partCacheContainer); partContainer.addChild(partCacheContainer);
@ -1014,7 +1019,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
break; 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]; 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];

View File

@ -1,4 +1,5 @@
import { Container, Point } from 'pixi.js'; import { Container } from '@pixi/display';
import { Point } from '@pixi/math';
export class AvatarImageBodyPartContainer export class AvatarImageBodyPartContainer
{ {

View File

@ -1,4 +1,4 @@
import { Point } from 'pixi.js'; import { Point } from '@pixi/math';
import { IAssetManager } from '../../core/asset/IAssetManager'; import { IAssetManager } from '../../core/asset/IAssetManager';
import { IAssetAnimation } from '../../core/asset/interfaces'; import { IAssetAnimation } from '../../core/asset/interfaces';
import { EventDispatcher } from '../../core/events/EventDispatcher'; import { EventDispatcher } from '../../core/events/EventDispatcher';

View File

@ -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 { IDisposable } from '../../core/common/disposable/IDisposable';
import { IGraphicAsset } from '../../room/object/visualization/utils/IGraphicAsset'; import { IGraphicAsset } from '../../room/object/visualization/utils/IGraphicAsset';
import { IAnimationLayerData } from './animation/IAnimationLayerData'; import { IAnimationLayerData } from './animation/IAnimationLayerData';

View File

@ -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 { RoomObjectSpriteData } from '../../../room/data/RoomObjectSpriteData';
import { Nitro } from '../../Nitro'; import { Nitro } from '../../Nitro';
import { IActiveActionData } from '../actions/IActiveActionData'; import { IActiveActionData } from '../actions/IActiveActionData';
@ -478,9 +480,9 @@ export class AvatarImageCache
for(const data of k) data && bounds.enlarge(data.offsetRect); for(const data of k) data && bounds.enlarge(data.offsetRect);
const point = new Point(-(bounds.x), -(bounds.y)); 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.width = bounds.width;
sprite.height = bounds.height; sprite.height = bounds.height;
@ -514,7 +516,7 @@ export class AvatarImageCache
this._matrix.ty = (regPoint.y - data.rect.y); this._matrix.ty = (regPoint.y - data.rect.y);
} }
const sprite = new Sprite(texture); const sprite = new NitroSprite(texture);
sprite.tint = color; sprite.tint = color;
sprite.transform.setFromMatrix(this._matrix); sprite.transform.setFromMatrix(this._matrix);

View File

@ -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 export class ImageData
{ {

View File

@ -1,4 +1,4 @@
import { Point } from 'pixi.js'; import { Point } from '@pixi/math';
import { AvatarScaleType } from '../enum/AvatarScaleType'; import { AvatarScaleType } from '../enum/AvatarScaleType';
export class AvatarCanvas export class AvatarCanvas

View File

@ -1,4 +1,4 @@
import { Point } from 'pixi.js'; import { Point } from '@pixi/math';
import { AnimationActionPart } from './AnimationActionPart'; import { AnimationActionPart } from './AnimationActionPart';
export class AnimationAction export class AnimationAction

View File

@ -1,5 +1,5 @@
import { Resource, Texture } from '@pixi/core';
import { ColorMatrix } from '@pixi/filter-color-matrix'; import { ColorMatrix } from '@pixi/filter-color-matrix';
import { Resource, Texture } from 'pixi.js';
export interface IRoomCameraWidgetEffect export interface IRoomCameraWidgetEffect
{ {

View File

@ -1,5 +1,5 @@
import { Resource, Texture } from '@pixi/core';
import { ColorMatrix } from '@pixi/filter-color-matrix'; import { ColorMatrix } from '@pixi/filter-color-matrix';
import { Resource, Texture } from 'pixi.js';
import { IRoomCameraWidgetEffect } from './IRoomCameraWidgetEffect'; import { IRoomCameraWidgetEffect } from './IRoomCameraWidgetEffect';
export class RoomCameraWidgetEffect implements IRoomCameraWidgetEffect export class RoomCameraWidgetEffect implements IRoomCameraWidgetEffect

View File

@ -1,6 +1,6 @@
import { ColorMatrix } from '@pixi/filter-color-matrix'; import { Texture } from '@pixi/core';
import { Container, filters, Sprite, Texture } from 'pixi.js'; import { ColorMatrix, ColorMatrixFilter } from '@pixi/filter-color-matrix';
import { EventDispatcher, IEventDispatcher } from '../../core'; import { EventDispatcher, IEventDispatcher, NitroContainer, NitroSprite } from '../../core';
import { TextureUtils } from '../../room'; import { TextureUtils } from '../../room';
import { Nitro } from '../Nitro'; import { Nitro } from '../Nitro';
import { RoomCameraWidgetManagerEvent } from './events/RoomCameraWidgetManagerEvent'; import { RoomCameraWidgetManagerEvent } from './events/RoomCameraWidgetManagerEvent';
@ -55,9 +55,9 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager
public applyEffects(image: HTMLImageElement, selectedEffects: IRoomCameraWidgetSelectedEffect[], isZoomed: boolean): HTMLImageElement public applyEffects(image: HTMLImageElement, selectedEffects: IRoomCameraWidgetSelectedEffect[], isZoomed: boolean): HTMLImageElement
{ {
const container = new Container(); const container = new NitroContainer();
const texture = Texture.from(image); const texture = Texture.from(image);
const sprite = new Sprite(texture); const sprite = new NitroSprite(texture);
container.addChild(sprite); container.addChild(sprite);
@ -69,7 +69,7 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager
if(effect.colorMatrix) if(effect.colorMatrix)
{ {
const filter = new filters.ColorMatrixFilter(); const filter = new ColorMatrixFilter();
filter.matrix = effect.colorMatrix; filter.matrix = effect.colorMatrix;
filter.alpha = selectedEffect.alpha; filter.alpha = selectedEffect.alpha;
@ -80,7 +80,7 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager
} }
else else
{ {
const effectSprite = new Sprite(effect.texture); const effectSprite = new NitroSprite(effect.texture);
effectSprite.alpha = selectedEffect.alpha; effectSprite.alpha = selectedEffect.alpha;
effectSprite.blendMode = effect.blendMode; effectSprite.blendMode = effect.blendMode;

View File

@ -1,4 +1,4 @@
import { RenderTexture } from 'pixi.js'; import { RenderTexture } from '@pixi/core';
import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer'; import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer';
import { TextureUtils } from '../../../../../room'; import { TextureUtils } from '../../../../../room';

View File

@ -1,4 +1,4 @@
import { RenderTexture } from 'pixi.js'; import { RenderTexture } from '@pixi/core';
export interface IGetImageListener export interface IGetImageListener
{ {

View File

@ -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 { INitroManager } from '../../core/common/INitroManager';
import { IRoomObject } from '../../room'; import { IRoomObject } from '../../room';
import { IRoomManager } from '../../room/IRoomManager'; import { IRoomManager } from '../../room/IRoomManager';

View File

@ -1,4 +1,4 @@
import { RenderTexture } from 'pixi.js'; import { RenderTexture } from '@pixi/core';
import { TextureUtils } from '../../room/utils/TextureUtils'; import { TextureUtils } from '../../room/utils/TextureUtils';
export class ImageResult export class ImageResult

View File

@ -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 { IAssetData } from '../../core/asset/interfaces';
import { NitroBundle } from '../../core/asset/NitroBundle'; import { NitroBundle } from '../../core/asset/NitroBundle';
import { INitroLogger } from '../../core/common/logger/INitroLogger'; import { INitroLogger } from '../../core/common/logger/INitroLogger';
@ -492,7 +494,7 @@ export class RoomContentLoader implements IFurnitureDataListener
const totalToDownload = assetUrls.length; const totalToDownload = assetUrls.length;
let totalDownloaded = 0; let totalDownloaded = 0;
const onDownloaded = (loader: Loader, resource: ILoaderResource, flag: boolean) => const onDownloaded = (loader: Loader, resource: LoaderResource, flag: boolean) =>
{ {
if(loader) loader.destroy(); if(loader) loader.destroy();
@ -529,7 +531,7 @@ export class RoomContentLoader implements IFurnitureDataListener
crossOrigin: 'anonymous', crossOrigin: 'anonymous',
xhrType: url.endsWith('.nitro') ? LoaderResource.XHR_RESPONSE_TYPE.BUFFER : LoaderResource.XHR_RESPONSE_TYPE.JSON 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); this.assetLoader(loader, resource, onDownloaded);
@ -541,7 +543,7 @@ export class RoomContentLoader implements IFurnitureDataListener
return true; return true;
} }
private assetLoader(loader: Loader, resource: ILoaderResource, onDownloaded: Function): void private assetLoader(loader: Loader, resource: LoaderResource, onDownloaded: Function): void
{ {
if(!resource || resource.error) if(!resource || resource.error)
{ {

View File

@ -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 { IDisposable } from '../../core/common/disposable/IDisposable';
import { IUpdateReceiver } from '../../core/common/IUpdateReceiver'; import { IUpdateReceiver } from '../../core/common/IUpdateReceiver';
import { NitroLogger } from '../../core/common/logger/NitroLogger'; import { NitroLogger } from '../../core/common/logger/NitroLogger';
@ -589,7 +592,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
if(displayObject) if(displayObject)
{ {
const overlay = Sprite.from(Texture.EMPTY); const overlay = new NitroSprite(Texture.EMPTY);
overlay.name = RoomEngine.OVERLAY; overlay.name = RoomEngine.OVERLAY;
overlay.interactive = false; overlay.interactive = false;
@ -2737,7 +2740,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
this._roomObjectEventHandler.cancelRoomObjectInsert(this._activeRoomId); this._roomObjectEventHandler.cancelRoomObjectInsert(this._activeRoomId);
} }
private addOverlayIconSprite(k: Sprite, _arg_2: string, _arg_3: Texture<Resource>, scale: number = 1): Sprite private addOverlayIconSprite(k: NitroSprite, _arg_2: string, _arg_3: Texture<Resource>, scale: number = 1): NitroSprite
{ {
if(!k || !_arg_3) return; if(!k || !_arg_3) return;
@ -2745,7 +2748,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
if(sprite) return null; if(sprite) return null;
sprite = Sprite.from(_arg_3); sprite = new NitroSprite(_arg_3);
sprite.name = _arg_2; sprite.name = _arg_2;
@ -3305,22 +3308,32 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
this.removeOverlayIconSprite(sprite, RoomEngine.OBJECT_ICON_SPRITE); this.removeOverlayIconSprite(sprite, RoomEngine.OBJECT_ICON_SPRITE);
} }
private getRenderingCanvasOverlay(k: IRoomRenderingCanvas): Sprite private getRenderingCanvasOverlay(k: IRoomRenderingCanvas): NitroSprite
{ {
if(!k) return null; if(!k) return null;
const displayObject = k.master as Container; const displayObject = (k.master as Container);
if(!displayObject) return null; 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;
} }
private removeOverlayIconSprite(k: Sprite, _arg_2: string): boolean index--;
}
return null;
}
private removeOverlayIconSprite(k: NitroSprite, _arg_2: string): boolean
{ {
if(!k) return false; if(!k) return false;
@ -3328,7 +3341,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
while(index >= 0) while(index >= 0)
{ {
const child = k.getChildAt(index) as Sprite; const child = (k.getChildAt(index) as NitroSprite);
if(child) if(child)
{ {
@ -3338,7 +3351,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
if(child.children.length) if(child.children.length)
{ {
const firstChild = child.getChildAt(0) as Sprite; const firstChild = (child.getChildAt(0) as NitroSprite);
firstChild.parent.removeChild(firstChild); firstChild.parent.removeChild(firstChild);
@ -3355,7 +3368,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
return false; return false;
} }
private getOverlayIconSprite(k: Sprite, _arg_2: string): Sprite private getOverlayIconSprite(k: NitroSprite, _arg_2: string): NitroSprite
{ {
if(!k) return null; if(!k) return null;
@ -3363,7 +3376,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
while(index >= 0) while(index >= 0)
{ {
const child = k.getChildAt(index) as Sprite; const child = (k.getChildAt(index) as NitroSprite);
if(child) if(child)
{ {