This commit is contained in:
Bill 2021-08-02 23:51:46 -04:00
parent 4d25b57bfc
commit b46fe6fcd6
32 changed files with 88 additions and 54 deletions

View File

@ -1,4 +1,8 @@
import { Container, DisplayObject, Point, Rectangle, RenderTexture, Sprite, Texture } from 'pixi.js';
import { RenderTexture, Texture } from '@pixi/core';
import { Container, DisplayObject } from '@pixi/display';
import { Point, Rectangle } from '@pixi/math';
import { Sprite } from '@pixi/sprite';
import { NitroSprite } from '../../../core';
import { IRoomObjectController } from '../../../room/object/IRoomObjectController';
import { IRoomRenderingCanvas } from '../../../room/renderer/IRoomRenderingCanvas';
import { IVector3D } from '../../../room/utils/IVector3D';
@ -455,7 +459,7 @@ export class RoomPreviewer
if(!backgroundSprite)
{
backgroundSprite = new Sprite(Texture.WHITE);
backgroundSprite = new NitroSprite(Texture.WHITE);
displayObject.addChildAt(backgroundSprite, 0);
}

View File

@ -1,4 +1,4 @@
import { Point, Rectangle } from 'pixi.js';
import { Point, Rectangle } from '@pixi/math';
import { RoomObjectSpriteData } from '../../../room/data/RoomObjectSpriteData';
import { IPlaneDrawingData } from '../../../room/object/visualization/IPlaneDrawingData';
import { IPlaneVisualization } from '../../../room/object/visualization/IPlaneVisualization';

View File

@ -1,4 +1,4 @@
import { Resource, Texture } from 'pixi.js';
import { Resource, Texture } from '@pixi/core';
import { IAssetManager } from '../../core/asset/IAssetManager';
import { IEventDispatcher } from '../../core/events/IEventDispatcher';
import { Nitro } from '../Nitro';

View File

