mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2025-01-31 11:12:35 +01:00
Updates
This commit is contained in:
parent
4d25b57bfc
commit
b46fe6fcd6
@ -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);
|
||||
}
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Resource, Texture } from 'pixi.js';
|
||||
import { Resource, Texture } from '@pixi/core';
|
||||
|
||||
export class BadgeInfo
|
||||
{
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
@ -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
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { SCALE_MODES } from 'pixi.js';
|
||||
import { SCALE_MODES } from '@pixi/constants';
|
||||
|
||||
export const Constant = {
|
||||
maxTextures: 16,
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Point } from 'pixi.js';
|
||||
import { Point } from '@pixi/math';
|
||||
|
||||
export interface IPlaneDrawingData
|
||||
{
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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[];
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Point } from 'pixi.js';
|
||||
import { Point } from '@pixi/math';
|
||||
import { IVector3D } from './IVector3D';
|
||||
|
||||
export interface IRoomGeometry
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Point } from 'pixi.js';
|
||||
import { Point } from '@pixi/math';
|
||||
|
||||
export class PointMath
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { BLEND_MODES } from 'pixi.js';
|
||||
import { BLEND_MODES } from '@pixi/constants';
|
||||
|
||||
export class SpriteUtilities
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user