mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-11-26 17:30:52 +01:00
Updates
This commit is contained in:
parent
4e4c4e4ce6
commit
4be404e96d
@ -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];
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { Container, Point } from 'pixi.js';
|
||||
import { Container } from '@pixi/display';
|
||||
import { Point } from '@pixi/math';
|
||||
|
||||
export class AvatarImageBodyPartContainer
|
||||
{
|
||||
|
@ -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';
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
10
src/nitro/avatar/cache/AvatarImageCache.ts
vendored
10
src/nitro/avatar/cache/AvatarImageCache.ts
vendored
@ -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);
|
||||
|
4
src/nitro/avatar/cache/ImageData.ts
vendored
4
src/nitro/avatar/cache/ImageData.ts
vendored
@ -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
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Point } from 'pixi.js';
|
||||
import { Point } from '@pixi/math';
|
||||
import { AvatarScaleType } from '../enum/AvatarScaleType';
|
||||
|
||||
export class AvatarCanvas
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Point } from 'pixi.js';
|
||||
import { Point } from '@pixi/math';
|
||||
import { AnimationActionPart } from './AnimationActionPart';
|
||||
|
||||
export class AnimationAction
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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';
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { RenderTexture } from 'pixi.js';
|
||||
import { RenderTexture } from '@pixi/core';
|
||||
|
||||
export interface IGetImageListener
|
||||
{
|
||||
|
@ -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';
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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<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;
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user