@ -1,4 +1,4 @@
import { Resource, Texture } from 'pixi.js';
import { Resource, Texture } from '@pixi/core';
export class BadgeInfo
{

View File

@ -1,4 +1,4 @@
import { Resource, Texture } from 'pixi.js';
import { Resource, Texture } from '@pixi/core';
import { INitroManager } from '../../core/common/INitroManager';
import { INitroCommunicationManager } from '../communication/INitroCommunicationManager';
import { IFurnitureData } from './furniture/IFurnitureData';

View File

@ -1,4 +1,4 @@
import { Resource, Texture } from 'pixi.js';
import { Resource, Texture } from '@pixi/core';
import { NitroManager } from '../../core/common/NitroManager';
import { IMessageComposer } from '../../core/communication/messages/IMessageComposer';
import { NitroEvent } from '../../core/events/NitroEvent';

View File

@ -1,4 +1,4 @@
import { Resource, Texture } from 'pixi.js';
import { Resource, Texture } from '@pixi/core';
import { NitroEvent } from '../../../core/events/NitroEvent';
export class BadgeImageReadyEvent extends NitroEvent

View File

@ -1,9 +1,8 @@
import { utils } from 'pixi.js';
import { isWebGLSupported } from '@pixi/utils';
export class WebGL
{
public static isWebGLAvailable(): boolean
{
return utils.isWebGLSupported();
return isWebGLSupported();
}
}

View File

@ -1,10 +1,12 @@
import { Container, Matrix, Renderer, Resource, Texture } from 'pixi.js';
import { Renderer, Resource, Texture } from '@pixi/core';
import { Container } from '@pixi/display';
import { Matrix } from '@pixi/math';
import { Constant } from './Constant';
import { RectTileLayer } from './RectTileLayer';
export class CompositeRectTileLayer extends Container
{
constructor(zIndex?: number, bitmaps?: Array<Texture>, texPerChild?: number, alpha?: number)
constructor(zIndex?: number, bitmaps?: Texture<Resource>[], texPerChild?: number, alpha?: number)
{
super();
// eslint-disable-next-line prefer-spread,prefer-rest-params

View File

@ -1,4 +1,4 @@
import { SCALE_MODES } from 'pixi.js';
import { SCALE_MODES } from '@pixi/constants';
export const Constant = {
maxTextures: 16,

View File

@ -1,4 +1,6 @@
import { BaseTexture, GLTexture, IAutoDetectOptions, Renderer, Resource, Sprite, Texture } from 'pixi.js';
import { BaseTexture, GLTexture, IAutoDetectOptions, Renderer, Resource, Texture } from '@pixi/core';
import { Sprite } from '@pixi/sprite';
import { NitroSprite } from '../../../core';
export interface IMultiTextureOptions {
boundCountPerBuffer: number;
@ -18,7 +20,7 @@ export class MultiTextureResource extends Resource
this.boundSize = options.boundSize;
for(let j = 0; j < options.boundCountPerBuffer; j++)
{
const spr = new Sprite();
const spr = new NitroSprite();
spr.position.x = options.boundSize * (j & 1);
spr.position.y = options.boundSize * (j >> 1);
bounds.push(spr);

View File

@ -1,4 +1,7 @@
import { Bounds, Container, DRAW_MODES, groupD8, Matrix, Rectangle, Renderer, Resource, Texture } from 'pixi.js';
import { DRAW_MODES } from '@pixi/constants';
import { Renderer, Resource, Texture } from '@pixi/core';
import { Bounds, Container } from '@pixi/display';
import { groupD8, Matrix, Rectangle } from '@pixi/math';
import { Constant } from './Constant';
import { RectTileGeom } from './RectTileShader';
import { TileRenderer } from './TileRenderer';
@ -24,7 +27,7 @@ export const POINT_STRUCT_SIZE_TWO = (Object.keys(PointStruct).length / 2);
//export const POINT_STRUCT_SIZE = 12;
export class RectTileLayer extends Container
{
constructor(zIndex: number, texture: Texture<Resource> | Array<Texture>)
constructor(zIndex: number, texture: Texture<Resource> | Texture<Resource>[])
{
super();
this.initialize(zIndex, texture);

View File

@ -1,4 +1,5 @@
import { Buffer, Geometry, Matrix, Program, Shader } from 'pixi.js';
import { Buffer, Geometry, Program, Shader } from '@pixi/core';
import { Matrix } from '@pixi/math';
import * as shaderGenerator from './shaderGenerator';
const rectShaderFrag = `
@ -22,6 +23,7 @@ void main(void){
gl_FragColor = (color * vAlpha) + (gl_FragColor * (1.0 - vAlpha));
}
`;
const rectShaderVert = `
attribute vec2 aVertexPosition;
attribute vec2 aTextureCoord;

View File

@ -1,5 +1,6 @@
import { WRAP_MODES } from '@pixi/constants';
import { Buffer, ObjectRenderer, Renderer, Resource, Texture } from '@pixi/core';
import { createIndicesForQuads } from '@pixi/utils';
import { BaseTexture, Buffer, ObjectRenderer, Renderer, Texture, WRAP_MODES } from 'pixi.js';
import { Constant } from './Constant';
import { MultiTextureResource } from './MultiTextureResource';
import type { TilemapShader } from './RectTileShader';
@ -49,7 +50,7 @@ export class TileRenderer extends ObjectRenderer
}
}
bindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array<Texture>)
bindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Texture<Resource>[])
{
const samplerSize: Array<number> = (shader as any).uniforms.uSamplerSize;
this.texLoc.length = 0;

View File

@ -1,4 +1,4 @@
import { Point } from 'pixi.js';
import { Point } from '@pixi/math';
export interface IPlaneDrawingData
{

View File

@ -1,4 +1,5 @@
import { Container, Filter, Resource, Texture } from 'pixi.js';
import { Filter, Resource, Texture } from '@pixi/core';
import { Container } from '@pixi/display';
export interface IRoomObjectSprite
{

View File

@ -1,4 +1,5 @@
import { Rectangle, RenderTexture } from 'pixi.js';
import { RenderTexture } from '@pixi/core';
import { Rectangle } from '@pixi/math';
import { IRoomGeometry } from '../../utils/IRoomGeometry';
import { IRoomObject } from '../IRoomObject';
import { IObjectVisualizationData } from './IRoomObjectVisualizationData';

View File

@ -1,4 +1,6 @@
import { BLEND_MODES, Container, Filter, Resource, Texture } from 'pixi.js';
import { BLEND_MODES } from '@pixi/constants';
import { Filter, Resource, Texture } from '@pixi/core';
import { Container } from '@pixi/display';
import { AlphaTolerance } from '../enum/AlphaTolerance';
import { RoomObjectSpriteType } from '../enum/RoomObjectSpriteType';
import { IRoomObjectSprite } from './IRoomObjectSprite';

View File

@ -1,4 +1,6 @@
import { Container, Point, Rectangle, RenderTexture, Sprite } from 'pixi.js';
import { RenderTexture } from '@pixi/core';
import { Point, Rectangle } from '@pixi/math';
import { NitroContainer, NitroSprite } from '../../../core';
import { RoomObjectSpriteData } from '../../data/RoomObjectSpriteData';
import { IRoomGeometry } from '../../utils/IRoomGeometry';
import { TextureUtils } from '../../utils/TextureUtils';
@ -153,7 +155,7 @@ export class RoomObjectSpriteVisualization implements IRoomObjectSpriteVisualiza
return b.relativeDepth - a.relativeDepth;
});
const container = new Container();
const container = new NitroContainer();
index = 0;
@ -164,7 +166,7 @@ export class RoomObjectSpriteVisualization implements IRoomObjectSpriteVisualiza
if(texture)
{
const sprite = Sprite.from(texture);
const sprite = new NitroSprite(texture);
sprite.alpha = (objectSprite.alpha / 255);
sprite.tint = objectSprite.color;

View File

@ -1,4 +1,5 @@
import { Rectangle, Resource, Texture } from 'pixi.js';
import { Resource, Texture } from '@pixi/core';
import { Rectangle } from '@pixi/math';
import { IGraphicAsset } from './IGraphicAsset';
export class GraphicAsset implements IGraphicAsset

View File

@ -1,5 +1,6 @@
import { Resource, Texture } from '@pixi/core';
import { Spritesheet } from '@pixi/spritesheet';
import { Dict } from '@pixi/utils';
import { Resource, Spritesheet, Texture } from 'pixi.js';
import { AssetManager } from '../../../../core/asset/AssetManager';
import { IAsset, IAssetData, IAssetPalette } from '../../../../core/asset/interfaces';
import { Nitro } from '../../../../nitro/Nitro';
@ -17,7 +18,7 @@ export class GraphicAssetCollection implements IGraphicAssetCollection
private _name: string;
private _data: IAssetData;
private _textures: Map<string, Texture>;
private _textures: Map<string, Texture<Resource>>;
private _assets: Map<string, GraphicAsset>;
private _palettes: Map<string, GraphicAssetPalette>;
private _paletteAssetNames: string[];

View File

@ -1,4 +1,5 @@
import { Resource, Sprite, Texture } from 'pixi.js';
import { Resource, Texture } from '@pixi/core';
import { NitroSprite } from '../../../../core';
import { TextureUtils } from '../../../utils';
export class GraphicAssetPalette
@ -24,7 +25,7 @@ export class GraphicAssetPalette
public applyPalette(texture: Texture<Resource>): Texture<Resource>
{
const sprite = Sprite.from(texture);
const sprite = new NitroSprite(texture);
const textureCanvas = TextureUtils.generateCanvas(sprite);
const textureCtx = textureCanvas.getContext('2d');
const textureImageData = textureCtx.getImageData(0, 0, textureCanvas.width, textureCanvas.height);

View File

@ -1,4 +1,5 @@
import { Rectangle, Resource, Texture } from 'pixi.js';
import { Resource, Texture } from '@pixi/core';
import { Rectangle } from '@pixi/math';
export interface IGraphicAsset
{

View File

@ -1,4 +1,4 @@
import { Resource, Texture } from 'pixi.js';
import { Resource, Texture } from '@pixi/core';
import { IAssetData } from '../../../../core/asset/interfaces';
import { GraphicAssetPalette } from './GraphicAssetPalette';
import { IGraphicAsset } from './IGraphicAsset';

View File

@ -1,4 +1,6 @@
import { DisplayObject, Point, RenderTexture } from 'pixi.js';
import { RenderTexture } from '@pixi/core';
import { DisplayObject } from '@pixi/display';
import { Point } from '@pixi/math';
import { RoomObjectSpriteData } from '../data/RoomObjectSpriteData';
import { IRoomGeometry } from '../utils/IRoomGeometry';
import { IRoomCanvasMouseListener } from './IRoomCanvasMouseListener';

View File

@ -1,4 +1,9 @@
import { Container, DisplayObject, Graphics, Matrix, Point, Rectangle, RenderTexture, Sprite } from 'pixi.js';
import { RenderTexture } from '@pixi/core';
import { Container, DisplayObject } from '@pixi/display';
import { Graphics } from '@pixi/graphics';
import { Matrix, Point, Rectangle } from '@pixi/math';
import { Sprite } from '@pixi/sprite';
import { NitroContainer, NitroSprite } from '../../core';
import { Nitro } from '../../nitro/Nitro';
import { MouseEventType } from '../../nitro/ui/MouseEventType';
import { RoomObjectSpriteData } from '../data/RoomObjectSpriteData';
@ -124,16 +129,14 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
{
if(!this._master)
{
this._master = new Sprite();
this._master = new NitroSprite();
this._master.interactiveChildren = false;
}
if(!this._display)
{
const display = new Container();
display.name = 'canvas';
const display = new NitroContainer();
this._master.addChild(display);
@ -221,8 +224,6 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
.drawRect(0, 0, width, height)
.endFill();
this._mask.name = 'mask';
if(this._master)
{
this._master.addChild(this._mask);

View File

@ -1,4 +1,8 @@
import { BaseTexture, BLEND_MODES, Point, RenderTexture, Resource, Sprite, Texture } from 'pixi.js';
import { BLEND_MODES } from '@pixi/constants';
import { BaseTexture, RenderTexture, Resource, Texture } from '@pixi/core';
import { Point } from '@pixi/math';
import { Sprite } from '@pixi/sprite';
import { NitroSprite } from '../../../core';
import { TextureUtils } from '../../utils';
export class ExtendedSprite extends Sprite
@ -13,6 +17,8 @@ export class ExtendedSprite extends Sprite
private _pairedSpriteId: number;
private _pairedSpriteUpdateCounter: number;
public name: string;
constructor(texture: Texture<Resource> = null)
{
super(texture);
@ -93,7 +99,7 @@ export class ExtendedSprite extends Sprite
//@ts-ignore
if(!texture.getLocalBounds)
{
const tempSprite = Sprite.from(texture);
const tempSprite = new NitroSprite(texture);
canvas = TextureUtils.generateCanvas(tempSprite);

View File

@ -1,4 +1,4 @@
import { Point } from 'pixi.js';
import { Point } from '@pixi/math';
import { IVector3D } from './IVector3D';
export interface IRoomGeometry

View File

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

View File

@ -1,4 +1,6 @@
import { Graphics, Matrix, Resource, Texture } from 'pixi.js';
import { Resource, Texture } from '@pixi/core';
import { Graphics } from '@pixi/graphics';
import { Matrix } from '@pixi/math';
import { TextureUtils } from './TextureUtils';
export class Rasterizer

View File

@ -1,4 +1,4 @@
import { Point } from 'pixi.js';
import { Point } from '@pixi/math';
import { IRoomGeometry } from './IRoomGeometry';
import { IVector3D } from './IVector3D';
import { Vector3d } from './Vector3d';

View File

@ -1,4 +1,4 @@
import { BLEND_MODES } from 'pixi.js';
import { BLEND_MODES } from '@pixi/constants';
export class SpriteUtilities
{