From 3c9b03d7a41cc2351c7f53cd00d37b8397989df0 Mon Sep 17 00:00:00 2001 From: Shukant Pal Date: Thu, 13 Aug 2020 22:21:23 -0400 Subject: [PATCH 1/8] Move to rollup, add api-extractor. Use import/export & import from correct packages --- .gitignore | 3 + api-extractor.json | 44 + dist/pixi-tilemap.d.ts | 164 --- dist/pixi-tilemap.js | 1825 +++++++++++++++--------------- dist/pixi-tilemap.js.map | 2 +- dist/pixi-tilemap.umd.js | 970 ++++++++++++++++ dist/pixi-tilemap.umd.js.map | 1 + dist/pixi-tilemap.umd.min.js | 25 + dist/pixi-tilemap.umd.min.js.map | 1 + index.d.ts | 201 ++++ lib/pixi-tilemap.es.js | 955 ++++++++++++++++ lib/pixi-tilemap.es.js.map | 1 + package-lock.json | 1784 ++++++++++++++++++++++++++++- package.json | 20 +- rollup.config.js | 110 ++ src/CanvasTileRenderer.ts | 28 +- src/CompositeRectTileLayer.ts | 379 +++---- src/Constant.ts | 22 +- src/GraphicsLayer.ts | 56 +- src/MultiTextureResource.ts | 179 +-- src/RectTileLayer.ts | 639 +++++------ src/RectTileShader.ts | 97 +- src/TileRenderer.ts | 242 ++-- src/ZLayer.ts | 152 +-- src/exporter.ts | 5 +- src/index.ts | 35 + src/shaderGenerator.ts | 77 +- src/types.d.ts | 51 + tsconfig.compile.json | 20 + tsconfig.json | 17 +- 30 files changed, 6079 insertions(+), 2026 deletions(-) create mode 100644 api-extractor.json delete mode 100644 dist/pixi-tilemap.d.ts create mode 100644 dist/pixi-tilemap.umd.js create mode 100644 dist/pixi-tilemap.umd.js.map create mode 100644 dist/pixi-tilemap.umd.min.js create mode 100644 dist/pixi-tilemap.umd.min.js.map create mode 100644 index.d.ts create mode 100644 lib/pixi-tilemap.es.js create mode 100644 lib/pixi-tilemap.es.js.map create mode 100644 rollup.config.js create mode 100644 src/index.ts create mode 100644 src/types.d.ts create mode 100644 tsconfig.compile.json diff --git a/.gitignore b/.gitignore index 72a72d7a..86de0523 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,6 @@ docs/ # jetBrains IDE ignores .idea + +# tsc compile +compile \ No newline at end of file diff --git a/api-extractor.json b/api-extractor.json new file mode 100644 index 00000000..86c3cdda --- /dev/null +++ b/api-extractor.json @@ -0,0 +1,44 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + "projectFolder": ".", + "mainEntryPointFilePath": "/compile/index.d.ts", + "bundledPackages": [], + "compiler": { + "tsconfigFilePath": "/tsconfig.compile.json", + "overrideTsconfig": { + "compilerOptions": { + "outDir": "compile" + } + } + }, + "apiReport": { + "enabled": false + }, + "docModel": { + "enabled": false + }, + "dtsRollup": { + "enabled": true, + "untrimmedFilePath": "/index.d.ts" + }, + "tsdocMetadata": { + "enabled": false + }, + "messages": { + "compilerMessageReporting": { + "default": { + "logLevel": "warning" + } + }, + "extractorMessageReporting": { + "default": { + "logLevel": "warning" + } + }, + "tsdocMessageReporting": { + "default": { + "logLevel": "warning" + } + } + } +} \ No newline at end of file diff --git a/dist/pixi-tilemap.d.ts b/dist/pixi-tilemap.d.ts deleted file mode 100644 index e72891f6..00000000 --- a/dist/pixi-tilemap.d.ts +++ /dev/null @@ -1,164 +0,0 @@ -declare module PIXI.tilemap { - class CanvasTileRenderer { - renderer: any; - tileAnim: number[]; - dontUseTransform: boolean; - constructor(renderer: any); - } -} -declare module PIXI.tilemap { - class CompositeRectTileLayer extends PIXI.Container { - constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number); - updateTransform(): void; - z: number; - zIndex: number; - modificationMarker: number; - shadowColor: Float32Array; - _globalMat: PIXI.Matrix; - _lastLayer: RectTileLayer; - texPerChild: number; - initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number): void; - setBitmaps(bitmaps: Array): void; - clear(): void; - addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this; - tileRotate(rotate: number): this; - tileAnimX(offset: number, count: number): this; - tileAnimY(offset: number, count: number): this; - addFrame(texture_: PIXI.Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this; - renderCanvas(renderer: any): void; - render(renderer: PIXI.Renderer): void; - isModified(anim: boolean): boolean; - clearModify(): void; - } -} -declare module PIXI.tilemap { - const Constant: { - maxTextures: number; - bufferSize: number; - boundSize: number; - boundCountPerBuffer: number; - use32bitIndex: boolean; - SCALE_MODE: PIXI.SCALE_MODES; - DO_CLEAR: boolean; - }; -} -declare module PIXI.tilemap { -} -declare module PIXI.tilemap { -} -declare module PIXI.tilemap { - interface IMultiTextureOptions { - boundCountPerBuffer: number; - boundSize: number; - bufferSize: number; - DO_CLEAR?: boolean; - } - class MultiTextureResource extends PIXI.resources.Resource { - constructor(options: IMultiTextureOptions); - DO_CLEAR: boolean; - boundSize: number; - _clearBuffer: Uint8Array; - bind(baseTexture: PIXI.BaseTexture): void; - baseTex: PIXI.BaseTexture; - boundSprites: Array; - dirties: Array; - setTexture(ind: number, texture: PIXI.Texture): void; - upload(renderer: PIXI.Renderer, texture: PIXI.BaseTexture, glTexture: PIXI.GLTexture): boolean; - } -} -declare module PIXI.tilemap { - const POINT_STRUCT_SIZE = 12; - class RectTileLayer extends PIXI.Container { - constructor(zIndex: number, texture: PIXI.Texture | Array); - zIndex: number; - modificationMarker: number; - shadowColor: Float32Array; - _globalMat: PIXI.Matrix; - pointsBuf: Array; - hasAnim: boolean; - textures: Array; - offsetX: number; - offsetY: number; - compositeParent: boolean; - initialize(zIndex: number, textures: PIXI.Texture | Array): void; - clear(): void; - addFrame(texture_: PIXI.Texture | String | number, x: number, y: number, animX: number, animY: number): boolean; - addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animCountX?: number, animCountY?: number): this; - tileRotate(rotate: number): void; - tileAnimX(offset: number, count: number): void; - tileAnimY(offset: number, count: number): void; - renderCanvas(renderer: any): void; - renderCanvasCore(renderer: any): void; - vbId: number; - vb: RectTileGeom; - vbBuffer: ArrayBuffer; - vbArray: Float32Array; - vbInts: Uint32Array; - destroyVb(): void; - render(renderer: PIXI.Renderer): void; - renderWebGLCore(renderer: PIXI.Renderer, plugin: TileRenderer): void; - isModified(anim: boolean): boolean; - clearModify(): void; - destroy(options?: any): void; - } -} -declare module PIXI.tilemap { - abstract class TilemapShader extends PIXI.Shader { - maxTextures: number; - constructor(maxTextures: number, shaderVert: string, shaderFrag: string); - } - class RectTileShader extends TilemapShader { - constructor(maxTextures: number); - } - class RectTileGeom extends PIXI.Geometry { - vertSize: number; - vertPerQuad: number; - stride: number; - lastTimeAccess: number; - constructor(); - buf: PIXI.Buffer; - } -} -declare module PIXI.tilemap.shaderGenerator { - function fillSamplers(shader: TilemapShader, maxTextures: number): void; - function generateFragmentSrc(maxTextures: number, fragmentSrc: string): string; - function generateSampleSrc(maxTextures: number): string; -} -declare module PIXI.tilemap { - class TileRenderer extends PIXI.ObjectRenderer { - renderer: PIXI.Renderer; - gl: WebGLRenderingContext; - sn: number; - indexBuffer: PIXI.Buffer; - ibLen: number; - tileAnim: number[]; - texLoc: Array; - rectShader: RectTileShader; - texResources: Array; - constructor(renderer: PIXI.Renderer); - initBounds(): void; - bindTexturesWithoutRT(renderer: PIXI.Renderer, shader: TilemapShader, textures: Array): void; - bindTextures(renderer: PIXI.Renderer, shader: TilemapShader, textures: Array): void; - start(): void; - createVb(): RectTileGeom; - checkIndexBuffer(size: number, vb?: RectTileGeom): void; - getShader(): TilemapShader; - destroy(): void; - } -} -declare module PIXI.tilemap { - class ZLayer extends PIXI.Container { - constructor(tilemap: PIXI.Container, zIndex: number); - tilemap: any; - z: number; - zIndex: number; - _previousLayers: number; - canvasBuffer: HTMLCanvasElement; - _tempRender: any; - _lastAnimationFrame: number; - layerTransform: PIXI.Matrix; - clear(): void; - cacheIfDirty(): void; - renderCanvas(renderer: any): void; - } -} diff --git a/dist/pixi-tilemap.js b/dist/pixi-tilemap.js index b1615f69..bab06c06 100644 --- a/dist/pixi-tilemap.js +++ b/dist/pixi-tilemap.js @@ -1,943 +1,974 @@ -var pixi_tilemap; -(function (pixi_tilemap) { - var CanvasTileRenderer = (function () { - function CanvasTileRenderer(renderer) { - this.tileAnim = [0, 0]; - this.dontUseTransform = false; - this.renderer = renderer; - this.tileAnim = [0, 0]; - } - return CanvasTileRenderer; - }()); - pixi_tilemap.CanvasTileRenderer = CanvasTileRenderer; - var cr = PIXI.CanvasRenderer; - if (cr) { - cr.registerPlugin('tilemap', CanvasTileRenderer); +/*! + * pixi-tilemap - v2.0.6 + * Compiled Fri, 14 Aug 2020 02:19:53 UTC + * + * pixi-tilemap is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + * + * Copyright 2016-20, Ivan Popelyshev All Rights Reserved + */ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var display = require('@pixi/display'); +var core = require('@pixi/core'); +var constants = require('@pixi/constants'); +var math = require('@pixi/math'); +var graphics = require('@pixi/graphics'); +var sprite = require('@pixi/sprite'); + +var CanvasTileRenderer = (function () { + function CanvasTileRenderer(renderer) { + this.tileAnim = [0, 0]; + this.dontUseTransform = false; + this.renderer = renderer; + this.tileAnim = [0, 0]; } -})(pixi_tilemap || (pixi_tilemap = {})); -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var pixi_tilemap; -(function (pixi_tilemap) { - var CompositeRectTileLayer = (function (_super) { - __extends(CompositeRectTileLayer, _super); - function CompositeRectTileLayer(zIndex, bitmaps, texPerChild) { - var _this = _super.call(this) || this; - _this.modificationMarker = 0; - _this.shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]); - _this._globalMat = null; - _this._lastLayer = null; - _this.initialize.apply(_this, arguments); - return _this; - } - CompositeRectTileLayer.prototype.updateTransform = function () { - this.displayObjectUpdateTransform(); - }; - CompositeRectTileLayer.prototype.initialize = function (zIndex, bitmaps, texPerChild) { - if (texPerChild === true) { - texPerChild = 0; - } - this.z = this.zIndex = zIndex; - this.texPerChild = texPerChild || pixi_tilemap.Constant.boundCountPerBuffer * pixi_tilemap.Constant.maxTextures; - if (bitmaps) { - this.setBitmaps(bitmaps); - } - }; - CompositeRectTileLayer.prototype.setBitmaps = function (bitmaps) { - var texPerChild = this.texPerChild; - var len1 = this.children.length; - var len2 = Math.ceil(bitmaps.length / texPerChild); - var i; - for (i = 0; i < len1; i++) { - this.children[i].textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild); - } - for (i = len1; i < len2; i++) { - var layer = new pixi_tilemap.RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild)); - layer.compositeParent = true; - layer.offsetX = pixi_tilemap.Constant.boundSize; - layer.offsetY = pixi_tilemap.Constant.boundSize; - this.addChild(layer); - } - }; - CompositeRectTileLayer.prototype.clear = function () { - for (var i = 0; i < this.children.length; i++) { - this.children[i].clear(); - } - this.modificationMarker = 0; - }; - CompositeRectTileLayer.prototype.addRect = function (textureIndex, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight) { - var childIndex = textureIndex / this.texPerChild >> 0; - var textureId = textureIndex % this.texPerChild; - if (this.children[childIndex] && this.children[childIndex].textures) { - this._lastLayer = this.children[childIndex]; - this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight); + return CanvasTileRenderer; +}()); +var cr = PIXI.CanvasRenderer; +if (cr) { + cr.registerPlugin('tilemap', CanvasTileRenderer); +} + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ +/* global Reflect, Promise */ + +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); +}; + +function __extends(d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +var Constant = { + maxTextures: 16, + bufferSize: 2048, + boundSize: 1024, + boundCountPerBuffer: 1, + use32bitIndex: false, + SCALE_MODE: PIXI.SCALE_MODES.LINEAR, + DO_CLEAR: true +}; + +var POINT_STRUCT_SIZE = 12; +var RectTileLayer = (function (_super) { + __extends(RectTileLayer, _super); + function RectTileLayer(zIndex, texture) { + var _this = _super.call(this) || this; + _this.zIndex = 0; + _this.modificationMarker = 0; + _this.shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]); + _this._globalMat = null; + _this.pointsBuf = []; + _this.hasAnim = false; + _this.offsetX = 0; + _this.offsetY = 0; + _this.compositeParent = false; + _this.vbId = 0; + _this.vb = null; + _this.vbBuffer = null; + _this.vbArray = null; + _this.vbInts = null; + _this.initialize(zIndex, texture); + return _this; + } + RectTileLayer.prototype.initialize = function (zIndex, textures) { + if (!textures) { + textures = []; + } + else if (!(textures instanceof Array) && textures.baseTexture) { + textures = [textures]; + } + this.textures = textures; + this.zIndex = zIndex; + }; + RectTileLayer.prototype.clear = function () { + this.pointsBuf.length = 0; + this.modificationMarker = 0; + this.hasAnim = false; + }; + RectTileLayer.prototype.addFrame = function (texture_, x, y, animX, animY) { + var texture; + var textureIndex = 0; + if (typeof texture_ === "number") { + textureIndex = texture_; + texture = this.textures[textureIndex]; + } + else { + if (typeof texture_ === "string") { + texture = core.Texture.from(texture_); } else { - this._lastLayer = null; - } - return this; - }; - CompositeRectTileLayer.prototype.tileRotate = function (rotate) { - if (this._lastLayer) { - this._lastLayer.tileRotate(rotate); - } - return this; - }; - CompositeRectTileLayer.prototype.tileAnimX = function (offset, count) { - if (this._lastLayer) { - this._lastLayer.tileAnimX(offset, count); + texture = texture_; + } + var found = false; + var textureList = this.textures; + for (var i = 0; i < textureList.length; i++) { + if (textureList[i].baseTexture === texture.baseTexture) { + textureIndex = i; + found = true; + break; + } } - return this; - }; - CompositeRectTileLayer.prototype.tileAnimY = function (offset, count) { - if (this._lastLayer) { - this._lastLayer.tileAnimY(offset, count); + if (!found) { + return false; } - return this; - }; - CompositeRectTileLayer.prototype.addFrame = function (texture_, x, y, animX, animY, animWidth, animHeight) { - var texture; - var layer = null; - var ind = 0; - var children = this.children; - this._lastLayer = null; - if (typeof texture_ === "number") { - var childIndex = texture_ / this.texPerChild >> 0; - layer = children[childIndex]; - if (!layer) { - layer = children[0]; - if (!layer) { - return this; - } - ind = 0; - } - else { - ind = texture_ % this.texPerChild; - } - texture = layer.textures[ind]; + } + this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate); + return true; + }; + RectTileLayer.prototype.addRect = function (textureIndex, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animCountX, animCountY) { + if (animX === void 0) { animX = 0; } + if (animY === void 0) { animY = 0; } + if (rotate === void 0) { rotate = 0; } + if (animCountX === void 0) { animCountX = 1024; } + if (animCountY === void 0) { animCountY = 1024; } + var pb = this.pointsBuf; + this.hasAnim = this.hasAnim || animX > 0 || animY > 0; + pb.push(u); + pb.push(v); + pb.push(x); + pb.push(y); + pb.push(tileWidth); + pb.push(tileHeight); + pb.push(rotate); + pb.push(animX | 0); + pb.push(animY | 0); + pb.push(textureIndex); + pb.push(animCountX); + pb.push(animCountY); + return this; + }; + RectTileLayer.prototype.tileRotate = function (rotate) { + var pb = this.pointsBuf; + pb[pb.length - 3] = rotate; + }; + RectTileLayer.prototype.tileAnimX = function (offset, count) { + var pb = this.pointsBuf; + pb[pb.length - 5] = offset; + pb[pb.length - 2] = count; + }; + RectTileLayer.prototype.tileAnimY = function (offset, count) { + var pb = this.pointsBuf; + pb[pb.length - 4] = offset; + pb[pb.length - 1] = count; + }; + RectTileLayer.prototype.renderCanvas = function (renderer) { + var plugin = renderer.plugins.tilemap; + if (!plugin.dontUseTransform) { + var wt = this.worldTransform; + renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution); + } + this.renderCanvasCore(renderer); + }; + RectTileLayer.prototype.renderCanvasCore = function (renderer) { + if (this.textures.length === 0) + return; + var points = this.pointsBuf; + renderer.context.fillStyle = '#000000'; + for (var i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) { + var x1 = points[i], y1 = points[i + 1]; + var x2 = points[i + 2], y2 = points[i + 3]; + var w = points[i + 4]; + var h = points[i + 5]; + var rotate = points[i + 6]; + x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0]; + y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1]; + var textureIndex = points[i + 9]; + if (textureIndex >= 0) { + renderer.context.drawImage(this.textures[textureIndex].baseTexture.getDrawableSource(), x1, y1, w, h, x2, y2, w, h); } else { - if (typeof texture_ === "string") { - texture = PIXI.Texture.from(texture_); - } - else { - texture = texture_; + renderer.context.globalAlpha = 0.5; + renderer.context.fillRect(x2, y2, w, h); + renderer.context.globalAlpha = 1; + } + } + }; + RectTileLayer.prototype.destroyVb = function () { + if (this.vb) { + this.vb.destroy(); + this.vb = null; + } + }; + RectTileLayer.prototype.render = function (renderer) { + var plugin = renderer.plugins['tilemap']; + var shader = plugin.getShader(); + renderer.batch.setObjectRenderer(plugin); + this._globalMat = shader.uniforms.projTransMatrix; + renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform); + shader.uniforms.shadowColor = this.shadowColor; + shader.uniforms.animationFrame = plugin.tileAnim; + this.renderWebGLCore(renderer, plugin); + }; + RectTileLayer.prototype.renderWebGLCore = function (renderer, plugin) { + var points = this.pointsBuf; + if (points.length === 0) + return; + var rectsCount = points.length / POINT_STRUCT_SIZE; + var shader = plugin.getShader(); + var textures = this.textures; + if (textures.length === 0) + return; + plugin.bindTextures(renderer, shader, textures); + renderer.shader.bind(shader, false); + var vb = this.vb; + if (!vb) { + vb = plugin.createVb(); + this.vb = vb; + this.vbId = vb.id; + this.vbBuffer = null; + this.modificationMarker = 0; + } + plugin.checkIndexBuffer(rectsCount, vb); + var boundCountPerBuffer = Constant.boundCountPerBuffer; + var vertexBuf = vb.getBuffer('aVertexPosition'); + var vertices = rectsCount * vb.vertPerQuad; + if (vertices === 0) + return; + if (this.modificationMarker !== vertices) { + this.modificationMarker = vertices; + var vs = vb.stride * vertices; + if (!this.vbBuffer || this.vbBuffer.byteLength < vs) { + var bk = vb.stride; + while (bk < vs) { + bk *= 2; } - for (var i = 0; i < children.length; i++) { - var child = children[i]; - var tex = child.textures; - for (var j = 0; j < tex.length; j++) { - if (tex[j].baseTexture === texture.baseTexture) { - layer = child; - ind = j; - break; - } + this.vbBuffer = new ArrayBuffer(bk); + this.vbArray = new Float32Array(this.vbBuffer); + this.vbInts = new Uint32Array(this.vbBuffer); + vertexBuf.update(this.vbBuffer); + } + var arr = this.vbArray, ints = this.vbInts; + var sz = 0; + var textureId = 0; + var shiftU = this.offsetX; + var shiftV = this.offsetY; + for (var i = 0; i < points.length; i += POINT_STRUCT_SIZE) { + var eps = 0.5; + if (this.compositeParent) { + if (boundCountPerBuffer > 1) { + textureId = (points[i + 9] >> 2); + shiftU = this.offsetX * (points[i + 9] & 1); + shiftV = this.offsetY * ((points[i + 9] >> 1) & 1); } - if (layer) { - break; + else { + textureId = points[i + 9]; + shiftU = 0; + shiftV = 0; } } - if (!layer) { - for (var i = 0; i < children.length; i++) { - var child = children[i]; - if (child.textures.length < this.texPerChild) { - layer = child; - ind = child.textures.length; - child.textures.push(texture); - break; - } - } - if (!layer) { - layer = new pixi_tilemap.RectTileLayer(this.zIndex, texture); - layer.compositeParent = true; - layer.offsetX = pixi_tilemap.Constant.boundSize; - layer.offsetY = pixi_tilemap.Constant.boundSize; - children.push(layer); - ind = 0; - } + var x = points[i + 2], y = points[i + 3]; + var w = points[i + 4], h = points[i + 5]; + var u = points[i] + shiftU, v = points[i + 1] + shiftV; + var rotate = points[i + 6]; + var animX = points[i + 7], animY = points[i + 8]; + var animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024; + var animXEncoded = animX + (animWidth * 2048); + var animYEncoded = animY + (animHeight * 2048); + var u0 = void 0, v0 = void 0, u1 = void 0, v1 = void 0, u2 = void 0, v2 = void 0, u3 = void 0, v3 = void 0; + if (rotate === 0) { + u0 = u; + v0 = v; + u1 = u + w; + v1 = v; + u2 = u + w; + v2 = v + h; + u3 = u; + v3 = v + h; } - } - this._lastLayer = layer; - layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight); - return this; - }; - CompositeRectTileLayer.prototype.renderCanvas = function (renderer) { - if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { - return; - } - var plugin = renderer.plugins.tilemap; - if (!plugin.dontUseTransform) { - var wt = this.worldTransform; - renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution); - } - var layers = this.children; - for (var i = 0; i < layers.length; i++) { - layers[i].renderCanvasCore(renderer); - } - }; - CompositeRectTileLayer.prototype.render = function (renderer) { - if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { - return; - } - var plugin = renderer.plugins['tilemap']; - var shader = plugin.getShader(); - renderer.batch.setObjectRenderer(plugin); - this._globalMat = shader.uniforms.projTransMatrix; - renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform); - shader.uniforms.shadowColor = this.shadowColor; - shader.uniforms.animationFrame = plugin.tileAnim; - renderer.shader.bind(shader, false); - var layers = this.children; - for (var i = 0; i < layers.length; i++) { - layers[i].renderWebGLCore(renderer, plugin); - } - }; - CompositeRectTileLayer.prototype.isModified = function (anim) { - var layers = this.children; - if (this.modificationMarker !== layers.length) { - return true; - } - for (var i = 0; i < layers.length; i++) { - if (layers[i].isModified(anim)) { - return true; + else { + var w2 = w / 2; + var h2 = h / 2; + if (rotate % 4 !== 0) { + w2 = h / 2; + h2 = w / 2; + } + var cX = u + w2; + var cY = v + h2; + rotate = math.groupD8.add(rotate, math.groupD8.NW); + u0 = cX + (w2 * math.groupD8.uX(rotate)); + v0 = cY + (h2 * math.groupD8.uY(rotate)); + rotate = math.groupD8.add(rotate, 2); + u1 = cX + (w2 * math.groupD8.uX(rotate)); + v1 = cY + (h2 * math.groupD8.uY(rotate)); + rotate = math.groupD8.add(rotate, 2); + u2 = cX + (w2 * math.groupD8.uX(rotate)); + v2 = cY + (h2 * math.groupD8.uY(rotate)); + rotate = math.groupD8.add(rotate, 2); + u3 = cX + (w2 * math.groupD8.uX(rotate)); + v3 = cY + (h2 * math.groupD8.uY(rotate)); } - } - return false; - }; - CompositeRectTileLayer.prototype.clearModify = function () { - var layers = this.children; - this.modificationMarker = layers.length; - for (var i = 0; i < layers.length; i++) { - layers[i].clearModify(); - } - }; - return CompositeRectTileLayer; - }(PIXI.Container)); - pixi_tilemap.CompositeRectTileLayer = CompositeRectTileLayer; -})(pixi_tilemap || (pixi_tilemap = {})); -var pixi_tilemap; -(function (pixi_tilemap) { - pixi_tilemap.Constant = { - maxTextures: 16, - bufferSize: 2048, - boundSize: 1024, - boundCountPerBuffer: 1, - use32bitIndex: false, - SCALE_MODE: PIXI.SCALE_MODES.LINEAR, - DO_CLEAR: true + arr[sz++] = x; + arr[sz++] = y; + arr[sz++] = u0; + arr[sz++] = v0; + arr[sz++] = u + eps; + arr[sz++] = v + eps; + arr[sz++] = u + w - eps; + arr[sz++] = v + h - eps; + arr[sz++] = animXEncoded; + arr[sz++] = animYEncoded; + arr[sz++] = textureId; + arr[sz++] = x + w; + arr[sz++] = y; + arr[sz++] = u1; + arr[sz++] = v1; + arr[sz++] = u + eps; + arr[sz++] = v + eps; + arr[sz++] = u + w - eps; + arr[sz++] = v + h - eps; + arr[sz++] = animXEncoded; + arr[sz++] = animYEncoded; + arr[sz++] = textureId; + arr[sz++] = x + w; + arr[sz++] = y + h; + arr[sz++] = u2; + arr[sz++] = v2; + arr[sz++] = u + eps; + arr[sz++] = v + eps; + arr[sz++] = u + w - eps; + arr[sz++] = v + h - eps; + arr[sz++] = animXEncoded; + arr[sz++] = animYEncoded; + arr[sz++] = textureId; + arr[sz++] = x; + arr[sz++] = y + h; + arr[sz++] = u3; + arr[sz++] = v3; + arr[sz++] = u + eps; + arr[sz++] = v + eps; + arr[sz++] = u + w - eps; + arr[sz++] = v + h - eps; + arr[sz++] = animXEncoded; + arr[sz++] = animYEncoded; + arr[sz++] = textureId; + } + vertexBuf.update(arr); + } + renderer.geometry.bind(vb, shader); + renderer.geometry.draw(constants.DRAW_MODES.TRIANGLES, rectsCount * 6, 0); }; -})(pixi_tilemap || (pixi_tilemap = {})); -var pixi_tilemap; -(function (pixi_tilemap) { - var GraphicsLayer = (function (_super) { - __extends(GraphicsLayer, _super); - function GraphicsLayer(zIndex) { - var _this = _super.call(this) || this; - _this.zIndex = zIndex; - return _this; - } - GraphicsLayer.prototype.renderCanvas = function (renderer) { - var wt = null; - if (renderer.plugins.tilemap.dontUseTransform) { - wt = this.transform.worldTransform; - this.transform.worldTransform = PIXI.Matrix.IDENTITY; - } - renderer.plugins.graphics.render(this); - if (renderer.plugins.tilemap.dontUseTransform) { - this.transform.worldTransform = wt; - } - renderer.context.globalAlpha = 1.0; - }; - GraphicsLayer.prototype.isModified = function (anim) { - return false; - }; - GraphicsLayer.prototype.clearModify = function () { - }; - return GraphicsLayer; - }(PIXI.Graphics)); -})(pixi_tilemap || (pixi_tilemap = {})); -var pixi_tilemap; -(function (pixi_tilemap) { - var MultiTextureResource = (function (_super) { - __extends(MultiTextureResource, _super); - function MultiTextureResource(options) { - var _this = _super.call(this, options.bufferSize, options.bufferSize) || this; - _this.DO_CLEAR = false; - _this.boundSize = 0; - _this._clearBuffer = null; - _this.baseTex = null; - _this.boundSprites = []; - _this.dirties = []; - var bounds = _this.boundSprites; - var dirties = _this.dirties; - _this.boundSize = options.boundSize; - for (var j = 0; j < options.boundCountPerBuffer; j++) { - var spr = new PIXI.Sprite(); - spr.position.x = options.boundSize * (j & 1); - spr.position.y = options.boundSize * (j >> 1); - bounds.push(spr); - dirties.push(0); - } - _this.DO_CLEAR = !!options.DO_CLEAR; - return _this; + RectTileLayer.prototype.isModified = function (anim) { + if (this.modificationMarker !== this.pointsBuf.length || + anim && this.hasAnim) { + return true; } - MultiTextureResource.prototype.bind = function (baseTexture) { - if (this.baseTex) { - throw new Error('Only one baseTexture is allowed for this resource!'); - } - this.baseTex = baseTexture; - _super.prototype.bind.call(this, baseTexture); - }; - MultiTextureResource.prototype.setTexture = function (ind, texture) { - var spr = this.boundSprites[ind]; - if (spr.texture.baseTexture === texture.baseTexture) { - return; - } - spr.texture = texture; - this.baseTex.update(); - this.dirties[ind] = this.baseTex.dirtyId; - }; - MultiTextureResource.prototype.upload = function (renderer, texture, glTexture) { - var gl = renderer.gl; - var _a = this, width = _a.width, height = _a.height; - gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined || - texture.alphaMode === PIXI.ALPHA_MODES.UNPACK); - if (glTexture.dirtyId < 0) { - glTexture.width = width; - glTexture.height = height; - gl.texImage2D(texture.target, 0, texture.format, width, height, 0, texture.format, texture.type, null); - } - var doClear = this.DO_CLEAR; - if (doClear && !this._clearBuffer) { - this._clearBuffer = new Uint8Array(pixi_tilemap.Constant.boundSize * pixi_tilemap.Constant.boundSize * 4); + return false; + }; + RectTileLayer.prototype.clearModify = function () { + this.modificationMarker = this.pointsBuf.length; + }; + RectTileLayer.prototype.destroy = function (options) { + _super.prototype.destroy.call(this, options); + this.destroyVb(); + }; + return RectTileLayer; +}(display.Container)); + +var CompositeRectTileLayer = (function (_super) { + __extends(CompositeRectTileLayer, _super); + function CompositeRectTileLayer(zIndex, bitmaps, texPerChild) { + var _this = _super.call(this) || this; + _this.modificationMarker = 0; + _this.shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]); + _this._globalMat = null; + _this._lastLayer = null; + _this.initialize.apply(_this, arguments); + return _this; + } + CompositeRectTileLayer.prototype.updateTransform = function () { + this.displayObjectUpdateTransform(); + }; + CompositeRectTileLayer.prototype.initialize = function (zIndex, bitmaps, texPerChild) { + if (texPerChild === true) { + texPerChild = 0; + } + this.z = this.zIndex = zIndex; + this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures; + if (bitmaps) { + this.setBitmaps(bitmaps); + } + }; + CompositeRectTileLayer.prototype.setBitmaps = function (bitmaps) { + for (var i_1 = 0; i_1 < bitmaps.length; i_1++) { + if (bitmaps[i_1] && !bitmaps[i_1].baseTexture) { + throw new Error("pixi-tilemap cannot use destroyed textures. " + + "Probably, you passed resources['myAtlas'].texture in pixi > 5.2.1, it does not exist there."); } - var bounds = this.boundSprites; - for (var i = 0; i < bounds.length; i++) { - var spr = bounds[i]; - var tex = spr.texture.baseTexture; - if (glTexture.dirtyId >= this.dirties[i]) { - continue; - } - var res = tex.resource; - if (!tex.valid || !res || !res.source) { - continue; - } - if (doClear && (tex.width < this.boundSize || tex.height < this.boundSize)) { - gl.texSubImage2D(texture.target, 0, spr.position.x, spr.position.y, this.boundSize, this.boundSize, texture.format, texture.type, this._clearBuffer); + } + var texPerChild = this.texPerChild; + var len1 = this.children.length; + var len2 = Math.ceil(bitmaps.length / texPerChild); + var i; + for (i = 0; i < len1; i++) { + this.children[i].textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild); + } + for (i = len1; i < len2; i++) { + var layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild)); + layer.compositeParent = true; + layer.offsetX = Constant.boundSize; + layer.offsetY = Constant.boundSize; + this.addChild(layer); + } + }; + CompositeRectTileLayer.prototype.clear = function () { + for (var i = 0; i < this.children.length; i++) { + this.children[i].clear(); + } + this.modificationMarker = 0; + }; + CompositeRectTileLayer.prototype.addRect = function (textureIndex, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight) { + var childIndex = textureIndex / this.texPerChild >> 0; + var textureId = textureIndex % this.texPerChild; + if (this.children[childIndex] && this.children[childIndex].textures) { + this._lastLayer = this.children[childIndex]; + this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight); + } + else { + this._lastLayer = null; + } + return this; + }; + CompositeRectTileLayer.prototype.tileRotate = function (rotate) { + if (this._lastLayer) { + this._lastLayer.tileRotate(rotate); + } + return this; + }; + CompositeRectTileLayer.prototype.tileAnimX = function (offset, count) { + if (this._lastLayer) { + this._lastLayer.tileAnimX(offset, count); + } + return this; + }; + CompositeRectTileLayer.prototype.tileAnimY = function (offset, count) { + if (this._lastLayer) { + this._lastLayer.tileAnimY(offset, count); + } + return this; + }; + CompositeRectTileLayer.prototype.addFrame = function (texture_, x, y, animX, animY, animWidth, animHeight) { + var texture; + var layer = null; + var ind = 0; + var children = this.children; + this._lastLayer = null; + if (typeof texture_ === "number") { + var childIndex = texture_ / this.texPerChild >> 0; + layer = children[childIndex]; + if (!layer) { + layer = children[0]; + if (!layer) { + return this; } - gl.texSubImage2D(texture.target, 0, spr.position.x, spr.position.y, texture.format, texture.type, res.source); + ind = 0; } - return true; - }; - return MultiTextureResource; - }(PIXI.resources.Resource)); - pixi_tilemap.MultiTextureResource = MultiTextureResource; -})(pixi_tilemap || (pixi_tilemap = {})); -var pixi_tilemap; -(function (pixi_tilemap) { - var groupD8 = PIXI.groupD8; - pixi_tilemap.POINT_STRUCT_SIZE = 12; - var RectTileLayer = (function (_super) { - __extends(RectTileLayer, _super); - function RectTileLayer(zIndex, texture) { - var _this = _super.call(this) || this; - _this.zIndex = 0; - _this.modificationMarker = 0; - _this.shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]); - _this._globalMat = null; - _this.pointsBuf = []; - _this.hasAnim = false; - _this.offsetX = 0; - _this.offsetY = 0; - _this.compositeParent = false; - _this.vbId = 0; - _this.vb = null; - _this.vbBuffer = null; - _this.vbArray = null; - _this.vbInts = null; - _this.initialize(zIndex, texture); - return _this; - } - RectTileLayer.prototype.initialize = function (zIndex, textures) { - if (!textures) { - textures = []; - } - else if (!(textures instanceof Array) && textures.baseTexture) { - textures = [textures]; + else { + ind = texture_ % this.texPerChild; } - this.textures = textures; - this.zIndex = zIndex; - }; - RectTileLayer.prototype.clear = function () { - this.pointsBuf.length = 0; - this.modificationMarker = 0; - this.hasAnim = false; - }; - RectTileLayer.prototype.addFrame = function (texture_, x, y, animX, animY) { - var texture; - var textureIndex = 0; - if (typeof texture_ === "number") { - textureIndex = texture_; - texture = this.textures[textureIndex]; + texture = layer.textures[ind]; + } + else { + if (typeof texture_ === "string") { + texture = core.Texture.from(texture_); } else { - if (typeof texture_ === "string") { - texture = PIXI.Texture.from(texture_); - } - else { - texture = texture_; - } - var found = false; - var textureList = this.textures; - for (var i = 0; i < textureList.length; i++) { - if (textureList[i].baseTexture === texture.baseTexture) { - textureIndex = i; - found = true; + texture = texture_; + } + for (var i = 0; i < children.length; i++) { + var child = children[i]; + var tex = child.textures; + for (var j = 0; j < tex.length; j++) { + if (tex[j].baseTexture === texture.baseTexture) { + layer = child; + ind = j; break; } } - if (!found) { - return false; - } - } - this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate); - return true; - }; - RectTileLayer.prototype.addRect = function (textureIndex, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animCountX, animCountY) { - if (animX === void 0) { animX = 0; } - if (animY === void 0) { animY = 0; } - if (rotate === void 0) { rotate = 0; } - if (animCountX === void 0) { animCountX = 1024; } - if (animCountY === void 0) { animCountY = 1024; } - var pb = this.pointsBuf; - this.hasAnim = this.hasAnim || animX > 0 || animY > 0; - pb.push(u); - pb.push(v); - pb.push(x); - pb.push(y); - pb.push(tileWidth); - pb.push(tileHeight); - pb.push(rotate); - pb.push(animX | 0); - pb.push(animY | 0); - pb.push(textureIndex); - pb.push(animCountX); - pb.push(animCountY); - return this; - }; - RectTileLayer.prototype.tileRotate = function (rotate) { - var pb = this.pointsBuf; - pb[pb.length - 3] = rotate; - }; - RectTileLayer.prototype.tileAnimX = function (offset, count) { - var pb = this.pointsBuf; - pb[pb.length - 5] = offset; - pb[pb.length - 2] = count; - }; - RectTileLayer.prototype.tileAnimY = function (offset, count) { - var pb = this.pointsBuf; - pb[pb.length - 4] = offset; - pb[pb.length - 1] = count; - }; - RectTileLayer.prototype.renderCanvas = function (renderer) { - var plugin = renderer.plugins.tilemap; - if (!plugin.dontUseTransform) { - var wt = this.worldTransform; - renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution); - } - this.renderCanvasCore(renderer); - }; - RectTileLayer.prototype.renderCanvasCore = function (renderer) { - if (this.textures.length === 0) - return; - var points = this.pointsBuf; - renderer.context.fillStyle = '#000000'; - for (var i = 0, n = points.length; i < n; i += pixi_tilemap.POINT_STRUCT_SIZE) { - var x1 = points[i], y1 = points[i + 1]; - var x2 = points[i + 2], y2 = points[i + 3]; - var w = points[i + 4]; - var h = points[i + 5]; - var rotate = points[i + 6]; - x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0]; - y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1]; - var textureIndex = points[i + 9]; - if (textureIndex >= 0) { - renderer.context.drawImage(this.textures[textureIndex].baseTexture.getDrawableSource(), x1, y1, w, h, x2, y2, w, h); - } - else { - renderer.context.globalAlpha = 0.5; - renderer.context.fillRect(x2, y2, w, h); - renderer.context.globalAlpha = 1; + if (layer) { + break; } } - }; - RectTileLayer.prototype.destroyVb = function () { - if (this.vb) { - this.vb.destroy(); - this.vb = null; - } - }; - RectTileLayer.prototype.render = function (renderer) { - var plugin = renderer.plugins['tilemap']; - var shader = plugin.getShader(); - renderer.batch.setObjectRenderer(plugin); - this._globalMat = shader.uniforms.projTransMatrix; - renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform); - shader.uniforms.shadowColor = this.shadowColor; - shader.uniforms.animationFrame = plugin.tileAnim; - this.renderWebGLCore(renderer, plugin); - }; - RectTileLayer.prototype.renderWebGLCore = function (renderer, plugin) { - var points = this.pointsBuf; - if (points.length === 0) - return; - var rectsCount = points.length / pixi_tilemap.POINT_STRUCT_SIZE; - var shader = plugin.getShader(); - var textures = this.textures; - if (textures.length === 0) - return; - plugin.bindTextures(renderer, shader, textures); - renderer.shader.bind(shader, false); - var vb = this.vb; - if (!vb) { - vb = plugin.createVb(); - this.vb = vb; - this.vbId = vb.id; - this.vbBuffer = null; - this.modificationMarker = 0; - } - plugin.checkIndexBuffer(rectsCount, vb); - var boundCountPerBuffer = pixi_tilemap.Constant.boundCountPerBuffer; - var vertexBuf = vb.getBuffer('aVertexPosition'); - var vertices = rectsCount * vb.vertPerQuad; - if (vertices === 0) - return; - if (this.modificationMarker !== vertices) { - this.modificationMarker = vertices; - var vs = vb.stride * vertices; - if (!this.vbBuffer || this.vbBuffer.byteLength < vs) { - var bk = vb.stride; - while (bk < vs) { - bk *= 2; + if (!layer) { + for (var i = 0; i < children.length; i++) { + var child = children[i]; + if (child.textures.length < this.texPerChild) { + layer = child; + ind = child.textures.length; + child.textures.push(texture); + break; } - this.vbBuffer = new ArrayBuffer(bk); - this.vbArray = new Float32Array(this.vbBuffer); - this.vbInts = new Uint32Array(this.vbBuffer); - vertexBuf.update(this.vbBuffer); } - var arr = this.vbArray, ints = this.vbInts; - var sz = 0; - var textureId = 0; - var shiftU = this.offsetX; - var shiftV = this.offsetY; - var tint = -1; - for (var i = 0; i < points.length; i += pixi_tilemap.POINT_STRUCT_SIZE) { - var eps = 0.5; - if (this.compositeParent) { - if (boundCountPerBuffer > 1) { - textureId = (points[i + 9] >> 2); - shiftU = this.offsetX * (points[i + 9] & 1); - shiftV = this.offsetY * ((points[i + 9] >> 1) & 1); - } - else { - textureId = points[i + 9]; - shiftU = 0; - shiftV = 0; - } - } - var x = points[i + 2], y = points[i + 3]; - var w = points[i + 4], h = points[i + 5]; - var u = points[i] + shiftU, v = points[i + 1] + shiftV; - var rotate = points[i + 6]; - var animX = points[i + 7], animY = points[i + 8]; - var animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024; - var animXEncoded = animX + (animWidth * 2048); - var animYEncoded = animY + (animHeight * 2048); - var u0 = void 0, v0 = void 0, u1 = void 0, v1 = void 0, u2 = void 0, v2 = void 0, u3 = void 0, v3 = void 0; - if (rotate === 0) { - u0 = u; - v0 = v; - u1 = u + w; - v1 = v; - u2 = u + w; - v2 = v + h; - u3 = u; - v3 = v + h; - } - else { - var w2 = w / 2; - var h2 = h / 2; - if (rotate % 4 !== 0) { - w2 = h / 2; - h2 = w / 2; - } - var cX = u + w2; - var cY = v + h2; - rotate = groupD8.add(rotate, groupD8.NW); - u0 = cX + (w2 * groupD8.uX(rotate)); - v0 = cY + (h2 * groupD8.uY(rotate)); - rotate = groupD8.add(rotate, 2); - u1 = cX + (w2 * groupD8.uX(rotate)); - v1 = cY + (h2 * groupD8.uY(rotate)); - rotate = groupD8.add(rotate, 2); - u2 = cX + (w2 * groupD8.uX(rotate)); - v2 = cY + (h2 * groupD8.uY(rotate)); - rotate = groupD8.add(rotate, 2); - u3 = cX + (w2 * groupD8.uX(rotate)); - v3 = cY + (h2 * groupD8.uY(rotate)); - } - arr[sz++] = x; - arr[sz++] = y; - arr[sz++] = u0; - arr[sz++] = v0; - arr[sz++] = u + eps; - arr[sz++] = v + eps; - arr[sz++] = u + w - eps; - arr[sz++] = v + h - eps; - arr[sz++] = animXEncoded; - arr[sz++] = animYEncoded; - arr[sz++] = textureId; - arr[sz++] = x + w; - arr[sz++] = y; - arr[sz++] = u1; - arr[sz++] = v1; - arr[sz++] = u + eps; - arr[sz++] = v + eps; - arr[sz++] = u + w - eps; - arr[sz++] = v + h - eps; - arr[sz++] = animXEncoded; - arr[sz++] = animYEncoded; - arr[sz++] = textureId; - arr[sz++] = x + w; - arr[sz++] = y + h; - arr[sz++] = u2; - arr[sz++] = v2; - arr[sz++] = u + eps; - arr[sz++] = v + eps; - arr[sz++] = u + w - eps; - arr[sz++] = v + h - eps; - arr[sz++] = animXEncoded; - arr[sz++] = animYEncoded; - arr[sz++] = textureId; - arr[sz++] = x; - arr[sz++] = y + h; - arr[sz++] = u3; - arr[sz++] = v3; - arr[sz++] = u + eps; - arr[sz++] = v + eps; - arr[sz++] = u + w - eps; - arr[sz++] = v + h - eps; - arr[sz++] = animXEncoded; - arr[sz++] = animYEncoded; - arr[sz++] = textureId; + if (!layer) { + layer = new RectTileLayer(this.zIndex, texture); + layer.compositeParent = true; + layer.offsetX = Constant.boundSize; + layer.offsetY = Constant.boundSize; + children.push(layer); + ind = 0; } - vertexBuf.update(arr); } - renderer.geometry.bind(vb, shader); - renderer.geometry.draw(PIXI.DRAW_MODES.TRIANGLES, rectsCount * 6, 0); - }; - RectTileLayer.prototype.isModified = function (anim) { - if (this.modificationMarker !== this.pointsBuf.length || - anim && this.hasAnim) { + } + this._lastLayer = layer; + layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight); + return this; + }; + CompositeRectTileLayer.prototype.renderCanvas = function (renderer) { + if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { + return; + } + var plugin = renderer.plugins.tilemap; + if (!plugin.dontUseTransform) { + var wt = this.worldTransform; + renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution); + } + var layers = this.children; + for (var i = 0; i < layers.length; i++) { + layers[i].renderCanvasCore(renderer); + } + }; + CompositeRectTileLayer.prototype.render = function (renderer) { + if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { + return; + } + var plugin = renderer.plugins['tilemap']; + var shader = plugin.getShader(); + renderer.batch.setObjectRenderer(plugin); + this._globalMat = shader.uniforms.projTransMatrix; + renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform); + shader.uniforms.shadowColor = this.shadowColor; + shader.uniforms.animationFrame = plugin.tileAnim; + renderer.shader.bind(shader, false); + var layers = this.children; + for (var i = 0; i < layers.length; i++) { + layers[i].renderWebGLCore(renderer, plugin); + } + }; + CompositeRectTileLayer.prototype.isModified = function (anim) { + var layers = this.children; + if (this.modificationMarker !== layers.length) { + return true; + } + for (var i = 0; i < layers.length; i++) { + if (layers[i].isModified(anim)) { return true; } - return false; - }; - RectTileLayer.prototype.clearModify = function () { - this.modificationMarker = this.pointsBuf.length; - }; - RectTileLayer.prototype.destroy = function (options) { - _super.prototype.destroy.call(this, options); - this.destroyVb(); - }; - return RectTileLayer; - }(PIXI.Container)); - pixi_tilemap.RectTileLayer = RectTileLayer; -})(pixi_tilemap || (pixi_tilemap = {})); -var pixi_tilemap; -(function (pixi_tilemap) { - var rectShaderFrag = "\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n"; - var rectShaderVert = "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n"; - var TilemapShader = (function (_super) { - __extends(TilemapShader, _super); - function TilemapShader(maxTextures, shaderVert, shaderFrag) { - var _this = _super.call(this, new PIXI.Program(shaderVert, shaderFrag), { - animationFrame: new Float32Array(2), - uSamplers: [], - uSamplerSize: [], - projTransMatrix: new PIXI.Matrix() - }) || this; - _this.maxTextures = 0; - _this.maxTextures = maxTextures; - pixi_tilemap.shaderGenerator.fillSamplers(_this, _this.maxTextures); - return _this; - } - return TilemapShader; - }(PIXI.Shader)); - pixi_tilemap.TilemapShader = TilemapShader; - var RectTileShader = (function (_super) { - __extends(RectTileShader, _super); - function RectTileShader(maxTextures) { - var _this = _super.call(this, maxTextures, rectShaderVert, pixi_tilemap.shaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)) || this; - pixi_tilemap.shaderGenerator.fillSamplers(_this, _this.maxTextures); - return _this; - } - return RectTileShader; - }(TilemapShader)); - pixi_tilemap.RectTileShader = RectTileShader; - var RectTileGeom = (function (_super) { - __extends(RectTileGeom, _super); - function RectTileGeom() { - var _this = _super.call(this) || this; - _this.vertSize = 11; - _this.vertPerQuad = 4; - _this.stride = _this.vertSize * 4; - _this.lastTimeAccess = 0; - var buf = _this.buf = new PIXI.Buffer(new Float32Array(2), true, false); - _this.addAttribute('aVertexPosition', buf, 0, false, 0, _this.stride, 0) - .addAttribute('aTextureCoord', buf, 0, false, 0, _this.stride, 2 * 4) - .addAttribute('aFrame', buf, 0, false, 0, _this.stride, 4 * 4) - .addAttribute('aAnim', buf, 0, false, 0, _this.stride, 8 * 4) - .addAttribute('aTextureId', buf, 0, false, 0, _this.stride, 10 * 4); - return _this; - } - return RectTileGeom; - }(PIXI.Geometry)); - pixi_tilemap.RectTileGeom = RectTileGeom; -})(pixi_tilemap || (pixi_tilemap = {})); -var pixi_tilemap; -(function (pixi_tilemap) { - var TileRenderer = (function (_super) { - __extends(TileRenderer, _super); - function TileRenderer(renderer) { - var _this = _super.call(this, renderer) || this; - _this.sn = -1; - _this.indexBuffer = null; - _this.ibLen = 0; - _this.tileAnim = [0, 0]; - _this.texLoc = []; - _this.texResources = []; - _this.rectShader = new pixi_tilemap.RectTileShader(pixi_tilemap.Constant.maxTextures); - _this.indexBuffer = new PIXI.Buffer(undefined, true, true); - _this.checkIndexBuffer(2000); - _this.initBounds(); - return _this; - } - TileRenderer.prototype.initBounds = function () { - if (pixi_tilemap.Constant.boundCountPerBuffer <= 1) { - return; - } - var maxTextures = pixi_tilemap.Constant.maxTextures; - for (var i = 0; i < maxTextures; i++) { - var resource = new pixi_tilemap.MultiTextureResource(pixi_tilemap.Constant); - var baseTex = new PIXI.BaseTexture(resource); - baseTex.scaleMode = pixi_tilemap.Constant.SCALE_MODE; - baseTex.wrapMode = PIXI.WRAP_MODES.CLAMP; - this.texResources.push(resource); - } - }; - TileRenderer.prototype.bindTexturesWithoutRT = function (renderer, shader, textures) { - var samplerSize = shader.uniforms.uSamplerSize; - this.texLoc.length = 0; - for (var i = 0; i < textures.length; i++) { - var texture = textures[i]; - if (!texture || !texture.valid) { - return; - } - renderer.texture.bind(textures[i], i); - samplerSize[i * 2] = 1.0 / textures[i].baseTexture.width; - samplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height; - } - shader.uniforms.uSamplerSize = samplerSize; - }; - TileRenderer.prototype.bindTextures = function (renderer, shader, textures) { - var len = textures.length; - var maxTextures = pixi_tilemap.Constant.maxTextures; - if (len > pixi_tilemap.Constant.boundCountPerBuffer * maxTextures) { - return; - } - if (pixi_tilemap.Constant.boundCountPerBuffer <= 1) { - this.bindTexturesWithoutRT(renderer, shader, textures); - return; + } + return false; + }; + CompositeRectTileLayer.prototype.clearModify = function () { + var layers = this.children; + this.modificationMarker = layers.length; + for (var i = 0; i < layers.length; i++) { + layers[i].clearModify(); + } + }; + return CompositeRectTileLayer; +}(display.Container)); + +var GraphicsLayer = (function (_super) { + __extends(GraphicsLayer, _super); + function GraphicsLayer(zIndex) { + var _this = _super.call(this) || this; + _this.zIndex = zIndex; + return _this; + } + GraphicsLayer.prototype.renderCanvas = function (renderer) { + var wt = null; + if (renderer.plugins.tilemap.dontUseTransform) { + wt = this.transform.worldTransform; + this.transform.worldTransform = math.Matrix.IDENTITY; + } + renderer.plugins.graphics.render(this); + if (renderer.plugins.tilemap.dontUseTransform) { + this.transform.worldTransform = wt; + } + renderer.context.globalAlpha = 1.0; + }; + GraphicsLayer.prototype.isModified = function (anim) { + return false; + }; + GraphicsLayer.prototype.clearModify = function () { + }; + return GraphicsLayer; +}(graphics.Graphics)); + +var MultiTextureResource = (function (_super) { + __extends(MultiTextureResource, _super); + function MultiTextureResource(options) { + var _this = _super.call(this, options.bufferSize, options.bufferSize) || this; + _this.DO_CLEAR = false; + _this.boundSize = 0; + _this._clearBuffer = null; + _this.baseTex = null; + _this.boundSprites = []; + _this.dirties = []; + var bounds = _this.boundSprites; + var dirties = _this.dirties; + _this.boundSize = options.boundSize; + for (var j = 0; j < options.boundCountPerBuffer; j++) { + var spr = new sprite.Sprite(); + spr.position.x = options.boundSize * (j & 1); + spr.position.y = options.boundSize * (j >> 1); + bounds.push(spr); + dirties.push(0); + } + _this.DO_CLEAR = !!options.DO_CLEAR; + return _this; + } + MultiTextureResource.prototype.bind = function (baseTexture) { + if (this.baseTex) { + throw new Error('Only one baseTexture is allowed for this resource!'); + } + this.baseTex = baseTexture; + _super.prototype.bind.call(this, baseTexture); + }; + MultiTextureResource.prototype.setTexture = function (ind, texture) { + var spr = this.boundSprites[ind]; + if (spr.texture.baseTexture === texture.baseTexture) { + return; + } + spr.texture = texture; + this.baseTex.update(); + this.dirties[ind] = this.baseTex.dirtyId; + }; + MultiTextureResource.prototype.upload = function (renderer, texture, glTexture) { + var gl = renderer.gl; + var _a = this, width = _a.width, height = _a.height; + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined || + texture.alphaMode === constants.ALPHA_MODES.UNPACK); + if (glTexture.dirtyId < 0) { + glTexture.width = width; + glTexture.height = height; + gl.texImage2D(texture.target, 0, texture.format, width, height, 0, texture.format, texture.type, null); + } + var doClear = this.DO_CLEAR; + if (doClear && !this._clearBuffer) { + this._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4); + } + var bounds = this.boundSprites; + for (var i = 0; i < bounds.length; i++) { + var spr = bounds[i]; + var tex = spr.texture.baseTexture; + if (glTexture.dirtyId >= this.dirties[i]) { + continue; } - var i = 0; - for (; i < len; i++) { - var texture = textures[i]; - if (!texture || !texture.valid) - continue; - var multi = this.texResources[i >> 2]; - multi.setTexture(i & 3, texture); + var res = tex.resource; + if (!tex.valid || !res || !res.source) { + continue; } - var gltsUsed = (i + 3) >> 2; - for (i = 0; i < gltsUsed; i++) { - renderer.texture.bind(this.texResources[i].baseTex, i); + if (doClear && (tex.width < this.boundSize || tex.height < this.boundSize)) { + gl.texSubImage2D(texture.target, 0, spr.position.x, spr.position.y, this.boundSize, this.boundSize, texture.format, texture.type, this._clearBuffer); } - }; - TileRenderer.prototype.start = function () { - }; - TileRenderer.prototype.createVb = function () { - var geom = new pixi_tilemap.RectTileGeom(); - geom.addIndex(this.indexBuffer); - geom.lastTimeAccess = Date.now(); - return geom; - }; - TileRenderer.prototype.checkIndexBuffer = function (size, vb) { - if (vb === void 0) { vb = null; } - var totalIndices = size * 6; - if (totalIndices <= this.ibLen) { + gl.texSubImage2D(texture.target, 0, spr.position.x, spr.position.y, texture.format, texture.type, res.source); + } + return true; + }; + return MultiTextureResource; +}(core.resources.Resource)); + +function fillSamplers(shader, maxTextures) { + var sampleValues = []; + for (var i = 0; i < maxTextures; i++) { + sampleValues[i] = i; + } + shader.uniforms.uSamplers = sampleValues; + var samplerSize = []; + for (var i = 0; i < maxTextures; i++) { + samplerSize.push(1.0 / Constant.bufferSize); + samplerSize.push(1.0 / Constant.bufferSize); + } + shader.uniforms.uSamplerSize = samplerSize; +} +function generateFragmentSrc(maxTextures, fragmentSrc) { + return fragmentSrc.replace(/%count%/gi, maxTextures + "") + .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures)); +} +function generateSampleSrc(maxTextures) { + var src = ''; + src += '\n'; + src += '\n'; + src += 'if(vTextureId <= -1.0) {'; + src += '\n\tcolor = shadowColor;'; + src += '\n}'; + for (var i = 0; i < maxTextures; i++) { + src += '\nelse '; + if (i < maxTextures - 1) { + src += 'if(textureId == ' + i + '.0)'; + } + src += '\n{'; + src += '\n\tcolor = texture2D(uSamplers[' + i + '], textureCoord * uSamplerSize[' + i + ']);'; + src += '\n}'; + } + src += '\n'; + src += '\n'; + return src; +} + +var rectShaderFrag = "\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n"; +var rectShaderVert = "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n"; +var TilemapShader = (function (_super) { + __extends(TilemapShader, _super); + function TilemapShader(maxTextures, shaderVert, shaderFrag) { + var _this = _super.call(this, new PIXI.Program(shaderVert, shaderFrag), { + animationFrame: new Float32Array(2), + uSamplers: [], + uSamplerSize: [], + projTransMatrix: new math.Matrix() + }) || this; + _this.maxTextures = 0; + _this.maxTextures = maxTextures; + fillSamplers(_this, _this.maxTextures); + return _this; + } + return TilemapShader; +}(core.Shader)); +var RectTileShader = (function (_super) { + __extends(RectTileShader, _super); + function RectTileShader(maxTextures) { + var _this = _super.call(this, maxTextures, rectShaderVert, generateFragmentSrc(maxTextures, rectShaderFrag)) || this; + fillSamplers(_this, _this.maxTextures); + return _this; + } + return RectTileShader; +}(TilemapShader)); +var RectTileGeom = (function (_super) { + __extends(RectTileGeom, _super); + function RectTileGeom() { + var _this = _super.call(this) || this; + _this.vertSize = 11; + _this.vertPerQuad = 4; + _this.stride = _this.vertSize * 4; + _this.lastTimeAccess = 0; + var buf = _this.buf = new core.Buffer(new Float32Array(2), true, false); + _this.addAttribute('aVertexPosition', buf, 0, false, 0, _this.stride, 0) + .addAttribute('aTextureCoord', buf, 0, false, 0, _this.stride, 2 * 4) + .addAttribute('aFrame', buf, 0, false, 0, _this.stride, 4 * 4) + .addAttribute('aAnim', buf, 0, false, 0, _this.stride, 8 * 4) + .addAttribute('aTextureId', buf, 0, false, 0, _this.stride, 10 * 4); + return _this; + } + return RectTileGeom; +}(core.Geometry)); + +var TileRenderer = (function (_super) { + __extends(TileRenderer, _super); + function TileRenderer(renderer) { + var _this = _super.call(this, renderer) || this; + _this.sn = -1; + _this.indexBuffer = null; + _this.ibLen = 0; + _this.tileAnim = [0, 0]; + _this.texLoc = []; + _this.texResources = []; + _this.rectShader = new RectTileShader(Constant.maxTextures); + _this.indexBuffer = new core.Buffer(undefined, true, true); + _this.checkIndexBuffer(2000); + _this.initBounds(); + return _this; + } + TileRenderer.prototype.initBounds = function () { + if (Constant.boundCountPerBuffer <= 1) { + return; + } + var maxTextures = Constant.maxTextures; + for (var i = 0; i < maxTextures; i++) { + var resource = new MultiTextureResource(Constant); + var baseTex = new core.BaseTexture(resource); + baseTex.scaleMode = Constant.SCALE_MODE; + baseTex.wrapMode = constants.WRAP_MODES.CLAMP; + this.texResources.push(resource); + } + }; + TileRenderer.prototype.bindTexturesWithoutRT = function (renderer, shader, textures) { + var samplerSize = shader.uniforms.uSamplerSize; + this.texLoc.length = 0; + for (var i = 0; i < textures.length; i++) { + var texture = textures[i]; + if (!texture || !texture.valid) { return; } - var len = totalIndices; - while (len < totalIndices) { - len <<= 1; - } - this.ibLen = totalIndices; - this.indexBuffer.update(PIXI.utils.createIndicesForQuads(size, pixi_tilemap.Constant.use32bitIndex ? new Uint32Array(size * 6) : undefined)); - }; - TileRenderer.prototype.getShader = function () { - return this.rectShader; - }; - TileRenderer.prototype.destroy = function () { - _super.prototype.destroy.call(this); - this.rectShader = null; - }; - return TileRenderer; - }(PIXI.ObjectRenderer)); - pixi_tilemap.TileRenderer = TileRenderer; - PIXI.Renderer.registerPlugin('tilemap', TileRenderer); -})(pixi_tilemap || (pixi_tilemap = {})); -var pixi_tilemap; -(function (pixi_tilemap) { - var ZLayer = (function (_super) { - __extends(ZLayer, _super); - function ZLayer(tilemap, zIndex) { - var _this = _super.call(this) || this; - _this._lastAnimationFrame = -1; - _this.tilemap = tilemap; - _this.z = zIndex; - return _this; - } - ZLayer.prototype.clear = function () { - var layers = this.children; - for (var i = 0; i < layers.length; i++) - layers[i].clear(); - this._previousLayers = 0; - }; - ZLayer.prototype.cacheIfDirty = function () { - var tilemap = this.tilemap; - var layers = this.children; - var modified = this._previousLayers !== layers.length; - this._previousLayers = layers.length; - var buf = this.canvasBuffer; - var tempRender = this._tempRender; - if (!buf) { - buf = this.canvasBuffer = document.createElement('canvas'); - tempRender = this._tempRender = new PIXI.CanvasRenderer(100, 100, { view: buf }); - tempRender.context = tempRender.rootContext; - tempRender.plugins.tilemap.dontUseTransform = true; - } - if (buf.width !== tilemap._layerWidth || - buf.height !== tilemap._layerHeight) { - buf.width = tilemap._layerWidth; - buf.height = tilemap._layerHeight; - modified = true; - } - var i; - if (!modified) { - for (i = 0; i < layers.length; i++) { - if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) { - modified = true; - break; - } + renderer.texture.bind(textures[i], i); + samplerSize[i * 2] = 1.0 / textures[i].baseTexture.width; + samplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height; + } + shader.uniforms.uSamplerSize = samplerSize; + }; + TileRenderer.prototype.bindTextures = function (renderer, shader, textures) { + var len = textures.length; + var maxTextures = Constant.maxTextures; + if (len > Constant.boundCountPerBuffer * maxTextures) { + return; + } + if (Constant.boundCountPerBuffer <= 1) { + this.bindTexturesWithoutRT(renderer, shader, textures); + return; + } + var i = 0; + for (; i < len; i++) { + var texture = textures[i]; + if (!texture || !texture.valid) + continue; + var multi = this.texResources[i >> 2]; + multi.setTexture(i & 3, texture); + } + var gltsUsed = (i + 3) >> 2; + for (i = 0; i < gltsUsed; i++) { + renderer.texture.bind(this.texResources[i].baseTex, i); + } + }; + TileRenderer.prototype.start = function () { + }; + TileRenderer.prototype.createVb = function () { + var geom = new RectTileGeom(); + geom.addIndex(this.indexBuffer); + geom.lastTimeAccess = Date.now(); + return geom; + }; + TileRenderer.prototype.checkIndexBuffer = function (size, vb) { + var totalIndices = size * 6; + if (totalIndices <= this.ibLen) { + return; + } + this.ibLen = totalIndices; + this.indexBuffer.update(PIXI.utils.createIndicesForQuads(size, Constant.use32bitIndex ? new Uint32Array(size * 6) : undefined)); + }; + TileRenderer.prototype.getShader = function () { + return this.rectShader; + }; + TileRenderer.prototype.destroy = function () { + _super.prototype.destroy.call(this); + this.rectShader = null; + }; + return TileRenderer; +}(core.ObjectRenderer)); +core.Renderer.registerPlugin('tilemap', TileRenderer); + +var ZLayer = (function (_super) { + __extends(ZLayer, _super); + function ZLayer(tilemap, zIndex) { + var _this = _super.call(this) || this; + _this._lastAnimationFrame = -1; + _this.tilemap = tilemap; + _this.z = zIndex; + return _this; + } + ZLayer.prototype.clear = function () { + var layers = this.children; + for (var i = 0; i < layers.length; i++) + layers[i].clear(); + this._previousLayers = 0; + }; + ZLayer.prototype.cacheIfDirty = function () { + var tilemap = this.tilemap; + var layers = this.children; + var modified = this._previousLayers !== layers.length; + this._previousLayers = layers.length; + var buf = this.canvasBuffer; + var tempRender = this._tempRender; + if (!buf) { + buf = this.canvasBuffer = document.createElement('canvas'); + tempRender = this._tempRender = new PIXI.CanvasRenderer(100, 100, { view: buf }); + tempRender.context = tempRender.rootContext; + tempRender.plugins.tilemap.dontUseTransform = true; + } + if (buf.width !== tilemap._layerWidth || + buf.height !== tilemap._layerHeight) { + buf.width = tilemap._layerWidth; + buf.height = tilemap._layerHeight; + modified = true; + } + var i; + if (!modified) { + for (i = 0; i < layers.length; i++) { + if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) { + modified = true; + break; } } - this._lastAnimationFrame = tilemap.animationFrame; - if (modified) { - if (tilemap._hackRenderer) { - tilemap._hackRenderer(tempRender); - } - tempRender.context.clearRect(0, 0, buf.width, buf.height); - for (i = 0; i < layers.length; i++) { - layers[i].clearModify(); - layers[i].renderCanvas(tempRender); - } + } + this._lastAnimationFrame = tilemap.animationFrame; + if (modified) { + if (tilemap._hackRenderer) { + tilemap._hackRenderer(tempRender); } - this.layerTransform = this.worldTransform; + tempRender.context.clearRect(0, 0, buf.width, buf.height); for (i = 0; i < layers.length; i++) { - this.layerTransform = layers[i].worldTransform; - break; + layers[i].clearModify(); + layers[i].renderCanvas(tempRender); } - }; - ZLayer.prototype.renderCanvas = function (renderer) { - this.cacheIfDirty(); - var wt = this.layerTransform; - renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution); - var tilemap = this.tilemap; - renderer.context.drawImage(this.canvasBuffer, 0, 0); - }; - return ZLayer; - }(PIXI.Container)); - pixi_tilemap.ZLayer = ZLayer; -})(pixi_tilemap || (pixi_tilemap = {})); + } + this.layerTransform = this.worldTransform; + for (i = 0; i < layers.length; i++) { + this.layerTransform = layers[i].worldTransform; + break; + } + }; + ZLayer.prototype.renderCanvas = function (renderer) { + this.cacheIfDirty(); + var wt = this.layerTransform; + renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution); + var tilemap = this.tilemap; + renderer.context.drawImage(this.canvasBuffer, 0, 0); + }; + return ZLayer; +}(display.Container)); + var pixi_tilemap; (function (pixi_tilemap) { PIXI.tilemap = pixi_tilemap; })(pixi_tilemap || (pixi_tilemap = {})); -var pixi_tilemap; -(function (pixi_tilemap) { - var shaderGenerator; - (function (shaderGenerator) { - function fillSamplers(shader, maxTextures) { - var sampleValues = []; - for (var i = 0; i < maxTextures; i++) { - sampleValues[i] = i; - } - shader.uniforms.uSamplers = sampleValues; - var samplerSize = []; - for (var i = 0; i < maxTextures; i++) { - samplerSize.push(1.0 / pixi_tilemap.Constant.bufferSize); - samplerSize.push(1.0 / pixi_tilemap.Constant.bufferSize); - } - shader.uniforms.uSamplerSize = samplerSize; - } - shaderGenerator.fillSamplers = fillSamplers; - function generateFragmentSrc(maxTextures, fragmentSrc) { - return fragmentSrc.replace(/%count%/gi, maxTextures + "") - .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures)); - } - shaderGenerator.generateFragmentSrc = generateFragmentSrc; - function generateSampleSrc(maxTextures) { - var src = ''; - src += '\n'; - src += '\n'; - src += 'if(vTextureId <= -1.0) {'; - src += '\n\tcolor = shadowColor;'; - src += '\n}'; - for (var i = 0; i < maxTextures; i++) { - src += '\nelse '; - if (i < maxTextures - 1) { - src += 'if(textureId == ' + i + '.0)'; - } - src += '\n{'; - src += '\n\tcolor = texture2D(uSamplers[' + i + '], textureCoord * uSamplerSize[' + i + ']);'; - src += '\n}'; - } - src += '\n'; - src += '\n'; - return src; - } - shaderGenerator.generateSampleSrc = generateSampleSrc; - })(shaderGenerator = pixi_tilemap.shaderGenerator || (pixi_tilemap.shaderGenerator = {})); -})(pixi_tilemap || (pixi_tilemap = {})); -//# sourceMappingURL=pixi-tilemap.js.map \ No newline at end of file + +var pixi_tilemap$1 = { + CanvasTileRenderer: CanvasTileRenderer, + CompositeRectTileLayer: CompositeRectTileLayer, + Constant: Constant, + GraphicsLayer: GraphicsLayer, + MultiTextureResource: MultiTextureResource, + RectTileLayer: RectTileLayer, + TilemapShader: TilemapShader, + RectTileShader: RectTileShader, + RectTileGeom: RectTileGeom, + TileRenderer: TileRenderer, + ZLayer: ZLayer, +}; + +exports.CanvasTileRenderer = CanvasTileRenderer; +exports.CompositeRectTileLayer = CompositeRectTileLayer; +exports.Constant = Constant; +exports.GraphicsLayer = GraphicsLayer; +exports.MultiTextureResource = MultiTextureResource; +exports.POINT_STRUCT_SIZE = POINT_STRUCT_SIZE; +exports.RectTileGeom = RectTileGeom; +exports.RectTileLayer = RectTileLayer; +exports.RectTileShader = RectTileShader; +exports.TileRenderer = TileRenderer; +exports.TilemapShader = TilemapShader; +exports.ZLayer = ZLayer; +exports.fillSamplers = fillSamplers; +exports.generateFragmentSrc = generateFragmentSrc; +exports.generateSampleSrc = generateSampleSrc; +exports.pixi_tilemap = pixi_tilemap$1; +//# sourceMappingURL=pixi-tilemap.js.map diff --git a/dist/pixi-tilemap.js.map b/dist/pixi-tilemap.js.map index 6b0dc30d..59bf8461 100644 --- a/dist/pixi-tilemap.js.map +++ b/dist/pixi-tilemap.js.map @@ -1 +1 @@ -{"version":3,"file":"pixi-tilemap.js","sourceRoot":"","sources":["../src/CanvasTileRenderer.ts","../src/CompositeRectTileLayer.ts","../src/Constant.ts","../src/GraphicsLayer.ts","../src/MultiTextureResource.ts","../src/RectTileLayer.ts","../src/RectTileShader.ts","../src/TileRenderer.ts","../src/ZLayer.ts","../src/exporter.ts","../src/shaderGenerator.ts"],"names":[],"mappings":"AAAA,IAAU,YAAY,CAiBrB;AAjBD,WAAU,YAAY;IAElB;QAKI,4BAAY,QAAa;YAHzB,aAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAClB,qBAAgB,GAAG,KAAK,CAAC;YAGrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC3B,CAAC;QACL,yBAAC;IAAD,CAAC,AATD,IASC;IATY,+BAAkB,qBAS9B,CAAA;IAED,IAAM,EAAE,GAAI,IAAY,CAAC,cAAc,CAAC;IACxC,IAAI,EAAE,EAAE;QACJ,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;KACpD;AACL,CAAC,EAjBS,YAAY,KAAZ,YAAY,QAiBrB;;;;;;;;;;;;;;ACfD,IAAU,YAAY,CAqOrB;AArOD,WAAU,YAAY;IAElB;QAA4C,0CAAc;QAEtD,gCAAY,MAAe,EAAE,OAA6B,EAAE,WAAoB;YAAhF,YACI,iBAAO,SAEV;YAQD,wBAAkB,GAAG,CAAC,CAAC;YACvB,iBAAW,GAAG,IAAI,YAAY,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YACrD,gBAAU,GAAgB,IAAI,CAAC;YAC/B,gBAAU,GAAkB,IAAI,CAAC;YAZ7B,KAAI,CAAC,UAAU,CAAC,KAAK,CAAC,KAAI,EAAE,SAAS,CAAC,CAAC;;QAC3C,CA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mB,EAAE,WAAmB;YACxE,OAAO,WAAW,CAAC,OAAO,CAAC,WAAW,EAAE,WAAW,GAAG,EAAE,CAAC;iBACpD,OAAO,CAAC,aAAa,EAAE,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,CAAC;QACrE,CAAC;QAHe,mCAAmB,sBAGlC,CAAA;QAED,SAAgB,iBAAiB,CAAC,WAAmB;YACjD,IAAI,GAAG,GAAG,EAAE,CAAC;YAEb,GAAG,IAAI,IAAI,CAAC;YACZ,GAAG,IAAI,IAAI,CAAC;YAEZ,GAAG,IAAI,0BAA0B,CAAC;YAClC,GAAG,IAAI,0BAA0B,CAAC;YAClC,GAAG,IAAI,KAAK,CAAC;YAEb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE,EACpC;gBACI,GAAG,IAAI,SAAS,CAAC;gBAEjB,IAAG,CAAC,GAAG,WAAW,GAAC,CAAC,EACpB;oBACI,GAAG,IAAI,kBAAkB,GAAG,CAAC,GAAG,KAAK,CAAC;iBACzC;gBAED,GAAG,IAAI,KAAK,CAAC;gBACb,GAAG,IAAI,kCAAkC,GAAC,CAAC,GAAC,iCAAiC,GAAC,CAAC,GAAC,KAAK,CAAC;gBACtF,GAAG,IAAI,KAAK,CAAC;aAChB;YAED,GAAG,IAAI,IAAI,CAAC;YACZ,GAAG,IAAI,IAAI,CAAC;YAEZ,OAAO,GAAG,CAAC;QACf,CAAC;QA5Be,iCAAiB,oBA4BhC,CAAA;IAEL,CAAC,EArDsB,eAAe,GAAf,4BAAe,KAAf,4BAAe,QAqDrC;AAAD,CAAC,EArDS,YAAY,KAAZ,YAAY,QAqDrB","sourcesContent":["namespace pixi_tilemap {\r\n\r\n export class CanvasTileRenderer {\r\n renderer: any;\r\n tileAnim = [0, 0];\r\n dontUseTransform = false;\r\n\r\n constructor(renderer: any) {\r\n this.renderer = renderer;\r\n this.tileAnim = [0, 0];\r\n }\r\n }\r\n\r\n const cr = (PIXI as any).CanvasRenderer;\r\n if (cr) {\r\n cr.registerPlugin('tilemap', CanvasTileRenderer);\r\n }\r\n}\r\n","/// \r\n\r\nnamespace pixi_tilemap {\r\n\r\n export class CompositeRectTileLayer extends PIXI.Container {\r\n\r\n constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\r\n super();\r\n this.initialize.apply(this, arguments);\r\n }\r\n\r\n updateTransform() {\r\n (this as any).displayObjectUpdateTransform();\r\n }\r\n\r\n z: number;\r\n zIndex: number;\r\n modificationMarker = 0;\r\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\r\n _globalMat: PIXI.Matrix = null;\r\n _lastLayer: RectTileLayer = null;\r\n\r\n texPerChild: number;\r\n\r\n initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\r\n if (texPerChild as any === true) {\r\n //old format, ignore it!\r\n texPerChild = 0;\r\n }\r\n this.z = this.zIndex = zIndex;\r\n this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures;\r\n if (bitmaps) {\r\n this.setBitmaps(bitmaps);\r\n }\r\n }\r\n\r\n setBitmaps(bitmaps: Array) {\r\n let texPerChild = this.texPerChild;\r\n let len1 = this.children.length;\r\n let len2 = Math.ceil(bitmaps.length / texPerChild);\r\n let i: number;\r\n for (i = 0; i < len1; i++) {\r\n (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);\r\n }\r\n for (i = len1; i < len2; i++) {\r\n let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild));\r\n layer.compositeParent = true;\r\n layer.offsetX = Constant.boundSize;\r\n layer.offsetY = Constant.boundSize;\r\n this.addChild(layer);\r\n }\r\n }\r\n\r\n clear() {\r\n for (let i = 0; i < this.children.length; i++) {\r\n (this.children[i] as RectTileLayer).clear();\r\n }\r\n this.modificationMarker = 0;\r\n }\r\n\r\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this {\r\n const childIndex: number = textureIndex / this.texPerChild >> 0;\r\n const textureId: number = textureIndex % this.texPerChild;\r\n\r\n if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) {\r\n this._lastLayer = (this.children[childIndex] as RectTileLayer);\r\n this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight);\r\n } else {\r\n this._lastLayer = null;\r\n }\r\n\r\n return this;\r\n }\r\n\r\n tileRotate(rotate: number): this {\r\n if (this._lastLayer)\r\n {\r\n this._lastLayer.tileRotate(rotate);\r\n }\r\n return this;\r\n }\r\n\r\n tileAnimX(offset: number, count: number): this {\r\n if (this._lastLayer)\r\n {\r\n this._lastLayer.tileAnimX(offset, count);\r\n }\r\n return this;\r\n }\r\n\r\n tileAnimY(offset: number, count: number): this {\r\n if (this._lastLayer)\r\n {\r\n this._lastLayer.tileAnimY(offset, count);\r\n }\r\n return this;\r\n }\r\n\r\n addFrame(texture_: PIXI.Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this {\r\n let texture: PIXI.Texture;\r\n let layer: RectTileLayer = null;\r\n let ind: number = 0;\r\n let children = this.children;\r\n\r\n this._lastLayer = null;\r\n if (typeof texture_ === \"number\") {\r\n let childIndex = texture_ / this.texPerChild >> 0;\r\n layer = children[childIndex] as RectTileLayer;\r\n\r\n if (!layer) {\r\n layer = children[0] as RectTileLayer;\r\n if (!layer) {\r\n return this;\r\n }\r\n ind = 0;\r\n } else {\r\n ind = texture_ % this.texPerChild;\r\n }\r\n\r\n texture = layer.textures[ind];\r\n } else {\r\n if (typeof texture_ === \"string\") {\r\n texture = PIXI.Texture.from(texture_);\r\n } else {\r\n texture = texture_ as PIXI.Texture;\r\n }\r\n\r\n for (let i = 0; i < children.length; i++) {\r\n let child = children[i] as RectTileLayer;\r\n let tex = child.textures;\r\n for (let j = 0; j < tex.length; j++) {\r\n if (tex[j].baseTexture === texture.baseTexture) {\r\n layer = child;\r\n ind = j;\r\n break;\r\n }\r\n }\r\n if (layer) {\r\n break;\r\n }\r\n }\r\n\r\n if (!layer) {\r\n for (let i = 0; i < children.length; i++) {\r\n let child = children[i] as RectTileLayer;\r\n if (child.textures.length < this.texPerChild) {\r\n layer = child;\r\n ind = child.textures.length;\r\n child.textures.push(texture);\r\n break;\r\n }\r\n }\r\n if (!layer) {\r\n layer = new RectTileLayer(this.zIndex, texture);\r\n layer.compositeParent = true;\r\n layer.offsetX = Constant.boundSize;\r\n layer.offsetY = Constant.boundSize;\r\n children.push(layer);\r\n ind = 0;\r\n }\r\n }\r\n }\r\n\r\n this._lastLayer = layer;\r\n layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight);\r\n return this;\r\n }\r\n\r\n renderCanvas(renderer: any) {\r\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\r\n return;\r\n }\r\n let plugin = renderer.plugins.tilemap;\r\n if (!plugin.dontUseTransform) {\r\n let wt = this.worldTransform;\r\n renderer.context.setTransform(\r\n wt.a,\r\n wt.b,\r\n wt.c,\r\n wt.d,\r\n wt.tx * renderer.resolution,\r\n wt.ty * renderer.resolution\r\n );\r\n }\r\n let layers = this.children;\r\n for (let i = 0; i < layers.length; i++) {\r\n (layers[i] as RectTileLayer).renderCanvasCore(renderer);\r\n }\r\n }\r\n\r\n render(renderer: PIXI.Renderer) {\r\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\r\n return;\r\n }\r\n let plugin = (renderer.plugins as any)['tilemap'];\r\n let shader = plugin.getShader();\r\n renderer.batch.setObjectRenderer(plugin);\r\n //TODO: dont create new array, please\r\n this._globalMat = shader.uniforms.projTransMatrix;\r\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\r\n shader.uniforms.shadowColor = this.shadowColor;\r\n shader.uniforms.animationFrame = plugin.tileAnim;\r\n renderer.shader.bind(shader, false);\r\n let layers = this.children;\r\n for (let i = 0; i < layers.length; i++) {\r\n (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin);\r\n }\r\n }\r\n\r\n isModified(anim: boolean) {\r\n let layers = this.children;\r\n if (this.modificationMarker !== layers.length) {\r\n return true;\r\n }\r\n for (let i = 0; i < layers.length; i++) {\r\n if ((layers[i] as RectTileLayer).isModified(anim)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n\r\n clearModify() {\r\n let layers = this.children;\r\n this.modificationMarker = layers.length;\r\n for (let i = 0; i < layers.length; i++) {\r\n (layers[i] as RectTileLayer).clearModify();\r\n }\r\n }\r\n }\r\n\r\n}\r\n","namespace pixi_tilemap {\r\n\r\n export const Constant = {\r\n maxTextures: 16,\r\n bufferSize: 2048,\r\n boundSize: 1024,\r\n boundCountPerBuffer: 1,\r\n use32bitIndex: false,\r\n SCALE_MODE: PIXI.SCALE_MODES.LINEAR,\r\n DO_CLEAR: true\r\n }\r\n\r\n}\r\n","namespace pixi_tilemap {\r\n class GraphicsLayer extends PIXI.Graphics {\r\n constructor(zIndex: number) {\r\n super();\r\n this.zIndex = zIndex;\r\n }\r\n\r\n renderCanvas(renderer: any) {\r\n let wt: PIXI.Matrix = null;\r\n if (renderer.plugins.tilemap.dontUseTransform) {\r\n wt = this.transform.worldTransform;\r\n this.transform.worldTransform = PIXI.Matrix.IDENTITY;\r\n }\r\n renderer.plugins.graphics.render(this);\r\n if (renderer.plugins.tilemap.dontUseTransform) {\r\n this.transform.worldTransform = wt;\r\n }\r\n renderer.context.globalAlpha = 1.0;\r\n }\r\n\r\n // renderWebGL(renderer: PIXI.Renderer) {\r\n // if (!this._webGL[renderer.CONTEXT_UID])\r\n // this.dirty++;\r\n // super.renderWebGL(renderer)\r\n // }\r\n\r\n isModified(anim: boolean): boolean {\r\n return false;\r\n }\r\n\r\n clearModify() {\r\n }\r\n }\r\n\r\n}\r\n","namespace pixi_tilemap {\r\n\texport interface IMultiTextureOptions {\r\n\t\tboundCountPerBuffer: number;\r\n\t\tboundSize: number;\r\n\t\tbufferSize: number;\r\n\t\tDO_CLEAR?: boolean;\r\n\t}\r\n\r\n\texport class MultiTextureResource extends PIXI.resources.Resource {\r\n\t\tconstructor(options: IMultiTextureOptions) {\r\n\t\t\tsuper(options.bufferSize, options.bufferSize);\r\n\r\n\t\t\tconst bounds = this.boundSprites;\r\n\t\t\tconst dirties = this.dirties;\r\n\t\t\tthis.boundSize = options.boundSize;\r\n\t\t\tfor (let j = 0; j < options.boundCountPerBuffer; j++) {\r\n\t\t\t\tconst spr = new PIXI.Sprite();\r\n\t\t\t\tspr.position.x = options.boundSize * (j & 1);\r\n\t\t\t\tspr.position.y = options.boundSize * (j >> 1);\r\n\t\t\t\tbounds.push(spr);\r\n\t\t\t\tdirties.push(0);\r\n\t\t\t}\r\n\t\t\tthis.DO_CLEAR = !!options.DO_CLEAR;\r\n\t\t}\r\n\r\n\t\tDO_CLEAR = false;\r\n\t\tboundSize: number = 0;\r\n\t\t_clearBuffer: Uint8Array = null;\r\n\r\n\t\tbind(baseTexture: PIXI.BaseTexture) {\r\n\t\t\tif (this.baseTex) {\r\n\t\t\t\tthrow new Error('Only one baseTexture is allowed for this resource!')\r\n\t\t\t}\r\n\t\t\tthis.baseTex = baseTexture;\r\n\t\t\tsuper.bind(baseTexture);\r\n\t\t}\r\n\r\n\t\tbaseTex: PIXI.BaseTexture = null;\r\n\t\tboundSprites: Array = [];\r\n\t\tdirties: Array = [];\r\n\r\n\t\tsetTexture(ind: number, texture: PIXI.Texture) {\r\n\t\t\tconst spr = this.boundSprites[ind];\r\n\t\t\tif (spr.texture.baseTexture === texture.baseTexture) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tspr.texture = texture;\r\n\t\t\tthis.baseTex.update();\r\n\t\t\tthis.dirties[ind] = (this.baseTex as any).dirtyId;\r\n\t\t}\r\n\r\n\t\tupload(renderer: PIXI.Renderer, texture: PIXI.BaseTexture, glTexture: PIXI.GLTexture) {\r\n\t\t\tconst { gl } = renderer as any;\r\n\r\n\t\t\tconst {width, height} = this;\r\n\t\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined ||\r\n texture.alphaMode === PIXI.ALPHA_MODES.UNPACK);\r\n\r\n\t\t\tif (glTexture.dirtyId < 0) {\r\n\t\t\t\t(glTexture as any).width = width;\r\n\t\t\t\t(glTexture as any).height = height;\r\n\r\n\t\t\t\tgl.texImage2D(texture.target, 0,\r\n\t\t\t\t\ttexture.format,\r\n\t\t\t\t\twidth,\r\n\t\t\t\t\theight,\r\n\t\t\t\t\t0,\r\n\t\t\t\t\ttexture.format,\r\n\t\t\t\t\ttexture.type,\r\n\t\t\t\t\tnull);\r\n\t\t\t}\r\n\r\n\t\t\tconst doClear = this.DO_CLEAR;\r\n\t\t\tif (doClear && !this._clearBuffer) {\r\n\t\t\t\tthis._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4);\r\n\t\t\t}\r\n\r\n\t\t\tconst bounds = this.boundSprites;\r\n\t\t\tfor (let i = 0; i < bounds.length; i++) {\r\n\t\t\t\tconst spr = bounds[i];\r\n\t\t\t\tconst tex = spr.texture.baseTexture;\r\n\t\t\t\tif (glTexture.dirtyId >= this.dirties[i]) {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\tconst res = tex.resource as any;\r\n\t\t\t\tif (!tex.valid || !res || !res.source) {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\tif (doClear && (tex.width < this.boundSize || tex.height < this.boundSize))\r\n\t\t\t\t{\r\n\t\t\t\t\tgl.texSubImage2D(texture.target, 0,\r\n\t\t\t\t\t\tspr.position.x,\r\n\t\t\t\t\t\tspr.position.y,\r\n\t\t\t\t\t\tthis.boundSize,\r\n\t\t\t\t\t\tthis.boundSize,\r\n\t\t\t\t\t\ttexture.format,\r\n\t\t\t\t\t\ttexture.type,\r\n\t\t\t\t\t\tthis._clearBuffer);\r\n\t\t\t\t}\r\n\t\t\t\tgl.texSubImage2D(texture.target, 0,\r\n\t\t\t\t\tspr.position.x,\r\n\t\t\t\t\tspr.position.y,\r\n\t\t\t\t\ttexture.format,\r\n\t\t\t\t\ttexture.type,\r\n\t\t\t\t\tres.source);\r\n\t\t\t}\r\n\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}\r\n}\r\n","namespace pixi_tilemap {\r\n import groupD8 = PIXI.groupD8;\r\n export const POINT_STRUCT_SIZE = 12;\r\n\r\n export class RectTileLayer extends PIXI.Container {\r\n constructor(zIndex: number, texture: PIXI.Texture | Array) {\r\n super();\r\n this.initialize(zIndex, texture);\r\n }\r\n\r\n zIndex = 0;\r\n modificationMarker = 0;\r\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\r\n _globalMat: PIXI.Matrix = null;\r\n\r\n pointsBuf: Array = [];\r\n hasAnim = false;\r\n textures: Array;\r\n\r\n offsetX = 0;\r\n offsetY = 0;\r\n compositeParent = false;\r\n\r\n initialize(zIndex: number, textures: PIXI.Texture | Array) {\r\n if (!textures) {\r\n textures = [];\r\n } else if (!(textures instanceof Array) && (textures as PIXI.Texture).baseTexture) {\r\n textures = [textures as PIXI.Texture];\r\n }\r\n this.textures = textures as Array;\r\n this.zIndex = zIndex;\r\n // this.visible = false;\r\n }\r\n\r\n clear() {\r\n this.pointsBuf.length = 0;\r\n this.modificationMarker = 0;\r\n this.hasAnim = false;\r\n }\r\n\r\n addFrame(texture_: PIXI.Texture | String | number, x: number, y: number, animX: number, animY: number) {\r\n let texture: PIXI.Texture;\r\n let textureIndex = 0;\r\n\r\n if (typeof texture_ === \"number\") {\r\n textureIndex = texture_;\r\n texture = this.textures[textureIndex];\r\n } else {\r\n if (typeof texture_ === \"string\") {\r\n texture = PIXI.Texture.from(texture_);\r\n } else {\r\n texture = texture_ as PIXI.Texture;\r\n }\r\n\r\n let found = false;\r\n let textureList = this.textures;\r\n for (let i = 0; i < textureList.length; i++) {\r\n if (textureList[i].baseTexture === texture.baseTexture) {\r\n textureIndex = i;\r\n found = true;\r\n break;\r\n }\r\n }\r\n\r\n if (!found) {\r\n // textureIndex = this.textures.length;\r\n // this.textures.push(texture);\r\n return false;\r\n }\r\n }\r\n\r\n this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate);\r\n return true;\r\n }\r\n\r\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number,\r\n animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this {\r\n let pb = this.pointsBuf;\r\n this.hasAnim = this.hasAnim || animX > 0 || animY > 0;\r\n pb.push(u);\r\n pb.push(v);\r\n pb.push(x);\r\n pb.push(y);\r\n pb.push(tileWidth);\r\n pb.push(tileHeight);\r\n pb.push(rotate);\r\n pb.push(animX | 0);\r\n pb.push(animY | 0);\r\n pb.push(textureIndex);\r\n pb.push(animCountX);\r\n pb.push(animCountY);\r\n\r\n return this;\r\n }\r\n\r\n tileRotate(rotate: number) {\r\n const pb = this.pointsBuf;\r\n pb[pb.length - 3] = rotate;\r\n }\r\n\r\n tileAnimX(offset: number, count: number) {\r\n const pb = this.pointsBuf;\r\n\r\n pb[pb.length - 5] = offset;\r\n pb[pb.length - 2] = count;\r\n }\r\n\r\n tileAnimY(offset: number, count: number) {\r\n const pb = this.pointsBuf;\r\n\r\n pb[pb.length - 4] = offset;\r\n pb[pb.length - 1] = count;\r\n }\r\n\r\n renderCanvas(renderer: any) {\r\n let plugin = renderer.plugins.tilemap;\r\n if (!plugin.dontUseTransform) {\r\n let wt = this.worldTransform;\r\n renderer.context.setTransform(\r\n wt.a,\r\n wt.b,\r\n wt.c,\r\n wt.d,\r\n wt.tx * renderer.resolution,\r\n wt.ty * renderer.resolution\r\n );\r\n }\r\n this.renderCanvasCore(renderer);\r\n }\r\n\r\n renderCanvasCore(renderer: any) {\r\n if (this.textures.length === 0) return;\r\n let points = this.pointsBuf;\r\n renderer.context.fillStyle = '#000000';\r\n for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) {\r\n let x1 = points[i], y1 = points[i + 1];\r\n let x2 = points[i + 2], y2 = points[i + 3];\r\n let w = points[i + 4];\r\n let h = points[i + 5];\r\n var rotate = points[i + 6];\r\n x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0];\r\n y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1];\r\n let textureIndex = points[i + 9];\r\n // canvas does not work with rotate yet\r\n if (textureIndex >= 0) {\r\n renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h);\r\n } else {\r\n renderer.context.globalAlpha = 0.5;\r\n renderer.context.fillRect(x2, y2, w, h);\r\n renderer.context.globalAlpha = 1;\r\n }\r\n }\r\n }\r\n\r\n vbId = 0;\r\n vb: RectTileGeom = null;\r\n vbBuffer: ArrayBuffer = null;\r\n vbArray: Float32Array = null;\r\n vbInts: Uint32Array = null;\r\n\r\n destroyVb() {\r\n if (this.vb) {\r\n this.vb.destroy();\r\n this.vb = null;\r\n }\r\n }\r\n\r\n render(renderer: PIXI.Renderer) {\r\n let plugin = (renderer.plugins as any)['tilemap'];\r\n let shader = plugin.getShader();\r\n renderer.batch.setObjectRenderer(plugin);\r\n this._globalMat = shader.uniforms.projTransMatrix;\r\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\r\n shader.uniforms.shadowColor = this.shadowColor;\r\n shader.uniforms.animationFrame = plugin.tileAnim;\r\n this.renderWebGLCore(renderer, plugin);\r\n }\r\n\r\n renderWebGLCore(renderer: PIXI.Renderer, plugin: TileRenderer) {\r\n let points = this.pointsBuf;\r\n if (points.length === 0) return;\r\n let rectsCount = points.length / POINT_STRUCT_SIZE;\r\n\r\n let shader = plugin.getShader();\r\n let textures = this.textures;\r\n if (textures.length === 0) return;\r\n\r\n plugin.bindTextures(renderer, shader, textures);\r\n renderer.shader.bind(shader, false);\r\n\r\n //lost context! recover!\r\n let vb = this.vb;\r\n if (!vb) {\r\n vb = plugin.createVb();\r\n this.vb = vb;\r\n this.vbId = (vb as any).id;\r\n this.vbBuffer = null;\r\n this.modificationMarker = 0;\r\n }\r\n\r\n plugin.checkIndexBuffer(rectsCount, vb);\r\n const boundCountPerBuffer = Constant.boundCountPerBuffer;\r\n\r\n let vertexBuf = vb.getBuffer('aVertexPosition');\r\n //if layer was changed, re-upload vertices\r\n let vertices = rectsCount * vb.vertPerQuad;\r\n if (vertices === 0) return;\r\n if (this.modificationMarker !== vertices) {\r\n this.modificationMarker = vertices;\r\n let vs = vb.stride * vertices;\r\n if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {\r\n //!@#$ happens, need resize\r\n let bk = vb.stride;\r\n while (bk < vs) {\r\n bk *= 2;\r\n }\r\n this.vbBuffer = new ArrayBuffer(bk);\r\n this.vbArray = new Float32Array(this.vbBuffer);\r\n this.vbInts = new Uint32Array(this.vbBuffer);\r\n vertexBuf.update(this.vbBuffer);\r\n }\r\n\r\n let arr = this.vbArray, ints = this.vbInts;\r\n //upload vertices!\r\n let sz = 0;\r\n //let tint = 0xffffffff;\r\n let textureId: number = 0;\r\n let shiftU: number = this.offsetX;\r\n let shiftV: number = this.offsetY;\r\n\r\n //let tint = 0xffffffff;\r\n let tint = -1;\r\n for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) {\r\n let eps = 0.5;\r\n if (this.compositeParent) {\r\n if (boundCountPerBuffer > 1) {\r\n //TODO: what if its more than 4?\r\n textureId = (points[i + 9] >> 2);\r\n shiftU = this.offsetX * (points[i + 9] & 1);\r\n shiftV = this.offsetY * ((points[i + 9] >> 1) & 1);\r\n } else {\r\n textureId = points[i + 9];\r\n shiftU = 0;\r\n shiftV = 0;\r\n }\r\n }\r\n let x = points[i + 2], y = points[i + 3];\r\n let w = points[i + 4], h = points[i + 5];\r\n let u = points[i] + shiftU, v = points[i + 1] + shiftV;\r\n let rotate = points[i + 6];\r\n\r\n const animX = points[i + 7], animY = points[i + 8];\r\n const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024;\r\n const animXEncoded = animX + (animWidth * 2048);\r\n const animYEncoded = animY + (animHeight * 2048);\r\n\r\n let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number;\r\n if (rotate === 0) {\r\n u0 = u;\r\n v0 = v;\r\n u1 = u + w;\r\n v1 = v;\r\n u2 = u + w;\r\n v2 = v + h;\r\n u3 = u;\r\n v3 = v + h;\r\n } else {\r\n let w2 = w / 2;\r\n let h2 = h / 2;\r\n if (rotate % 4 !== 0) {\r\n w2 = h / 2;\r\n h2 = w / 2;\r\n }\r\n const cX = u + w2;\r\n const cY = v + h2;\r\n\r\n rotate = groupD8.add(rotate, groupD8.NW);\r\n u0 = cX + (w2 * groupD8.uX(rotate));\r\n v0 = cY + (h2 * groupD8.uY(rotate));\r\n\r\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\r\n u1 = cX + (w2 * groupD8.uX(rotate));\r\n v1 = cY + (h2 * groupD8.uY(rotate));\r\n\r\n rotate = groupD8.add(rotate, 2);\r\n u2 = cX + (w2 * groupD8.uX(rotate));\r\n v2 = cY + (h2 * groupD8.uY(rotate));\r\n\r\n rotate = groupD8.add(rotate, 2);\r\n u3 = cX + (w2 * groupD8.uX(rotate));\r\n v3 = cY + (h2 * groupD8.uY(rotate));\r\n }\r\n\r\n arr[sz++] = x;\r\n arr[sz++] = y;\r\n arr[sz++] = u0;\r\n arr[sz++] = v0;\r\n arr[sz++] = u + eps;\r\n arr[sz++] = v + eps;\r\n arr[sz++] = u + w - eps;\r\n arr[sz++] = v + h - eps;\r\n arr[sz++] = animXEncoded;\r\n arr[sz++] = animYEncoded;\r\n arr[sz++] = textureId;\r\n arr[sz++] = x + w;\r\n arr[sz++] = y;\r\n arr[sz++] = u1;\r\n arr[sz++] = v1;\r\n arr[sz++] = u + eps;\r\n arr[sz++] = v + eps;\r\n arr[sz++] = u + w - eps;\r\n arr[sz++] = v + h - eps;\r\n arr[sz++] = animXEncoded;\r\n arr[sz++] = animYEncoded;\r\n arr[sz++] = textureId;\r\n arr[sz++] = x + w;\r\n arr[sz++] = y + h;\r\n arr[sz++] = u2;\r\n arr[sz++] = v2;\r\n arr[sz++] = u + eps;\r\n arr[sz++] = v + eps;\r\n arr[sz++] = u + w - eps;\r\n arr[sz++] = v + h - eps;\r\n arr[sz++] = animXEncoded;\r\n arr[sz++] = animYEncoded;\r\n arr[sz++] = textureId;\r\n arr[sz++] = x;\r\n arr[sz++] = y + h;\r\n arr[sz++] = u3;\r\n arr[sz++] = v3;\r\n arr[sz++] = u + eps;\r\n arr[sz++] = v + eps;\r\n arr[sz++] = u + w - eps;\r\n arr[sz++] = v + h - eps;\r\n arr[sz++] = animXEncoded;\r\n arr[sz++] = animYEncoded;\r\n arr[sz++] = textureId;\r\n }\r\n\r\n vertexBuf.update(arr);\r\n }\r\n\r\n (renderer.geometry as any).bind(vb, shader);\r\n renderer.geometry.draw(PIXI.DRAW_MODES.TRIANGLES, rectsCount * 6, 0);\r\n }\r\n\r\n isModified(anim: boolean) {\r\n if (this.modificationMarker !== this.pointsBuf.length ||\r\n anim && this.hasAnim) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n clearModify() {\r\n this.modificationMarker = this.pointsBuf.length;\r\n }\r\n\r\n destroy(options?: any) {\r\n super.destroy(options);\r\n this.destroyVb();\r\n }\r\n }\r\n\r\n}\r\n","namespace pixi_tilemap {\r\n\tlet rectShaderFrag = `\r\nvarying vec2 vTextureCoord;\r\nvarying vec4 vFrame;\r\nvarying float vTextureId;\r\nuniform vec4 shadowColor;\r\nuniform sampler2D uSamplers[%count%];\r\nuniform vec2 uSamplerSize[%count%];\r\n\r\nvoid main(void){\r\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\r\n float textureId = floor(vTextureId + 0.5);\r\n\r\n vec4 color;\r\n %forloop%\r\n gl_FragColor = color;\r\n}\r\n`;\r\n\r\n\tlet rectShaderVert = `\r\nattribute vec2 aVertexPosition;\r\nattribute vec2 aTextureCoord;\r\nattribute vec4 aFrame;\r\nattribute vec2 aAnim;\r\nattribute float aTextureId;\r\n\r\nuniform mat3 projTransMatrix;\r\nuniform vec2 animationFrame;\r\n\r\nvarying vec2 vTextureCoord;\r\nvarying float vTextureId;\r\nvarying vec4 vFrame;\r\n\r\nvoid main(void){\r\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\r\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\r\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\r\n\r\n vTextureCoord = aTextureCoord + animOffset;\r\n vFrame = aFrame + vec4(animOffset, animOffset);\r\n vTextureId = aTextureId;\r\n}\r\n`;\r\n\r\n\texport abstract class TilemapShader extends PIXI.Shader {\r\n\t\tmaxTextures = 0;\r\n\r\n\t\tconstructor(maxTextures: number, shaderVert: string, shaderFrag: string) {\r\n\t\t\tsuper(\r\n\t\t\t\tnew PIXI.Program(\r\n\t\t\t\t\tshaderVert,\r\n\t\t\t\t\tshaderFrag),\r\n\t\t\t\t{\r\n\t\t\t\t\tanimationFrame: new Float32Array(2),\r\n\t\t\t\t\tuSamplers: [],\r\n\t\t\t\t\tuSamplerSize: [],\r\n\t\t\t\t\tprojTransMatrix: new PIXI.Matrix()\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t\tthis.maxTextures = maxTextures;\r\n\t\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\r\n\t\t}\r\n\t}\r\n\r\n\texport class RectTileShader extends TilemapShader {\r\n\t\tconstructor(maxTextures: number) {\r\n\t\t\tsuper(\r\n\t\t\t\tmaxTextures,\r\n\t\t\t\trectShaderVert,\r\n\t\t\t\tshaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)\r\n\t\t\t);\r\n\t\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\r\n\t\t}\r\n\t}\r\n\r\n\texport class RectTileGeom extends PIXI.Geometry {\r\n\t\tvertSize = 11;\r\n\t\tvertPerQuad = 4;\r\n\t\tstride = this.vertSize * 4;\r\n\t\tlastTimeAccess = 0;\r\n\t\tconstructor() {\r\n\t\t\tsuper();\r\n\t\t\tconst buf = this.buf = new PIXI.Buffer(new Float32Array(2), true, false);\r\n\t\t\tthis.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0)\r\n\t\t\t\t.addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4)\r\n\t\t\t\t.addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4)\r\n\t\t\t\t.addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4)\r\n\t\t\t\t.addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4);\r\n\t\t}\r\n\r\n\t\tbuf: PIXI.Buffer;\r\n\t}\r\n}\r\n","namespace pixi_tilemap {\r\n\t/*\r\n\t * Renderer for rectangle tiles.\r\n\t *\r\n\t * @class\r\n\t * @memberof PIXI.tilemap\r\n\t * @extends PIXI.ObjectRenderer\r\n\t * @param renderer {PIXI.WebGLRenderer} The renderer this sprite batch works for.\r\n\t */\r\n\r\n\texport class TileRenderer extends PIXI.ObjectRenderer {\r\n\t\trenderer: PIXI.Renderer;\r\n\t\tgl: WebGLRenderingContext;\r\n\t\tsn: number = -1;\r\n\t\tindexBuffer: PIXI.Buffer = null;\r\n\t\tibLen: number = 0;\r\n\t\ttileAnim = [0, 0];\r\n\t\ttexLoc: Array = [];\r\n\r\n\t\trectShader: RectTileShader;\r\n\t\ttexResources: Array = [];\r\n\r\n\t\tconstructor(renderer: PIXI.Renderer) {\r\n\t\t\tsuper(renderer);\r\n\t\t\tthis.rectShader = new RectTileShader(Constant.maxTextures);\r\n\t\t\tthis.indexBuffer = new PIXI.Buffer(undefined, true, true);\r\n\t\t\tthis.checkIndexBuffer(2000);\r\n\t\t\tthis.initBounds();\r\n\t\t}\r\n\r\n\t\tinitBounds() {\r\n\t\t\tif (Constant.boundCountPerBuffer <= 1) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tconst maxTextures = Constant.maxTextures;\r\n\t\t\tfor (let i = 0; i < maxTextures; i++) {\r\n\t\t\t\tconst resource = new MultiTextureResource(Constant);\r\n\t\t\t\tconst baseTex = new PIXI.BaseTexture(resource);\r\n\t\t\t\tbaseTex.scaleMode = Constant.SCALE_MODE;\r\n\t\t\t\tbaseTex.wrapMode = PIXI.WRAP_MODES.CLAMP;\r\n\t\t\t\tthis.texResources.push(resource);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tbindTexturesWithoutRT(renderer: PIXI.Renderer, shader: TilemapShader, textures: Array) {\r\n\t\t\tlet samplerSize: Array = shader.uniforms.uSamplerSize;\r\n\t\t\tthis.texLoc.length = 0;\r\n\t\t\tfor (let i = 0; i < textures.length; i++) {\r\n\t\t\t\tconst texture = textures[i];\r\n\t\t\t\tif (!texture || !texture.valid) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\trenderer.texture.bind(textures[i], i);\r\n\t\t\t\t//TODO: add resolution here\r\n\t\t\t\tsamplerSize[i * 2] = 1.0 / textures[i].baseTexture.width;\r\n\t\t\t\tsamplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height;\r\n\t\t\t}\r\n\t\t\tshader.uniforms.uSamplerSize = samplerSize;\r\n\t\t}\r\n\r\n\t\tbindTextures(renderer: PIXI.Renderer, shader: TilemapShader, textures: Array) {\r\n\t\t\tconst len = textures.length;\r\n\t\t\tconst maxTextures = Constant.maxTextures;\r\n\t\t\tif (len > Constant.boundCountPerBuffer * maxTextures) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tif (Constant.boundCountPerBuffer <= 1) {\r\n\t\t\t\tthis.bindTexturesWithoutRT(renderer, shader, textures);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tlet i = 0;\r\n\t\t\tfor (; i < len; i++) {\r\n\t\t\t\tconst texture = textures[i];\r\n\t\t\t\tif (!texture || !texture.valid) continue;\r\n\t\t\t\tconst multi = this.texResources[i >> 2];\r\n\t\t\t\tmulti.setTexture(i & 3, texture);\r\n\t\t\t}\r\n\r\n\t\t\tlet gltsUsed = (i + 3) >> 2;\r\n\t\t\tfor (i = 0; i < gltsUsed; i++) {\r\n\t\t\t\t//remove \"i, true\" after resolving a bug\r\n\t\t\t\trenderer.texture.bind(this.texResources[i].baseTex, i);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tstart() {\r\n\t\t\t//sorry, nothing\r\n\t\t}\r\n\r\n\t\tcreateVb() {\r\n\t\t\tconst geom = new RectTileGeom();\r\n\t\t\tgeom.addIndex(this.indexBuffer);\r\n\t\t\tgeom.lastTimeAccess = Date.now();\r\n\t\t\treturn geom;\r\n\t\t}\r\n\r\n\t\tcheckIndexBuffer(size: number, vb: RectTileGeom = null) {\r\n\t\t\tconst totalIndices = size * 6;\r\n\r\n\t\t\tif (totalIndices <= this.ibLen) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tlet len = totalIndices;\r\n\t\t\twhile (len < totalIndices) {\r\n\t\t\t\tlen <<= 1;\r\n\t\t\t}\r\n\r\n\t\t\tthis.ibLen = totalIndices;\r\n\t\t\tthis.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size,\r\n Constant.use32bitIndex ? new Uint32Array(size * 6) : undefined));\r\n\r\n\t\t\t// \tTODO: create new index buffer instead?\r\n\t\t\t// if (vb) {\r\n\t\t\t// \tconst curIndex = vb.getIndex();\r\n\t\t\t// \tif (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) {\r\n\t\t\t// \t\tthis.swapIndex(vb, this.indexBuffer);\r\n\t\t\t// \t}\r\n\t\t\t// }\r\n\t\t}\r\n\r\n\t\t// swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) {\r\n\t\t\t// let buffers = (geom as any).buffers;\r\n\t\t\t// const oldIndex = geom.getIndex();\r\n\t\t\t// let ind = buffers.indexOf(oldIndex);\r\n\t\t\t// if (ind >= 0) {\r\n\t\t\t// \tbuffers.splice(ind, 1);\r\n\t\t\t// }\r\n\t\t\t// geom.addIndex(indexBuf);\r\n\t\t// }\r\n\r\n\t\tgetShader(): TilemapShader {\r\n\t\t\treturn this.rectShader;\r\n\t\t}\r\n\r\n\t\tdestroy() {\r\n\t\t\tsuper.destroy();\r\n\t\t\t// this.rectShader.destroy();\r\n\t\t\tthis.rectShader = null;\r\n\t\t}\r\n\t}\r\n\r\n\tPIXI.Renderer.registerPlugin('tilemap', TileRenderer as any);\r\n}\r\n","namespace pixi_tilemap {\r\n\r\n export class ZLayer extends PIXI.Container {\r\n\r\n constructor(tilemap: PIXI.Container, zIndex: number) {\r\n super();\r\n this.tilemap = tilemap;\r\n this.z = zIndex;\r\n }\r\n\r\n tilemap: any;\r\n z: number;\r\n zIndex: number;\r\n _previousLayers: number;\r\n canvasBuffer: HTMLCanvasElement;\r\n _tempRender: any;\r\n _lastAnimationFrame: number = -1;\r\n layerTransform: PIXI.Matrix;\r\n\r\n clear() {\r\n let layers = this.children as Array;\r\n for (let i = 0; i < layers.length; i++)\r\n layers[i].clear();\r\n this._previousLayers = 0;\r\n }\r\n\r\n cacheIfDirty() {\r\n let tilemap: any = this.tilemap;\r\n let layers = this.children as Array;\r\n let modified = this._previousLayers !== layers.length;\r\n this._previousLayers = layers.length;\r\n let buf = this.canvasBuffer;\r\n let tempRender = this._tempRender;\r\n if (!buf) {\r\n buf = this.canvasBuffer = document.createElement('canvas');\r\n tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf});\r\n tempRender.context = tempRender.rootContext;\r\n tempRender.plugins.tilemap.dontUseTransform = true;\r\n }\r\n if (buf.width !== tilemap._layerWidth ||\r\n buf.height !== tilemap._layerHeight) {\r\n buf.width = tilemap._layerWidth;\r\n buf.height = tilemap._layerHeight;\r\n modified = true;\r\n }\r\n let i: number;\r\n if (!modified) {\r\n for (i = 0; i < layers.length; i++) {\r\n if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) {\r\n modified = true;\r\n break;\r\n }\r\n }\r\n }\r\n this._lastAnimationFrame = tilemap.animationFrame;\r\n if (modified) {\r\n if (tilemap._hackRenderer) {\r\n tilemap._hackRenderer(tempRender);\r\n }\r\n tempRender.context.clearRect(0, 0, buf.width, buf.height);\r\n for (i = 0; i < layers.length; i++) {\r\n layers[i].clearModify();\r\n layers[i].renderCanvas(tempRender);\r\n }\r\n }\r\n this.layerTransform = this.worldTransform;\r\n for (i = 0; i < layers.length; i++) {\r\n this.layerTransform = layers[i].worldTransform;\r\n break;\r\n }\r\n }\r\n\r\n renderCanvas(renderer: any) {\r\n this.cacheIfDirty();\r\n let wt = this.layerTransform;\r\n renderer.context.setTransform(\r\n wt.a,\r\n wt.b,\r\n wt.c,\r\n wt.d,\r\n wt.tx * renderer.resolution,\r\n wt.ty * renderer.resolution\r\n );\r\n let tilemap = this.tilemap;\r\n renderer.context.drawImage(this.canvasBuffer, 0, 0);\r\n }\r\n }\r\n}\r\n","/// \r\n\r\nnamespace pixi_tilemap {\r\n\r\n (PIXI as any).tilemap = pixi_tilemap;\r\n\r\n}\r\n","namespace pixi_tilemap.shaderGenerator {\r\n\r\n export function fillSamplers(shader: TilemapShader, maxTextures: number) {\r\n let sampleValues: Array = [];\r\n for (let i = 0; i < maxTextures; i++)\r\n {\r\n sampleValues[i] = i;\r\n }\r\n shader.uniforms.uSamplers = sampleValues;\r\n\r\n let samplerSize: Array = [];\r\n for (let i = 0; i < maxTextures; i++) {\r\n samplerSize.push(1.0 / Constant.bufferSize);\r\n samplerSize.push(1.0 / Constant.bufferSize);\r\n }\r\n shader.uniforms.uSamplerSize = samplerSize;\r\n }\r\n\r\n export function generateFragmentSrc(maxTextures: number, fragmentSrc: string) {\r\n return fragmentSrc.replace(/%count%/gi, maxTextures + \"\")\r\n .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\r\n }\r\n\r\n export function generateSampleSrc(maxTextures: number) {\r\n let src = '';\r\n\r\n src += '\\n';\r\n src += '\\n';\r\n\r\n src += 'if(vTextureId <= -1.0) {';\r\n src += '\\n\\tcolor = shadowColor;';\r\n src += '\\n}';\r\n\r\n for (let i = 0; i < maxTextures; i++)\r\n {\r\n src += '\\nelse ';\r\n\r\n if(i < maxTextures-1)\r\n {\r\n src += 'if(textureId == ' + i + '.0)';\r\n }\r\n\r\n src += '\\n{';\r\n src += '\\n\\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);';\r\n src += '\\n}';\r\n }\r\n\r\n src += '\\n';\r\n src += '\\n';\r\n\r\n return src;\r\n }\r\n\r\n}\r\n"]} \ No newline at end of file +{"version":3,"file":"pixi-tilemap.js","sources":["../src/CanvasTileRenderer.ts","../node_modules/tslib/tslib.es6.js","../src/Constant.ts","../src/RectTileLayer.ts","../src/CompositeRectTileLayer.ts","../src/GraphicsLayer.ts","../src/MultiTextureResource.ts","../src/shaderGenerator.ts","../src/RectTileShader.ts","../src/TileRenderer.ts","../src/ZLayer.ts","../src/exporter.ts","../src/index.ts"],"sourcesContent":["/// \n\nimport { Renderer } from '@pixi/core';\n\nexport class CanvasTileRenderer {\n renderer: Renderer;\n tileAnim = [0, 0];\n dontUseTransform = false;\n\n constructor(renderer: Renderer) {\n this.renderer = renderer;\n this.tileAnim = [0, 0];\n }\n}\n\nconst cr = (PIXI as any).CanvasRenderer;\n\nif (cr) {\n cr.registerPlugin('tilemap', CanvasTileRenderer);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","export const Constant = {\n maxTextures: 16,\n bufferSize: 2048,\n boundSize: 1024,\n boundCountPerBuffer: 1,\n use32bitIndex: false,\n SCALE_MODE: PIXI.SCALE_MODES.LINEAR,\n DO_CLEAR: true\n};","/// \n\nimport { Container } from '@pixi/display';\nimport { Constant } from './Constant';\nimport { DRAW_MODES } from '@pixi/constants';\nimport { Texture, Renderer } from '@pixi/core';\nimport { TileRenderer } from './TileRenderer';\nimport { Matrix, groupD8 } from '@pixi/math';\n\nimport type { RectTileGeom } from './RectTileShader';\n\nexport const POINT_STRUCT_SIZE = 12;\n\nexport class RectTileLayer extends Container {\n constructor(zIndex: number, texture: Texture | Array) {\n super();\n this.initialize(zIndex, texture);\n }\n\n zIndex = 0;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n\n pointsBuf: Array = [];\n hasAnim = false;\n textures: Array;\n\n offsetX = 0;\n offsetY = 0;\n compositeParent = false;\n\n initialize(zIndex: number, textures: Texture | Array) {\n if (!textures) {\n textures = [];\n } else if (!(textures instanceof Array) && (textures as Texture).baseTexture) {\n textures = [textures as Texture];\n }\n this.textures = textures as Array;\n this.zIndex = zIndex;\n // this.visible = false;\n }\n\n clear() {\n this.pointsBuf.length = 0;\n this.modificationMarker = 0;\n this.hasAnim = false;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX: number, animY: number) {\n let texture: Texture;\n let textureIndex = 0;\n\n if (typeof texture_ === \"number\") {\n textureIndex = texture_;\n texture = this.textures[textureIndex];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n let found = false;\n let textureList = this.textures;\n for (let i = 0; i < textureList.length; i++) {\n if (textureList[i].baseTexture === texture.baseTexture) {\n textureIndex = i;\n found = true;\n break;\n }\n }\n\n if (!found) {\n // textureIndex = this.textures.length;\n // this.textures.push(texture);\n return false;\n }\n }\n\n this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate);\n return true;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number,\n animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this {\n let pb = this.pointsBuf;\n this.hasAnim = this.hasAnim || animX > 0 || animY > 0;\n pb.push(u);\n pb.push(v);\n pb.push(x);\n pb.push(y);\n pb.push(tileWidth);\n pb.push(tileHeight);\n pb.push(rotate);\n pb.push(animX | 0);\n pb.push(animY | 0);\n pb.push(textureIndex);\n pb.push(animCountX);\n pb.push(animCountY);\n\n return this;\n }\n\n tileRotate(rotate: number) {\n const pb = this.pointsBuf;\n pb[pb.length - 3] = rotate;\n }\n\n tileAnimX(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 5] = offset;\n pb[pb.length - 2] = count;\n }\n\n tileAnimY(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 4] = offset;\n pb[pb.length - 1] = count;\n }\n\n renderCanvas(renderer: any) {\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n this.renderCanvasCore(renderer);\n }\n\n renderCanvasCore(renderer: any) {\n if (this.textures.length === 0) return;\n let points = this.pointsBuf;\n renderer.context.fillStyle = '#000000';\n for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) {\n let x1 = points[i], y1 = points[i + 1];\n let x2 = points[i + 2], y2 = points[i + 3];\n let w = points[i + 4];\n let h = points[i + 5];\n var rotate = points[i + 6];\n x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0];\n y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1];\n let textureIndex = points[i + 9];\n // canvas does not work with rotate yet\n if (textureIndex >= 0) {\n renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h);\n } else {\n renderer.context.globalAlpha = 0.5;\n renderer.context.fillRect(x2, y2, w, h);\n renderer.context.globalAlpha = 1;\n }\n }\n }\n\n vbId = 0;\n vb: RectTileGeom = null;\n vbBuffer: ArrayBuffer = null;\n vbArray: Float32Array = null;\n vbInts: Uint32Array = null;\n\n destroyVb() {\n if (this.vb) {\n this.vb.destroy();\n this.vb = null;\n }\n }\n\n render(renderer: Renderer) {\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n this.renderWebGLCore(renderer, plugin);\n }\n\n renderWebGLCore(renderer: Renderer, plugin: TileRenderer) {\n let points = this.pointsBuf;\n if (points.length === 0) return;\n let rectsCount = points.length / POINT_STRUCT_SIZE;\n\n let shader = plugin.getShader();\n let textures = this.textures;\n if (textures.length === 0) return;\n\n plugin.bindTextures(renderer, shader, textures);\n renderer.shader.bind(shader, false);\n\n //lost context! recover!\n let vb = this.vb;\n if (!vb) {\n vb = plugin.createVb();\n this.vb = vb;\n this.vbId = (vb as any).id;\n this.vbBuffer = null;\n this.modificationMarker = 0;\n }\n\n plugin.checkIndexBuffer(rectsCount, vb);\n const boundCountPerBuffer = Constant.boundCountPerBuffer;\n\n let vertexBuf = vb.getBuffer('aVertexPosition');\n //if layer was changed, re-upload vertices\n let vertices = rectsCount * vb.vertPerQuad;\n if (vertices === 0) return;\n if (this.modificationMarker !== vertices) {\n this.modificationMarker = vertices;\n let vs = vb.stride * vertices;\n if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {\n //!@#$ happens, need resize\n let bk = vb.stride;\n while (bk < vs) {\n bk *= 2;\n }\n this.vbBuffer = new ArrayBuffer(bk);\n this.vbArray = new Float32Array(this.vbBuffer);\n this.vbInts = new Uint32Array(this.vbBuffer);\n vertexBuf.update(this.vbBuffer);\n }\n\n let arr = this.vbArray, ints = this.vbInts;\n //upload vertices!\n let sz = 0;\n //let tint = 0xffffffff;\n let textureId: number = 0;\n let shiftU: number = this.offsetX;\n let shiftV: number = this.offsetY;\n\n //let tint = 0xffffffff;\n let tint = -1;\n for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) {\n let eps = 0.5;\n if (this.compositeParent) {\n if (boundCountPerBuffer > 1) {\n //TODO: what if its more than 4?\n textureId = (points[i + 9] >> 2);\n shiftU = this.offsetX * (points[i + 9] & 1);\n shiftV = this.offsetY * ((points[i + 9] >> 1) & 1);\n } else {\n textureId = points[i + 9];\n shiftU = 0;\n shiftV = 0;\n }\n }\n let x = points[i + 2], y = points[i + 3];\n let w = points[i + 4], h = points[i + 5];\n let u = points[i] + shiftU, v = points[i + 1] + shiftV;\n let rotate = points[i + 6];\n\n const animX = points[i + 7], animY = points[i + 8];\n const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024;\n const animXEncoded = animX + (animWidth * 2048);\n const animYEncoded = animY + (animHeight * 2048);\n\n let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number;\n if (rotate === 0) {\n u0 = u;\n v0 = v;\n u1 = u + w;\n v1 = v;\n u2 = u + w;\n v2 = v + h;\n u3 = u;\n v3 = v + h;\n } else {\n let w2 = w / 2;\n let h2 = h / 2;\n if (rotate % 4 !== 0) {\n w2 = h / 2;\n h2 = w / 2;\n }\n const cX = u + w2;\n const cY = v + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW);\n u0 = cX + (w2 * groupD8.uX(rotate));\n v0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n u1 = cX + (w2 * groupD8.uX(rotate));\n v1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u2 = cX + (w2 * groupD8.uX(rotate));\n v2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u3 = cX + (w2 * groupD8.uX(rotate));\n v3 = cY + (h2 * groupD8.uY(rotate));\n }\n\n arr[sz++] = x;\n arr[sz++] = y;\n arr[sz++] = u0;\n arr[sz++] = v0;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y;\n arr[sz++] = u1;\n arr[sz++] = v1;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y + h;\n arr[sz++] = u2;\n arr[sz++] = v2;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x;\n arr[sz++] = y + h;\n arr[sz++] = u3;\n arr[sz++] = v3;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n }\n\n vertexBuf.update(arr);\n }\n\n (renderer.geometry as any).bind(vb, shader);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES, rectsCount * 6, 0);\n }\n\n isModified(anim: boolean) {\n if (this.modificationMarker !== this.pointsBuf.length ||\n anim && this.hasAnim) {\n return true;\n }\n return false;\n }\n\n clearModify() {\n this.modificationMarker = this.pointsBuf.length;\n }\n\n destroy(options?: any) {\n super.destroy(options);\n this.destroyVb();\n }\n}\n","/// \n\nimport { Container } from '@pixi/display';\nimport { Texture, Renderer } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { Constant } from './Constant';\nimport { RectTileLayer } from './RectTileLayer';\n\nexport class CompositeRectTileLayer extends Container {\n constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n super();\n this.initialize.apply(this, arguments);\n }\n\n updateTransform() {\n (this as any).displayObjectUpdateTransform();\n }\n\n z: number;\n zIndex: number;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n _lastLayer: RectTileLayer = null;\n\n texPerChild: number;\n\n initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n if (texPerChild as any === true) {\n //old format, ignore it!\n texPerChild = 0;\n }\n this.z = this.zIndex = zIndex;\n this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures;\n if (bitmaps) {\n this.setBitmaps(bitmaps);\n }\n }\n\n setBitmaps(bitmaps: Array) {\n for (let i=0;i 5.2.1, it does not exist there.`);\n }\n }\n let texPerChild = this.texPerChild;\n let len1 = this.children.length;\n let len2 = Math.ceil(bitmaps.length / texPerChild);\n let i: number;\n for (i = 0; i < len1; i++) {\n (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);\n }\n for (i = len1; i < len2; i++) {\n let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild));\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n this.addChild(layer);\n }\n }\n\n clear() {\n for (let i = 0; i < this.children.length; i++) {\n (this.children[i] as RectTileLayer).clear();\n }\n this.modificationMarker = 0;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this {\n const childIndex: number = textureIndex / this.texPerChild >> 0;\n const textureId: number = textureIndex % this.texPerChild;\n\n if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) {\n this._lastLayer = (this.children[childIndex] as RectTileLayer);\n this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight);\n } else {\n this._lastLayer = null;\n }\n\n return this;\n }\n\n tileRotate(rotate: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileRotate(rotate);\n }\n return this;\n }\n\n tileAnimX(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimX(offset, count);\n }\n return this;\n }\n\n tileAnimY(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimY(offset, count);\n }\n return this;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this {\n let texture: Texture;\n let layer: RectTileLayer = null;\n let ind: number = 0;\n let children = this.children;\n\n this._lastLayer = null;\n if (typeof texture_ === \"number\") {\n let childIndex = texture_ / this.texPerChild >> 0;\n layer = children[childIndex] as RectTileLayer;\n\n if (!layer) {\n layer = children[0] as RectTileLayer;\n if (!layer) {\n return this;\n }\n ind = 0;\n } else {\n ind = texture_ % this.texPerChild;\n }\n\n texture = layer.textures[ind];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n let tex = child.textures;\n for (let j = 0; j < tex.length; j++) {\n if (tex[j].baseTexture === texture.baseTexture) {\n layer = child;\n ind = j;\n break;\n }\n }\n if (layer) {\n break;\n }\n }\n\n if (!layer) {\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n if (child.textures.length < this.texPerChild) {\n layer = child;\n ind = child.textures.length;\n child.textures.push(texture);\n break;\n }\n }\n if (!layer) {\n layer = new RectTileLayer(this.zIndex, texture);\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n children.push(layer);\n ind = 0;\n }\n }\n }\n\n this._lastLayer = layer;\n layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight);\n return this;\n }\n\n renderCanvas(renderer: any) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderCanvasCore(renderer);\n }\n }\n\n render(renderer: Renderer) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n //TODO: dont create new array, please\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n renderer.shader.bind(shader, false);\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin);\n }\n }\n\n isModified(anim: boolean) {\n let layers = this.children;\n if (this.modificationMarker !== layers.length) {\n return true;\n }\n for (let i = 0; i < layers.length; i++) {\n if ((layers[i] as RectTileLayer).isModified(anim)) {\n return true;\n }\n }\n return false;\n }\n\n clearModify() {\n let layers = this.children;\n this.modificationMarker = layers.length;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).clearModify();\n }\n }\n}","/// \n\nimport { Matrix } from '@pixi/math';\nimport { Graphics } from '@pixi/graphics';\n\nexport class GraphicsLayer extends Graphics {\n constructor(zIndex: number) {\n super();\n this.zIndex = zIndex;\n }\n\n renderCanvas(renderer: any) {\n let wt: Matrix = null;\n if (renderer.plugins.tilemap.dontUseTransform) {\n wt = this.transform.worldTransform;\n this.transform.worldTransform = Matrix.IDENTITY;\n }\n renderer.plugins.graphics.render(this);\n if (renderer.plugins.tilemap.dontUseTransform) {\n this.transform.worldTransform = wt;\n }\n renderer.context.globalAlpha = 1.0;\n }\n\n // renderWebGL(renderer: PIXI.Renderer) {\n // if (!this._webGL[renderer.CONTEXT_UID])\n // this.dirty++;\n // super.renderWebGL(renderer)\n // }\n\n isModified(anim: boolean): boolean {\n return false;\n }\n\n clearModify() {\n }\n}\n","/// \n\nimport { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, Renderer, Texture, GLTexture, resources } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Constant } from './Constant';\n\nexport interface IMultiTextureOptions {\n\tboundCountPerBuffer: number;\n\tboundSize: number;\n\tbufferSize: number;\n\tDO_CLEAR?: boolean;\n}\n\nexport class MultiTextureResource extends resources.Resource {\n\tconstructor(options: IMultiTextureOptions) {\n\t\tsuper(options.bufferSize, options.bufferSize);\n\n\t\tconst bounds = this.boundSprites;\n\t\tconst dirties = this.dirties;\n\t\tthis.boundSize = options.boundSize;\n\t\tfor (let j = 0; j < options.boundCountPerBuffer; j++) {\n\t\t\tconst spr = new Sprite();\n\t\t\tspr.position.x = options.boundSize * (j & 1);\n\t\t\tspr.position.y = options.boundSize * (j >> 1);\n\t\t\tbounds.push(spr);\n\t\t\tdirties.push(0);\n\t\t}\n\t\tthis.DO_CLEAR = !!options.DO_CLEAR;\n\t}\n\n\tDO_CLEAR = false;\n\tboundSize: number = 0;\n\t_clearBuffer: Uint8Array = null;\n\n\tbind(baseTexture: BaseTexture) {\n\t\tif (this.baseTex) {\n\t\t\tthrow new Error('Only one baseTexture is allowed for this resource!')\n\t\t}\n\t\tthis.baseTex = baseTexture;\n\t\tsuper.bind(baseTexture);\n\t}\n\n\tbaseTex: BaseTexture = null;\n\tboundSprites: Array = [];\n\tdirties: Array = [];\n\n\tsetTexture(ind: number, texture: Texture) {\n\t\tconst spr = this.boundSprites[ind];\n\t\tif (spr.texture.baseTexture === texture.baseTexture) {\n\t\t\treturn;\n\t\t}\n\t\tspr.texture = texture;\n\t\tthis.baseTex.update();\n\t\tthis.dirties[ind] = (this.baseTex as any).dirtyId;\n\t}\n\n\tupload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture) {\n\t\tconst { gl } = renderer as any;\n\n\t\tconst {width, height} = this;\n\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined ||\n\t\t\ttexture.alphaMode === ALPHA_MODES.UNPACK);\n\n\t\tif (glTexture.dirtyId < 0) {\n\t\t\t(glTexture as any).width = width;\n\t\t\t(glTexture as any).height = height;\n\n\t\t\tgl.texImage2D(texture.target, 0,\n\t\t\t\ttexture.format,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\t0,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tnull);\n\t\t}\n\n\t\tconst doClear = this.DO_CLEAR;\n\t\tif (doClear && !this._clearBuffer) {\n\t\t\tthis._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4);\n\t\t}\n\n\t\tconst bounds = this.boundSprites;\n\t\tfor (let i = 0; i < bounds.length; i++) {\n\t\t\tconst spr = bounds[i];\n\t\t\tconst tex = spr.texture.baseTexture;\n\t\t\tif (glTexture.dirtyId >= this.dirties[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst res = tex.resource as any;\n\t\t\tif (!tex.valid || !res || !res.source) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (doClear && (tex.width < this.boundSize || tex.height < this.boundSize))\n\t\t\t{\n\t\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\t\tspr.position.x,\n\t\t\t\t\tspr.position.y,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\ttexture.format,\n\t\t\t\t\ttexture.type,\n\t\t\t\t\tthis._clearBuffer);\n\t\t\t}\n\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\tspr.position.x,\n\t\t\t\tspr.position.y,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tres.source);\n\t\t}\n\n\t\treturn true;\n\t}\n}\n","import { Constant } from './Constant';\n\nimport type { TilemapShader } from './RectTileShader';\n\n\nexport function fillSamplers(shader: TilemapShader, maxTextures: number) {\n let sampleValues: Array = [];\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n shader.uniforms.uSamplers = sampleValues;\n\n let samplerSize: Array = [];\n for (let i = 0; i < maxTextures; i++) {\n samplerSize.push(1.0 / Constant.bufferSize);\n samplerSize.push(1.0 / Constant.bufferSize);\n }\n shader.uniforms.uSamplerSize = samplerSize;\n}\n\nexport function generateFragmentSrc(maxTextures: number, fragmentSrc: string) {\n return fragmentSrc.replace(/%count%/gi, maxTextures + \"\")\n .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n}\n\nexport function generateSampleSrc(maxTextures: number) {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n src += 'if(vTextureId <= -1.0) {';\n src += '\\n\\tcolor = shadowColor;';\n src += '\\n}';\n\n for (let i = 0; i < maxTextures; i++)\n {\n src += '\\nelse ';\n\n if(i < maxTextures-1)\n {\n src += 'if(textureId == ' + i + '.0)';\n }\n\n src += '\\n{';\n src += '\\n\\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);';\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n}\n","/// \n\nimport * as shaderGenerator from './shaderGenerator';\n\nimport { Buffer, Geometry, Shader } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nlet rectShaderFrag = `\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n`;\nlet rectShaderVert = `\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n`;\n\nexport abstract class TilemapShader extends Shader {\n\tmaxTextures = 0;\n\n\tconstructor(maxTextures: number, shaderVert: string, shaderFrag: string) {\n\t\tsuper(\n\t\t\tnew PIXI.Program(\n\t\t\t\tshaderVert,\n\t\t\t\tshaderFrag),\n\t\t\t{\n\t\t\t\tanimationFrame: new Float32Array(2),\n\t\t\t\tuSamplers: [],\n\t\t\t\tuSamplerSize: [],\n\t\t\t\tprojTransMatrix: new Matrix()\n\t\t\t}\n\t\t);\n\t\tthis.maxTextures = maxTextures;\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileShader extends TilemapShader {\n\tconstructor(maxTextures: number) {\n\t\tsuper(\n\t\t\tmaxTextures,\n\t\t\trectShaderVert,\n\t\t\tshaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)\n\t\t);\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileGeom extends Geometry {\n\tvertSize = 11;\n\tvertPerQuad = 4;\n\tstride = this.vertSize * 4;\n\tlastTimeAccess = 0;\n\n\tconstructor() {\n\t\tsuper();\n\t\tconst buf = this.buf = new Buffer(new Float32Array(2), true, false);\n\t\tthis.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0)\n\t\t\t.addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4)\n\t\t\t.addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4)\n\t\t\t.addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4)\n\t\t\t.addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4);\n\t}\n\n\tbuf: PIXI.Buffer;\n}","import { WRAP_MODES } from '@pixi/constants';\nimport { BaseTexture, Buffer, resources, ObjectRenderer, Texture, Renderer } from '@pixi/core';\nimport { Constant } from './Constant';\nimport { RectTileGeom, RectTileShader } from './RectTileShader';\nimport { MultiTextureResource } from './MultiTextureResource';\n\nimport type { TilemapShader } from './RectTileShader';\n\n/**\n * Renderer for rectangle tiles.\n */\nexport class TileRenderer extends ObjectRenderer {\n\trenderer: Renderer;\n\tgl: WebGLRenderingContext;\n\tsn: number = -1;\n\tindexBuffer: PIXI.Buffer = null;\n\tibLen: number = 0;\n\ttileAnim = [0, 0];\n\ttexLoc: Array = [];\n\n\trectShader: RectTileShader;\n\ttexResources: Array = [];\n\n\tconstructor(renderer: Renderer) {\n\t\tsuper(renderer);\n\t\tthis.rectShader = new RectTileShader(Constant.maxTextures);\n\t\tthis.indexBuffer = new Buffer(undefined, true, true);\n\t\tthis.checkIndexBuffer(2000);\n\t\tthis.initBounds();\n\t}\n\n\tinitBounds() {\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tfor (let i = 0; i < maxTextures; i++) {\n\t\t\tconst resource = new MultiTextureResource(Constant);\n\t\t\tconst baseTex = new BaseTexture(resource);\n\t\t\tbaseTex.scaleMode = Constant.SCALE_MODE;\n\t\t\tbaseTex.wrapMode = WRAP_MODES.CLAMP;\n\t\t\tthis.texResources.push(resource);\n\t\t}\n\t}\n\n\tbindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tlet samplerSize: Array = (shader as any).uniforms.uSamplerSize;\n\t\tthis.texLoc.length = 0;\n\t\tfor (let i = 0; i < textures.length; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trenderer.texture.bind(textures[i], i);\n\t\t\t//TODO: add resolution here\n\t\t\tsamplerSize[i * 2] = 1.0 / textures[i].baseTexture.width;\n\t\t\tsamplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height;\n\t\t}\n\t\t(shader as any).uniforms.uSamplerSize = samplerSize;\n\t}\n\n\tbindTextures(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tconst len = textures.length;\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tif (len > Constant.boundCountPerBuffer * maxTextures) {\n\t\t\treturn;\n\t\t}\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\tthis.bindTexturesWithoutRT(renderer, shader, textures);\n\t\t\treturn;\n\t\t}\n\n\t\tlet i = 0;\n\t\tfor (; i < len; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) continue;\n\t\t\tconst multi = this.texResources[i >> 2];\n\t\t\tmulti.setTexture(i & 3, texture);\n\t\t}\n\n\t\tlet gltsUsed = (i + 3) >> 2;\n\t\tfor (i = 0; i < gltsUsed; i++) {\n\t\t\t//remove \"i, true\" after resolving a bug\n\t\t\trenderer.texture.bind(this.texResources[i].baseTex, i);\n\t\t}\n\t}\n\n\tstart() {\n\t\t//sorry, nothing\n\t}\n\n\tcreateVb() {\n\t\tconst geom = new RectTileGeom();\n\t\tgeom.addIndex(this.indexBuffer);\n\t\tgeom.lastTimeAccess = Date.now();\n\t\treturn geom;\n\t}\n\n\tcheckIndexBuffer(size: number, vb: RectTileGeom = null) {\n\t\tconst totalIndices = size * 6;\n\n\t\tif (totalIndices <= this.ibLen) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet len = totalIndices;\n\t\twhile (len < totalIndices) {\n\t\t\tlen <<= 1;\n\t\t}\n\n\t\tthis.ibLen = totalIndices;\n\t\tthis.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size,\n\t\t\tConstant.use32bitIndex ? new Uint32Array(size * 6) : undefined));\n\n\t\t// \tTODO: create new index buffer instead?\n\t\t// if (vb) {\n\t\t// \tconst curIndex = vb.getIndex();\n\t\t// \tif (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) {\n\t\t// \t\tthis.swapIndex(vb, this.indexBuffer);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t// swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) {\n\t\t// let buffers = (geom as any).buffers;\n\t\t// const oldIndex = geom.getIndex();\n\t\t// let ind = buffers.indexOf(oldIndex);\n\t\t// if (ind >= 0) {\n\t\t// \tbuffers.splice(ind, 1);\n\t\t// }\n\t\t// geom.addIndex(indexBuf);\n\t// }\n\n\tgetShader(): TilemapShader {\n\t\treturn this.rectShader;\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\t// this.rectShader.destroy();\n\t\tthis.rectShader = null;\n\t}\n}\n\nRenderer.registerPlugin('tilemap', TileRenderer as any);\n","/// \n\nimport { Container } from '@pixi/display';\n\nimport type { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport type { Matrix } from '@pixi/math';\n\nexport class ZLayer extends Container {\n\n constructor(tilemap: Container, zIndex: number) {\n super();\n this.tilemap = tilemap;\n this.z = zIndex;\n }\n\n tilemap: any;\n z: number;\n zIndex: number;\n _previousLayers: number;\n canvasBuffer: HTMLCanvasElement;\n _tempRender: any;\n _lastAnimationFrame: number = -1;\n layerTransform: Matrix;\n\n clear() {\n let layers = this.children as Array;\n for (let i = 0; i < layers.length; i++)\n layers[i].clear();\n this._previousLayers = 0;\n }\n\n cacheIfDirty() {\n let tilemap: any = this.tilemap;\n let layers = this.children as Array;\n let modified = this._previousLayers !== layers.length;\n this._previousLayers = layers.length;\n let buf = this.canvasBuffer;\n let tempRender = this._tempRender;\n if (!buf) {\n buf = this.canvasBuffer = document.createElement('canvas');\n tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf});\n tempRender.context = tempRender.rootContext;\n tempRender.plugins.tilemap.dontUseTransform = true;\n }\n if (buf.width !== tilemap._layerWidth ||\n buf.height !== tilemap._layerHeight) {\n buf.width = tilemap._layerWidth;\n buf.height = tilemap._layerHeight;\n modified = true;\n }\n let i: number;\n if (!modified) {\n for (i = 0; i < layers.length; i++) {\n if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) {\n modified = true;\n break;\n }\n }\n }\n this._lastAnimationFrame = tilemap.animationFrame;\n if (modified) {\n if (tilemap._hackRenderer) {\n tilemap._hackRenderer(tempRender);\n }\n tempRender.context.clearRect(0, 0, buf.width, buf.height);\n for (i = 0; i < layers.length; i++) {\n layers[i].clearModify();\n layers[i].renderCanvas(tempRender);\n }\n }\n this.layerTransform = this.worldTransform;\n for (i = 0; i < layers.length; i++) {\n this.layerTransform = layers[i].worldTransform;\n break;\n }\n }\n\n renderCanvas(renderer: any) {\n this.cacheIfDirty();\n let wt = this.layerTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n let tilemap = this.tilemap;\n renderer.context.drawImage(this.canvasBuffer, 0, 0);\n }\n}\n","/// \n\nnamespace pixi_tilemap {\n (PIXI as any).tilemap = pixi_tilemap;\n}\n\n// This makes exporter.ts a module!\nexport default {}\n","import { CanvasTileRenderer } from './CanvasTileRenderer';\nimport { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport { Constant } from './Constant';\nimport { GraphicsLayer } from './GraphicsLayer';\nimport { MultiTextureResource } from './MultiTextureResource';\nimport { RectTileLayer } from './RectTileLayer';\nimport { TilemapShader, RectTileShader, RectTileGeom } from './RectTileShader';\nimport { TileRenderer } from './TileRenderer';\nimport { ZLayer } from './ZLayer';\n\nexport const pixi_tilemap = {\n CanvasTileRenderer,\n CompositeRectTileLayer,\n Constant,\n GraphicsLayer,\n MultiTextureResource,\n RectTileLayer,\n TilemapShader,\n RectTileShader,\n RectTileGeom,\n TileRenderer,\n ZLayer,\n};\n\nexport * from './CanvasTileRenderer';\nexport * from './CompositeRectTileLayer';\nexport * from './Constant';\nexport * from './exporter';\nexport * from './GraphicsLayer';\nexport * from './MultiTextureResource';\nexport * from './RectTileLayer';\nexport * from './RectTileShader';\nexport * from './shaderGenerator';\nexport * from './TileRenderer';\nexport * from './ZLayer';"],"names":["Texture","groupD8","DRAW_MODES","Container","Matrix","Graphics","Sprite","ALPHA_MODES","resources","shaderGenerator.fillSamplers","Shader","shaderGenerator.generateFragmentSrc","Buffer","Geometry","BaseTexture","WRAP_MODES","ObjectRenderer","Renderer","pixi_tilemap"],"mappings":";;;;;;;;;;;;;;;;;;;;;IASI,4BAAY,QAAkB;QAH9B,aAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAClB,qBAAgB,GAAG,KAAK,CAAC;QAGrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KAC1B;IACL,yBAAC;AAAD,CAAC,IAAA;AAED,IAAM,EAA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ErB;AAFD,WAAU,YAAY;IACjB,IAAY,CAAC,OAAO,GAAG,YAAY,CAAC;AACzC,CAAC,EAFS,YAAY,KAAZ,YAAY;;ICQTe,cAAY,GAAG;IACxB,kBAAkB,oBAAA;IAClB,sBAAsB,wBAAA;IACtB,QAAQ,UAAA;IACR,aAAa,eAAA;IACb,oBAAoB,sBAAA;IACpB,aAAa,eAAA;IACb,aAAa,eAAA;IACb,cAAc,gBAAA;IACd,YAAY,cAAA;IACZ,YAAY,cAAA;IACZ,MAAM,QAAA;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/pixi-tilemap.umd.js b/dist/pixi-tilemap.umd.js new file mode 100644 index 00000000..96169a07 --- /dev/null +++ b/dist/pixi-tilemap.umd.js @@ -0,0 +1,970 @@ +/*! + * pixi-tilemap - v2.0.6 + * Compiled Fri, 14 Aug 2020 02:19:53 UTC + * + * pixi-tilemap is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + * + * Copyright 2016-20, Ivan Popelyshev All Rights Reserved + */ +var pixi_tilemap = (function (exports, display, core, constants, math, graphics, sprite) { + 'use strict'; + + var CanvasTileRenderer = (function () { + function CanvasTileRenderer(renderer) { + this.tileAnim = [0, 0]; + this.dontUseTransform = false; + this.renderer = renderer; + this.tileAnim = [0, 0]; + } + return CanvasTileRenderer; + }()); + var cr = PIXI.CanvasRenderer; + if (cr) { + cr.registerPlugin('tilemap', CanvasTileRenderer); + } + + /*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + /* global Reflect, Promise */ + + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + + function __extends(d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + } + + var Constant = { + maxTextures: 16, + bufferSize: 2048, + boundSize: 1024, + boundCountPerBuffer: 1, + use32bitIndex: false, + SCALE_MODE: PIXI.SCALE_MODES.LINEAR, + DO_CLEAR: true + }; + + var POINT_STRUCT_SIZE = 12; + var RectTileLayer = (function (_super) { + __extends(RectTileLayer, _super); + function RectTileLayer(zIndex, texture) { + var _this = _super.call(this) || this; + _this.zIndex = 0; + _this.modificationMarker = 0; + _this.shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]); + _this._globalMat = null; + _this.pointsBuf = []; + _this.hasAnim = false; + _this.offsetX = 0; + _this.offsetY = 0; + _this.compositeParent = false; + _this.vbId = 0; + _this.vb = null; + _this.vbBuffer = null; + _this.vbArray = null; + _this.vbInts = null; + _this.initialize(zIndex, texture); + return _this; + } + RectTileLayer.prototype.initialize = function (zIndex, textures) { + if (!textures) { + textures = []; + } + else if (!(textures instanceof Array) && textures.baseTexture) { + textures = [textures]; + } + this.textures = textures; + this.zIndex = zIndex; + }; + RectTileLayer.prototype.clear = function () { + this.pointsBuf.length = 0; + this.modificationMarker = 0; + this.hasAnim = false; + }; + RectTileLayer.prototype.addFrame = function (texture_, x, y, animX, animY) { + var texture; + var textureIndex = 0; + if (typeof texture_ === "number") { + textureIndex = texture_; + texture = this.textures[textureIndex]; + } + else { + if (typeof texture_ === "string") { + texture = core.Texture.from(texture_); + } + else { + texture = texture_; + } + var found = false; + var textureList = this.textures; + for (var i = 0; i < textureList.length; i++) { + if (textureList[i].baseTexture === texture.baseTexture) { + textureIndex = i; + found = true; + break; + } + } + if (!found) { + return false; + } + } + this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate); + return true; + }; + RectTileLayer.prototype.addRect = function (textureIndex, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animCountX, animCountY) { + if (animX === void 0) { animX = 0; } + if (animY === void 0) { animY = 0; } + if (rotate === void 0) { rotate = 0; } + if (animCountX === void 0) { animCountX = 1024; } + if (animCountY === void 0) { animCountY = 1024; } + var pb = this.pointsBuf; + this.hasAnim = this.hasAnim || animX > 0 || animY > 0; + pb.push(u); + pb.push(v); + pb.push(x); + pb.push(y); + pb.push(tileWidth); + pb.push(tileHeight); + pb.push(rotate); + pb.push(animX | 0); + pb.push(animY | 0); + pb.push(textureIndex); + pb.push(animCountX); + pb.push(animCountY); + return this; + }; + RectTileLayer.prototype.tileRotate = function (rotate) { + var pb = this.pointsBuf; + pb[pb.length - 3] = rotate; + }; + RectTileLayer.prototype.tileAnimX = function (offset, count) { + var pb = this.pointsBuf; + pb[pb.length - 5] = offset; + pb[pb.length - 2] = count; + }; + RectTileLayer.prototype.tileAnimY = function (offset, count) { + var pb = this.pointsBuf; + pb[pb.length - 4] = offset; + pb[pb.length - 1] = count; + }; + RectTileLayer.prototype.renderCanvas = function (renderer) { + var plugin = renderer.plugins.tilemap; + if (!plugin.dontUseTransform) { + var wt = this.worldTransform; + renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution); + } + this.renderCanvasCore(renderer); + }; + RectTileLayer.prototype.renderCanvasCore = function (renderer) { + if (this.textures.length === 0) + return; + var points = this.pointsBuf; + renderer.context.fillStyle = '#000000'; + for (var i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) { + var x1 = points[i], y1 = points[i + 1]; + var x2 = points[i + 2], y2 = points[i + 3]; + var w = points[i + 4]; + var h = points[i + 5]; + var rotate = points[i + 6]; + x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0]; + y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1]; + var textureIndex = points[i + 9]; + if (textureIndex >= 0) { + renderer.context.drawImage(this.textures[textureIndex].baseTexture.getDrawableSource(), x1, y1, w, h, x2, y2, w, h); + } + else { + renderer.context.globalAlpha = 0.5; + renderer.context.fillRect(x2, y2, w, h); + renderer.context.globalAlpha = 1; + } + } + }; + RectTileLayer.prototype.destroyVb = function () { + if (this.vb) { + this.vb.destroy(); + this.vb = null; + } + }; + RectTileLayer.prototype.render = function (renderer) { + var plugin = renderer.plugins['tilemap']; + var shader = plugin.getShader(); + renderer.batch.setObjectRenderer(plugin); + this._globalMat = shader.uniforms.projTransMatrix; + renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform); + shader.uniforms.shadowColor = this.shadowColor; + shader.uniforms.animationFrame = plugin.tileAnim; + this.renderWebGLCore(renderer, plugin); + }; + RectTileLayer.prototype.renderWebGLCore = function (renderer, plugin) { + var points = this.pointsBuf; + if (points.length === 0) + return; + var rectsCount = points.length / POINT_STRUCT_SIZE; + var shader = plugin.getShader(); + var textures = this.textures; + if (textures.length === 0) + return; + plugin.bindTextures(renderer, shader, textures); + renderer.shader.bind(shader, false); + var vb = this.vb; + if (!vb) { + vb = plugin.createVb(); + this.vb = vb; + this.vbId = vb.id; + this.vbBuffer = null; + this.modificationMarker = 0; + } + plugin.checkIndexBuffer(rectsCount, vb); + var boundCountPerBuffer = Constant.boundCountPerBuffer; + var vertexBuf = vb.getBuffer('aVertexPosition'); + var vertices = rectsCount * vb.vertPerQuad; + if (vertices === 0) + return; + if (this.modificationMarker !== vertices) { + this.modificationMarker = vertices; + var vs = vb.stride * vertices; + if (!this.vbBuffer || this.vbBuffer.byteLength < vs) { + var bk = vb.stride; + while (bk < vs) { + bk *= 2; + } + this.vbBuffer = new ArrayBuffer(bk); + this.vbArray = new Float32Array(this.vbBuffer); + this.vbInts = new Uint32Array(this.vbBuffer); + vertexBuf.update(this.vbBuffer); + } + var arr = this.vbArray, ints = this.vbInts; + var sz = 0; + var textureId = 0; + var shiftU = this.offsetX; + var shiftV = this.offsetY; + for (var i = 0; i < points.length; i += POINT_STRUCT_SIZE) { + var eps = 0.5; + if (this.compositeParent) { + if (boundCountPerBuffer > 1) { + textureId = (points[i + 9] >> 2); + shiftU = this.offsetX * (points[i + 9] & 1); + shiftV = this.offsetY * ((points[i + 9] >> 1) & 1); + } + else { + textureId = points[i + 9]; + shiftU = 0; + shiftV = 0; + } + } + var x = points[i + 2], y = points[i + 3]; + var w = points[i + 4], h = points[i + 5]; + var u = points[i] + shiftU, v = points[i + 1] + shiftV; + var rotate = points[i + 6]; + var animX = points[i + 7], animY = points[i + 8]; + var animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024; + var animXEncoded = animX + (animWidth * 2048); + var animYEncoded = animY + (animHeight * 2048); + var u0 = void 0, v0 = void 0, u1 = void 0, v1 = void 0, u2 = void 0, v2 = void 0, u3 = void 0, v3 = void 0; + if (rotate === 0) { + u0 = u; + v0 = v; + u1 = u + w; + v1 = v; + u2 = u + w; + v2 = v + h; + u3 = u; + v3 = v + h; + } + else { + var w2 = w / 2; + var h2 = h / 2; + if (rotate % 4 !== 0) { + w2 = h / 2; + h2 = w / 2; + } + var cX = u + w2; + var cY = v + h2; + rotate = math.groupD8.add(rotate, math.groupD8.NW); + u0 = cX + (w2 * math.groupD8.uX(rotate)); + v0 = cY + (h2 * math.groupD8.uY(rotate)); + rotate = math.groupD8.add(rotate, 2); + u1 = cX + (w2 * math.groupD8.uX(rotate)); + v1 = cY + (h2 * math.groupD8.uY(rotate)); + rotate = math.groupD8.add(rotate, 2); + u2 = cX + (w2 * math.groupD8.uX(rotate)); + v2 = cY + (h2 * math.groupD8.uY(rotate)); + rotate = math.groupD8.add(rotate, 2); + u3 = cX + (w2 * math.groupD8.uX(rotate)); + v3 = cY + (h2 * math.groupD8.uY(rotate)); + } + arr[sz++] = x; + arr[sz++] = y; + arr[sz++] = u0; + arr[sz++] = v0; + arr[sz++] = u + eps; + arr[sz++] = v + eps; + arr[sz++] = u + w - eps; + arr[sz++] = v + h - eps; + arr[sz++] = animXEncoded; + arr[sz++] = animYEncoded; + arr[sz++] = textureId; + arr[sz++] = x + w; + arr[sz++] = y; + arr[sz++] = u1; + arr[sz++] = v1; + arr[sz++] = u + eps; + arr[sz++] = v + eps; + arr[sz++] = u + w - eps; + arr[sz++] = v + h - eps; + arr[sz++] = animXEncoded; + arr[sz++] = animYEncoded; + arr[sz++] = textureId; + arr[sz++] = x + w; + arr[sz++] = y + h; + arr[sz++] = u2; + arr[sz++] = v2; + arr[sz++] = u + eps; + arr[sz++] = v + eps; + arr[sz++] = u + w - eps; + arr[sz++] = v + h - eps; + arr[sz++] = animXEncoded; + arr[sz++] = animYEncoded; + arr[sz++] = textureId; + arr[sz++] = x; + arr[sz++] = y + h; + arr[sz++] = u3; + arr[sz++] = v3; + arr[sz++] = u + eps; + arr[sz++] = v + eps; + arr[sz++] = u + w - eps; + arr[sz++] = v + h - eps; + arr[sz++] = animXEncoded; + arr[sz++] = animYEncoded; + arr[sz++] = textureId; + } + vertexBuf.update(arr); + } + renderer.geometry.bind(vb, shader); + renderer.geometry.draw(constants.DRAW_MODES.TRIANGLES, rectsCount * 6, 0); + }; + RectTileLayer.prototype.isModified = function (anim) { + if (this.modificationMarker !== this.pointsBuf.length || + anim && this.hasAnim) { + return true; + } + return false; + }; + RectTileLayer.prototype.clearModify = function () { + this.modificationMarker = this.pointsBuf.length; + }; + RectTileLayer.prototype.destroy = function (options) { + _super.prototype.destroy.call(this, options); + this.destroyVb(); + }; + return RectTileLayer; + }(display.Container)); + + var CompositeRectTileLayer = (function (_super) { + __extends(CompositeRectTileLayer, _super); + function CompositeRectTileLayer(zIndex, bitmaps, texPerChild) { + var _this = _super.call(this) || this; + _this.modificationMarker = 0; + _this.shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]); + _this._globalMat = null; + _this._lastLayer = null; + _this.initialize.apply(_this, arguments); + return _this; + } + CompositeRectTileLayer.prototype.updateTransform = function () { + this.displayObjectUpdateTransform(); + }; + CompositeRectTileLayer.prototype.initialize = function (zIndex, bitmaps, texPerChild) { + if (texPerChild === true) { + texPerChild = 0; + } + this.z = this.zIndex = zIndex; + this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures; + if (bitmaps) { + this.setBitmaps(bitmaps); + } + }; + CompositeRectTileLayer.prototype.setBitmaps = function (bitmaps) { + for (var i_1 = 0; i_1 < bitmaps.length; i_1++) { + if (bitmaps[i_1] && !bitmaps[i_1].baseTexture) { + throw new Error("pixi-tilemap cannot use destroyed textures. " + + "Probably, you passed resources['myAtlas'].texture in pixi > 5.2.1, it does not exist there."); + } + } + var texPerChild = this.texPerChild; + var len1 = this.children.length; + var len2 = Math.ceil(bitmaps.length / texPerChild); + var i; + for (i = 0; i < len1; i++) { + this.children[i].textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild); + } + for (i = len1; i < len2; i++) { + var layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild)); + layer.compositeParent = true; + layer.offsetX = Constant.boundSize; + layer.offsetY = Constant.boundSize; + this.addChild(layer); + } + }; + CompositeRectTileLayer.prototype.clear = function () { + for (var i = 0; i < this.children.length; i++) { + this.children[i].clear(); + } + this.modificationMarker = 0; + }; + CompositeRectTileLayer.prototype.addRect = function (textureIndex, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight) { + var childIndex = textureIndex / this.texPerChild >> 0; + var textureId = textureIndex % this.texPerChild; + if (this.children[childIndex] && this.children[childIndex].textures) { + this._lastLayer = this.children[childIndex]; + this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight); + } + else { + this._lastLayer = null; + } + return this; + }; + CompositeRectTileLayer.prototype.tileRotate = function (rotate) { + if (this._lastLayer) { + this._lastLayer.tileRotate(rotate); + } + return this; + }; + CompositeRectTileLayer.prototype.tileAnimX = function (offset, count) { + if (this._lastLayer) { + this._lastLayer.tileAnimX(offset, count); + } + return this; + }; + CompositeRectTileLayer.prototype.tileAnimY = function (offset, count) { + if (this._lastLayer) { + this._lastLayer.tileAnimY(offset, count); + } + return this; + }; + CompositeRectTileLayer.prototype.addFrame = function (texture_, x, y, animX, animY, animWidth, animHeight) { + var texture; + var layer = null; + var ind = 0; + var children = this.children; + this._lastLayer = null; + if (typeof texture_ === "number") { + var childIndex = texture_ / this.texPerChild >> 0; + layer = children[childIndex]; + if (!layer) { + layer = children[0]; + if (!layer) { + return this; + } + ind = 0; + } + else { + ind = texture_ % this.texPerChild; + } + texture = layer.textures[ind]; + } + else { + if (typeof texture_ === "string") { + texture = core.Texture.from(texture_); + } + else { + texture = texture_; + } + for (var i = 0; i < children.length; i++) { + var child = children[i]; + var tex = child.textures; + for (var j = 0; j < tex.length; j++) { + if (tex[j].baseTexture === texture.baseTexture) { + layer = child; + ind = j; + break; + } + } + if (layer) { + break; + } + } + if (!layer) { + for (var i = 0; i < children.length; i++) { + var child = children[i]; + if (child.textures.length < this.texPerChild) { + layer = child; + ind = child.textures.length; + child.textures.push(texture); + break; + } + } + if (!layer) { + layer = new RectTileLayer(this.zIndex, texture); + layer.compositeParent = true; + layer.offsetX = Constant.boundSize; + layer.offsetY = Constant.boundSize; + children.push(layer); + ind = 0; + } + } + } + this._lastLayer = layer; + layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight); + return this; + }; + CompositeRectTileLayer.prototype.renderCanvas = function (renderer) { + if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { + return; + } + var plugin = renderer.plugins.tilemap; + if (!plugin.dontUseTransform) { + var wt = this.worldTransform; + renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution); + } + var layers = this.children; + for (var i = 0; i < layers.length; i++) { + layers[i].renderCanvasCore(renderer); + } + }; + CompositeRectTileLayer.prototype.render = function (renderer) { + if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { + return; + } + var plugin = renderer.plugins['tilemap']; + var shader = plugin.getShader(); + renderer.batch.setObjectRenderer(plugin); + this._globalMat = shader.uniforms.projTransMatrix; + renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform); + shader.uniforms.shadowColor = this.shadowColor; + shader.uniforms.animationFrame = plugin.tileAnim; + renderer.shader.bind(shader, false); + var layers = this.children; + for (var i = 0; i < layers.length; i++) { + layers[i].renderWebGLCore(renderer, plugin); + } + }; + CompositeRectTileLayer.prototype.isModified = function (anim) { + var layers = this.children; + if (this.modificationMarker !== layers.length) { + return true; + } + for (var i = 0; i < layers.length; i++) { + if (layers[i].isModified(anim)) { + return true; + } + } + return false; + }; + CompositeRectTileLayer.prototype.clearModify = function () { + var layers = this.children; + this.modificationMarker = layers.length; + for (var i = 0; i < layers.length; i++) { + layers[i].clearModify(); + } + }; + return CompositeRectTileLayer; + }(display.Container)); + + var GraphicsLayer = (function (_super) { + __extends(GraphicsLayer, _super); + function GraphicsLayer(zIndex) { + var _this = _super.call(this) || this; + _this.zIndex = zIndex; + return _this; + } + GraphicsLayer.prototype.renderCanvas = function (renderer) { + var wt = null; + if (renderer.plugins.tilemap.dontUseTransform) { + wt = this.transform.worldTransform; + this.transform.worldTransform = math.Matrix.IDENTITY; + } + renderer.plugins.graphics.render(this); + if (renderer.plugins.tilemap.dontUseTransform) { + this.transform.worldTransform = wt; + } + renderer.context.globalAlpha = 1.0; + }; + GraphicsLayer.prototype.isModified = function (anim) { + return false; + }; + GraphicsLayer.prototype.clearModify = function () { + }; + return GraphicsLayer; + }(graphics.Graphics)); + + var MultiTextureResource = (function (_super) { + __extends(MultiTextureResource, _super); + function MultiTextureResource(options) { + var _this = _super.call(this, options.bufferSize, options.bufferSize) || this; + _this.DO_CLEAR = false; + _this.boundSize = 0; + _this._clearBuffer = null; + _this.baseTex = null; + _this.boundSprites = []; + _this.dirties = []; + var bounds = _this.boundSprites; + var dirties = _this.dirties; + _this.boundSize = options.boundSize; + for (var j = 0; j < options.boundCountPerBuffer; j++) { + var spr = new sprite.Sprite(); + spr.position.x = options.boundSize * (j & 1); + spr.position.y = options.boundSize * (j >> 1); + bounds.push(spr); + dirties.push(0); + } + _this.DO_CLEAR = !!options.DO_CLEAR; + return _this; + } + MultiTextureResource.prototype.bind = function (baseTexture) { + if (this.baseTex) { + throw new Error('Only one baseTexture is allowed for this resource!'); + } + this.baseTex = baseTexture; + _super.prototype.bind.call(this, baseTexture); + }; + MultiTextureResource.prototype.setTexture = function (ind, texture) { + var spr = this.boundSprites[ind]; + if (spr.texture.baseTexture === texture.baseTexture) { + return; + } + spr.texture = texture; + this.baseTex.update(); + this.dirties[ind] = this.baseTex.dirtyId; + }; + MultiTextureResource.prototype.upload = function (renderer, texture, glTexture) { + var gl = renderer.gl; + var _a = this, width = _a.width, height = _a.height; + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined || + texture.alphaMode === constants.ALPHA_MODES.UNPACK); + if (glTexture.dirtyId < 0) { + glTexture.width = width; + glTexture.height = height; + gl.texImage2D(texture.target, 0, texture.format, width, height, 0, texture.format, texture.type, null); + } + var doClear = this.DO_CLEAR; + if (doClear && !this._clearBuffer) { + this._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4); + } + var bounds = this.boundSprites; + for (var i = 0; i < bounds.length; i++) { + var spr = bounds[i]; + var tex = spr.texture.baseTexture; + if (glTexture.dirtyId >= this.dirties[i]) { + continue; + } + var res = tex.resource; + if (!tex.valid || !res || !res.source) { + continue; + } + if (doClear && (tex.width < this.boundSize || tex.height < this.boundSize)) { + gl.texSubImage2D(texture.target, 0, spr.position.x, spr.position.y, this.boundSize, this.boundSize, texture.format, texture.type, this._clearBuffer); + } + gl.texSubImage2D(texture.target, 0, spr.position.x, spr.position.y, texture.format, texture.type, res.source); + } + return true; + }; + return MultiTextureResource; + }(core.resources.Resource)); + + function fillSamplers(shader, maxTextures) { + var sampleValues = []; + for (var i = 0; i < maxTextures; i++) { + sampleValues[i] = i; + } + shader.uniforms.uSamplers = sampleValues; + var samplerSize = []; + for (var i = 0; i < maxTextures; i++) { + samplerSize.push(1.0 / Constant.bufferSize); + samplerSize.push(1.0 / Constant.bufferSize); + } + shader.uniforms.uSamplerSize = samplerSize; + } + function generateFragmentSrc(maxTextures, fragmentSrc) { + return fragmentSrc.replace(/%count%/gi, maxTextures + "") + .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures)); + } + function generateSampleSrc(maxTextures) { + var src = ''; + src += '\n'; + src += '\n'; + src += 'if(vTextureId <= -1.0) {'; + src += '\n\tcolor = shadowColor;'; + src += '\n}'; + for (var i = 0; i < maxTextures; i++) { + src += '\nelse '; + if (i < maxTextures - 1) { + src += 'if(textureId == ' + i + '.0)'; + } + src += '\n{'; + src += '\n\tcolor = texture2D(uSamplers[' + i + '], textureCoord * uSamplerSize[' + i + ']);'; + src += '\n}'; + } + src += '\n'; + src += '\n'; + return src; + } + + var rectShaderFrag = "\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n"; + var rectShaderVert = "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n"; + var TilemapShader = (function (_super) { + __extends(TilemapShader, _super); + function TilemapShader(maxTextures, shaderVert, shaderFrag) { + var _this = _super.call(this, new PIXI.Program(shaderVert, shaderFrag), { + animationFrame: new Float32Array(2), + uSamplers: [], + uSamplerSize: [], + projTransMatrix: new math.Matrix() + }) || this; + _this.maxTextures = 0; + _this.maxTextures = maxTextures; + fillSamplers(_this, _this.maxTextures); + return _this; + } + return TilemapShader; + }(core.Shader)); + var RectTileShader = (function (_super) { + __extends(RectTileShader, _super); + function RectTileShader(maxTextures) { + var _this = _super.call(this, maxTextures, rectShaderVert, generateFragmentSrc(maxTextures, rectShaderFrag)) || this; + fillSamplers(_this, _this.maxTextures); + return _this; + } + return RectTileShader; + }(TilemapShader)); + var RectTileGeom = (function (_super) { + __extends(RectTileGeom, _super); + function RectTileGeom() { + var _this = _super.call(this) || this; + _this.vertSize = 11; + _this.vertPerQuad = 4; + _this.stride = _this.vertSize * 4; + _this.lastTimeAccess = 0; + var buf = _this.buf = new core.Buffer(new Float32Array(2), true, false); + _this.addAttribute('aVertexPosition', buf, 0, false, 0, _this.stride, 0) + .addAttribute('aTextureCoord', buf, 0, false, 0, _this.stride, 2 * 4) + .addAttribute('aFrame', buf, 0, false, 0, _this.stride, 4 * 4) + .addAttribute('aAnim', buf, 0, false, 0, _this.stride, 8 * 4) + .addAttribute('aTextureId', buf, 0, false, 0, _this.stride, 10 * 4); + return _this; + } + return RectTileGeom; + }(core.Geometry)); + + var TileRenderer = (function (_super) { + __extends(TileRenderer, _super); + function TileRenderer(renderer) { + var _this = _super.call(this, renderer) || this; + _this.sn = -1; + _this.indexBuffer = null; + _this.ibLen = 0; + _this.tileAnim = [0, 0]; + _this.texLoc = []; + _this.texResources = []; + _this.rectShader = new RectTileShader(Constant.maxTextures); + _this.indexBuffer = new core.Buffer(undefined, true, true); + _this.checkIndexBuffer(2000); + _this.initBounds(); + return _this; + } + TileRenderer.prototype.initBounds = function () { + if (Constant.boundCountPerBuffer <= 1) { + return; + } + var maxTextures = Constant.maxTextures; + for (var i = 0; i < maxTextures; i++) { + var resource = new MultiTextureResource(Constant); + var baseTex = new core.BaseTexture(resource); + baseTex.scaleMode = Constant.SCALE_MODE; + baseTex.wrapMode = constants.WRAP_MODES.CLAMP; + this.texResources.push(resource); + } + }; + TileRenderer.prototype.bindTexturesWithoutRT = function (renderer, shader, textures) { + var samplerSize = shader.uniforms.uSamplerSize; + this.texLoc.length = 0; + for (var i = 0; i < textures.length; i++) { + var texture = textures[i]; + if (!texture || !texture.valid) { + return; + } + renderer.texture.bind(textures[i], i); + samplerSize[i * 2] = 1.0 / textures[i].baseTexture.width; + samplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height; + } + shader.uniforms.uSamplerSize = samplerSize; + }; + TileRenderer.prototype.bindTextures = function (renderer, shader, textures) { + var len = textures.length; + var maxTextures = Constant.maxTextures; + if (len > Constant.boundCountPerBuffer * maxTextures) { + return; + } + if (Constant.boundCountPerBuffer <= 1) { + this.bindTexturesWithoutRT(renderer, shader, textures); + return; + } + var i = 0; + for (; i < len; i++) { + var texture = textures[i]; + if (!texture || !texture.valid) + continue; + var multi = this.texResources[i >> 2]; + multi.setTexture(i & 3, texture); + } + var gltsUsed = (i + 3) >> 2; + for (i = 0; i < gltsUsed; i++) { + renderer.texture.bind(this.texResources[i].baseTex, i); + } + }; + TileRenderer.prototype.start = function () { + }; + TileRenderer.prototype.createVb = function () { + var geom = new RectTileGeom(); + geom.addIndex(this.indexBuffer); + geom.lastTimeAccess = Date.now(); + return geom; + }; + TileRenderer.prototype.checkIndexBuffer = function (size, vb) { + var totalIndices = size * 6; + if (totalIndices <= this.ibLen) { + return; + } + this.ibLen = totalIndices; + this.indexBuffer.update(PIXI.utils.createIndicesForQuads(size, Constant.use32bitIndex ? new Uint32Array(size * 6) : undefined)); + }; + TileRenderer.prototype.getShader = function () { + return this.rectShader; + }; + TileRenderer.prototype.destroy = function () { + _super.prototype.destroy.call(this); + this.rectShader = null; + }; + return TileRenderer; + }(core.ObjectRenderer)); + core.Renderer.registerPlugin('tilemap', TileRenderer); + + var ZLayer = (function (_super) { + __extends(ZLayer, _super); + function ZLayer(tilemap, zIndex) { + var _this = _super.call(this) || this; + _this._lastAnimationFrame = -1; + _this.tilemap = tilemap; + _this.z = zIndex; + return _this; + } + ZLayer.prototype.clear = function () { + var layers = this.children; + for (var i = 0; i < layers.length; i++) + layers[i].clear(); + this._previousLayers = 0; + }; + ZLayer.prototype.cacheIfDirty = function () { + var tilemap = this.tilemap; + var layers = this.children; + var modified = this._previousLayers !== layers.length; + this._previousLayers = layers.length; + var buf = this.canvasBuffer; + var tempRender = this._tempRender; + if (!buf) { + buf = this.canvasBuffer = document.createElement('canvas'); + tempRender = this._tempRender = new PIXI.CanvasRenderer(100, 100, { view: buf }); + tempRender.context = tempRender.rootContext; + tempRender.plugins.tilemap.dontUseTransform = true; + } + if (buf.width !== tilemap._layerWidth || + buf.height !== tilemap._layerHeight) { + buf.width = tilemap._layerWidth; + buf.height = tilemap._layerHeight; + modified = true; + } + var i; + if (!modified) { + for (i = 0; i < layers.length; i++) { + if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) { + modified = true; + break; + } + } + } + this._lastAnimationFrame = tilemap.animationFrame; + if (modified) { + if (tilemap._hackRenderer) { + tilemap._hackRenderer(tempRender); + } + tempRender.context.clearRect(0, 0, buf.width, buf.height); + for (i = 0; i < layers.length; i++) { + layers[i].clearModify(); + layers[i].renderCanvas(tempRender); + } + } + this.layerTransform = this.worldTransform; + for (i = 0; i < layers.length; i++) { + this.layerTransform = layers[i].worldTransform; + break; + } + }; + ZLayer.prototype.renderCanvas = function (renderer) { + this.cacheIfDirty(); + var wt = this.layerTransform; + renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution); + var tilemap = this.tilemap; + renderer.context.drawImage(this.canvasBuffer, 0, 0); + }; + return ZLayer; + }(display.Container)); + + var pixi_tilemap; + (function (pixi_tilemap) { + PIXI.tilemap = pixi_tilemap; + })(pixi_tilemap || (pixi_tilemap = {})); + + var pixi_tilemap$1 = { + CanvasTileRenderer: CanvasTileRenderer, + CompositeRectTileLayer: CompositeRectTileLayer, + Constant: Constant, + GraphicsLayer: GraphicsLayer, + MultiTextureResource: MultiTextureResource, + RectTileLayer: RectTileLayer, + TilemapShader: TilemapShader, + RectTileShader: RectTileShader, + RectTileGeom: RectTileGeom, + TileRenderer: TileRenderer, + ZLayer: ZLayer, + }; + + exports.CanvasTileRenderer = CanvasTileRenderer; + exports.CompositeRectTileLayer = CompositeRectTileLayer; + exports.Constant = Constant; + exports.GraphicsLayer = GraphicsLayer; + exports.MultiTextureResource = MultiTextureResource; + exports.POINT_STRUCT_SIZE = POINT_STRUCT_SIZE; + exports.RectTileGeom = RectTileGeom; + exports.RectTileLayer = RectTileLayer; + exports.RectTileShader = RectTileShader; + exports.TileRenderer = TileRenderer; + exports.TilemapShader = TilemapShader; + exports.ZLayer = ZLayer; + exports.fillSamplers = fillSamplers; + exports.generateFragmentSrc = generateFragmentSrc; + exports.generateSampleSrc = generateSampleSrc; + exports.pixi_tilemap = pixi_tilemap$1; + + return exports; + +}({}, _pixi_display, _pixi_core, _pixi_constants, _pixi_math, _pixi_graphics, _pixi_sprite)); +//# sourceMappingURL=pixi-tilemap.umd.js.map diff --git a/dist/pixi-tilemap.umd.js.map b/dist/pixi-tilemap.umd.js.map new file mode 100644 index 00000000..8ac2512c --- /dev/null +++ b/dist/pixi-tilemap.umd.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pixi-tilemap.umd.js","sources":["../src/CanvasTileRenderer.ts","../node_modules/tslib/tslib.es6.js","../src/Constant.ts","../src/RectTileLayer.ts","../src/CompositeRectTileLayer.ts","../src/GraphicsLayer.ts","../src/MultiTextureResource.ts","../src/shaderGenerator.ts","../src/RectTileShader.ts","../src/TileRenderer.ts","../src/ZLayer.ts","../src/exporter.ts","../src/index.ts"],"sourcesContent":["/// \n\nimport { Renderer } from '@pixi/core';\n\nexport class CanvasTileRenderer {\n renderer: Renderer;\n tileAnim = [0, 0];\n dontUseTransform = false;\n\n constructor(renderer: Renderer) {\n this.renderer = renderer;\n this.tileAnim = [0, 0];\n }\n}\n\nconst cr = (PIXI as any).CanvasRenderer;\n\nif (cr) {\n cr.registerPlugin('tilemap', CanvasTileRenderer);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","export const Constant = {\n maxTextures: 16,\n bufferSize: 2048,\n boundSize: 1024,\n boundCountPerBuffer: 1,\n use32bitIndex: false,\n SCALE_MODE: PIXI.SCALE_MODES.LINEAR,\n DO_CLEAR: true\n};","/// \n\nimport { Container } from '@pixi/display';\nimport { Constant } from './Constant';\nimport { DRAW_MODES } from '@pixi/constants';\nimport { Texture, Renderer } from '@pixi/core';\nimport { TileRenderer } from './TileRenderer';\nimport { Matrix, groupD8 } from '@pixi/math';\n\nimport type { RectTileGeom } from './RectTileShader';\n\nexport const POINT_STRUCT_SIZE = 12;\n\nexport class RectTileLayer extends Container {\n constructor(zIndex: number, texture: Texture | Array) {\n super();\n this.initialize(zIndex, texture);\n }\n\n zIndex = 0;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n\n pointsBuf: Array = [];\n hasAnim = false;\n textures: Array;\n\n offsetX = 0;\n offsetY = 0;\n compositeParent = false;\n\n initialize(zIndex: number, textures: Texture | Array) {\n if (!textures) {\n textures = [];\n } else if (!(textures instanceof Array) && (textures as Texture).baseTexture) {\n textures = [textures as Texture];\n }\n this.textures = textures as Array;\n this.zIndex = zIndex;\n // this.visible = false;\n }\n\n clear() {\n this.pointsBuf.length = 0;\n this.modificationMarker = 0;\n this.hasAnim = false;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX: number, animY: number) {\n let texture: Texture;\n let textureIndex = 0;\n\n if (typeof texture_ === \"number\") {\n textureIndex = texture_;\n texture = this.textures[textureIndex];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n let found = false;\n let textureList = this.textures;\n for (let i = 0; i < textureList.length; i++) {\n if (textureList[i].baseTexture === texture.baseTexture) {\n textureIndex = i;\n found = true;\n break;\n }\n }\n\n if (!found) {\n // textureIndex = this.textures.length;\n // this.textures.push(texture);\n return false;\n }\n }\n\n this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate);\n return true;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number,\n animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this {\n let pb = this.pointsBuf;\n this.hasAnim = this.hasAnim || animX > 0 || animY > 0;\n pb.push(u);\n pb.push(v);\n pb.push(x);\n pb.push(y);\n pb.push(tileWidth);\n pb.push(tileHeight);\n pb.push(rotate);\n pb.push(animX | 0);\n pb.push(animY | 0);\n pb.push(textureIndex);\n pb.push(animCountX);\n pb.push(animCountY);\n\n return this;\n }\n\n tileRotate(rotate: number) {\n const pb = this.pointsBuf;\n pb[pb.length - 3] = rotate;\n }\n\n tileAnimX(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 5] = offset;\n pb[pb.length - 2] = count;\n }\n\n tileAnimY(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 4] = offset;\n pb[pb.length - 1] = count;\n }\n\n renderCanvas(renderer: any) {\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n this.renderCanvasCore(renderer);\n }\n\n renderCanvasCore(renderer: any) {\n if (this.textures.length === 0) return;\n let points = this.pointsBuf;\n renderer.context.fillStyle = '#000000';\n for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) {\n let x1 = points[i], y1 = points[i + 1];\n let x2 = points[i + 2], y2 = points[i + 3];\n let w = points[i + 4];\n let h = points[i + 5];\n var rotate = points[i + 6];\n x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0];\n y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1];\n let textureIndex = points[i + 9];\n // canvas does not work with rotate yet\n if (textureIndex >= 0) {\n renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h);\n } else {\n renderer.context.globalAlpha = 0.5;\n renderer.context.fillRect(x2, y2, w, h);\n renderer.context.globalAlpha = 1;\n }\n }\n }\n\n vbId = 0;\n vb: RectTileGeom = null;\n vbBuffer: ArrayBuffer = null;\n vbArray: Float32Array = null;\n vbInts: Uint32Array = null;\n\n destroyVb() {\n if (this.vb) {\n this.vb.destroy();\n this.vb = null;\n }\n }\n\n render(renderer: Renderer) {\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n this.renderWebGLCore(renderer, plugin);\n }\n\n renderWebGLCore(renderer: Renderer, plugin: TileRenderer) {\n let points = this.pointsBuf;\n if (points.length === 0) return;\n let rectsCount = points.length / POINT_STRUCT_SIZE;\n\n let shader = plugin.getShader();\n let textures = this.textures;\n if (textures.length === 0) return;\n\n plugin.bindTextures(renderer, shader, textures);\n renderer.shader.bind(shader, false);\n\n //lost context! recover!\n let vb = this.vb;\n if (!vb) {\n vb = plugin.createVb();\n this.vb = vb;\n this.vbId = (vb as any).id;\n this.vbBuffer = null;\n this.modificationMarker = 0;\n }\n\n plugin.checkIndexBuffer(rectsCount, vb);\n const boundCountPerBuffer = Constant.boundCountPerBuffer;\n\n let vertexBuf = vb.getBuffer('aVertexPosition');\n //if layer was changed, re-upload vertices\n let vertices = rectsCount * vb.vertPerQuad;\n if (vertices === 0) return;\n if (this.modificationMarker !== vertices) {\n this.modificationMarker = vertices;\n let vs = vb.stride * vertices;\n if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {\n //!@#$ happens, need resize\n let bk = vb.stride;\n while (bk < vs) {\n bk *= 2;\n }\n this.vbBuffer = new ArrayBuffer(bk);\n this.vbArray = new Float32Array(this.vbBuffer);\n this.vbInts = new Uint32Array(this.vbBuffer);\n vertexBuf.update(this.vbBuffer);\n }\n\n let arr = this.vbArray, ints = this.vbInts;\n //upload vertices!\n let sz = 0;\n //let tint = 0xffffffff;\n let textureId: number = 0;\n let shiftU: number = this.offsetX;\n let shiftV: number = this.offsetY;\n\n //let tint = 0xffffffff;\n let tint = -1;\n for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) {\n let eps = 0.5;\n if (this.compositeParent) {\n if (boundCountPerBuffer > 1) {\n //TODO: what if its more than 4?\n textureId = (points[i + 9] >> 2);\n shiftU = this.offsetX * (points[i + 9] & 1);\n shiftV = this.offsetY * ((points[i + 9] >> 1) & 1);\n } else {\n textureId = points[i + 9];\n shiftU = 0;\n shiftV = 0;\n }\n }\n let x = points[i + 2], y = points[i + 3];\n let w = points[i + 4], h = points[i + 5];\n let u = points[i] + shiftU, v = points[i + 1] + shiftV;\n let rotate = points[i + 6];\n\n const animX = points[i + 7], animY = points[i + 8];\n const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024;\n const animXEncoded = animX + (animWidth * 2048);\n const animYEncoded = animY + (animHeight * 2048);\n\n let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number;\n if (rotate === 0) {\n u0 = u;\n v0 = v;\n u1 = u + w;\n v1 = v;\n u2 = u + w;\n v2 = v + h;\n u3 = u;\n v3 = v + h;\n } else {\n let w2 = w / 2;\n let h2 = h / 2;\n if (rotate % 4 !== 0) {\n w2 = h / 2;\n h2 = w / 2;\n }\n const cX = u + w2;\n const cY = v + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW);\n u0 = cX + (w2 * groupD8.uX(rotate));\n v0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n u1 = cX + (w2 * groupD8.uX(rotate));\n v1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u2 = cX + (w2 * groupD8.uX(rotate));\n v2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u3 = cX + (w2 * groupD8.uX(rotate));\n v3 = cY + (h2 * groupD8.uY(rotate));\n }\n\n arr[sz++] = x;\n arr[sz++] = y;\n arr[sz++] = u0;\n arr[sz++] = v0;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y;\n arr[sz++] = u1;\n arr[sz++] = v1;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y + h;\n arr[sz++] = u2;\n arr[sz++] = v2;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x;\n arr[sz++] = y + h;\n arr[sz++] = u3;\n arr[sz++] = v3;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n }\n\n vertexBuf.update(arr);\n }\n\n (renderer.geometry as any).bind(vb, shader);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES, rectsCount * 6, 0);\n }\n\n isModified(anim: boolean) {\n if (this.modificationMarker !== this.pointsBuf.length ||\n anim && this.hasAnim) {\n return true;\n }\n return false;\n }\n\n clearModify() {\n this.modificationMarker = this.pointsBuf.length;\n }\n\n destroy(options?: any) {\n super.destroy(options);\n this.destroyVb();\n }\n}\n","/// \n\nimport { Container } from '@pixi/display';\nimport { Texture, Renderer } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { Constant } from './Constant';\nimport { RectTileLayer } from './RectTileLayer';\n\nexport class CompositeRectTileLayer extends Container {\n constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n super();\n this.initialize.apply(this, arguments);\n }\n\n updateTransform() {\n (this as any).displayObjectUpdateTransform();\n }\n\n z: number;\n zIndex: number;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n _lastLayer: RectTileLayer = null;\n\n texPerChild: number;\n\n initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n if (texPerChild as any === true) {\n //old format, ignore it!\n texPerChild = 0;\n }\n this.z = this.zIndex = zIndex;\n this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures;\n if (bitmaps) {\n this.setBitmaps(bitmaps);\n }\n }\n\n setBitmaps(bitmaps: Array) {\n for (let i=0;i 5.2.1, it does not exist there.`);\n }\n }\n let texPerChild = this.texPerChild;\n let len1 = this.children.length;\n let len2 = Math.ceil(bitmaps.length / texPerChild);\n let i: number;\n for (i = 0; i < len1; i++) {\n (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);\n }\n for (i = len1; i < len2; i++) {\n let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild));\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n this.addChild(layer);\n }\n }\n\n clear() {\n for (let i = 0; i < this.children.length; i++) {\n (this.children[i] as RectTileLayer).clear();\n }\n this.modificationMarker = 0;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this {\n const childIndex: number = textureIndex / this.texPerChild >> 0;\n const textureId: number = textureIndex % this.texPerChild;\n\n if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) {\n this._lastLayer = (this.children[childIndex] as RectTileLayer);\n this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight);\n } else {\n this._lastLayer = null;\n }\n\n return this;\n }\n\n tileRotate(rotate: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileRotate(rotate);\n }\n return this;\n }\n\n tileAnimX(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimX(offset, count);\n }\n return this;\n }\n\n tileAnimY(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimY(offset, count);\n }\n return this;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this {\n let texture: Texture;\n let layer: RectTileLayer = null;\n let ind: number = 0;\n let children = this.children;\n\n this._lastLayer = null;\n if (typeof texture_ === \"number\") {\n let childIndex = texture_ / this.texPerChild >> 0;\n layer = children[childIndex] as RectTileLayer;\n\n if (!layer) {\n layer = children[0] as RectTileLayer;\n if (!layer) {\n return this;\n }\n ind = 0;\n } else {\n ind = texture_ % this.texPerChild;\n }\n\n texture = layer.textures[ind];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n let tex = child.textures;\n for (let j = 0; j < tex.length; j++) {\n if (tex[j].baseTexture === texture.baseTexture) {\n layer = child;\n ind = j;\n break;\n }\n }\n if (layer) {\n break;\n }\n }\n\n if (!layer) {\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n if (child.textures.length < this.texPerChild) {\n layer = child;\n ind = child.textures.length;\n child.textures.push(texture);\n break;\n }\n }\n if (!layer) {\n layer = new RectTileLayer(this.zIndex, texture);\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n children.push(layer);\n ind = 0;\n }\n }\n }\n\n this._lastLayer = layer;\n layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight);\n return this;\n }\n\n renderCanvas(renderer: any) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderCanvasCore(renderer);\n }\n }\n\n render(renderer: Renderer) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n //TODO: dont create new array, please\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n renderer.shader.bind(shader, false);\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin);\n }\n }\n\n isModified(anim: boolean) {\n let layers = this.children;\n if (this.modificationMarker !== layers.length) {\n return true;\n }\n for (let i = 0; i < layers.length; i++) {\n if ((layers[i] as RectTileLayer).isModified(anim)) {\n return true;\n }\n }\n return false;\n }\n\n clearModify() {\n let layers = this.children;\n this.modificationMarker = layers.length;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).clearModify();\n }\n }\n}","/// \n\nimport { Matrix } from '@pixi/math';\nimport { Graphics } from '@pixi/graphics';\n\nexport class GraphicsLayer extends Graphics {\n constructor(zIndex: number) {\n super();\n this.zIndex = zIndex;\n }\n\n renderCanvas(renderer: any) {\n let wt: Matrix = null;\n if (renderer.plugins.tilemap.dontUseTransform) {\n wt = this.transform.worldTransform;\n this.transform.worldTransform = Matrix.IDENTITY;\n }\n renderer.plugins.graphics.render(this);\n if (renderer.plugins.tilemap.dontUseTransform) {\n this.transform.worldTransform = wt;\n }\n renderer.context.globalAlpha = 1.0;\n }\n\n // renderWebGL(renderer: PIXI.Renderer) {\n // if (!this._webGL[renderer.CONTEXT_UID])\n // this.dirty++;\n // super.renderWebGL(renderer)\n // }\n\n isModified(anim: boolean): boolean {\n return false;\n }\n\n clearModify() {\n }\n}\n","/// \n\nimport { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, Renderer, Texture, GLTexture, resources } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Constant } from './Constant';\n\nexport interface IMultiTextureOptions {\n\tboundCountPerBuffer: number;\n\tboundSize: number;\n\tbufferSize: number;\n\tDO_CLEAR?: boolean;\n}\n\nexport class MultiTextureResource extends resources.Resource {\n\tconstructor(options: IMultiTextureOptions) {\n\t\tsuper(options.bufferSize, options.bufferSize);\n\n\t\tconst bounds = this.boundSprites;\n\t\tconst dirties = this.dirties;\n\t\tthis.boundSize = options.boundSize;\n\t\tfor (let j = 0; j < options.boundCountPerBuffer; j++) {\n\t\t\tconst spr = new Sprite();\n\t\t\tspr.position.x = options.boundSize * (j & 1);\n\t\t\tspr.position.y = options.boundSize * (j >> 1);\n\t\t\tbounds.push(spr);\n\t\t\tdirties.push(0);\n\t\t}\n\t\tthis.DO_CLEAR = !!options.DO_CLEAR;\n\t}\n\n\tDO_CLEAR = false;\n\tboundSize: number = 0;\n\t_clearBuffer: Uint8Array = null;\n\n\tbind(baseTexture: BaseTexture) {\n\t\tif (this.baseTex) {\n\t\t\tthrow new Error('Only one baseTexture is allowed for this resource!')\n\t\t}\n\t\tthis.baseTex = baseTexture;\n\t\tsuper.bind(baseTexture);\n\t}\n\n\tbaseTex: BaseTexture = null;\n\tboundSprites: Array = [];\n\tdirties: Array = [];\n\n\tsetTexture(ind: number, texture: Texture) {\n\t\tconst spr = this.boundSprites[ind];\n\t\tif (spr.texture.baseTexture === texture.baseTexture) {\n\t\t\treturn;\n\t\t}\n\t\tspr.texture = texture;\n\t\tthis.baseTex.update();\n\t\tthis.dirties[ind] = (this.baseTex as any).dirtyId;\n\t}\n\n\tupload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture) {\n\t\tconst { gl } = renderer as any;\n\n\t\tconst {width, height} = this;\n\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined ||\n\t\t\ttexture.alphaMode === ALPHA_MODES.UNPACK);\n\n\t\tif (glTexture.dirtyId < 0) {\n\t\t\t(glTexture as any).width = width;\n\t\t\t(glTexture as any).height = height;\n\n\t\t\tgl.texImage2D(texture.target, 0,\n\t\t\t\ttexture.format,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\t0,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tnull);\n\t\t}\n\n\t\tconst doClear = this.DO_CLEAR;\n\t\tif (doClear && !this._clearBuffer) {\n\t\t\tthis._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4);\n\t\t}\n\n\t\tconst bounds = this.boundSprites;\n\t\tfor (let i = 0; i < bounds.length; i++) {\n\t\t\tconst spr = bounds[i];\n\t\t\tconst tex = spr.texture.baseTexture;\n\t\t\tif (glTexture.dirtyId >= this.dirties[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst res = tex.resource as any;\n\t\t\tif (!tex.valid || !res || !res.source) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (doClear && (tex.width < this.boundSize || tex.height < this.boundSize))\n\t\t\t{\n\t\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\t\tspr.position.x,\n\t\t\t\t\tspr.position.y,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\ttexture.format,\n\t\t\t\t\ttexture.type,\n\t\t\t\t\tthis._clearBuffer);\n\t\t\t}\n\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\tspr.position.x,\n\t\t\t\tspr.position.y,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tres.source);\n\t\t}\n\n\t\treturn true;\n\t}\n}\n","import { Constant } from './Constant';\n\nimport type { TilemapShader } from './RectTileShader';\n\n\nexport function fillSamplers(shader: TilemapShader, maxTextures: number) {\n let sampleValues: Array = [];\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n shader.uniforms.uSamplers = sampleValues;\n\n let samplerSize: Array = [];\n for (let i = 0; i < maxTextures; i++) {\n samplerSize.push(1.0 / Constant.bufferSize);\n samplerSize.push(1.0 / Constant.bufferSize);\n }\n shader.uniforms.uSamplerSize = samplerSize;\n}\n\nexport function generateFragmentSrc(maxTextures: number, fragmentSrc: string) {\n return fragmentSrc.replace(/%count%/gi, maxTextures + \"\")\n .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n}\n\nexport function generateSampleSrc(maxTextures: number) {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n src += 'if(vTextureId <= -1.0) {';\n src += '\\n\\tcolor = shadowColor;';\n src += '\\n}';\n\n for (let i = 0; i < maxTextures; i++)\n {\n src += '\\nelse ';\n\n if(i < maxTextures-1)\n {\n src += 'if(textureId == ' + i + '.0)';\n }\n\n src += '\\n{';\n src += '\\n\\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);';\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n}\n","/// \n\nimport * as shaderGenerator from './shaderGenerator';\n\nimport { Buffer, Geometry, Shader } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nlet rectShaderFrag = `\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n`;\nlet rectShaderVert = `\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n`;\n\nexport abstract class TilemapShader extends Shader {\n\tmaxTextures = 0;\n\n\tconstructor(maxTextures: number, shaderVert: string, shaderFrag: string) {\n\t\tsuper(\n\t\t\tnew PIXI.Program(\n\t\t\t\tshaderVert,\n\t\t\t\tshaderFrag),\n\t\t\t{\n\t\t\t\tanimationFrame: new Float32Array(2),\n\t\t\t\tuSamplers: [],\n\t\t\t\tuSamplerSize: [],\n\t\t\t\tprojTransMatrix: new Matrix()\n\t\t\t}\n\t\t);\n\t\tthis.maxTextures = maxTextures;\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileShader extends TilemapShader {\n\tconstructor(maxTextures: number) {\n\t\tsuper(\n\t\t\tmaxTextures,\n\t\t\trectShaderVert,\n\t\t\tshaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)\n\t\t);\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileGeom extends Geometry {\n\tvertSize = 11;\n\tvertPerQuad = 4;\n\tstride = this.vertSize * 4;\n\tlastTimeAccess = 0;\n\n\tconstructor() {\n\t\tsuper();\n\t\tconst buf = this.buf = new Buffer(new Float32Array(2), true, false);\n\t\tthis.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0)\n\t\t\t.addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4)\n\t\t\t.addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4)\n\t\t\t.addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4)\n\t\t\t.addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4);\n\t}\n\n\tbuf: PIXI.Buffer;\n}","import { WRAP_MODES } from '@pixi/constants';\nimport { BaseTexture, Buffer, resources, ObjectRenderer, Texture, Renderer } from '@pixi/core';\nimport { Constant } from './Constant';\nimport { RectTileGeom, RectTileShader } from './RectTileShader';\nimport { MultiTextureResource } from './MultiTextureResource';\n\nimport type { TilemapShader } from './RectTileShader';\n\n/**\n * Renderer for rectangle tiles.\n */\nexport class TileRenderer extends ObjectRenderer {\n\trenderer: Renderer;\n\tgl: WebGLRenderingContext;\n\tsn: number = -1;\n\tindexBuffer: PIXI.Buffer = null;\n\tibLen: number = 0;\n\ttileAnim = [0, 0];\n\ttexLoc: Array = [];\n\n\trectShader: RectTileShader;\n\ttexResources: Array = [];\n\n\tconstructor(renderer: Renderer) {\n\t\tsuper(renderer);\n\t\tthis.rectShader = new RectTileShader(Constant.maxTextures);\n\t\tthis.indexBuffer = new Buffer(undefined, true, true);\n\t\tthis.checkIndexBuffer(2000);\n\t\tthis.initBounds();\n\t}\n\n\tinitBounds() {\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tfor (let i = 0; i < maxTextures; i++) {\n\t\t\tconst resource = new MultiTextureResource(Constant);\n\t\t\tconst baseTex = new BaseTexture(resource);\n\t\t\tbaseTex.scaleMode = Constant.SCALE_MODE;\n\t\t\tbaseTex.wrapMode = WRAP_MODES.CLAMP;\n\t\t\tthis.texResources.push(resource);\n\t\t}\n\t}\n\n\tbindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tlet samplerSize: Array = (shader as any).uniforms.uSamplerSize;\n\t\tthis.texLoc.length = 0;\n\t\tfor (let i = 0; i < textures.length; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trenderer.texture.bind(textures[i], i);\n\t\t\t//TODO: add resolution here\n\t\t\tsamplerSize[i * 2] = 1.0 / textures[i].baseTexture.width;\n\t\t\tsamplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height;\n\t\t}\n\t\t(shader as any).uniforms.uSamplerSize = samplerSize;\n\t}\n\n\tbindTextures(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tconst len = textures.length;\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tif (len > Constant.boundCountPerBuffer * maxTextures) {\n\t\t\treturn;\n\t\t}\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\tthis.bindTexturesWithoutRT(renderer, shader, textures);\n\t\t\treturn;\n\t\t}\n\n\t\tlet i = 0;\n\t\tfor (; i < len; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) continue;\n\t\t\tconst multi = this.texResources[i >> 2];\n\t\t\tmulti.setTexture(i & 3, texture);\n\t\t}\n\n\t\tlet gltsUsed = (i + 3) >> 2;\n\t\tfor (i = 0; i < gltsUsed; i++) {\n\t\t\t//remove \"i, true\" after resolving a bug\n\t\t\trenderer.texture.bind(this.texResources[i].baseTex, i);\n\t\t}\n\t}\n\n\tstart() {\n\t\t//sorry, nothing\n\t}\n\n\tcreateVb() {\n\t\tconst geom = new RectTileGeom();\n\t\tgeom.addIndex(this.indexBuffer);\n\t\tgeom.lastTimeAccess = Date.now();\n\t\treturn geom;\n\t}\n\n\tcheckIndexBuffer(size: number, vb: RectTileGeom = null) {\n\t\tconst totalIndices = size * 6;\n\n\t\tif (totalIndices <= this.ibLen) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet len = totalIndices;\n\t\twhile (len < totalIndices) {\n\t\t\tlen <<= 1;\n\t\t}\n\n\t\tthis.ibLen = totalIndices;\n\t\tthis.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size,\n\t\t\tConstant.use32bitIndex ? new Uint32Array(size * 6) : undefined));\n\n\t\t// \tTODO: create new index buffer instead?\n\t\t// if (vb) {\n\t\t// \tconst curIndex = vb.getIndex();\n\t\t// \tif (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) {\n\t\t// \t\tthis.swapIndex(vb, this.indexBuffer);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t// swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) {\n\t\t// let buffers = (geom as any).buffers;\n\t\t// const oldIndex = geom.getIndex();\n\t\t// let ind = buffers.indexOf(oldIndex);\n\t\t// if (ind >= 0) {\n\t\t// \tbuffers.splice(ind, 1);\n\t\t// }\n\t\t// geom.addIndex(indexBuf);\n\t// }\n\n\tgetShader(): TilemapShader {\n\t\treturn this.rectShader;\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\t// this.rectShader.destroy();\n\t\tthis.rectShader = null;\n\t}\n}\n\nRenderer.registerPlugin('tilemap', TileRenderer as any);\n","/// \n\nimport { Container } from '@pixi/display';\n\nimport type { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport type { Matrix } from '@pixi/math';\n\nexport class ZLayer extends Container {\n\n constructor(tilemap: Container, zIndex: number) {\n super();\n this.tilemap = tilemap;\n this.z = zIndex;\n }\n\n tilemap: any;\n z: number;\n zIndex: number;\n _previousLayers: number;\n canvasBuffer: HTMLCanvasElement;\n _tempRender: any;\n _lastAnimationFrame: number = -1;\n layerTransform: Matrix;\n\n clear() {\n let layers = this.children as Array;\n for (let i = 0; i < layers.length; i++)\n layers[i].clear();\n this._previousLayers = 0;\n }\n\n cacheIfDirty() {\n let tilemap: any = this.tilemap;\n let layers = this.children as Array;\n let modified = this._previousLayers !== layers.length;\n this._previousLayers = layers.length;\n let buf = this.canvasBuffer;\n let tempRender = this._tempRender;\n if (!buf) {\n buf = this.canvasBuffer = document.createElement('canvas');\n tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf});\n tempRender.context = tempRender.rootContext;\n tempRender.plugins.tilemap.dontUseTransform = true;\n }\n if (buf.width !== tilemap._layerWidth ||\n buf.height !== tilemap._layerHeight) {\n buf.width = tilemap._layerWidth;\n buf.height = tilemap._layerHeight;\n modified = true;\n }\n let i: number;\n if (!modified) {\n for (i = 0; i < layers.length; i++) {\n if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) {\n modified = true;\n break;\n }\n }\n }\n this._lastAnimationFrame = tilemap.animationFrame;\n if (modified) {\n if (tilemap._hackRenderer) {\n tilemap._hackRenderer(tempRender);\n }\n tempRender.context.clearRect(0, 0, buf.width, buf.height);\n for (i = 0; i < layers.length; i++) {\n layers[i].clearModify();\n layers[i].renderCanvas(tempRender);\n }\n }\n this.layerTransform = this.worldTransform;\n for (i = 0; i < layers.length; i++) {\n this.layerTransform = layers[i].worldTransform;\n break;\n }\n }\n\n renderCanvas(renderer: any) {\n this.cacheIfDirty();\n let wt = this.layerTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n let tilemap = this.tilemap;\n renderer.context.drawImage(this.canvasBuffer, 0, 0);\n }\n}\n","/// \n\nnamespace pixi_tilemap {\n (PIXI as any).tilemap = pixi_tilemap;\n}\n\n// This makes exporter.ts a module!\nexport default {}\n","import { CanvasTileRenderer } from './CanvasTileRenderer';\nimport { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport { Constant } from './Constant';\nimport { GraphicsLayer } from './GraphicsLayer';\nimport { MultiTextureResource } from './MultiTextureResource';\nimport { RectTileLayer } from './RectTileLayer';\nimport { TilemapShader, RectTileShader, RectTileGeom } from './RectTileShader';\nimport { TileRenderer } from './TileRenderer';\nimport { ZLayer } from './ZLayer';\n\nexport const pixi_tilemap = {\n CanvasTileRenderer,\n CompositeRectTileLayer,\n Constant,\n GraphicsLayer,\n MultiTextureResource,\n RectTileLayer,\n TilemapShader,\n RectTileShader,\n RectTileGeom,\n TileRenderer,\n ZLayer,\n};\n\nexport * from './CanvasTileRenderer';\nexport * from './CompositeRectTileLayer';\nexport * from './Constant';\nexport * from './exporter';\nexport * from './GraphicsLayer';\nexport * from './MultiTextureResource';\nexport * from './RectTileLayer';\nexport * from './RectTileShader';\nexport * from './shaderGenerator';\nexport * from './TileRenderer';\nexport * from './ZLayer';"],"names":["Texture","groupD8","DRAW_MODES","Container","Matrix","Graphics","Sprite","ALPHA_MODES","resources","shaderGenerator.fillSamplers","Shader","shaderGenerator.generateFragmentSrc","Buffer","Geometry","BaseTexture","WRAP_MODES","ObjectRenderer","Renderer","pixi_tilemap"],"mappings":";;;;;;;;;;;;;QASI,4BAAY,QAAkB;YAH9B,aAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAClB,qBAAgB,GAAG,KAAK,CAAC;YAGrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SAC1B;QACL,yBAAC;IAAD,CAAC,IAAA;IAED,IAAM,EAAE,GAAI,IAAY,CAAC,cAAc,CAAC;IAExC,IAAI,EAAE,EAAE;QACJ,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;;;IClBrD;IACA;IACA;IACA;IACA;AACA;IACA;IACA;IACA;IACA;AACA;IACA;IACA;IACA;IACA;AACA;IACA,IAAI,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE;IACnC,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc;IACzC,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC;IACpF,QAAQ,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,C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i-tilemap.umd.min.js new file mode 100644 index 00000000..ec7abdce --- /dev/null +++ b/dist/pixi-tilemap.umd.min.js @@ -0,0 +1,25 @@ +/*! + * pixi-tilemap - v2.0.6 + * Compiled Fri, 14 Aug 2020 02:19:53 UTC + * + * pixi-tilemap is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + * + * Copyright 2016-20, Ivan Popelyshev All Rights Reserved + */ +var pixi_tilemap=function(e,t,r,i,n,o,a){"use strict";var s=function(e){this.tileAnim=[0,0],this.dontUseTransform=!1,this.renderer=e,this.tileAnim=[0,0]},u=PIXI.CanvasRenderer;u&&u.registerPlugin("tilemap",s) +/*! ***************************************************************************** + Copyright (c) Microsoft Corporation. All rights reserved. + Licensed under the Apache License, Version 2.0 (the "License"); you may not use + this file except in compliance with the License. You may obtain a copy of the + License at http://www.apache.org/licenses/LICENSE-2.0 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */;var h=function(e,t){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function l(e,t){function r(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var f={maxTextures:16,bufferSize:2048,boundSize:1024,boundCountPerBuffer:1,use32bitIndex:!1,SCALE_MODE:PIXI.SCALE_MODES.LINEAR,DO_CLEAR:!0},d=function(e){function t(t,r){var i=e.call(this)||this;return i.zIndex=0,i.modificationMarker=0,i.shadowColor=new Float32Array([0,0,0,.5]),i._globalMat=null,i.pointsBuf=[],i.hasAnim=!1,i.offsetX=0,i.offsetY=0,i.compositeParent=!1,i.vbId=0,i.vb=null,i.vbBuffer=null,i.vbArray=null,i.vbInts=null,i.initialize(t,r),i}return l(t,e),t.prototype.initialize=function(e,t){t?t instanceof Array||!t.baseTexture||(t=[t]):t=[],this.textures=t,this.zIndex=e},t.prototype.clear=function(){this.pointsBuf.length=0,this.modificationMarker=0,this.hasAnim=!1},t.prototype.addFrame=function(e,t,i,n,o){var a,s=0;if("number"==typeof e)s=e,a=this.textures[s];else{a="string"==typeof e?r.Texture.from(e):e;for(var u=!1,h=this.textures,l=0;l0||u>0,d.push(t),d.push(r),d.push(i),d.push(n),d.push(o),d.push(a),d.push(h),d.push(0|s),d.push(0|u),d.push(e),d.push(l),d.push(f),this},t.prototype.tileRotate=function(e){var t=this.pointsBuf;t[t.length-3]=e},t.prototype.tileAnimX=function(e,t){var r=this.pointsBuf;r[r.length-5]=e,r[r.length-2]=t},t.prototype.tileAnimY=function(e,t){var r=this.pointsBuf;r[r.length-4]=e,r[r.length-1]=t},t.prototype.renderCanvas=function(e){if(!e.plugins.tilemap.dontUseTransform){var t=this.worldTransform;e.context.setTransform(t.a,t.b,t.c,t.d,t.tx*e.resolution,t.ty*e.resolution)}this.renderCanvasCore(e)},t.prototype.renderCanvasCore=function(e){if(0!==this.textures.length){var t=this.pointsBuf;e.context.fillStyle="#000000";for(var r=0,i=t.length;r=0?e.context.drawImage(this.textures[l].baseTexture.getDrawableSource(),n,o,u,h,a,s,u,h):(e.context.globalAlpha=.5,e.context.fillRect(a,s,u,h),e.context.globalAlpha=1)}}},t.prototype.destroyVb=function(){this.vb&&(this.vb.destroy(),this.vb=null)},t.prototype.render=function(e){var t=e.plugins.tilemap,r=t.getShader();e.batch.setObjectRenderer(t),this._globalMat=r.uniforms.projTransMatrix,e.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform),r.uniforms.shadowColor=this.shadowColor,r.uniforms.animationFrame=t.tileAnim,this.renderWebGLCore(e,t)},t.prototype.renderWebGLCore=function(e,t){var r=this.pointsBuf;if(0!==r.length){var o=r.length/12,a=t.getShader(),s=this.textures;if(0!==s.length){t.bindTextures(e,a,s),e.shader.bind(a,!1);var u=this.vb;u||(u=t.createVb(),this.vb=u,this.vbId=u.id,this.vbBuffer=null,this.modificationMarker=0),t.checkIndexBuffer(o,u);var h=f.boundCountPerBuffer,l=u.getBuffer("aVertexPosition"),d=o*u.vertPerQuad;if(0!==d){if(this.modificationMarker!==d){this.modificationMarker=d;var p=u.stride*d;if(!this.vbBuffer||this.vbBuffer.byteLength1?(x=r[g+9]>>2,y=this.offsetX*(1&r[g+9]),b=this.offsetY*(r[g+9]>>1&1)):(x=r[g+9],y=0,b=0));var T=r[g+2],S=r[g+3],_=r[g+4],C=r[g+5],A=r[g]+y,w=r[g+1]+b,I=r[g+6],R=r[g+7],M=r[g+8],B=R+2048*(r[g+10]||1024),L=M+2048*(r[g+11]||1024),P=void 0,z=void 0,D=void 0,F=void 0,O=void 0,E=void 0,k=void 0,X=void 0;if(0===I)P=A,z=w,D=A+_,F=w,O=A+_,E=w+C,k=A,X=w+C;else{var U=_/2,Y=C/2;I%4!=0&&(U=C/2,Y=_/2);var j=A+U,G=w+Y;I=n.groupD8.add(I,n.groupD8.NW),P=j+U*n.groupD8.uX(I),z=G+Y*n.groupD8.uY(I),I=n.groupD8.add(I,2),D=j+U*n.groupD8.uX(I),F=G+Y*n.groupD8.uY(I),I=n.groupD8.add(I,2),O=j+U*n.groupD8.uX(I),E=G+Y*n.groupD8.uY(I),I=n.groupD8.add(I,2),k=j+U*n.groupD8.uX(I),X=G+Y*n.groupD8.uY(I)}m[v++]=T,m[v++]=S,m[v++]=P,m[v++]=z,m[v++]=A+.5,m[v++]=w+.5,m[v++]=A+_-.5,m[v++]=w+C-.5,m[v++]=B,m[v++]=L,m[v++]=x,m[v++]=T+_,m[v++]=S,m[v++]=D,m[v++]=F,m[v++]=A+.5,m[v++]=w+.5,m[v++]=A+_-.5,m[v++]=w+C-.5,m[v++]=B,m[v++]=L,m[v++]=x,m[v++]=T+_,m[v++]=S+C,m[v++]=O,m[v++]=E,m[v++]=A+.5,m[v++]=w+.5,m[v++]=A+_-.5,m[v++]=w+C-.5,m[v++]=B,m[v++]=L,m[v++]=x,m[v++]=T,m[v++]=S+C,m[v++]=k,m[v++]=X,m[v++]=A+.5,m[v++]=w+.5,m[v++]=A+_-.5,m[v++]=w+C-.5,m[v++]=B,m[v++]=L,m[v++]=x}l.update(m)}e.geometry.bind(u,a),e.geometry.draw(i.DRAW_MODES.TRIANGLES,6*o,0)}}}},t.prototype.isModified=function(e){return!!(this.modificationMarker!==this.pointsBuf.length||e&&this.hasAnim)},t.prototype.clearModify=function(){this.modificationMarker=this.pointsBuf.length},t.prototype.destroy=function(t){e.prototype.destroy.call(this,t),this.destroyVb()},t}(t.Container),p=function(e){function t(t,r,i){var n=e.call(this)||this;return n.modificationMarker=0,n.shadowColor=new Float32Array([0,0,0,.5]),n._globalMat=null,n._lastLayer=null,n.initialize.apply(n,arguments),n}return l(t,e),t.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},t.prototype.initialize=function(e,t,r){!0===r&&(r=0),this.z=this.zIndex=e,this.texPerChild=r||f.boundCountPerBuffer*f.maxTextures,t&&this.setBitmaps(t)},t.prototype.setBitmaps=function(e){for(var t=0;t 5.2.1, it does not exist there.");var r,i=this.texPerChild,n=this.children.length,o=Math.ceil(e.length/i);for(r=0;r>0,p=e%this.texPerChild;return this.children[d]&&this.children[d].textures?(this._lastLayer=this.children[d],this._lastLayer.addRect(p,t,r,i,n,o,a,s,u,h,l,f)):this._lastLayer=null,this},t.prototype.tileRotate=function(e){return this._lastLayer&&this._lastLayer.tileRotate(e),this},t.prototype.tileAnimX=function(e,t){return this._lastLayer&&this._lastLayer.tileAnimX(e,t),this},t.prototype.tileAnimY=function(e,t){return this._lastLayer&&this._lastLayer.tileAnimY(e,t),this},t.prototype.addFrame=function(e,t,i,n,o,a,s){var u,h=null,l=0,p=this.children;if(this._lastLayer=null,"number"==typeof e){if(h=p[e/this.texPerChild>>0])l=e%this.texPerChild;else{if(!(h=p[0]))return this;l=0}u=h.textures[l]}else{u="string"==typeof e?r.Texture.from(e):e;for(var c=0;c>1),i.push(s),n.push(0)}return r.DO_CLEAR=!!t.DO_CLEAR,r}return l(t,e),t.prototype.bind=function(t){if(this.baseTex)throw new Error("Only one baseTexture is allowed for this resource!");this.baseTex=t,e.prototype.bind.call(this,t)},t.prototype.setTexture=function(e,t){var r=this.boundSprites[e];r.texture.baseTexture!==t.baseTexture&&(r.texture=t,this.baseTex.update(),this.dirties[e]=this.baseTex.dirtyId)},t.prototype.upload=function(e,t,r){var n=e.gl,o=this.width,a=this.height;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,void 0===t.alphaMode||t.alphaMode===i.ALPHA_MODES.UNPACK),r.dirtyId<0&&(r.width=o,r.height=a,n.texImage2D(t.target,0,t.format,o,a,0,t.format,t.type,null));var s=this.DO_CLEAR;s&&!this._clearBuffer&&(this._clearBuffer=new Uint8Array(f.boundSize*f.boundSize*4));for(var u=this.boundSprites,h=0;h=this.dirties[h])){var p=d.resource;d.valid&&p&&p.source&&(s&&(d.widthf.boundCountPerBuffer*f.maxTextures))if(f.boundCountPerBuffer<=1)this.bindTexturesWithoutRT(e,t,r);else{for(var n=0;n>2].setTexture(3&n,o)}var a=n+3>>2;for(n=0;n\n\nimport { Renderer } from '@pixi/core';\n\nexport class CanvasTileRenderer {\n renderer: Renderer;\n tileAnim = [0, 0];\n dontUseTransform = false;\n\n constructor(renderer: Renderer) {\n this.renderer = renderer;\n this.tileAnim = [0, 0];\n }\n}\n\nconst cr = (PIXI as any).CanvasRenderer;\n\nif (cr) {\n cr.registerPlugin('tilemap', CanvasTileRenderer);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","export const Constant = {\n maxTextures: 16,\n bufferSize: 2048,\n boundSize: 1024,\n boundCountPerBuffer: 1,\n use32bitIndex: false,\n SCALE_MODE: PIXI.SCALE_MODES.LINEAR,\n DO_CLEAR: true\n};","/// \n\nimport { Container } from '@pixi/display';\nimport { Constant } from './Constant';\nimport { DRAW_MODES } from '@pixi/constants';\nimport { Texture, Renderer } from '@pixi/core';\nimport { TileRenderer } from './TileRenderer';\nimport { Matrix, groupD8 } from '@pixi/math';\n\nimport type { RectTileGeom } from './RectTileShader';\n\nexport const POINT_STRUCT_SIZE = 12;\n\nexport class RectTileLayer extends Container {\n constructor(zIndex: number, texture: Texture | Array) {\n super();\n this.initialize(zIndex, texture);\n }\n\n zIndex = 0;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n\n pointsBuf: Array = [];\n hasAnim = false;\n textures: Array;\n\n offsetX = 0;\n offsetY = 0;\n compositeParent = false;\n\n initialize(zIndex: number, textures: Texture | Array) {\n if (!textures) {\n textures = [];\n } else if (!(textures instanceof Array) && (textures as Texture).baseTexture) {\n textures = [textures as Texture];\n }\n this.textures = textures as Array;\n this.zIndex = zIndex;\n // this.visible = false;\n }\n\n clear() {\n this.pointsBuf.length = 0;\n this.modificationMarker = 0;\n this.hasAnim = false;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX: number, animY: number) {\n let texture: Texture;\n let textureIndex = 0;\n\n if (typeof texture_ === \"number\") {\n textureIndex = texture_;\n texture = this.textures[textureIndex];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n let found = false;\n let textureList = this.textures;\n for (let i = 0; i < textureList.length; i++) {\n if (textureList[i].baseTexture === texture.baseTexture) {\n textureIndex = i;\n found = true;\n break;\n }\n }\n\n if (!found) {\n // textureIndex = this.textures.length;\n // this.textures.push(texture);\n return false;\n }\n }\n\n this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate);\n return true;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number,\n animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this {\n let pb = this.pointsBuf;\n this.hasAnim = this.hasAnim || animX > 0 || animY > 0;\n pb.push(u);\n pb.push(v);\n pb.push(x);\n pb.push(y);\n pb.push(tileWidth);\n pb.push(tileHeight);\n pb.push(rotate);\n pb.push(animX | 0);\n pb.push(animY | 0);\n pb.push(textureIndex);\n pb.push(animCountX);\n pb.push(animCountY);\n\n return this;\n }\n\n tileRotate(rotate: number) {\n const pb = this.pointsBuf;\n pb[pb.length - 3] = rotate;\n }\n\n tileAnimX(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 5] = offset;\n pb[pb.length - 2] = count;\n }\n\n tileAnimY(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 4] = offset;\n pb[pb.length - 1] = count;\n }\n\n renderCanvas(renderer: any) {\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n this.renderCanvasCore(renderer);\n }\n\n renderCanvasCore(renderer: any) {\n if (this.textures.length === 0) return;\n let points = this.pointsBuf;\n renderer.context.fillStyle = '#000000';\n for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) {\n let x1 = points[i], y1 = points[i + 1];\n let x2 = points[i + 2], y2 = points[i + 3];\n let w = points[i + 4];\n let h = points[i + 5];\n var rotate = points[i + 6];\n x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0];\n y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1];\n let textureIndex = points[i + 9];\n // canvas does not work with rotate yet\n if (textureIndex >= 0) {\n renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h);\n } else {\n renderer.context.globalAlpha = 0.5;\n renderer.context.fillRect(x2, y2, w, h);\n renderer.context.globalAlpha = 1;\n }\n }\n }\n\n vbId = 0;\n vb: RectTileGeom = null;\n vbBuffer: ArrayBuffer = null;\n vbArray: Float32Array = null;\n vbInts: Uint32Array = null;\n\n destroyVb() {\n if (this.vb) {\n this.vb.destroy();\n this.vb = null;\n }\n }\n\n render(renderer: Renderer) {\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n this.renderWebGLCore(renderer, plugin);\n }\n\n renderWebGLCore(renderer: Renderer, plugin: TileRenderer) {\n let points = this.pointsBuf;\n if (points.length === 0) return;\n let rectsCount = points.length / POINT_STRUCT_SIZE;\n\n let shader = plugin.getShader();\n let textures = this.textures;\n if (textures.length === 0) return;\n\n plugin.bindTextures(renderer, shader, textures);\n renderer.shader.bind(shader, false);\n\n //lost context! recover!\n let vb = this.vb;\n if (!vb) {\n vb = plugin.createVb();\n this.vb = vb;\n this.vbId = (vb as any).id;\n this.vbBuffer = null;\n this.modificationMarker = 0;\n }\n\n plugin.checkIndexBuffer(rectsCount, vb);\n const boundCountPerBuffer = Constant.boundCountPerBuffer;\n\n let vertexBuf = vb.getBuffer('aVertexPosition');\n //if layer was changed, re-upload vertices\n let vertices = rectsCount * vb.vertPerQuad;\n if (vertices === 0) return;\n if (this.modificationMarker !== vertices) {\n this.modificationMarker = vertices;\n let vs = vb.stride * vertices;\n if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {\n //!@#$ happens, need resize\n let bk = vb.stride;\n while (bk < vs) {\n bk *= 2;\n }\n this.vbBuffer = new ArrayBuffer(bk);\n this.vbArray = new Float32Array(this.vbBuffer);\n this.vbInts = new Uint32Array(this.vbBuffer);\n vertexBuf.update(this.vbBuffer);\n }\n\n let arr = this.vbArray, ints = this.vbInts;\n //upload vertices!\n let sz = 0;\n //let tint = 0xffffffff;\n let textureId: number = 0;\n let shiftU: number = this.offsetX;\n let shiftV: number = this.offsetY;\n\n //let tint = 0xffffffff;\n let tint = -1;\n for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) {\n let eps = 0.5;\n if (this.compositeParent) {\n if (boundCountPerBuffer > 1) {\n //TODO: what if its more than 4?\n textureId = (points[i + 9] >> 2);\n shiftU = this.offsetX * (points[i + 9] & 1);\n shiftV = this.offsetY * ((points[i + 9] >> 1) & 1);\n } else {\n textureId = points[i + 9];\n shiftU = 0;\n shiftV = 0;\n }\n }\n let x = points[i + 2], y = points[i + 3];\n let w = points[i + 4], h = points[i + 5];\n let u = points[i] + shiftU, v = points[i + 1] + shiftV;\n let rotate = points[i + 6];\n\n const animX = points[i + 7], animY = points[i + 8];\n const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024;\n const animXEncoded = animX + (animWidth * 2048);\n const animYEncoded = animY + (animHeight * 2048);\n\n let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number;\n if (rotate === 0) {\n u0 = u;\n v0 = v;\n u1 = u + w;\n v1 = v;\n u2 = u + w;\n v2 = v + h;\n u3 = u;\n v3 = v + h;\n } else {\n let w2 = w / 2;\n let h2 = h / 2;\n if (rotate % 4 !== 0) {\n w2 = h / 2;\n h2 = w / 2;\n }\n const cX = u + w2;\n const cY = v + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW);\n u0 = cX + (w2 * groupD8.uX(rotate));\n v0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n u1 = cX + (w2 * groupD8.uX(rotate));\n v1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u2 = cX + (w2 * groupD8.uX(rotate));\n v2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u3 = cX + (w2 * groupD8.uX(rotate));\n v3 = cY + (h2 * groupD8.uY(rotate));\n }\n\n arr[sz++] = x;\n arr[sz++] = y;\n arr[sz++] = u0;\n arr[sz++] = v0;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y;\n arr[sz++] = u1;\n arr[sz++] = v1;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y + h;\n arr[sz++] = u2;\n arr[sz++] = v2;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x;\n arr[sz++] = y + h;\n arr[sz++] = u3;\n arr[sz++] = v3;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n }\n\n vertexBuf.update(arr);\n }\n\n (renderer.geometry as any).bind(vb, shader);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES, rectsCount * 6, 0);\n }\n\n isModified(anim: boolean) {\n if (this.modificationMarker !== this.pointsBuf.length ||\n anim && this.hasAnim) {\n return true;\n }\n return false;\n }\n\n clearModify() {\n this.modificationMarker = this.pointsBuf.length;\n }\n\n destroy(options?: any) {\n super.destroy(options);\n this.destroyVb();\n }\n}\n","/// \n\nimport { Container } from '@pixi/display';\nimport { Texture, Renderer } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { Constant } from './Constant';\nimport { RectTileLayer } from './RectTileLayer';\n\nexport class CompositeRectTileLayer extends Container {\n constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n super();\n this.initialize.apply(this, arguments);\n }\n\n updateTransform() {\n (this as any).displayObjectUpdateTransform();\n }\n\n z: number;\n zIndex: number;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n _lastLayer: RectTileLayer = null;\n\n texPerChild: number;\n\n initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n if (texPerChild as any === true) {\n //old format, ignore it!\n texPerChild = 0;\n }\n this.z = this.zIndex = zIndex;\n this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures;\n if (bitmaps) {\n this.setBitmaps(bitmaps);\n }\n }\n\n setBitmaps(bitmaps: Array) {\n for (let i=0;i 5.2.1, it does not exist there.`);\n }\n }\n let texPerChild = this.texPerChild;\n let len1 = this.children.length;\n let len2 = Math.ceil(bitmaps.length / texPerChild);\n let i: number;\n for (i = 0; i < len1; i++) {\n (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);\n }\n for (i = len1; i < len2; i++) {\n let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild));\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n this.addChild(layer);\n }\n }\n\n clear() {\n for (let i = 0; i < this.children.length; i++) {\n (this.children[i] as RectTileLayer).clear();\n }\n this.modificationMarker = 0;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this {\n const childIndex: number = textureIndex / this.texPerChild >> 0;\n const textureId: number = textureIndex % this.texPerChild;\n\n if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) {\n this._lastLayer = (this.children[childIndex] as RectTileLayer);\n this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight);\n } else {\n this._lastLayer = null;\n }\n\n return this;\n }\n\n tileRotate(rotate: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileRotate(rotate);\n }\n return this;\n }\n\n tileAnimX(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimX(offset, count);\n }\n return this;\n }\n\n tileAnimY(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimY(offset, count);\n }\n return this;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this {\n let texture: Texture;\n let layer: RectTileLayer = null;\n let ind: number = 0;\n let children = this.children;\n\n this._lastLayer = null;\n if (typeof texture_ === \"number\") {\n let childIndex = texture_ / this.texPerChild >> 0;\n layer = children[childIndex] as RectTileLayer;\n\n if (!layer) {\n layer = children[0] as RectTileLayer;\n if (!layer) {\n return this;\n }\n ind = 0;\n } else {\n ind = texture_ % this.texPerChild;\n }\n\n texture = layer.textures[ind];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n let tex = child.textures;\n for (let j = 0; j < tex.length; j++) {\n if (tex[j].baseTexture === texture.baseTexture) {\n layer = child;\n ind = j;\n break;\n }\n }\n if (layer) {\n break;\n }\n }\n\n if (!layer) {\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n if (child.textures.length < this.texPerChild) {\n layer = child;\n ind = child.textures.length;\n child.textures.push(texture);\n break;\n }\n }\n if (!layer) {\n layer = new RectTileLayer(this.zIndex, texture);\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n children.push(layer);\n ind = 0;\n }\n }\n }\n\n this._lastLayer = layer;\n layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight);\n return this;\n }\n\n renderCanvas(renderer: any) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderCanvasCore(renderer);\n }\n }\n\n render(renderer: Renderer) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n //TODO: dont create new array, please\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n renderer.shader.bind(shader, false);\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin);\n }\n }\n\n isModified(anim: boolean) {\n let layers = this.children;\n if (this.modificationMarker !== layers.length) {\n return true;\n }\n for (let i = 0; i < layers.length; i++) {\n if ((layers[i] as RectTileLayer).isModified(anim)) {\n return true;\n }\n }\n return false;\n }\n\n clearModify() {\n let layers = this.children;\n this.modificationMarker = layers.length;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).clearModify();\n }\n }\n}","/// \n\nimport { Matrix } from '@pixi/math';\nimport { Graphics } from '@pixi/graphics';\n\nexport class GraphicsLayer extends Graphics {\n constructor(zIndex: number) {\n super();\n this.zIndex = zIndex;\n }\n\n renderCanvas(renderer: any) {\n let wt: Matrix = null;\n if (renderer.plugins.tilemap.dontUseTransform) {\n wt = this.transform.worldTransform;\n this.transform.worldTransform = Matrix.IDENTITY;\n }\n renderer.plugins.graphics.render(this);\n if (renderer.plugins.tilemap.dontUseTransform) {\n this.transform.worldTransform = wt;\n }\n renderer.context.globalAlpha = 1.0;\n }\n\n // renderWebGL(renderer: PIXI.Renderer) {\n // if (!this._webGL[renderer.CONTEXT_UID])\n // this.dirty++;\n // super.renderWebGL(renderer)\n // }\n\n isModified(anim: boolean): boolean {\n return false;\n }\n\n clearModify() {\n }\n}\n","/// \n\nimport { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, Renderer, Texture, GLTexture, resources } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Constant } from './Constant';\n\nexport interface IMultiTextureOptions {\n\tboundCountPerBuffer: number;\n\tboundSize: number;\n\tbufferSize: number;\n\tDO_CLEAR?: boolean;\n}\n\nexport class MultiTextureResource extends resources.Resource {\n\tconstructor(options: IMultiTextureOptions) {\n\t\tsuper(options.bufferSize, options.bufferSize);\n\n\t\tconst bounds = this.boundSprites;\n\t\tconst dirties = this.dirties;\n\t\tthis.boundSize = options.boundSize;\n\t\tfor (let j = 0; j < options.boundCountPerBuffer; j++) {\n\t\t\tconst spr = new Sprite();\n\t\t\tspr.position.x = options.boundSize * (j & 1);\n\t\t\tspr.position.y = options.boundSize * (j >> 1);\n\t\t\tbounds.push(spr);\n\t\t\tdirties.push(0);\n\t\t}\n\t\tthis.DO_CLEAR = !!options.DO_CLEAR;\n\t}\n\n\tDO_CLEAR = false;\n\tboundSize: number = 0;\n\t_clearBuffer: Uint8Array = null;\n\n\tbind(baseTexture: BaseTexture) {\n\t\tif (this.baseTex) {\n\t\t\tthrow new Error('Only one baseTexture is allowed for this resource!')\n\t\t}\n\t\tthis.baseTex = baseTexture;\n\t\tsuper.bind(baseTexture);\n\t}\n\n\tbaseTex: BaseTexture = null;\n\tboundSprites: Array = [];\n\tdirties: Array = [];\n\n\tsetTexture(ind: number, texture: Texture) {\n\t\tconst spr = this.boundSprites[ind];\n\t\tif (spr.texture.baseTexture === texture.baseTexture) {\n\t\t\treturn;\n\t\t}\n\t\tspr.texture = texture;\n\t\tthis.baseTex.update();\n\t\tthis.dirties[ind] = (this.baseTex as any).dirtyId;\n\t}\n\n\tupload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture) {\n\t\tconst { gl } = renderer as any;\n\n\t\tconst {width, height} = this;\n\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined ||\n\t\t\ttexture.alphaMode === ALPHA_MODES.UNPACK);\n\n\t\tif (glTexture.dirtyId < 0) {\n\t\t\t(glTexture as any).width = width;\n\t\t\t(glTexture as any).height = height;\n\n\t\t\tgl.texImage2D(texture.target, 0,\n\t\t\t\ttexture.format,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\t0,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tnull);\n\t\t}\n\n\t\tconst doClear = this.DO_CLEAR;\n\t\tif (doClear && !this._clearBuffer) {\n\t\t\tthis._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4);\n\t\t}\n\n\t\tconst bounds = this.boundSprites;\n\t\tfor (let i = 0; i < bounds.length; i++) {\n\t\t\tconst spr = bounds[i];\n\t\t\tconst tex = spr.texture.baseTexture;\n\t\t\tif (glTexture.dirtyId >= this.dirties[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst res = tex.resource as any;\n\t\t\tif (!tex.valid || !res || !res.source) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (doClear && (tex.width < this.boundSize || tex.height < this.boundSize))\n\t\t\t{\n\t\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\t\tspr.position.x,\n\t\t\t\t\tspr.position.y,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\ttexture.format,\n\t\t\t\t\ttexture.type,\n\t\t\t\t\tthis._clearBuffer);\n\t\t\t}\n\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\tspr.position.x,\n\t\t\t\tspr.position.y,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tres.source);\n\t\t}\n\n\t\treturn true;\n\t}\n}\n","import { Constant } from './Constant';\n\nimport type { TilemapShader } from './RectTileShader';\n\n\nexport function fillSamplers(shader: TilemapShader, maxTextures: number) {\n let sampleValues: Array = [];\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n shader.uniforms.uSamplers = sampleValues;\n\n let samplerSize: Array = [];\n for (let i = 0; i < maxTextures; i++) {\n samplerSize.push(1.0 / Constant.bufferSize);\n samplerSize.push(1.0 / Constant.bufferSize);\n }\n shader.uniforms.uSamplerSize = samplerSize;\n}\n\nexport function generateFragmentSrc(maxTextures: number, fragmentSrc: string) {\n return fragmentSrc.replace(/%count%/gi, maxTextures + \"\")\n .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n}\n\nexport function generateSampleSrc(maxTextures: number) {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n src += 'if(vTextureId <= -1.0) {';\n src += '\\n\\tcolor = shadowColor;';\n src += '\\n}';\n\n for (let i = 0; i < maxTextures; i++)\n {\n src += '\\nelse ';\n\n if(i < maxTextures-1)\n {\n src += 'if(textureId == ' + i + '.0)';\n }\n\n src += '\\n{';\n src += '\\n\\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);';\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n}\n","/// \n\nimport * as shaderGenerator from './shaderGenerator';\n\nimport { Buffer, Geometry, Shader } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nlet rectShaderFrag = `\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n`;\nlet rectShaderVert = `\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n`;\n\nexport abstract class TilemapShader extends Shader {\n\tmaxTextures = 0;\n\n\tconstructor(maxTextures: number, shaderVert: string, shaderFrag: string) {\n\t\tsuper(\n\t\t\tnew PIXI.Program(\n\t\t\t\tshaderVert,\n\t\t\t\tshaderFrag),\n\t\t\t{\n\t\t\t\tanimationFrame: new Float32Array(2),\n\t\t\t\tuSamplers: [],\n\t\t\t\tuSamplerSize: [],\n\t\t\t\tprojTransMatrix: new Matrix()\n\t\t\t}\n\t\t);\n\t\tthis.maxTextures = maxTextures;\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileShader extends TilemapShader {\n\tconstructor(maxTextures: number) {\n\t\tsuper(\n\t\t\tmaxTextures,\n\t\t\trectShaderVert,\n\t\t\tshaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)\n\t\t);\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileGeom extends Geometry {\n\tvertSize = 11;\n\tvertPerQuad = 4;\n\tstride = this.vertSize * 4;\n\tlastTimeAccess = 0;\n\n\tconstructor() {\n\t\tsuper();\n\t\tconst buf = this.buf = new Buffer(new Float32Array(2), true, false);\n\t\tthis.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0)\n\t\t\t.addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4)\n\t\t\t.addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4)\n\t\t\t.addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4)\n\t\t\t.addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4);\n\t}\n\n\tbuf: PIXI.Buffer;\n}","import { WRAP_MODES } from '@pixi/constants';\nimport { BaseTexture, Buffer, resources, ObjectRenderer, Texture, Renderer } from '@pixi/core';\nimport { Constant } from './Constant';\nimport { RectTileGeom, RectTileShader } from './RectTileShader';\nimport { MultiTextureResource } from './MultiTextureResource';\n\nimport type { TilemapShader } from './RectTileShader';\n\n/**\n * Renderer for rectangle tiles.\n */\nexport class TileRenderer extends ObjectRenderer {\n\trenderer: Renderer;\n\tgl: WebGLRenderingContext;\n\tsn: number = -1;\n\tindexBuffer: PIXI.Buffer = null;\n\tibLen: number = 0;\n\ttileAnim = [0, 0];\n\ttexLoc: Array = [];\n\n\trectShader: RectTileShader;\n\ttexResources: Array = [];\n\n\tconstructor(renderer: Renderer) {\n\t\tsuper(renderer);\n\t\tthis.rectShader = new RectTileShader(Constant.maxTextures);\n\t\tthis.indexBuffer = new Buffer(undefined, true, true);\n\t\tthis.checkIndexBuffer(2000);\n\t\tthis.initBounds();\n\t}\n\n\tinitBounds() {\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tfor (let i = 0; i < maxTextures; i++) {\n\t\t\tconst resource = new MultiTextureResource(Constant);\n\t\t\tconst baseTex = new BaseTexture(resource);\n\t\t\tbaseTex.scaleMode = Constant.SCALE_MODE;\n\t\t\tbaseTex.wrapMode = WRAP_MODES.CLAMP;\n\t\t\tthis.texResources.push(resource);\n\t\t}\n\t}\n\n\tbindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tlet samplerSize: Array = (shader as any).uniforms.uSamplerSize;\n\t\tthis.texLoc.length = 0;\n\t\tfor (let i = 0; i < textures.length; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trenderer.texture.bind(textures[i], i);\n\t\t\t//TODO: add resolution here\n\t\t\tsamplerSize[i * 2] = 1.0 / textures[i].baseTexture.width;\n\t\t\tsamplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height;\n\t\t}\n\t\t(shader as any).uniforms.uSamplerSize = samplerSize;\n\t}\n\n\tbindTextures(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tconst len = textures.length;\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tif (len > Constant.boundCountPerBuffer * maxTextures) {\n\t\t\treturn;\n\t\t}\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\tthis.bindTexturesWithoutRT(renderer, shader, textures);\n\t\t\treturn;\n\t\t}\n\n\t\tlet i = 0;\n\t\tfor (; i < len; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) continue;\n\t\t\tconst multi = this.texResources[i >> 2];\n\t\t\tmulti.setTexture(i & 3, texture);\n\t\t}\n\n\t\tlet gltsUsed = (i + 3) >> 2;\n\t\tfor (i = 0; i < gltsUsed; i++) {\n\t\t\t//remove \"i, true\" after resolving a bug\n\t\t\trenderer.texture.bind(this.texResources[i].baseTex, i);\n\t\t}\n\t}\n\n\tstart() {\n\t\t//sorry, nothing\n\t}\n\n\tcreateVb() {\n\t\tconst geom = new RectTileGeom();\n\t\tgeom.addIndex(this.indexBuffer);\n\t\tgeom.lastTimeAccess = Date.now();\n\t\treturn geom;\n\t}\n\n\tcheckIndexBuffer(size: number, vb: RectTileGeom = null) {\n\t\tconst totalIndices = size * 6;\n\n\t\tif (totalIndices <= this.ibLen) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet len = totalIndices;\n\t\twhile (len < totalIndices) {\n\t\t\tlen <<= 1;\n\t\t}\n\n\t\tthis.ibLen = totalIndices;\n\t\tthis.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size,\n\t\t\tConstant.use32bitIndex ? new Uint32Array(size * 6) : undefined));\n\n\t\t// \tTODO: create new index buffer instead?\n\t\t// if (vb) {\n\t\t// \tconst curIndex = vb.getIndex();\n\t\t// \tif (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) {\n\t\t// \t\tthis.swapIndex(vb, this.indexBuffer);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t// swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) {\n\t\t// let buffers = (geom as any).buffers;\n\t\t// const oldIndex = geom.getIndex();\n\t\t// let ind = buffers.indexOf(oldIndex);\n\t\t// if (ind >= 0) {\n\t\t// \tbuffers.splice(ind, 1);\n\t\t// }\n\t\t// geom.addIndex(indexBuf);\n\t// }\n\n\tgetShader(): TilemapShader {\n\t\treturn this.rectShader;\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\t// this.rectShader.destroy();\n\t\tthis.rectShader = null;\n\t}\n}\n\nRenderer.registerPlugin('tilemap', TileRenderer as any);\n","/// \n\nnamespace pixi_tilemap {\n (PIXI as any).tilemap = pixi_tilemap;\n}\n\n// This makes exporter.ts a module!\nexport default {}\n","/// \n\nimport { Container } from '@pixi/display';\n\nimport type { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport type { Matrix } from '@pixi/math';\n\nexport class ZLayer extends Container {\n\n constructor(tilemap: Container, zIndex: number) {\n super();\n this.tilemap = tilemap;\n this.z = zIndex;\n }\n\n tilemap: any;\n z: number;\n zIndex: number;\n _previousLayers: number;\n canvasBuffer: HTMLCanvasElement;\n _tempRender: any;\n _lastAnimationFrame: number = -1;\n layerTransform: Matrix;\n\n clear() {\n let layers = this.children as Array;\n for (let i = 0; i < layers.length; i++)\n layers[i].clear();\n this._previousLayers = 0;\n }\n\n cacheIfDirty() {\n let tilemap: any = this.tilemap;\n let layers = this.children as Array;\n let modified = this._previousLayers !== layers.length;\n this._previousLayers = layers.length;\n let buf = this.canvasBuffer;\n let tempRender = this._tempRender;\n if (!buf) {\n buf = this.canvasBuffer = document.createElement('canvas');\n tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf});\n tempRender.context = tempRender.rootContext;\n tempRender.plugins.tilemap.dontUseTransform = true;\n }\n if (buf.width !== tilemap._layerWidth ||\n buf.height !== tilemap._layerHeight) {\n buf.width = tilemap._layerWidth;\n buf.height = tilemap._layerHeight;\n modified = true;\n }\n let i: number;\n if (!modified) {\n for (i = 0; i < layers.length; i++) {\n if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) {\n modified = true;\n break;\n }\n }\n }\n this._lastAnimationFrame = tilemap.animationFrame;\n if (modified) {\n if (tilemap._hackRenderer) {\n tilemap._hackRenderer(tempRender);\n }\n tempRender.context.clearRect(0, 0, buf.width, buf.height);\n for (i = 0; i < layers.length; i++) {\n layers[i].clearModify();\n layers[i].renderCanvas(tempRender);\n }\n }\n this.layerTransform = this.worldTransform;\n for (i = 0; i < layers.length; i++) {\n this.layerTransform = layers[i].worldTransform;\n break;\n }\n }\n\n renderCanvas(renderer: any) {\n this.cacheIfDirty();\n let wt = this.layerTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n let tilemap = this.tilemap;\n renderer.context.drawImage(this.canvasBuffer, 0, 0);\n }\n}\n","import { CanvasTileRenderer } from './CanvasTileRenderer';\nimport { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport { Constant } from './Constant';\nimport { GraphicsLayer } from './GraphicsLayer';\nimport { MultiTextureResource } from './MultiTextureResource';\nimport { RectTileLayer } from './RectTileLayer';\nimport { TilemapShader, RectTileShader, RectTileGeom } from './RectTileShader';\nimport { TileRenderer } from './TileRenderer';\nimport { ZLayer } from './ZLayer';\n\nexport const pixi_tilemap = {\n CanvasTileRenderer,\n CompositeRectTileLayer,\n Constant,\n GraphicsLayer,\n MultiTextureResource,\n RectTileLayer,\n TilemapShader,\n RectTileShader,\n RectTileGeom,\n TileRenderer,\n ZLayer,\n};\n\nexport * from './CanvasTileRenderer';\nexport * from './CompositeRectTileLayer';\nexport * from './Constant';\nexport * from './exporter';\nexport * from './GraphicsLayer';\nexport * from './MultiTextureResource';\nexport * from './RectTileLayer';\nexport * from './RectTileShader';\nexport * from './shaderGenerator';\nexport * from './TileRenderer';\nexport * from './ZLayer';"],"names":["renderer","this","tileAnim","cr","PIXI","CanvasRenderer","registerPlugin","CanvasTileRenderer","extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","__extends","__","constructor","prototype","create","Constant","maxTextures","bufferSize","boundSize","boundCountPerBuffer","use32bitIndex","SCALE_MODE","SCALE_MODES","LINEAR","DO_CLEAR","zIndex","texture","_super","_this","Float32Array","initialize","RectTileLayer","textures","baseTexture","pointsBuf","length","modificationMarker","hasAnim","texture_","x","y","animX","animY","textureIndex","Texture","from","found","textureList","i","addRect","frame","orig","width","height","rotate","u","v","tileWidth","tileHeight","animCountX","animCountY","pb","push","offset","count","plugins","tilemap","dontUseTransform","wt","worldTransform","context","setTransform","a","c","tx","resolution","ty","renderCanvasCore","points","fillStyle","n","x1","y1","x2","y2","w","h","drawImage","getDrawableSource","globalAlpha","fillRect","vb","destroy","plugin","shader","getShader","batch","setObjectRenderer","_globalMat","uniforms","projTransMatrix","globalUniforms","projectionMatrix","copyTo","append","shadowColor","animationFrame","renderWebGLCore","rectsCount","bindTextures","bind","createVb","vbId","id","vbBuffer","checkIndexBuffer","vertexBuf","getBuffer","vertices","vertPerQuad","vs","stride","byteLength","bk","ArrayBuffer","vbArray","vbInts","Uint32Array","update","arr","sz","textureId","shiftU","offsetX","shiftV","offsetY","compositeParent","animXEncoded","animYEncoded","u0","v0","u1","v1","u2","v2","u3","v3","w2","h2","cX","cY","groupD8","add","NW","uX","uY","geometry","draw","DRAW_MODES","TRIANGLES","anim","options","destroyVb","Container","bitmaps","texPerChild","apply","arguments","CompositeRectTileLayer","displayObjectUpdateTransform","z","setBitmaps","i_1","Error","len1","children","len2","Math","ceil","slice","layer","addChild","clear","animWidth","animHeight","childIndex","_lastLayer","tileRotate","tileAnimX","tileAnimY","ind","tex","child","j","visible","worldAlpha","renderable","layers","isModified","clearModify","GraphicsLayer","transform","Matrix","IDENTITY","graphics","render","Graphics","bounds","boundSprites","dirties","spr","Sprite","position","MultiTextureResource","baseTex","dirtyId","glTexture","gl","pixelStorei","UNPACK_PREMULTIPLY_ALPHA_WEBGL","undefined","alphaMode","ALPHA_MODES","UNPACK","texImage2D","target","format","type","doClear","_clearBuffer","Uint8Array","res","resource","valid","source","texSubImage2D","resources","Resource","fillSamplers","sampleValues","uSamplers","samplerSize","uSamplerSize","generateFragmentSrc","fragmentSrc","replace","generateSampleSrc","shaderVert","shaderFrag","Program","shaderGenerator.fillSamplers","Shader","shaderGenerator.generateFragmentSrc","TilemapShader","vertSize","buf","Buffer","addAttribute","Geometry","rectShader","RectTileShader","indexBuffer","initBounds","TileRenderer","BaseTexture","scaleMode","wrapMode","WRAP_MODES","CLAMP","texResources","texLoc","len","bindTexturesWithoutRT","setTexture","gltsUsed","geom","RectTileGeom","addIndex","lastTimeAccess","Date","now","size","totalIndices","ibLen","utils","createIndicesForQuads","ObjectRenderer","pixi_tilemap","ZLayer","_previousLayers","modified","canvasBuffer","tempRender","_tempRender","document","createElement","view","rootContext","_layerWidth","_layerHeight","_lastAnimationFrame","_hackRenderer","clearRect","renderCanvas","layerTransform","cacheIfDirty","src"],"mappings":";;;;;;;;;4DASI,SAAYA,GAHZC,cAAW,CAAC,EAAG,GACfA,uBAAmB,EAGfA,KAAKD,SAAWA,EAChBC,KAAKC,SAAW,CAAC,EAAG,IAItBC,EAAMC,KAAaC,eAErBF,GACAA,EAAGG,eAAe,UAAWC;;;;;;;;;;;;;;qFCFjC,IAAIC,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,IACvE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOA,EAAEM,eAAeD,KAAIN,EAAEM,GAAKL,EAAEK,MACpDN,EAAGC,IAGrB,SAASO,EAAUR,EAAGC,GAEzB,SAASQ,IAAOjB,KAAKkB,YAAcV,EADnCD,EAAcC,EAAGC,GAEjBD,EAAEW,UAAkB,OAANV,EAAaC,OAAOU,OAAOX,IAAMQ,EAAGE,UAAYV,EAAEU,UAAW,IAAIF,OC1BtEI,EAAW,CACpBC,YAAa,GACbC,WAAY,KACZC,UAAW,KACXC,oBAAqB,EACrBC,eAAe,EACfC,WAAYxB,KAAKyB,YAAYC,OAC7BC,UAAU,iBCOV,WAAYC,EAAgBC,GAA5B,MACIC,0BAIJC,SAAS,EACTA,qBAAqB,EACrBA,cAAc,IAAIC,aAAa,CAAC,EAAK,EAAK,EAAK,KAC/CD,aAAqB,KAErBA,YAA2B,GAC3BA,WAAU,EAGVA,UAAU,EACVA,UAAU,EACVA,mBAAkB,EAqIlBA,OAAO,EACPA,KAAmB,KACnBA,WAAwB,KACxBA,UAAwB,KACxBA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E,eACtBrB,EAAI,EAAGA,EAAIqJ,EAAOlK,OAAQa,IAAK,CAChCtD,KAAKsT,eAAiB3G,EAAOrJ,GAAGqB,eAChC,QAIR2N,yBAAA,SAAavS,GACTC,KAAKuT,eACL,IAAI7O,EAAK1E,KAAKsT,eACdvT,EAAS6E,QAAQC,aACbH,EAAGI,EACHJ,EAAGjE,EACHiE,EAAGK,EACHL,EAAGlE,EACHkE,EAAGM,GAAKjF,EAASkF,WACjBP,EAAGQ,GAAKnF,EAASkF,YAEPjF,KAAKwE,QACnBzE,EAAS6E,QAAQiB,UAAU7F,KAAKyS,aAAc,EAAG,OAlF7BhI,cDL5B,SAAU4H,GACLlS,KAAaqE,QAAU6N,EAD5B,CAAUA,IAAAA,WEQGA,EAAe,CACxB/R,qBACAwK,yBACAzJ,WACAyL,gBACAa,uBACAtL,gBACA8N,gBACAO,iBACAgB,eACAb,eACAyB,+ITV6B,6KIeChR,GAC9B,IAAIkS,EAAM,GAEVA,GAAO,KACPA,GAAO,KAEPA,GAAO,2BACPA,GAAO,2BACPA,GAAO,MAEP,IAAK,IAAIlQ,EAAI,EAAGA,EAAIhC,EAAagC,IAE7BkQ,GAAO,UAEJlQ,EAAIhC,EAAY,IAEfkS,GAAO,mBAAqBlQ,EAAI,OAGpCkQ,GAAO,MACPA,GAAO,mCAAmClQ,EAAE,kCAAkCA,EAAE,MAChFkQ,GAAO,MAMX,OAHAA,GAAO,KACPA,GAAO"} \ No newline at end of file diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 00000000..4e0e2c1f --- /dev/null +++ b/index.d.ts @@ -0,0 +1,201 @@ +/// +import { BaseTexture } from '@pixi/core'; +import { Container } from '@pixi/display'; +import { Geometry } from '@pixi/core'; +import { GLTexture } from '@pixi/core'; +import { Graphics } from '@pixi/graphics'; +import { Matrix } from '@pixi/math'; +import { ObjectRenderer } from '@pixi/core'; +import { Renderer } from '@pixi/core'; +import { resources } from '@pixi/core'; +import { Shader } from '@pixi/core'; +import { Sprite } from '@pixi/sprite'; +import { Texture } from '@pixi/core'; + +export declare class CanvasTileRenderer { + renderer: Renderer; + tileAnim: number[]; + dontUseTransform: boolean; + constructor(renderer: Renderer); +} + +export declare class CompositeRectTileLayer extends Container { + constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number); + updateTransform(): void; + z: number; + zIndex: number; + modificationMarker: number; + shadowColor: Float32Array; + _globalMat: Matrix; + _lastLayer: RectTileLayer; + texPerChild: number; + initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number): void; + setBitmaps(bitmaps: Array): void; + clear(): void; + addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this; + tileRotate(rotate: number): this; + tileAnimX(offset: number, count: number): this; + tileAnimY(offset: number, count: number): this; + addFrame(texture_: Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this; + renderCanvas(renderer: any): void; + render(renderer: Renderer): void; + isModified(anim: boolean): boolean; + clearModify(): void; +} + +export declare const Constant: { + maxTextures: number; + bufferSize: number; + boundSize: number; + boundCountPerBuffer: number; + use32bitIndex: boolean; + SCALE_MODE: PIXI.SCALE_MODES; + DO_CLEAR: boolean; +}; + +export declare function fillSamplers(shader: TilemapShader, maxTextures: number): void; + +export declare function generateFragmentSrc(maxTextures: number, fragmentSrc: string): string; + +export declare function generateSampleSrc(maxTextures: number): string; + +export declare class GraphicsLayer extends Graphics { + constructor(zIndex: number); + renderCanvas(renderer: any): void; + isModified(anim: boolean): boolean; + clearModify(): void; +} + +export declare interface IMultiTextureOptions { + boundCountPerBuffer: number; + boundSize: number; + bufferSize: number; + DO_CLEAR?: boolean; +} + +export declare class MultiTextureResource extends resources.Resource { + constructor(options: IMultiTextureOptions); + DO_CLEAR: boolean; + boundSize: number; + _clearBuffer: Uint8Array; + bind(baseTexture: BaseTexture): void; + baseTex: BaseTexture; + boundSprites: Array; + dirties: Array; + setTexture(ind: number, texture: Texture): void; + upload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture): boolean; +} + +export declare const pixi_tilemap: { + CanvasTileRenderer: typeof CanvasTileRenderer; + CompositeRectTileLayer: typeof CompositeRectTileLayer; + Constant: { + maxTextures: number; + bufferSize: number; + boundSize: number; + boundCountPerBuffer: number; + use32bitIndex: boolean; + SCALE_MODE: PIXI.SCALE_MODES; + DO_CLEAR: boolean; + }; + GraphicsLayer: typeof GraphicsLayer; + MultiTextureResource: typeof MultiTextureResource; + RectTileLayer: typeof RectTileLayer; + TilemapShader: typeof TilemapShader; + RectTileShader: typeof RectTileShader; + RectTileGeom: typeof RectTileGeom; + TileRenderer: typeof TileRenderer; + ZLayer: typeof ZLayer; +}; + +export declare const POINT_STRUCT_SIZE = 12; + +export declare class RectTileGeom extends Geometry { + vertSize: number; + vertPerQuad: number; + stride: number; + lastTimeAccess: number; + constructor(); + buf: PIXI.Buffer; +} + +export declare class RectTileLayer extends Container { + constructor(zIndex: number, texture: Texture | Array); + zIndex: number; + modificationMarker: number; + shadowColor: Float32Array; + _globalMat: Matrix; + pointsBuf: Array; + hasAnim: boolean; + textures: Array; + offsetX: number; + offsetY: number; + compositeParent: boolean; + initialize(zIndex: number, textures: Texture | Array): void; + clear(): void; + addFrame(texture_: Texture | String | number, x: number, y: number, animX: number, animY: number): boolean; + addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animCountX?: number, animCountY?: number): this; + tileRotate(rotate: number): void; + tileAnimX(offset: number, count: number): void; + tileAnimY(offset: number, count: number): void; + renderCanvas(renderer: any): void; + renderCanvasCore(renderer: any): void; + vbId: number; + vb: RectTileGeom; + vbBuffer: ArrayBuffer; + vbArray: Float32Array; + vbInts: Uint32Array; + destroyVb(): void; + render(renderer: Renderer): void; + renderWebGLCore(renderer: Renderer, plugin: TileRenderer): void; + isModified(anim: boolean): boolean; + clearModify(): void; + destroy(options?: any): void; +} + +export declare class RectTileShader extends TilemapShader { + constructor(maxTextures: number); +} + +export declare abstract class TilemapShader extends Shader { + maxTextures: number; + constructor(maxTextures: number, shaderVert: string, shaderFrag: string); +} + +export declare class TileRenderer extends ObjectRenderer { + renderer: Renderer; + gl: WebGLRenderingContext; + sn: number; + indexBuffer: PIXI.Buffer; + ibLen: number; + tileAnim: number[]; + texLoc: Array; + rectShader: RectTileShader; + texResources: Array; + constructor(renderer: Renderer); + initBounds(): void; + bindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array): void; + bindTextures(renderer: Renderer, shader: TilemapShader, textures: Array): void; + start(): void; + createVb(): RectTileGeom; + checkIndexBuffer(size: number, vb?: RectTileGeom): void; + getShader(): TilemapShader; + destroy(): void; +} + +export declare class ZLayer extends Container { + constructor(tilemap: Container, zIndex: number); + tilemap: any; + z: number; + zIndex: number; + _previousLayers: number; + canvasBuffer: HTMLCanvasElement; + _tempRender: any; + _lastAnimationFrame: number; + layerTransform: Matrix; + clear(): void; + cacheIfDirty(): void; + renderCanvas(renderer: any): void; +} + +export { } diff --git a/lib/pixi-tilemap.es.js b/lib/pixi-tilemap.es.js new file mode 100644 index 00000000..ab14d3f7 --- /dev/null +++ b/lib/pixi-tilemap.es.js @@ -0,0 +1,955 @@ +/*! + * pixi-tilemap - v2.0.6 + * Compiled Fri, 14 Aug 2020 02:19:53 UTC + * + * pixi-tilemap is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + * + * Copyright 2016-20, Ivan Popelyshev All Rights Reserved + */ +import { Container } from '@pixi/display'; +import { Texture, resources, Shader, Buffer, Geometry, BaseTexture, ObjectRenderer, Renderer } from '@pixi/core'; +import { DRAW_MODES, ALPHA_MODES, WRAP_MODES } from '@pixi/constants'; +import { groupD8, Matrix } from '@pixi/math'; +import { Graphics } from '@pixi/graphics'; +import { Sprite } from '@pixi/sprite'; + +var CanvasTileRenderer = (function () { + function CanvasTileRenderer(renderer) { + this.tileAnim = [0, 0]; + this.dontUseTransform = false; + this.renderer = renderer; + this.tileAnim = [0, 0]; + } + return CanvasTileRenderer; +}()); +var cr = PIXI.CanvasRenderer; +if (cr) { + cr.registerPlugin('tilemap', CanvasTileRenderer); +} + +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ +/* global Reflect, Promise */ + +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); +}; + +function __extends(d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +var Constant = { + maxTextures: 16, + bufferSize: 2048, + boundSize: 1024, + boundCountPerBuffer: 1, + use32bitIndex: false, + SCALE_MODE: PIXI.SCALE_MODES.LINEAR, + DO_CLEAR: true +}; + +var POINT_STRUCT_SIZE = 12; +var RectTileLayer = (function (_super) { + __extends(RectTileLayer, _super); + function RectTileLayer(zIndex, texture) { + var _this = _super.call(this) || this; + _this.zIndex = 0; + _this.modificationMarker = 0; + _this.shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]); + _this._globalMat = null; + _this.pointsBuf = []; + _this.hasAnim = false; + _this.offsetX = 0; + _this.offsetY = 0; + _this.compositeParent = false; + _this.vbId = 0; + _this.vb = null; + _this.vbBuffer = null; + _this.vbArray = null; + _this.vbInts = null; + _this.initialize(zIndex, texture); + return _this; + } + RectTileLayer.prototype.initialize = function (zIndex, textures) { + if (!textures) { + textures = []; + } + else if (!(textures instanceof Array) && textures.baseTexture) { + textures = [textures]; + } + this.textures = textures; + this.zIndex = zIndex; + }; + RectTileLayer.prototype.clear = function () { + this.pointsBuf.length = 0; + this.modificationMarker = 0; + this.hasAnim = false; + }; + RectTileLayer.prototype.addFrame = function (texture_, x, y, animX, animY) { + var texture; + var textureIndex = 0; + if (typeof texture_ === "number") { + textureIndex = texture_; + texture = this.textures[textureIndex]; + } + else { + if (typeof texture_ === "string") { + texture = Texture.from(texture_); + } + else { + texture = texture_; + } + var found = false; + var textureList = this.textures; + for (var i = 0; i < textureList.length; i++) { + if (textureList[i].baseTexture === texture.baseTexture) { + textureIndex = i; + found = true; + break; + } + } + if (!found) { + return false; + } + } + this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate); + return true; + }; + RectTileLayer.prototype.addRect = function (textureIndex, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animCountX, animCountY) { + if (animX === void 0) { animX = 0; } + if (animY === void 0) { animY = 0; } + if (rotate === void 0) { rotate = 0; } + if (animCountX === void 0) { animCountX = 1024; } + if (animCountY === void 0) { animCountY = 1024; } + var pb = this.pointsBuf; + this.hasAnim = this.hasAnim || animX > 0 || animY > 0; + pb.push(u); + pb.push(v); + pb.push(x); + pb.push(y); + pb.push(tileWidth); + pb.push(tileHeight); + pb.push(rotate); + pb.push(animX | 0); + pb.push(animY | 0); + pb.push(textureIndex); + pb.push(animCountX); + pb.push(animCountY); + return this; + }; + RectTileLayer.prototype.tileRotate = function (rotate) { + var pb = this.pointsBuf; + pb[pb.length - 3] = rotate; + }; + RectTileLayer.prototype.tileAnimX = function (offset, count) { + var pb = this.pointsBuf; + pb[pb.length - 5] = offset; + pb[pb.length - 2] = count; + }; + RectTileLayer.prototype.tileAnimY = function (offset, count) { + var pb = this.pointsBuf; + pb[pb.length - 4] = offset; + pb[pb.length - 1] = count; + }; + RectTileLayer.prototype.renderCanvas = function (renderer) { + var plugin = renderer.plugins.tilemap; + if (!plugin.dontUseTransform) { + var wt = this.worldTransform; + renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution); + } + this.renderCanvasCore(renderer); + }; + RectTileLayer.prototype.renderCanvasCore = function (renderer) { + if (this.textures.length === 0) + return; + var points = this.pointsBuf; + renderer.context.fillStyle = '#000000'; + for (var i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) { + var x1 = points[i], y1 = points[i + 1]; + var x2 = points[i + 2], y2 = points[i + 3]; + var w = points[i + 4]; + var h = points[i + 5]; + var rotate = points[i + 6]; + x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0]; + y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1]; + var textureIndex = points[i + 9]; + if (textureIndex >= 0) { + renderer.context.drawImage(this.textures[textureIndex].baseTexture.getDrawableSource(), x1, y1, w, h, x2, y2, w, h); + } + else { + renderer.context.globalAlpha = 0.5; + renderer.context.fillRect(x2, y2, w, h); + renderer.context.globalAlpha = 1; + } + } + }; + RectTileLayer.prototype.destroyVb = function () { + if (this.vb) { + this.vb.destroy(); + this.vb = null; + } + }; + RectTileLayer.prototype.render = function (renderer) { + var plugin = renderer.plugins['tilemap']; + var shader = plugin.getShader(); + renderer.batch.setObjectRenderer(plugin); + this._globalMat = shader.uniforms.projTransMatrix; + renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform); + shader.uniforms.shadowColor = this.shadowColor; + shader.uniforms.animationFrame = plugin.tileAnim; + this.renderWebGLCore(renderer, plugin); + }; + RectTileLayer.prototype.renderWebGLCore = function (renderer, plugin) { + var points = this.pointsBuf; + if (points.length === 0) + return; + var rectsCount = points.length / POINT_STRUCT_SIZE; + var shader = plugin.getShader(); + var textures = this.textures; + if (textures.length === 0) + return; + plugin.bindTextures(renderer, shader, textures); + renderer.shader.bind(shader, false); + var vb = this.vb; + if (!vb) { + vb = plugin.createVb(); + this.vb = vb; + this.vbId = vb.id; + this.vbBuffer = null; + this.modificationMarker = 0; + } + plugin.checkIndexBuffer(rectsCount, vb); + var boundCountPerBuffer = Constant.boundCountPerBuffer; + var vertexBuf = vb.getBuffer('aVertexPosition'); + var vertices = rectsCount * vb.vertPerQuad; + if (vertices === 0) + return; + if (this.modificationMarker !== vertices) { + this.modificationMarker = vertices; + var vs = vb.stride * vertices; + if (!this.vbBuffer || this.vbBuffer.byteLength < vs) { + var bk = vb.stride; + while (bk < vs) { + bk *= 2; + } + this.vbBuffer = new ArrayBuffer(bk); + this.vbArray = new Float32Array(this.vbBuffer); + this.vbInts = new Uint32Array(this.vbBuffer); + vertexBuf.update(this.vbBuffer); + } + var arr = this.vbArray, ints = this.vbInts; + var sz = 0; + var textureId = 0; + var shiftU = this.offsetX; + var shiftV = this.offsetY; + for (var i = 0; i < points.length; i += POINT_STRUCT_SIZE) { + var eps = 0.5; + if (this.compositeParent) { + if (boundCountPerBuffer > 1) { + textureId = (points[i + 9] >> 2); + shiftU = this.offsetX * (points[i + 9] & 1); + shiftV = this.offsetY * ((points[i + 9] >> 1) & 1); + } + else { + textureId = points[i + 9]; + shiftU = 0; + shiftV = 0; + } + } + var x = points[i + 2], y = points[i + 3]; + var w = points[i + 4], h = points[i + 5]; + var u = points[i] + shiftU, v = points[i + 1] + shiftV; + var rotate = points[i + 6]; + var animX = points[i + 7], animY = points[i + 8]; + var animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024; + var animXEncoded = animX + (animWidth * 2048); + var animYEncoded = animY + (animHeight * 2048); + var u0 = void 0, v0 = void 0, u1 = void 0, v1 = void 0, u2 = void 0, v2 = void 0, u3 = void 0, v3 = void 0; + if (rotate === 0) { + u0 = u; + v0 = v; + u1 = u + w; + v1 = v; + u2 = u + w; + v2 = v + h; + u3 = u; + v3 = v + h; + } + else { + var w2 = w / 2; + var h2 = h / 2; + if (rotate % 4 !== 0) { + w2 = h / 2; + h2 = w / 2; + } + var cX = u + w2; + var cY = v + h2; + rotate = groupD8.add(rotate, groupD8.NW); + u0 = cX + (w2 * groupD8.uX(rotate)); + v0 = cY + (h2 * groupD8.uY(rotate)); + rotate = groupD8.add(rotate, 2); + u1 = cX + (w2 * groupD8.uX(rotate)); + v1 = cY + (h2 * groupD8.uY(rotate)); + rotate = groupD8.add(rotate, 2); + u2 = cX + (w2 * groupD8.uX(rotate)); + v2 = cY + (h2 * groupD8.uY(rotate)); + rotate = groupD8.add(rotate, 2); + u3 = cX + (w2 * groupD8.uX(rotate)); + v3 = cY + (h2 * groupD8.uY(rotate)); + } + arr[sz++] = x; + arr[sz++] = y; + arr[sz++] = u0; + arr[sz++] = v0; + arr[sz++] = u + eps; + arr[sz++] = v + eps; + arr[sz++] = u + w - eps; + arr[sz++] = v + h - eps; + arr[sz++] = animXEncoded; + arr[sz++] = animYEncoded; + arr[sz++] = textureId; + arr[sz++] = x + w; + arr[sz++] = y; + arr[sz++] = u1; + arr[sz++] = v1; + arr[sz++] = u + eps; + arr[sz++] = v + eps; + arr[sz++] = u + w - eps; + arr[sz++] = v + h - eps; + arr[sz++] = animXEncoded; + arr[sz++] = animYEncoded; + arr[sz++] = textureId; + arr[sz++] = x + w; + arr[sz++] = y + h; + arr[sz++] = u2; + arr[sz++] = v2; + arr[sz++] = u + eps; + arr[sz++] = v + eps; + arr[sz++] = u + w - eps; + arr[sz++] = v + h - eps; + arr[sz++] = animXEncoded; + arr[sz++] = animYEncoded; + arr[sz++] = textureId; + arr[sz++] = x; + arr[sz++] = y + h; + arr[sz++] = u3; + arr[sz++] = v3; + arr[sz++] = u + eps; + arr[sz++] = v + eps; + arr[sz++] = u + w - eps; + arr[sz++] = v + h - eps; + arr[sz++] = animXEncoded; + arr[sz++] = animYEncoded; + arr[sz++] = textureId; + } + vertexBuf.update(arr); + } + renderer.geometry.bind(vb, shader); + renderer.geometry.draw(DRAW_MODES.TRIANGLES, rectsCount * 6, 0); + }; + RectTileLayer.prototype.isModified = function (anim) { + if (this.modificationMarker !== this.pointsBuf.length || + anim && this.hasAnim) { + return true; + } + return false; + }; + RectTileLayer.prototype.clearModify = function () { + this.modificationMarker = this.pointsBuf.length; + }; + RectTileLayer.prototype.destroy = function (options) { + _super.prototype.destroy.call(this, options); + this.destroyVb(); + }; + return RectTileLayer; +}(Container)); + +var CompositeRectTileLayer = (function (_super) { + __extends(CompositeRectTileLayer, _super); + function CompositeRectTileLayer(zIndex, bitmaps, texPerChild) { + var _this = _super.call(this) || this; + _this.modificationMarker = 0; + _this.shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]); + _this._globalMat = null; + _this._lastLayer = null; + _this.initialize.apply(_this, arguments); + return _this; + } + CompositeRectTileLayer.prototype.updateTransform = function () { + this.displayObjectUpdateTransform(); + }; + CompositeRectTileLayer.prototype.initialize = function (zIndex, bitmaps, texPerChild) { + if (texPerChild === true) { + texPerChild = 0; + } + this.z = this.zIndex = zIndex; + this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures; + if (bitmaps) { + this.setBitmaps(bitmaps); + } + }; + CompositeRectTileLayer.prototype.setBitmaps = function (bitmaps) { + for (var i_1 = 0; i_1 < bitmaps.length; i_1++) { + if (bitmaps[i_1] && !bitmaps[i_1].baseTexture) { + throw new Error("pixi-tilemap cannot use destroyed textures. " + + "Probably, you passed resources['myAtlas'].texture in pixi > 5.2.1, it does not exist there."); + } + } + var texPerChild = this.texPerChild; + var len1 = this.children.length; + var len2 = Math.ceil(bitmaps.length / texPerChild); + var i; + for (i = 0; i < len1; i++) { + this.children[i].textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild); + } + for (i = len1; i < len2; i++) { + var layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild)); + layer.compositeParent = true; + layer.offsetX = Constant.boundSize; + layer.offsetY = Constant.boundSize; + this.addChild(layer); + } + }; + CompositeRectTileLayer.prototype.clear = function () { + for (var i = 0; i < this.children.length; i++) { + this.children[i].clear(); + } + this.modificationMarker = 0; + }; + CompositeRectTileLayer.prototype.addRect = function (textureIndex, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight) { + var childIndex = textureIndex / this.texPerChild >> 0; + var textureId = textureIndex % this.texPerChild; + if (this.children[childIndex] && this.children[childIndex].textures) { + this._lastLayer = this.children[childIndex]; + this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight); + } + else { + this._lastLayer = null; + } + return this; + }; + CompositeRectTileLayer.prototype.tileRotate = function (rotate) { + if (this._lastLayer) { + this._lastLayer.tileRotate(rotate); + } + return this; + }; + CompositeRectTileLayer.prototype.tileAnimX = function (offset, count) { + if (this._lastLayer) { + this._lastLayer.tileAnimX(offset, count); + } + return this; + }; + CompositeRectTileLayer.prototype.tileAnimY = function (offset, count) { + if (this._lastLayer) { + this._lastLayer.tileAnimY(offset, count); + } + return this; + }; + CompositeRectTileLayer.prototype.addFrame = function (texture_, x, y, animX, animY, animWidth, animHeight) { + var texture; + var layer = null; + var ind = 0; + var children = this.children; + this._lastLayer = null; + if (typeof texture_ === "number") { + var childIndex = texture_ / this.texPerChild >> 0; + layer = children[childIndex]; + if (!layer) { + layer = children[0]; + if (!layer) { + return this; + } + ind = 0; + } + else { + ind = texture_ % this.texPerChild; + } + texture = layer.textures[ind]; + } + else { + if (typeof texture_ === "string") { + texture = Texture.from(texture_); + } + else { + texture = texture_; + } + for (var i = 0; i < children.length; i++) { + var child = children[i]; + var tex = child.textures; + for (var j = 0; j < tex.length; j++) { + if (tex[j].baseTexture === texture.baseTexture) { + layer = child; + ind = j; + break; + } + } + if (layer) { + break; + } + } + if (!layer) { + for (var i = 0; i < children.length; i++) { + var child = children[i]; + if (child.textures.length < this.texPerChild) { + layer = child; + ind = child.textures.length; + child.textures.push(texture); + break; + } + } + if (!layer) { + layer = new RectTileLayer(this.zIndex, texture); + layer.compositeParent = true; + layer.offsetX = Constant.boundSize; + layer.offsetY = Constant.boundSize; + children.push(layer); + ind = 0; + } + } + } + this._lastLayer = layer; + layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight); + return this; + }; + CompositeRectTileLayer.prototype.renderCanvas = function (renderer) { + if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { + return; + } + var plugin = renderer.plugins.tilemap; + if (!plugin.dontUseTransform) { + var wt = this.worldTransform; + renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution); + } + var layers = this.children; + for (var i = 0; i < layers.length; i++) { + layers[i].renderCanvasCore(renderer); + } + }; + CompositeRectTileLayer.prototype.render = function (renderer) { + if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { + return; + } + var plugin = renderer.plugins['tilemap']; + var shader = plugin.getShader(); + renderer.batch.setObjectRenderer(plugin); + this._globalMat = shader.uniforms.projTransMatrix; + renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform); + shader.uniforms.shadowColor = this.shadowColor; + shader.uniforms.animationFrame = plugin.tileAnim; + renderer.shader.bind(shader, false); + var layers = this.children; + for (var i = 0; i < layers.length; i++) { + layers[i].renderWebGLCore(renderer, plugin); + } + }; + CompositeRectTileLayer.prototype.isModified = function (anim) { + var layers = this.children; + if (this.modificationMarker !== layers.length) { + return true; + } + for (var i = 0; i < layers.length; i++) { + if (layers[i].isModified(anim)) { + return true; + } + } + return false; + }; + CompositeRectTileLayer.prototype.clearModify = function () { + var layers = this.children; + this.modificationMarker = layers.length; + for (var i = 0; i < layers.length; i++) { + layers[i].clearModify(); + } + }; + return CompositeRectTileLayer; +}(Container)); + +var GraphicsLayer = (function (_super) { + __extends(GraphicsLayer, _super); + function GraphicsLayer(zIndex) { + var _this = _super.call(this) || this; + _this.zIndex = zIndex; + return _this; + } + GraphicsLayer.prototype.renderCanvas = function (renderer) { + var wt = null; + if (renderer.plugins.tilemap.dontUseTransform) { + wt = this.transform.worldTransform; + this.transform.worldTransform = Matrix.IDENTITY; + } + renderer.plugins.graphics.render(this); + if (renderer.plugins.tilemap.dontUseTransform) { + this.transform.worldTransform = wt; + } + renderer.context.globalAlpha = 1.0; + }; + GraphicsLayer.prototype.isModified = function (anim) { + return false; + }; + GraphicsLayer.prototype.clearModify = function () { + }; + return GraphicsLayer; +}(Graphics)); + +var MultiTextureResource = (function (_super) { + __extends(MultiTextureResource, _super); + function MultiTextureResource(options) { + var _this = _super.call(this, options.bufferSize, options.bufferSize) || this; + _this.DO_CLEAR = false; + _this.boundSize = 0; + _this._clearBuffer = null; + _this.baseTex = null; + _this.boundSprites = []; + _this.dirties = []; + var bounds = _this.boundSprites; + var dirties = _this.dirties; + _this.boundSize = options.boundSize; + for (var j = 0; j < options.boundCountPerBuffer; j++) { + var spr = new Sprite(); + spr.position.x = options.boundSize * (j & 1); + spr.position.y = options.boundSize * (j >> 1); + bounds.push(spr); + dirties.push(0); + } + _this.DO_CLEAR = !!options.DO_CLEAR; + return _this; + } + MultiTextureResource.prototype.bind = function (baseTexture) { + if (this.baseTex) { + throw new Error('Only one baseTexture is allowed for this resource!'); + } + this.baseTex = baseTexture; + _super.prototype.bind.call(this, baseTexture); + }; + MultiTextureResource.prototype.setTexture = function (ind, texture) { + var spr = this.boundSprites[ind]; + if (spr.texture.baseTexture === texture.baseTexture) { + return; + } + spr.texture = texture; + this.baseTex.update(); + this.dirties[ind] = this.baseTex.dirtyId; + }; + MultiTextureResource.prototype.upload = function (renderer, texture, glTexture) { + var gl = renderer.gl; + var _a = this, width = _a.width, height = _a.height; + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined || + texture.alphaMode === ALPHA_MODES.UNPACK); + if (glTexture.dirtyId < 0) { + glTexture.width = width; + glTexture.height = height; + gl.texImage2D(texture.target, 0, texture.format, width, height, 0, texture.format, texture.type, null); + } + var doClear = this.DO_CLEAR; + if (doClear && !this._clearBuffer) { + this._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4); + } + var bounds = this.boundSprites; + for (var i = 0; i < bounds.length; i++) { + var spr = bounds[i]; + var tex = spr.texture.baseTexture; + if (glTexture.dirtyId >= this.dirties[i]) { + continue; + } + var res = tex.resource; + if (!tex.valid || !res || !res.source) { + continue; + } + if (doClear && (tex.width < this.boundSize || tex.height < this.boundSize)) { + gl.texSubImage2D(texture.target, 0, spr.position.x, spr.position.y, this.boundSize, this.boundSize, texture.format, texture.type, this._clearBuffer); + } + gl.texSubImage2D(texture.target, 0, spr.position.x, spr.position.y, texture.format, texture.type, res.source); + } + return true; + }; + return MultiTextureResource; +}(resources.Resource)); + +function fillSamplers(shader, maxTextures) { + var sampleValues = []; + for (var i = 0; i < maxTextures; i++) { + sampleValues[i] = i; + } + shader.uniforms.uSamplers = sampleValues; + var samplerSize = []; + for (var i = 0; i < maxTextures; i++) { + samplerSize.push(1.0 / Constant.bufferSize); + samplerSize.push(1.0 / Constant.bufferSize); + } + shader.uniforms.uSamplerSize = samplerSize; +} +function generateFragmentSrc(maxTextures, fragmentSrc) { + return fragmentSrc.replace(/%count%/gi, maxTextures + "") + .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures)); +} +function generateSampleSrc(maxTextures) { + var src = ''; + src += '\n'; + src += '\n'; + src += 'if(vTextureId <= -1.0) {'; + src += '\n\tcolor = shadowColor;'; + src += '\n}'; + for (var i = 0; i < maxTextures; i++) { + src += '\nelse '; + if (i < maxTextures - 1) { + src += 'if(textureId == ' + i + '.0)'; + } + src += '\n{'; + src += '\n\tcolor = texture2D(uSamplers[' + i + '], textureCoord * uSamplerSize[' + i + ']);'; + src += '\n}'; + } + src += '\n'; + src += '\n'; + return src; +} + +var rectShaderFrag = "\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n"; +var rectShaderVert = "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n"; +var TilemapShader = (function (_super) { + __extends(TilemapShader, _super); + function TilemapShader(maxTextures, shaderVert, shaderFrag) { + var _this = _super.call(this, new PIXI.Program(shaderVert, shaderFrag), { + animationFrame: new Float32Array(2), + uSamplers: [], + uSamplerSize: [], + projTransMatrix: new Matrix() + }) || this; + _this.maxTextures = 0; + _this.maxTextures = maxTextures; + fillSamplers(_this, _this.maxTextures); + return _this; + } + return TilemapShader; +}(Shader)); +var RectTileShader = (function (_super) { + __extends(RectTileShader, _super); + function RectTileShader(maxTextures) { + var _this = _super.call(this, maxTextures, rectShaderVert, generateFragmentSrc(maxTextures, rectShaderFrag)) || this; + fillSamplers(_this, _this.maxTextures); + return _this; + } + return RectTileShader; +}(TilemapShader)); +var RectTileGeom = (function (_super) { + __extends(RectTileGeom, _super); + function RectTileGeom() { + var _this = _super.call(this) || this; + _this.vertSize = 11; + _this.vertPerQuad = 4; + _this.stride = _this.vertSize * 4; + _this.lastTimeAccess = 0; + var buf = _this.buf = new Buffer(new Float32Array(2), true, false); + _this.addAttribute('aVertexPosition', buf, 0, false, 0, _this.stride, 0) + .addAttribute('aTextureCoord', buf, 0, false, 0, _this.stride, 2 * 4) + .addAttribute('aFrame', buf, 0, false, 0, _this.stride, 4 * 4) + .addAttribute('aAnim', buf, 0, false, 0, _this.stride, 8 * 4) + .addAttribute('aTextureId', buf, 0, false, 0, _this.stride, 10 * 4); + return _this; + } + return RectTileGeom; +}(Geometry)); + +var TileRenderer = (function (_super) { + __extends(TileRenderer, _super); + function TileRenderer(renderer) { + var _this = _super.call(this, renderer) || this; + _this.sn = -1; + _this.indexBuffer = null; + _this.ibLen = 0; + _this.tileAnim = [0, 0]; + _this.texLoc = []; + _this.texResources = []; + _this.rectShader = new RectTileShader(Constant.maxTextures); + _this.indexBuffer = new Buffer(undefined, true, true); + _this.checkIndexBuffer(2000); + _this.initBounds(); + return _this; + } + TileRenderer.prototype.initBounds = function () { + if (Constant.boundCountPerBuffer <= 1) { + return; + } + var maxTextures = Constant.maxTextures; + for (var i = 0; i < maxTextures; i++) { + var resource = new MultiTextureResource(Constant); + var baseTex = new BaseTexture(resource); + baseTex.scaleMode = Constant.SCALE_MODE; + baseTex.wrapMode = WRAP_MODES.CLAMP; + this.texResources.push(resource); + } + }; + TileRenderer.prototype.bindTexturesWithoutRT = function (renderer, shader, textures) { + var samplerSize = shader.uniforms.uSamplerSize; + this.texLoc.length = 0; + for (var i = 0; i < textures.length; i++) { + var texture = textures[i]; + if (!texture || !texture.valid) { + return; + } + renderer.texture.bind(textures[i], i); + samplerSize[i * 2] = 1.0 / textures[i].baseTexture.width; + samplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height; + } + shader.uniforms.uSamplerSize = samplerSize; + }; + TileRenderer.prototype.bindTextures = function (renderer, shader, textures) { + var len = textures.length; + var maxTextures = Constant.maxTextures; + if (len > Constant.boundCountPerBuffer * maxTextures) { + return; + } + if (Constant.boundCountPerBuffer <= 1) { + this.bindTexturesWithoutRT(renderer, shader, textures); + return; + } + var i = 0; + for (; i < len; i++) { + var texture = textures[i]; + if (!texture || !texture.valid) + continue; + var multi = this.texResources[i >> 2]; + multi.setTexture(i & 3, texture); + } + var gltsUsed = (i + 3) >> 2; + for (i = 0; i < gltsUsed; i++) { + renderer.texture.bind(this.texResources[i].baseTex, i); + } + }; + TileRenderer.prototype.start = function () { + }; + TileRenderer.prototype.createVb = function () { + var geom = new RectTileGeom(); + geom.addIndex(this.indexBuffer); + geom.lastTimeAccess = Date.now(); + return geom; + }; + TileRenderer.prototype.checkIndexBuffer = function (size, vb) { + var totalIndices = size * 6; + if (totalIndices <= this.ibLen) { + return; + } + this.ibLen = totalIndices; + this.indexBuffer.update(PIXI.utils.createIndicesForQuads(size, Constant.use32bitIndex ? new Uint32Array(size * 6) : undefined)); + }; + TileRenderer.prototype.getShader = function () { + return this.rectShader; + }; + TileRenderer.prototype.destroy = function () { + _super.prototype.destroy.call(this); + this.rectShader = null; + }; + return TileRenderer; +}(ObjectRenderer)); +Renderer.registerPlugin('tilemap', TileRenderer); + +var ZLayer = (function (_super) { + __extends(ZLayer, _super); + function ZLayer(tilemap, zIndex) { + var _this = _super.call(this) || this; + _this._lastAnimationFrame = -1; + _this.tilemap = tilemap; + _this.z = zIndex; + return _this; + } + ZLayer.prototype.clear = function () { + var layers = this.children; + for (var i = 0; i < layers.length; i++) + layers[i].clear(); + this._previousLayers = 0; + }; + ZLayer.prototype.cacheIfDirty = function () { + var tilemap = this.tilemap; + var layers = this.children; + var modified = this._previousLayers !== layers.length; + this._previousLayers = layers.length; + var buf = this.canvasBuffer; + var tempRender = this._tempRender; + if (!buf) { + buf = this.canvasBuffer = document.createElement('canvas'); + tempRender = this._tempRender = new PIXI.CanvasRenderer(100, 100, { view: buf }); + tempRender.context = tempRender.rootContext; + tempRender.plugins.tilemap.dontUseTransform = true; + } + if (buf.width !== tilemap._layerWidth || + buf.height !== tilemap._layerHeight) { + buf.width = tilemap._layerWidth; + buf.height = tilemap._layerHeight; + modified = true; + } + var i; + if (!modified) { + for (i = 0; i < layers.length; i++) { + if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) { + modified = true; + break; + } + } + } + this._lastAnimationFrame = tilemap.animationFrame; + if (modified) { + if (tilemap._hackRenderer) { + tilemap._hackRenderer(tempRender); + } + tempRender.context.clearRect(0, 0, buf.width, buf.height); + for (i = 0; i < layers.length; i++) { + layers[i].clearModify(); + layers[i].renderCanvas(tempRender); + } + } + this.layerTransform = this.worldTransform; + for (i = 0; i < layers.length; i++) { + this.layerTransform = layers[i].worldTransform; + break; + } + }; + ZLayer.prototype.renderCanvas = function (renderer) { + this.cacheIfDirty(); + var wt = this.layerTransform; + renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution); + var tilemap = this.tilemap; + renderer.context.drawImage(this.canvasBuffer, 0, 0); + }; + return ZLayer; +}(Container)); + +var pixi_tilemap; +(function (pixi_tilemap) { + PIXI.tilemap = pixi_tilemap; +})(pixi_tilemap || (pixi_tilemap = {})); + +var pixi_tilemap$1 = { + CanvasTileRenderer: CanvasTileRenderer, + CompositeRectTileLayer: CompositeRectTileLayer, + Constant: Constant, + GraphicsLayer: GraphicsLayer, + MultiTextureResource: MultiTextureResource, + RectTileLayer: RectTileLayer, + TilemapShader: TilemapShader, + RectTileShader: RectTileShader, + RectTileGeom: RectTileGeom, + TileRenderer: TileRenderer, + ZLayer: ZLayer, +}; + +export { CanvasTileRenderer, CompositeRectTileLayer, Constant, GraphicsLayer, MultiTextureResource, POINT_STRUCT_SIZE, RectTileGeom, RectTileLayer, RectTileShader, TileRenderer, TilemapShader, ZLayer, fillSamplers, generateFragmentSrc, generateSampleSrc, pixi_tilemap$1 as pixi_tilemap }; +//# sourceMappingURL=pixi-tilemap.es.js.map diff --git a/lib/pixi-tilemap.es.js.map b/lib/pixi-tilemap.es.js.map new file mode 100644 index 00000000..3756e52b --- /dev/null +++ b/lib/pixi-tilemap.es.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pixi-tilemap.es.js","sources":["../src/CanvasTileRenderer.ts","../node_modules/tslib/tslib.es6.js","../src/Constant.ts","../src/RectTileLayer.ts","../src/CompositeRectTileLayer.ts","../src/GraphicsLayer.ts","../src/MultiTextureResource.ts","../src/shaderGenerator.ts","../src/RectTileShader.ts","../src/TileRenderer.ts","../src/ZLayer.ts","../src/exporter.ts","../src/index.ts"],"sourcesContent":["/// \n\nimport { Renderer } from '@pixi/core';\n\nexport class CanvasTileRenderer {\n renderer: Renderer;\n tileAnim = [0, 0];\n dontUseTransform = false;\n\n constructor(renderer: Renderer) {\n this.renderer = renderer;\n this.tileAnim = [0, 0];\n }\n}\n\nconst cr = (PIXI as any).CanvasRenderer;\n\nif (cr) {\n cr.registerPlugin('tilemap', CanvasTileRenderer);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","export const Constant = {\n maxTextures: 16,\n bufferSize: 2048,\n boundSize: 1024,\n boundCountPerBuffer: 1,\n use32bitIndex: false,\n SCALE_MODE: PIXI.SCALE_MODES.LINEAR,\n DO_CLEAR: true\n};","/// \n\nimport { Container } from '@pixi/display';\nimport { Constant } from './Constant';\nimport { DRAW_MODES } from '@pixi/constants';\nimport { Texture, Renderer } from '@pixi/core';\nimport { TileRenderer } from './TileRenderer';\nimport { Matrix, groupD8 } from '@pixi/math';\n\nimport type { RectTileGeom } from './RectTileShader';\n\nexport const POINT_STRUCT_SIZE = 12;\n\nexport class RectTileLayer extends Container {\n constructor(zIndex: number, texture: Texture | Array) {\n super();\n this.initialize(zIndex, texture);\n }\n\n zIndex = 0;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n\n pointsBuf: Array = [];\n hasAnim = false;\n textures: Array;\n\n offsetX = 0;\n offsetY = 0;\n compositeParent = false;\n\n initialize(zIndex: number, textures: Texture | Array) {\n if (!textures) {\n textures = [];\n } else if (!(textures instanceof Array) && (textures as Texture).baseTexture) {\n textures = [textures as Texture];\n }\n this.textures = textures as Array;\n this.zIndex = zIndex;\n // this.visible = false;\n }\n\n clear() {\n this.pointsBuf.length = 0;\n this.modificationMarker = 0;\n this.hasAnim = false;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX: number, animY: number) {\n let texture: Texture;\n let textureIndex = 0;\n\n if (typeof texture_ === \"number\") {\n textureIndex = texture_;\n texture = this.textures[textureIndex];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n let found = false;\n let textureList = this.textures;\n for (let i = 0; i < textureList.length; i++) {\n if (textureList[i].baseTexture === texture.baseTexture) {\n textureIndex = i;\n found = true;\n break;\n }\n }\n\n if (!found) {\n // textureIndex = this.textures.length;\n // this.textures.push(texture);\n return false;\n }\n }\n\n this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate);\n return true;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number,\n animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this {\n let pb = this.pointsBuf;\n this.hasAnim = this.hasAnim || animX > 0 || animY > 0;\n pb.push(u);\n pb.push(v);\n pb.push(x);\n pb.push(y);\n pb.push(tileWidth);\n pb.push(tileHeight);\n pb.push(rotate);\n pb.push(animX | 0);\n pb.push(animY | 0);\n pb.push(textureIndex);\n pb.push(animCountX);\n pb.push(animCountY);\n\n return this;\n }\n\n tileRotate(rotate: number) {\n const pb = this.pointsBuf;\n pb[pb.length - 3] = rotate;\n }\n\n tileAnimX(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 5] = offset;\n pb[pb.length - 2] = count;\n }\n\n tileAnimY(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 4] = offset;\n pb[pb.length - 1] = count;\n }\n\n renderCanvas(renderer: any) {\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n this.renderCanvasCore(renderer);\n }\n\n renderCanvasCore(renderer: any) {\n if (this.textures.length === 0) return;\n let points = this.pointsBuf;\n renderer.context.fillStyle = '#000000';\n for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) {\n let x1 = points[i], y1 = points[i + 1];\n let x2 = points[i + 2], y2 = points[i + 3];\n let w = points[i + 4];\n let h = points[i + 5];\n var rotate = points[i + 6];\n x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0];\n y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1];\n let textureIndex = points[i + 9];\n // canvas does not work with rotate yet\n if (textureIndex >= 0) {\n renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h);\n } else {\n renderer.context.globalAlpha = 0.5;\n renderer.context.fillRect(x2, y2, w, h);\n renderer.context.globalAlpha = 1;\n }\n }\n }\n\n vbId = 0;\n vb: RectTileGeom = null;\n vbBuffer: ArrayBuffer = null;\n vbArray: Float32Array = null;\n vbInts: Uint32Array = null;\n\n destroyVb() {\n if (this.vb) {\n this.vb.destroy();\n this.vb = null;\n }\n }\n\n render(renderer: Renderer) {\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n this.renderWebGLCore(renderer, plugin);\n }\n\n renderWebGLCore(renderer: Renderer, plugin: TileRenderer) {\n let points = this.pointsBuf;\n if (points.length === 0) return;\n let rectsCount = points.length / POINT_STRUCT_SIZE;\n\n let shader = plugin.getShader();\n let textures = this.textures;\n if (textures.length === 0) return;\n\n plugin.bindTextures(renderer, shader, textures);\n renderer.shader.bind(shader, false);\n\n //lost context! recover!\n let vb = this.vb;\n if (!vb) {\n vb = plugin.createVb();\n this.vb = vb;\n this.vbId = (vb as any).id;\n this.vbBuffer = null;\n this.modificationMarker = 0;\n }\n\n plugin.checkIndexBuffer(rectsCount, vb);\n const boundCountPerBuffer = Constant.boundCountPerBuffer;\n\n let vertexBuf = vb.getBuffer('aVertexPosition');\n //if layer was changed, re-upload vertices\n let vertices = rectsCount * vb.vertPerQuad;\n if (vertices === 0) return;\n if (this.modificationMarker !== vertices) {\n this.modificationMarker = vertices;\n let vs = vb.stride * vertices;\n if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {\n //!@#$ happens, need resize\n let bk = vb.stride;\n while (bk < vs) {\n bk *= 2;\n }\n this.vbBuffer = new ArrayBuffer(bk);\n this.vbArray = new Float32Array(this.vbBuffer);\n this.vbInts = new Uint32Array(this.vbBuffer);\n vertexBuf.update(this.vbBuffer);\n }\n\n let arr = this.vbArray, ints = this.vbInts;\n //upload vertices!\n let sz = 0;\n //let tint = 0xffffffff;\n let textureId: number = 0;\n let shiftU: number = this.offsetX;\n let shiftV: number = this.offsetY;\n\n //let tint = 0xffffffff;\n let tint = -1;\n for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) {\n let eps = 0.5;\n if (this.compositeParent) {\n if (boundCountPerBuffer > 1) {\n //TODO: what if its more than 4?\n textureId = (points[i + 9] >> 2);\n shiftU = this.offsetX * (points[i + 9] & 1);\n shiftV = this.offsetY * ((points[i + 9] >> 1) & 1);\n } else {\n textureId = points[i + 9];\n shiftU = 0;\n shiftV = 0;\n }\n }\n let x = points[i + 2], y = points[i + 3];\n let w = points[i + 4], h = points[i + 5];\n let u = points[i] + shiftU, v = points[i + 1] + shiftV;\n let rotate = points[i + 6];\n\n const animX = points[i + 7], animY = points[i + 8];\n const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024;\n const animXEncoded = animX + (animWidth * 2048);\n const animYEncoded = animY + (animHeight * 2048);\n\n let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number;\n if (rotate === 0) {\n u0 = u;\n v0 = v;\n u1 = u + w;\n v1 = v;\n u2 = u + w;\n v2 = v + h;\n u3 = u;\n v3 = v + h;\n } else {\n let w2 = w / 2;\n let h2 = h / 2;\n if (rotate % 4 !== 0) {\n w2 = h / 2;\n h2 = w / 2;\n }\n const cX = u + w2;\n const cY = v + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW);\n u0 = cX + (w2 * groupD8.uX(rotate));\n v0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n u1 = cX + (w2 * groupD8.uX(rotate));\n v1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u2 = cX + (w2 * groupD8.uX(rotate));\n v2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u3 = cX + (w2 * groupD8.uX(rotate));\n v3 = cY + (h2 * groupD8.uY(rotate));\n }\n\n arr[sz++] = x;\n arr[sz++] = y;\n arr[sz++] = u0;\n arr[sz++] = v0;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y;\n arr[sz++] = u1;\n arr[sz++] = v1;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y + h;\n arr[sz++] = u2;\n arr[sz++] = v2;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x;\n arr[sz++] = y + h;\n arr[sz++] = u3;\n arr[sz++] = v3;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n }\n\n vertexBuf.update(arr);\n }\n\n (renderer.geometry as any).bind(vb, shader);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES, rectsCount * 6, 0);\n }\n\n isModified(anim: boolean) {\n if (this.modificationMarker !== this.pointsBuf.length ||\n anim && this.hasAnim) {\n return true;\n }\n return false;\n }\n\n clearModify() {\n this.modificationMarker = this.pointsBuf.length;\n }\n\n destroy(options?: any) {\n super.destroy(options);\n this.destroyVb();\n }\n}\n","/// \n\nimport { Container } from '@pixi/display';\nimport { Texture, Renderer } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { Constant } from './Constant';\nimport { RectTileLayer } from './RectTileLayer';\n\nexport class CompositeRectTileLayer extends Container {\n constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n super();\n this.initialize.apply(this, arguments);\n }\n\n updateTransform() {\n (this as any).displayObjectUpdateTransform();\n }\n\n z: number;\n zIndex: number;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n _lastLayer: RectTileLayer = null;\n\n texPerChild: number;\n\n initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n if (texPerChild as any === true) {\n //old format, ignore it!\n texPerChild = 0;\n }\n this.z = this.zIndex = zIndex;\n this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures;\n if (bitmaps) {\n this.setBitmaps(bitmaps);\n }\n }\n\n setBitmaps(bitmaps: Array) {\n for (let i=0;i 5.2.1, it does not exist there.`);\n }\n }\n let texPerChild = this.texPerChild;\n let len1 = this.children.length;\n let len2 = Math.ceil(bitmaps.length / texPerChild);\n let i: number;\n for (i = 0; i < len1; i++) {\n (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);\n }\n for (i = len1; i < len2; i++) {\n let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild));\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n this.addChild(layer);\n }\n }\n\n clear() {\n for (let i = 0; i < this.children.length; i++) {\n (this.children[i] as RectTileLayer).clear();\n }\n this.modificationMarker = 0;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this {\n const childIndex: number = textureIndex / this.texPerChild >> 0;\n const textureId: number = textureIndex % this.texPerChild;\n\n if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) {\n this._lastLayer = (this.children[childIndex] as RectTileLayer);\n this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight);\n } else {\n this._lastLayer = null;\n }\n\n return this;\n }\n\n tileRotate(rotate: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileRotate(rotate);\n }\n return this;\n }\n\n tileAnimX(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimX(offset, count);\n }\n return this;\n }\n\n tileAnimY(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimY(offset, count);\n }\n return this;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this {\n let texture: Texture;\n let layer: RectTileLayer = null;\n let ind: number = 0;\n let children = this.children;\n\n this._lastLayer = null;\n if (typeof texture_ === \"number\") {\n let childIndex = texture_ / this.texPerChild >> 0;\n layer = children[childIndex] as RectTileLayer;\n\n if (!layer) {\n layer = children[0] as RectTileLayer;\n if (!layer) {\n return this;\n }\n ind = 0;\n } else {\n ind = texture_ % this.texPerChild;\n }\n\n texture = layer.textures[ind];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n let tex = child.textures;\n for (let j = 0; j < tex.length; j++) {\n if (tex[j].baseTexture === texture.baseTexture) {\n layer = child;\n ind = j;\n break;\n }\n }\n if (layer) {\n break;\n }\n }\n\n if (!layer) {\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n if (child.textures.length < this.texPerChild) {\n layer = child;\n ind = child.textures.length;\n child.textures.push(texture);\n break;\n }\n }\n if (!layer) {\n layer = new RectTileLayer(this.zIndex, texture);\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n children.push(layer);\n ind = 0;\n }\n }\n }\n\n this._lastLayer = layer;\n layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight);\n return this;\n }\n\n renderCanvas(renderer: any) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderCanvasCore(renderer);\n }\n }\n\n render(renderer: Renderer) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n //TODO: dont create new array, please\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n renderer.shader.bind(shader, false);\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin);\n }\n }\n\n isModified(anim: boolean) {\n let layers = this.children;\n if (this.modificationMarker !== layers.length) {\n return true;\n }\n for (let i = 0; i < layers.length; i++) {\n if ((layers[i] as RectTileLayer).isModified(anim)) {\n return true;\n }\n }\n return false;\n }\n\n clearModify() {\n let layers = this.children;\n this.modificationMarker = layers.length;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).clearModify();\n }\n }\n}","/// \n\nimport { Matrix } from '@pixi/math';\nimport { Graphics } from '@pixi/graphics';\n\nexport class GraphicsLayer extends Graphics {\n constructor(zIndex: number) {\n super();\n this.zIndex = zIndex;\n }\n\n renderCanvas(renderer: any) {\n let wt: Matrix = null;\n if (renderer.plugins.tilemap.dontUseTransform) {\n wt = this.transform.worldTransform;\n this.transform.worldTransform = Matrix.IDENTITY;\n }\n renderer.plugins.graphics.render(this);\n if (renderer.plugins.tilemap.dontUseTransform) {\n this.transform.worldTransform = wt;\n }\n renderer.context.globalAlpha = 1.0;\n }\n\n // renderWebGL(renderer: PIXI.Renderer) {\n // if (!this._webGL[renderer.CONTEXT_UID])\n // this.dirty++;\n // super.renderWebGL(renderer)\n // }\n\n isModified(anim: boolean): boolean {\n return false;\n }\n\n clearModify() {\n }\n}\n","/// \n\nimport { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, Renderer, Texture, GLTexture, resources } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Constant } from './Constant';\n\nexport interface IMultiTextureOptions {\n\tboundCountPerBuffer: number;\n\tboundSize: number;\n\tbufferSize: number;\n\tDO_CLEAR?: boolean;\n}\n\nexport class MultiTextureResource extends resources.Resource {\n\tconstructor(options: IMultiTextureOptions) {\n\t\tsuper(options.bufferSize, options.bufferSize);\n\n\t\tconst bounds = this.boundSprites;\n\t\tconst dirties = this.dirties;\n\t\tthis.boundSize = options.boundSize;\n\t\tfor (let j = 0; j < options.boundCountPerBuffer; j++) {\n\t\t\tconst spr = new Sprite();\n\t\t\tspr.position.x = options.boundSize * (j & 1);\n\t\t\tspr.position.y = options.boundSize * (j >> 1);\n\t\t\tbounds.push(spr);\n\t\t\tdirties.push(0);\n\t\t}\n\t\tthis.DO_CLEAR = !!options.DO_CLEAR;\n\t}\n\n\tDO_CLEAR = false;\n\tboundSize: number = 0;\n\t_clearBuffer: Uint8Array = null;\n\n\tbind(baseTexture: BaseTexture) {\n\t\tif (this.baseTex) {\n\t\t\tthrow new Error('Only one baseTexture is allowed for this resource!')\n\t\t}\n\t\tthis.baseTex = baseTexture;\n\t\tsuper.bind(baseTexture);\n\t}\n\n\tbaseTex: BaseTexture = null;\n\tboundSprites: Array = [];\n\tdirties: Array = [];\n\n\tsetTexture(ind: number, texture: Texture) {\n\t\tconst spr = this.boundSprites[ind];\n\t\tif (spr.texture.baseTexture === texture.baseTexture) {\n\t\t\treturn;\n\t\t}\n\t\tspr.texture = texture;\n\t\tthis.baseTex.update();\n\t\tthis.dirties[ind] = (this.baseTex as any).dirtyId;\n\t}\n\n\tupload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture) {\n\t\tconst { gl } = renderer as any;\n\n\t\tconst {width, height} = this;\n\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined ||\n\t\t\ttexture.alphaMode === ALPHA_MODES.UNPACK);\n\n\t\tif (glTexture.dirtyId < 0) {\n\t\t\t(glTexture as any).width = width;\n\t\t\t(glTexture as any).height = height;\n\n\t\t\tgl.texImage2D(texture.target, 0,\n\t\t\t\ttexture.format,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\t0,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tnull);\n\t\t}\n\n\t\tconst doClear = this.DO_CLEAR;\n\t\tif (doClear && !this._clearBuffer) {\n\t\t\tthis._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4);\n\t\t}\n\n\t\tconst bounds = this.boundSprites;\n\t\tfor (let i = 0; i < bounds.length; i++) {\n\t\t\tconst spr = bounds[i];\n\t\t\tconst tex = spr.texture.baseTexture;\n\t\t\tif (glTexture.dirtyId >= this.dirties[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst res = tex.resource as any;\n\t\t\tif (!tex.valid || !res || !res.source) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (doClear && (tex.width < this.boundSize || tex.height < this.boundSize))\n\t\t\t{\n\t\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\t\tspr.position.x,\n\t\t\t\t\tspr.position.y,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\ttexture.format,\n\t\t\t\t\ttexture.type,\n\t\t\t\t\tthis._clearBuffer);\n\t\t\t}\n\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\tspr.position.x,\n\t\t\t\tspr.position.y,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tres.source);\n\t\t}\n\n\t\treturn true;\n\t}\n}\n","import { Constant } from './Constant';\n\nimport type { TilemapShader } from './RectTileShader';\n\n\nexport function fillSamplers(shader: TilemapShader, maxTextures: number) {\n let sampleValues: Array = [];\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n shader.uniforms.uSamplers = sampleValues;\n\n let samplerSize: Array = [];\n for (let i = 0; i < maxTextures; i++) {\n samplerSize.push(1.0 / Constant.bufferSize);\n samplerSize.push(1.0 / Constant.bufferSize);\n }\n shader.uniforms.uSamplerSize = samplerSize;\n}\n\nexport function generateFragmentSrc(maxTextures: number, fragmentSrc: string) {\n return fragmentSrc.replace(/%count%/gi, maxTextures + \"\")\n .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n}\n\nexport function generateSampleSrc(maxTextures: number) {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n src += 'if(vTextureId <= -1.0) {';\n src += '\\n\\tcolor = shadowColor;';\n src += '\\n}';\n\n for (let i = 0; i < maxTextures; i++)\n {\n src += '\\nelse ';\n\n if(i < maxTextures-1)\n {\n src += 'if(textureId == ' + i + '.0)';\n }\n\n src += '\\n{';\n src += '\\n\\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);';\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n}\n","/// \n\nimport * as shaderGenerator from './shaderGenerator';\n\nimport { Buffer, Geometry, Shader } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nlet rectShaderFrag = `\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n`;\nlet rectShaderVert = `\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n`;\n\nexport abstract class TilemapShader extends Shader {\n\tmaxTextures = 0;\n\n\tconstructor(maxTextures: number, shaderVert: string, shaderFrag: string) {\n\t\tsuper(\n\t\t\tnew PIXI.Program(\n\t\t\t\tshaderVert,\n\t\t\t\tshaderFrag),\n\t\t\t{\n\t\t\t\tanimationFrame: new Float32Array(2),\n\t\t\t\tuSamplers: [],\n\t\t\t\tuSamplerSize: [],\n\t\t\t\tprojTransMatrix: new Matrix()\n\t\t\t}\n\t\t);\n\t\tthis.maxTextures = maxTextures;\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileShader extends TilemapShader {\n\tconstructor(maxTextures: number) {\n\t\tsuper(\n\t\t\tmaxTextures,\n\t\t\trectShaderVert,\n\t\t\tshaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)\n\t\t);\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileGeom extends Geometry {\n\tvertSize = 11;\n\tvertPerQuad = 4;\n\tstride = this.vertSize * 4;\n\tlastTimeAccess = 0;\n\n\tconstructor() {\n\t\tsuper();\n\t\tconst buf = this.buf = new Buffer(new Float32Array(2), true, false);\n\t\tthis.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0)\n\t\t\t.addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4)\n\t\t\t.addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4)\n\t\t\t.addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4)\n\t\t\t.addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4);\n\t}\n\n\tbuf: PIXI.Buffer;\n}","import { WRAP_MODES } from '@pixi/constants';\nimport { BaseTexture, Buffer, resources, ObjectRenderer, Texture, Renderer } from '@pixi/core';\nimport { Constant } from './Constant';\nimport { RectTileGeom, RectTileShader } from './RectTileShader';\nimport { MultiTextureResource } from './MultiTextureResource';\n\nimport type { TilemapShader } from './RectTileShader';\n\n/**\n * Renderer for rectangle tiles.\n */\nexport class TileRenderer extends ObjectRenderer {\n\trenderer: Renderer;\n\tgl: WebGLRenderingContext;\n\tsn: number = -1;\n\tindexBuffer: PIXI.Buffer = null;\n\tibLen: number = 0;\n\ttileAnim = [0, 0];\n\ttexLoc: Array = [];\n\n\trectShader: RectTileShader;\n\ttexResources: Array = [];\n\n\tconstructor(renderer: Renderer) {\n\t\tsuper(renderer);\n\t\tthis.rectShader = new RectTileShader(Constant.maxTextures);\n\t\tthis.indexBuffer = new Buffer(undefined, true, true);\n\t\tthis.checkIndexBuffer(2000);\n\t\tthis.initBounds();\n\t}\n\n\tinitBounds() {\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tfor (let i = 0; i < maxTextures; i++) {\n\t\t\tconst resource = new MultiTextureResource(Constant);\n\t\t\tconst baseTex = new BaseTexture(resource);\n\t\t\tbaseTex.scaleMode = Constant.SCALE_MODE;\n\t\t\tbaseTex.wrapMode = WRAP_MODES.CLAMP;\n\t\t\tthis.texResources.push(resource);\n\t\t}\n\t}\n\n\tbindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tlet samplerSize: Array = (shader as any).uniforms.uSamplerSize;\n\t\tthis.texLoc.length = 0;\n\t\tfor (let i = 0; i < textures.length; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trenderer.texture.bind(textures[i], i);\n\t\t\t//TODO: add resolution here\n\t\t\tsamplerSize[i * 2] = 1.0 / textures[i].baseTexture.width;\n\t\t\tsamplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height;\n\t\t}\n\t\t(shader as any).uniforms.uSamplerSize = samplerSize;\n\t}\n\n\tbindTextures(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tconst len = textures.length;\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tif (len > Constant.boundCountPerBuffer * maxTextures) {\n\t\t\treturn;\n\t\t}\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\tthis.bindTexturesWithoutRT(renderer, shader, textures);\n\t\t\treturn;\n\t\t}\n\n\t\tlet i = 0;\n\t\tfor (; i < len; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) continue;\n\t\t\tconst multi = this.texResources[i >> 2];\n\t\t\tmulti.setTexture(i & 3, texture);\n\t\t}\n\n\t\tlet gltsUsed = (i + 3) >> 2;\n\t\tfor (i = 0; i < gltsUsed; i++) {\n\t\t\t//remove \"i, true\" after resolving a bug\n\t\t\trenderer.texture.bind(this.texResources[i].baseTex, i);\n\t\t}\n\t}\n\n\tstart() {\n\t\t//sorry, nothing\n\t}\n\n\tcreateVb() {\n\t\tconst geom = new RectTileGeom();\n\t\tgeom.addIndex(this.indexBuffer);\n\t\tgeom.lastTimeAccess = Date.now();\n\t\treturn geom;\n\t}\n\n\tcheckIndexBuffer(size: number, vb: RectTileGeom = null) {\n\t\tconst totalIndices = size * 6;\n\n\t\tif (totalIndices <= this.ibLen) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet len = totalIndices;\n\t\twhile (len < totalIndices) {\n\t\t\tlen <<= 1;\n\t\t}\n\n\t\tthis.ibLen = totalIndices;\n\t\tthis.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size,\n\t\t\tConstant.use32bitIndex ? new Uint32Array(size * 6) : undefined));\n\n\t\t// \tTODO: create new index buffer instead?\n\t\t// if (vb) {\n\t\t// \tconst curIndex = vb.getIndex();\n\t\t// \tif (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) {\n\t\t// \t\tthis.swapIndex(vb, this.indexBuffer);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t// swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) {\n\t\t// let buffers = (geom as any).buffers;\n\t\t// const oldIndex = geom.getIndex();\n\t\t// let ind = buffers.indexOf(oldIndex);\n\t\t// if (ind >= 0) {\n\t\t// \tbuffers.splice(ind, 1);\n\t\t// }\n\t\t// geom.addIndex(indexBuf);\n\t// }\n\n\tgetShader(): TilemapShader {\n\t\treturn this.rectShader;\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\t// this.rectShader.destroy();\n\t\tthis.rectShader = null;\n\t}\n}\n\nRenderer.registerPlugin('tilemap', TileRenderer as any);\n","/// \n\nimport { Container } from '@pixi/display';\n\nimport type { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport type { Matrix } from '@pixi/math';\n\nexport class ZLayer extends Container {\n\n constructor(tilemap: Container, zIndex: number) {\n super();\n this.tilemap = tilemap;\n this.z = zIndex;\n }\n\n tilemap: any;\n z: number;\n zIndex: number;\n _previousLayers: number;\n canvasBuffer: HTMLCanvasElement;\n _tempRender: any;\n _lastAnimationFrame: number = -1;\n layerTransform: Matrix;\n\n clear() {\n let layers = this.children as Array;\n for (let i = 0; i < layers.length; i++)\n layers[i].clear();\n this._previousLayers = 0;\n }\n\n cacheIfDirty() {\n let tilemap: any = this.tilemap;\n let layers = this.children as Array;\n let modified = this._previousLayers !== layers.length;\n this._previousLayers = layers.length;\n let buf = this.canvasBuffer;\n let tempRender = this._tempRender;\n if (!buf) {\n buf = this.canvasBuffer = document.createElement('canvas');\n tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf});\n tempRender.context = tempRender.rootContext;\n tempRender.plugins.tilemap.dontUseTransform = true;\n }\n if (buf.width !== tilemap._layerWidth ||\n buf.height !== tilemap._layerHeight) {\n buf.width = tilemap._layerWidth;\n buf.height = tilemap._layerHeight;\n modified = true;\n }\n let i: number;\n if (!modified) {\n for (i = 0; i < layers.length; i++) {\n if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) {\n modified = true;\n break;\n }\n }\n }\n this._lastAnimationFrame = tilemap.animationFrame;\n if (modified) {\n if (tilemap._hackRenderer) {\n tilemap._hackRenderer(tempRender);\n }\n tempRender.context.clearRect(0, 0, buf.width, buf.height);\n for (i = 0; i < layers.length; i++) {\n layers[i].clearModify();\n layers[i].renderCanvas(tempRender);\n }\n }\n this.layerTransform = this.worldTransform;\n for (i = 0; i < layers.length; i++) {\n this.layerTransform = layers[i].worldTransform;\n break;\n }\n }\n\n renderCanvas(renderer: any) {\n this.cacheIfDirty();\n let wt = this.layerTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n let tilemap = this.tilemap;\n renderer.context.drawImage(this.canvasBuffer, 0, 0);\n }\n}\n","/// \n\nnamespace pixi_tilemap {\n (PIXI as any).tilemap = pixi_tilemap;\n}\n\n// This makes exporter.ts a module!\nexport default {}\n","import { CanvasTileRenderer } from './CanvasTileRenderer';\nimport { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport { Constant } from './Constant';\nimport { GraphicsLayer } from './GraphicsLayer';\nimport { MultiTextureResource } from './MultiTextureResource';\nimport { RectTileLayer } from './RectTileLayer';\nimport { TilemapShader, RectTileShader, RectTileGeom } from './RectTileShader';\nimport { TileRenderer } from './TileRenderer';\nimport { ZLayer } from './ZLayer';\n\nexport const pixi_tilemap = {\n CanvasTileRenderer,\n CompositeRectTileLayer,\n Constant,\n GraphicsLayer,\n MultiTextureResource,\n RectTileLayer,\n TilemapShader,\n RectTileShader,\n RectTileGeom,\n TileRenderer,\n ZLayer,\n};\n\nexport * from './CanvasTileRenderer';\nexport * from './CompositeRectTileLayer';\nexport * from './Constant';\nexport * from './exporter';\nexport * from './GraphicsLayer';\nexport * from './MultiTextureResource';\nexport * from './RectTileLayer';\nexport * from './RectTileShader';\nexport * from './shaderGenerator';\nexport * from './TileRenderer';\nexport * from './ZLayer';"],"names":["shaderGenerator.fillSamplers","shaderGenerator.generateFragmentSrc","pixi_tilemap"],"mappings":";;;;;;;;;;;;;;;;;IASI,4BAAY,QAAkB;QAH9B,aAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAClB,qBAAgB,GAAG,KAAK,CAAC;QAGrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KAC1B;IACL,yBAAC;AAAD,CAAC,IAAA;AAED,IAAM,EAAE,GAAI,IAAY,CAAC,cAAc,CAAC;AAExC,IAAI,EAAE,EAAE;IACJ,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;;;AClBrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE;AACnC,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc;AACzC,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC;AACpF,QAAQ,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACnF,IAAI,OAAO,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AE,CAAC;QACpB,IAAI,EAAE,GAAG,IAAI,CAAC,cAAc,CAAC;QAC7B,QAAQ,CAAC,OAAO,CAAC,YAAY,CACzB,EAAE,CAAC,CAAC,EACJ,EAAE,CAAC,CAAC,EACJ,EAAE,CAAC,CAAC,EACJ,EAAE,CAAC,CAAC,EACJ,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,UAAU,EAC3B,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,UAAU,CAC9B,CAAC;QACF,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC3B,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;KACvD;IACL,aAAC;AAAD,CApFA,CAA4B,SAAS;;ACLrC,IAAU,YAAY,CAErB;AAFD,WAAU,YAAY;IACjB,IAAY,CAAC,OAAO,GAAG,YAAY,CAAC;AACzC,CAAC,EAFS,YAAY,KAAZ,YAAY;;ICQTE,cAAY,GAAG;IACxB,kBAAkB,oBAAA;IAClB,sBAAsB,wBAAA;IACtB,QAAQ,UAAA;IACR,aAAa,eAAA;IACb,oBAAoB,sBAAA;IACpB,aAAa,eAAA;IACb,aAAa,eAAA;IACb,cAAc,gBAAA;IACd,YAAY,cAAA;IACZ,YAAY,cAAA;IACZ,MAAM,QAAA;;;;;"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 0a02580a..5dcb35b3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,9 +1,104 @@ { "name": "pixi-tilemap", - "version": "2.0.2", + "version": "2.0.6", "lockfileVersion": 1, "requires": true, "dependencies": { + "@babel/code-frame": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz", + "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==", + "dev": true, + "requires": { + "@babel/highlight": "^7.10.4" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", + "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "dev": true + }, + "@babel/highlight": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz", + "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.10.4", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "@microsoft/api-extractor": { + "version": "7.9.4", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor/-/api-extractor-7.9.4.tgz", + "integrity": "sha512-r4kqFO0unCuEcKQkEVBCw/L4YuU4larQ45iDVRFOyarER03I7FGiGy/iFoTXeN9CSnFGoXOYNokt0MkqzOYjtQ==", + "dev": true, + "requires": { + "@microsoft/api-extractor-model": "7.8.14", + "@microsoft/tsdoc": "0.12.19", + "@rushstack/node-core-library": "3.26.2", + "@rushstack/ts-command-line": "4.4.7", + "colors": "~1.2.1", + "lodash": "~4.17.15", + "resolve": "~1.17.0", + "semver": "~7.3.0", + "source-map": "~0.6.1", + "typescript": "~3.9.5" + }, + "dependencies": { + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "resolve": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", + "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + }, + "semver": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "typescript": { + "version": "3.9.7", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz", + "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==", + "dev": true + } + } + }, + "@microsoft/api-extractor-model": { + "version": "7.8.14", + "resolved": "https://registry.npmjs.org/@microsoft/api-extractor-model/-/api-extractor-model-7.8.14.tgz", + "integrity": "sha512-M29U8lfwCf/vadMpLsNWGyE+A5HNGulMzVoQtpQhDxbigEXqw0OYUDbWFdsdoMiNGk3jzPVz+AIks+EXJJP0OQ==", + "dev": true, + "requires": { + "@microsoft/tsdoc": "0.12.19", + "@rushstack/node-core-library": "3.26.2" + } + }, + "@microsoft/tsdoc": { + "version": "0.12.19", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.12.19.tgz", + "integrity": "sha512-IpgPxHrNxZiMNUSXqR1l/gePKPkfAmIKoDRP9hp7OwjU29ZR8WCJsOJ8iBKgw0Qk+pFwR+8Y1cy8ImLY6e9m4A==", + "dev": true + }, "@pixi/accessibility": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/@pixi/accessibility/-/accessibility-5.2.1.tgz", @@ -13,6 +108,56 @@ "@pixi/core": "5.2.1", "@pixi/display": "5.2.1", "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", + "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "dev": true, + "requires": { + "@pixi/constants": "5.2.1", + "@pixi/display": "5.2.1", + "@pixi/math": "5.2.1", + "@pixi/runner": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/ticker": "5.2.1", + "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } + } + }, + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } + } + } } }, "@pixi/app": { @@ -23,38 +168,241 @@ "requires": { "@pixi/core": "5.2.1", "@pixi/display": "5.2.1" + }, + "dependencies": { + "@pixi/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", + "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "dev": true, + "requires": { + "@pixi/constants": "5.2.1", + "@pixi/display": "5.2.1", + "@pixi/math": "5.2.1", + "@pixi/runner": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/ticker": "5.2.1", + "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } + } + }, + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } + } + } + } + }, + "@pixi/canvas-renderer": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/@pixi/canvas-renderer/-/canvas-renderer-5.3.3.tgz", + "integrity": "sha512-xAi3x2D0Jykk5vTsTMPEPTazQ7tmHnIj1pbEXL+knmNL0zmpekVpg5nY2RoztHW98oLfno5at5JNWtSQA/tiQA==", + "dev": true, + "requires": { + "@pixi/constants": "5.3.3", + "@pixi/core": "5.3.3", + "@pixi/math": "5.3.3", + "@pixi/settings": "5.3.3", + "@pixi/utils": "5.3.3" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.3.3.tgz", + "integrity": "sha512-IybgxzLlEPm7ihp70cLNKc3IPyqkFuW+idk9Zw2St+OayJTw5ctCnLAg9cducwIVHjPYTvN46BYDa+n0KRWZYw==", + "dev": true + }, + "@pixi/math": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.3.3.tgz", + "integrity": "sha512-k5C3kQpxlGm2AdBJEUjjW2l2YlSvTKf+54vNOjD4UcEfRoDevC5p4Zg49q3UAu855lrs5qw49AbkrFKsQvPIRA==", + "dev": true + }, + "@pixi/settings": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/@pixi/settings/-/settings-5.3.3.tgz", + "integrity": "sha512-1MYJokqpPUtvYEX0BVi0Pq2Xi6KGmWDV5hlQnTXY9NGv6tmqrPYvIb/uHFaDyVUWmrqsFL3xZ4W5zMo+c/dwVA==", + "dev": true, + "requires": { + "ismobilejs": "^1.1.0" + } + }, + "@pixi/utils": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/@pixi/utils/-/utils-5.3.3.tgz", + "integrity": "sha512-GDP2h1Mph9Uei4zmJjzDK6GZ5S9O2A09VySVfWyKgWwP3SQ/Ss0bGYm4sE6+u1NMSz1WCrLgu66H82XuXs2Cbg==", + "dev": true, + "requires": { + "@pixi/constants": "5.3.3", + "@pixi/settings": "5.3.3", + "earcut": "^2.1.5", + "eventemitter3": "^3.1.0", + "url": "^0.11.0" + } + }, + "ismobilejs": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ismobilejs/-/ismobilejs-1.1.1.tgz", + "integrity": "sha512-VaFW53yt8QO61k2WJui0dHf4SlL8lxBofUuUmwBo0ljPk0Drz2TiuDW4jo3wDcv41qy/SxrJ+VAzJ/qYqsmzRw==", + "dev": true + } } }, "@pixi/constants": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", - "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.3.3.tgz", + "integrity": "sha512-IybgxzLlEPm7ihp70cLNKc3IPyqkFuW+idk9Zw2St+OayJTw5ctCnLAg9cducwIVHjPYTvN46BYDa+n0KRWZYw==", "dev": true }, "@pixi/core": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", - "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.3.3.tgz", + "integrity": "sha512-taw50LnzV+TQVMx5HQA2ZJgF9wuhZ6DeoXHW2KkevYB0ekKYnEO2VMMiRDMcmchtyvHclJebzjeHZLGqDtKDgw==", "dev": true, "requires": { - "@pixi/constants": "5.2.1", - "@pixi/display": "5.2.1", - "@pixi/math": "5.2.1", - "@pixi/runner": "5.2.1", - "@pixi/settings": "5.2.1", - "@pixi/ticker": "5.2.1", - "@pixi/utils": "5.2.1" + "@pixi/constants": "5.3.3", + "@pixi/math": "5.3.3", + "@pixi/runner": "5.3.3", + "@pixi/settings": "5.3.3", + "@pixi/ticker": "5.3.3", + "@pixi/utils": "5.3.3" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.3.3.tgz", + "integrity": "sha512-IybgxzLlEPm7ihp70cLNKc3IPyqkFuW+idk9Zw2St+OayJTw5ctCnLAg9cducwIVHjPYTvN46BYDa+n0KRWZYw==", + "dev": true + }, + "@pixi/math": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.3.3.tgz", + "integrity": "sha512-k5C3kQpxlGm2AdBJEUjjW2l2YlSvTKf+54vNOjD4UcEfRoDevC5p4Zg49q3UAu855lrs5qw49AbkrFKsQvPIRA==", + "dev": true + }, + "@pixi/runner": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/@pixi/runner/-/runner-5.3.3.tgz", + "integrity": "sha512-7eLZxxT+PwxuwzcRL1egrnEdLHwD41yFb24pMSo6XM86ppP1tdBjrv5+pLDnUuDEfNjZQxx07FAlZY+sMKANmw==", + "dev": true + }, + "@pixi/settings": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/@pixi/settings/-/settings-5.3.3.tgz", + "integrity": "sha512-1MYJokqpPUtvYEX0BVi0Pq2Xi6KGmWDV5hlQnTXY9NGv6tmqrPYvIb/uHFaDyVUWmrqsFL3xZ4W5zMo+c/dwVA==", + "dev": true, + "requires": { + "ismobilejs": "^1.1.0" + } + }, + "@pixi/ticker": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/@pixi/ticker/-/ticker-5.3.3.tgz", + "integrity": "sha512-p5F/dwJGwfZWUg5cCPqOnEx5iYGW+huQlZZtrTKKd1KoVehFsrzHeRBOEp4d584jsOmBf7fjJaUTyzsFn0YtOQ==", + "dev": true, + "requires": { + "@pixi/settings": "5.3.3" + } + }, + "@pixi/utils": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/@pixi/utils/-/utils-5.3.3.tgz", + "integrity": "sha512-GDP2h1Mph9Uei4zmJjzDK6GZ5S9O2A09VySVfWyKgWwP3SQ/Ss0bGYm4sE6+u1NMSz1WCrLgu66H82XuXs2Cbg==", + "dev": true, + "requires": { + "@pixi/constants": "5.3.3", + "@pixi/settings": "5.3.3", + "earcut": "^2.1.5", + "eventemitter3": "^3.1.0", + "url": "^0.11.0" + } + }, + "ismobilejs": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ismobilejs/-/ismobilejs-1.1.1.tgz", + "integrity": "sha512-VaFW53yt8QO61k2WJui0dHf4SlL8lxBofUuUmwBo0ljPk0Drz2TiuDW4jo3wDcv41qy/SxrJ+VAzJ/qYqsmzRw==", + "dev": true + } } }, "@pixi/display": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", - "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.3.3.tgz", + "integrity": "sha512-dPm7Vk2BH9byu6RHBYsI9MtjUU8x1HNm/PIi6lIlxANhTjWnhxwfvmrGE7ZcRLThTenNdDVlZ2ke2XAXP98UgA==", "dev": true, "requires": { - "@pixi/math": "5.2.1", - "@pixi/settings": "5.2.1", - "@pixi/utils": "5.2.1" + "@pixi/math": "5.3.3", + "@pixi/settings": "5.3.3", + "@pixi/utils": "5.3.3" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.3.3.tgz", + "integrity": "sha512-IybgxzLlEPm7ihp70cLNKc3IPyqkFuW+idk9Zw2St+OayJTw5ctCnLAg9cducwIVHjPYTvN46BYDa+n0KRWZYw==", + "dev": true + }, + "@pixi/math": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.3.3.tgz", + "integrity": "sha512-k5C3kQpxlGm2AdBJEUjjW2l2YlSvTKf+54vNOjD4UcEfRoDevC5p4Zg49q3UAu855lrs5qw49AbkrFKsQvPIRA==", + "dev": true + }, + "@pixi/settings": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/@pixi/settings/-/settings-5.3.3.tgz", + "integrity": "sha512-1MYJokqpPUtvYEX0BVi0Pq2Xi6KGmWDV5hlQnTXY9NGv6tmqrPYvIb/uHFaDyVUWmrqsFL3xZ4W5zMo+c/dwVA==", + "dev": true, + "requires": { + "ismobilejs": "^1.1.0" + } + }, + "@pixi/utils": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/@pixi/utils/-/utils-5.3.3.tgz", + "integrity": "sha512-GDP2h1Mph9Uei4zmJjzDK6GZ5S9O2A09VySVfWyKgWwP3SQ/Ss0bGYm4sE6+u1NMSz1WCrLgu66H82XuXs2Cbg==", + "dev": true, + "requires": { + "@pixi/constants": "5.3.3", + "@pixi/settings": "5.3.3", + "earcut": "^2.1.5", + "eventemitter3": "^3.1.0", + "url": "^0.11.0" + } + }, + "ismobilejs": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ismobilejs/-/ismobilejs-1.1.1.tgz", + "integrity": "sha512-VaFW53yt8QO61k2WJui0dHf4SlL8lxBofUuUmwBo0ljPk0Drz2TiuDW4jo3wDcv41qy/SxrJ+VAzJ/qYqsmzRw==", + "dev": true + } } }, "@pixi/extract": { @@ -66,6 +414,48 @@ "@pixi/core": "5.2.1", "@pixi/math": "5.2.1", "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", + "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "dev": true, + "requires": { + "@pixi/constants": "5.2.1", + "@pixi/display": "5.2.1", + "@pixi/math": "5.2.1", + "@pixi/runner": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/ticker": "5.2.1", + "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + }, + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + } + } + } + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } } }, "@pixi/filter-alpha": { @@ -75,6 +465,48 @@ "dev": true, "requires": { "@pixi/core": "5.2.1" + }, + "dependencies": { + "@pixi/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", + "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "dev": true, + "requires": { + "@pixi/constants": "5.2.1", + "@pixi/display": "5.2.1", + "@pixi/math": "5.2.1", + "@pixi/runner": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/ticker": "5.2.1", + "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + }, + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + } + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } + } + } } }, "@pixi/filter-blur": { @@ -85,6 +517,48 @@ "requires": { "@pixi/core": "5.2.1", "@pixi/settings": "5.2.1" + }, + "dependencies": { + "@pixi/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", + "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "dev": true, + "requires": { + "@pixi/constants": "5.2.1", + "@pixi/display": "5.2.1", + "@pixi/math": "5.2.1", + "@pixi/runner": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/ticker": "5.2.1", + "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + }, + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + } + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } + } + } } }, "@pixi/filter-color-matrix": { @@ -94,6 +568,48 @@ "dev": true, "requires": { "@pixi/core": "5.2.1" + }, + "dependencies": { + "@pixi/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", + "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "dev": true, + "requires": { + "@pixi/constants": "5.2.1", + "@pixi/display": "5.2.1", + "@pixi/math": "5.2.1", + "@pixi/runner": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/ticker": "5.2.1", + "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + }, + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + } + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } + } + } } }, "@pixi/filter-displacement": { @@ -104,6 +620,48 @@ "requires": { "@pixi/core": "5.2.1", "@pixi/math": "5.2.1" + }, + "dependencies": { + "@pixi/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", + "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "dev": true, + "requires": { + "@pixi/constants": "5.2.1", + "@pixi/display": "5.2.1", + "@pixi/math": "5.2.1", + "@pixi/runner": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/ticker": "5.2.1", + "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + }, + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + } + } + } + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } } }, "@pixi/filter-fxaa": { @@ -113,6 +671,48 @@ "dev": true, "requires": { "@pixi/core": "5.2.1" + }, + "dependencies": { + "@pixi/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", + "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "dev": true, + "requires": { + "@pixi/constants": "5.2.1", + "@pixi/display": "5.2.1", + "@pixi/math": "5.2.1", + "@pixi/runner": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/ticker": "5.2.1", + "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + }, + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + } + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } + } + } } }, "@pixi/filter-noise": { @@ -122,6 +722,48 @@ "dev": true, "requires": { "@pixi/core": "5.2.1" + }, + "dependencies": { + "@pixi/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", + "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "dev": true, + "requires": { + "@pixi/constants": "5.2.1", + "@pixi/display": "5.2.1", + "@pixi/math": "5.2.1", + "@pixi/runner": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/ticker": "5.2.1", + "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + }, + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + } + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } + } + } } }, "@pixi/graphics": { @@ -136,6 +778,46 @@ "@pixi/math": "5.2.1", "@pixi/sprite": "5.2.1", "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + }, + "@pixi/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", + "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "dev": true, + "requires": { + "@pixi/constants": "5.2.1", + "@pixi/display": "5.2.1", + "@pixi/math": "5.2.1", + "@pixi/runner": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/ticker": "5.2.1", + "@pixi/utils": "5.2.1" + } + }, + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + } + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } } }, "@pixi/interaction": { @@ -149,6 +831,48 @@ "@pixi/math": "5.2.1", "@pixi/ticker": "5.2.1", "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", + "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "dev": true, + "requires": { + "@pixi/constants": "5.2.1", + "@pixi/display": "5.2.1", + "@pixi/math": "5.2.1", + "@pixi/runner": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/ticker": "5.2.1", + "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + } + } + }, + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + } + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } } }, "@pixi/loaders": { @@ -160,12 +884,54 @@ "@pixi/core": "5.2.1", "@pixi/utils": "5.2.1", "resource-loader": "^3.0.1" + }, + "dependencies": { + "@pixi/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", + "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "dev": true, + "requires": { + "@pixi/constants": "5.2.1", + "@pixi/display": "5.2.1", + "@pixi/math": "5.2.1", + "@pixi/runner": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/ticker": "5.2.1", + "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + }, + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + } + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } + } + } } }, "@pixi/math": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", - "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.3.3.tgz", + "integrity": "sha512-k5C3kQpxlGm2AdBJEUjjW2l2YlSvTKf+54vNOjD4UcEfRoDevC5p4Zg49q3UAu855lrs5qw49AbkrFKsQvPIRA==", "dev": true }, "@pixi/mesh": { @@ -180,6 +946,46 @@ "@pixi/math": "5.2.1", "@pixi/settings": "5.2.1", "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + }, + "@pixi/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", + "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "dev": true, + "requires": { + "@pixi/constants": "5.2.1", + "@pixi/display": "5.2.1", + "@pixi/math": "5.2.1", + "@pixi/runner": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/ticker": "5.2.1", + "@pixi/utils": "5.2.1" + } + }, + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + } + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } } }, "@pixi/mesh-extras": { @@ -193,6 +999,48 @@ "@pixi/math": "5.2.1", "@pixi/mesh": "5.2.1", "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + }, + "@pixi/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", + "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "dev": true, + "requires": { + "@pixi/constants": "5.2.1", + "@pixi/display": "5.2.1", + "@pixi/math": "5.2.1", + "@pixi/runner": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/ticker": "5.2.1", + "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + } + } + } + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } } }, "@pixi/mixin-cache-as-bitmap": { @@ -207,6 +1055,48 @@ "@pixi/settings": "5.2.1", "@pixi/sprite": "5.2.1", "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", + "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "dev": true, + "requires": { + "@pixi/constants": "5.2.1", + "@pixi/display": "5.2.1", + "@pixi/math": "5.2.1", + "@pixi/runner": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/ticker": "5.2.1", + "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + } + } + }, + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + } + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } } }, "@pixi/mixin-get-child-by-name": { @@ -216,6 +1106,27 @@ "dev": true, "requires": { "@pixi/display": "5.2.1" + }, + "dependencies": { + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } + } + } } }, "@pixi/mixin-get-global-position": { @@ -226,6 +1137,25 @@ "requires": { "@pixi/display": "5.2.1", "@pixi/math": "5.2.1" + }, + "dependencies": { + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + } + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } } }, "@pixi/particles": { @@ -239,6 +1169,46 @@ "@pixi/display": "5.2.1", "@pixi/math": "5.2.1", "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + }, + "@pixi/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", + "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "dev": true, + "requires": { + "@pixi/constants": "5.2.1", + "@pixi/display": "5.2.1", + "@pixi/math": "5.2.1", + "@pixi/runner": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/ticker": "5.2.1", + "@pixi/utils": "5.2.1" + } + }, + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + } + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } } }, "@pixi/polyfill": { @@ -263,6 +1233,56 @@ "@pixi/settings": "5.2.1", "@pixi/text": "5.2.1", "@pixi/ticker": "5.2.1" + }, + "dependencies": { + "@pixi/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", + "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "dev": true, + "requires": { + "@pixi/constants": "5.2.1", + "@pixi/display": "5.2.1", + "@pixi/math": "5.2.1", + "@pixi/runner": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/ticker": "5.2.1", + "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } + } + }, + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } + } + } } }, "@pixi/runner": { @@ -292,6 +1312,46 @@ "@pixi/math": "5.2.1", "@pixi/settings": "5.2.1", "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + }, + "@pixi/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", + "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "dev": true, + "requires": { + "@pixi/constants": "5.2.1", + "@pixi/display": "5.2.1", + "@pixi/math": "5.2.1", + "@pixi/runner": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/ticker": "5.2.1", + "@pixi/utils": "5.2.1" + } + }, + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + } + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } } }, "@pixi/sprite-animated": { @@ -303,6 +1363,48 @@ "@pixi/core": "5.2.1", "@pixi/sprite": "5.2.1", "@pixi/ticker": "5.2.1" + }, + "dependencies": { + "@pixi/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", + "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "dev": true, + "requires": { + "@pixi/constants": "5.2.1", + "@pixi/display": "5.2.1", + "@pixi/math": "5.2.1", + "@pixi/runner": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/ticker": "5.2.1", + "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + }, + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + } + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } + } + } } }, "@pixi/sprite-tiling": { @@ -317,6 +1419,46 @@ "@pixi/math": "5.2.1", "@pixi/sprite": "5.2.1", "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + }, + "@pixi/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", + "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "dev": true, + "requires": { + "@pixi/constants": "5.2.1", + "@pixi/display": "5.2.1", + "@pixi/math": "5.2.1", + "@pixi/runner": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/ticker": "5.2.1", + "@pixi/utils": "5.2.1" + } + }, + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + } + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } } }, "@pixi/spritesheet": { @@ -329,6 +1471,48 @@ "@pixi/loaders": "5.2.1", "@pixi/math": "5.2.1", "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", + "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "dev": true, + "requires": { + "@pixi/constants": "5.2.1", + "@pixi/display": "5.2.1", + "@pixi/math": "5.2.1", + "@pixi/runner": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/ticker": "5.2.1", + "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + }, + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + } + } + } + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } } }, "@pixi/text": { @@ -342,6 +1526,48 @@ "@pixi/settings": "5.2.1", "@pixi/sprite": "5.2.1", "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", + "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "dev": true, + "requires": { + "@pixi/constants": "5.2.1", + "@pixi/display": "5.2.1", + "@pixi/math": "5.2.1", + "@pixi/runner": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/ticker": "5.2.1", + "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + }, + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + } + } + } + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } } }, "@pixi/text-bitmap": { @@ -357,6 +1583,48 @@ "@pixi/settings": "5.2.1", "@pixi/sprite": "5.2.1", "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", + "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "dev": true, + "requires": { + "@pixi/constants": "5.2.1", + "@pixi/display": "5.2.1", + "@pixi/math": "5.2.1", + "@pixi/runner": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/ticker": "5.2.1", + "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + } + } + }, + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + } + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } } }, "@pixi/ticker": { @@ -379,6 +1647,118 @@ "earcut": "^2.1.5", "eventemitter3": "^3.1.0", "url": "^0.11.0" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + } + } + }, + "@rollup/plugin-node-resolve": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-8.4.0.tgz", + "integrity": "sha512-LFqKdRLn0ShtQyf6SBYO69bGE1upV6wUhBX0vFOUnLAyzx5cwp8svA0eHUnu8+YU57XOkrMtfG63QOpQx25pHQ==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.1.0", + "@types/resolve": "1.17.1", + "builtin-modules": "^3.1.0", + "deep-freeze": "^0.0.1", + "deepmerge": "^4.2.2", + "is-module": "^1.0.0", + "resolve": "^1.17.0" + }, + "dependencies": { + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "resolve": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", + "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + } + } + }, + "@rollup/pluginutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", + "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "dev": true, + "requires": { + "@types/estree": "0.0.39", + "estree-walker": "^1.0.1", + "picomatch": "^2.2.2" + } + }, + "@rushstack/node-core-library": { + "version": "3.26.2", + "resolved": "https://registry.npmjs.org/@rushstack/node-core-library/-/node-core-library-3.26.2.tgz", + "integrity": "sha512-gm4w4L+xhYAzZmBpZIyWHvqpa5fdtt9WpvBBhi/HjyIA/z472gZA3R3gZnGNaYw4y4/w2GkZL0IYhAGqLk7Qpw==", + "dev": true, + "requires": { + "@types/node": "10.17.13", + "colors": "~1.2.1", + "fs-extra": "~7.0.1", + "jju": "~1.4.0", + "semver": "~7.3.0", + "timsort": "~0.3.0", + "z-schema": "~3.18.3" + }, + "dependencies": { + "semver": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "dev": true + } + } + }, + "@rushstack/ts-command-line": { + "version": "4.4.7", + "resolved": "https://registry.npmjs.org/@rushstack/ts-command-line/-/ts-command-line-4.4.7.tgz", + "integrity": "sha512-rBMMeH0a+43JvpEwtqVe1P+RlJmYe3rkHJctCIFXUHJWnmTCYNKB/Xp3LLzA/d4SsmAXXeKmbaOFXML7mwBveA==", + "dev": true, + "requires": { + "@types/argparse": "1.0.38", + "argparse": "~1.0.9", + "colors": "~1.2.1" + } + }, + "@types/argparse": { + "version": "1.0.38", + "resolved": "https://registry.npmjs.org/@types/argparse/-/argparse-1.0.38.tgz", + "integrity": "sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==", + "dev": true + }, + "@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", + "dev": true + }, + "@types/node": { + "version": "10.17.13", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.13.tgz", + "integrity": "sha512-pMCcqU2zT4TjqYFrWtYHKal7Sl30Ims6ulZ4UFXxI4xbtQqK/qqKwkDoBFCfooRqqmRu9vY3xaJRwxSh673aYg==", + "dev": true + }, + "@types/resolve": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", + "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==", + "dev": true, + "requires": { + "@types/node": "*" } }, "@webassemblyjs/ast": { @@ -740,6 +2120,15 @@ "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", "dev": true }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, "arr-diff": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", @@ -1244,6 +2633,12 @@ "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", "dev": true }, + "builtin-modules": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.1.0.tgz", + "integrity": "sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==", + "dev": true + }, "builtin-status-codes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", @@ -1490,6 +2885,12 @@ "integrity": "sha1-SxQVMEz1ACjqgWQ2Q72C6gWANok=", "dev": true }, + "colors": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.2.5.tgz", + "integrity": "sha512-erNRLao/Y3Fv54qUa0LBB+//Uf3YwMUmdJinN20yMXm9zdKKqH9wt7R9IIVZ+K7ShzfpLV/Zg8+VyrBJYB4lpg==", + "dev": true + }, "combine-source-map": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/combine-source-map/-/combine-source-map-0.8.0.tgz", @@ -1728,6 +3129,18 @@ "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", "dev": true }, + "deep-freeze": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/deep-freeze/-/deep-freeze-0.0.1.tgz", + "integrity": "sha1-OgsABd4YZygZ39OM0x+RF5yJPoQ=", + "dev": true + }, + "deepmerge": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", + "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", + "dev": true + }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -2026,6 +3439,12 @@ "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", "dev": true }, + "estree-walker": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", + "dev": true + }, "eventemitter3": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.2.tgz", @@ -2333,6 +3752,17 @@ "readable-stream": "^2.0.0" } }, + "fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, "fs-write-stream-atomic": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", @@ -3313,6 +4743,12 @@ "is-extglob": "^2.1.1" } }, + "is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", + "dev": true + }, "is-number": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", @@ -3424,6 +4860,46 @@ "underscore": "^1.7.0" } }, + "jest-worker": { + "version": "26.3.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-26.3.0.tgz", + "integrity": "sha512-Vmpn2F6IASefL+DVBhPzI2J9/GJUsqzomdeN+P+dK8/jKxbh8R3BtFnx3FIta7wYlPU62cpJMJQo4kuOowcMnw==", + "dev": true, + "requires": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^7.0.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "jju": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz", + "integrity": "sha1-o6vicYryQaKykE+EpiWXDzia4yo=", + "dev": true + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, "js2xmlparser": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-3.0.0.tgz", @@ -3494,6 +4970,15 @@ "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", "dev": true }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + }, "jsonify": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", @@ -3588,6 +5073,18 @@ "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", "dev": true }, + "lodash.get": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", + "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", + "dev": true + }, + "lodash.isequal": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz", + "integrity": "sha1-QVxEePK8wwEgwizhDtMib30+GOA=", + "dev": true + }, "lodash.memoize": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-3.0.4.tgz", @@ -3694,6 +5191,12 @@ "readable-stream": "^2.0.1" } }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, "micromatch": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", @@ -4296,6 +5799,12 @@ "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", "dev": true }, + "picomatch": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", + "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", + "dev": true + }, "pify": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", @@ -4357,6 +5866,46 @@ "@pixi/text-bitmap": "5.2.1", "@pixi/ticker": "5.2.1", "@pixi/utils": "5.2.1" + }, + "dependencies": { + "@pixi/constants": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/constants/-/constants-5.2.1.tgz", + "integrity": "sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA==", + "dev": true + }, + "@pixi/core": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/core/-/core-5.2.1.tgz", + "integrity": "sha512-kREyWm87C4xZtdlw+otX+U/xJZhDUQyY/UHirbBwkO0LeAfrJm3qNyMfFZTcyW4PvmF16989IjvjGAWSeZSIQw==", + "dev": true, + "requires": { + "@pixi/constants": "5.2.1", + "@pixi/display": "5.2.1", + "@pixi/math": "5.2.1", + "@pixi/runner": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/ticker": "5.2.1", + "@pixi/utils": "5.2.1" + } + }, + "@pixi/display": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/display/-/display-5.2.1.tgz", + "integrity": "sha512-tr++p14im8KBzZHxMtM/E2Q7FWHYp9bjjDl+rA1b91HSN/vUJu1OlkUoCN4x7TyfkVtDPnrglhZykf7d93Nl9A==", + "dev": true, + "requires": { + "@pixi/math": "5.2.1", + "@pixi/settings": "5.2.1", + "@pixi/utils": "5.2.1" + } + }, + "@pixi/math": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@pixi/math/-/math-5.2.1.tgz", + "integrity": "sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g==", + "dev": true + } } }, "pkg-dir": { @@ -4663,6 +6212,128 @@ "inherits": "^2.0.1" } }, + "rollup": { + "version": "2.23.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.23.1.tgz", + "integrity": "sha512-Heyl885+lyN/giQwxA8AYT2GY3U+gOlTqVLrMQYno8Z1X9lAOpfXPiKiZCyPc25e9BLJM3Zlh957dpTlO4pa8A==", + "dev": true, + "requires": { + "fsevents": "~2.1.2" + }, + "dependencies": { + "fsevents": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.1.3.tgz", + "integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==", + "dev": true, + "optional": true + } + } + }, + "rollup-plugin-sourcemaps": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rollup-plugin-sourcemaps/-/rollup-plugin-sourcemaps-0.6.2.tgz", + "integrity": "sha512-9AwTKg3yRykwzemfLt71ySe0LvrAci+bpsOL1LaTYFk5BX4HF6X7DQfpHa74ANfSja3hyjiQkXCR8goSOnW//Q==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.0.9", + "source-map-resolve": "^0.6.0" + }, + "dependencies": { + "atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "dev": true + }, + "source-map-resolve": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.6.0.tgz", + "integrity": "sha512-KXBr9d/fO/bWo97NXsPIAW1bFSBOuCnjbNTBMO7N59hsv5i9yzRDfcYwwt0l04+VqnKC+EwzvJZIP/qkuMgR/w==", + "dev": true, + "requires": { + "atob": "^2.1.2", + "decode-uri-component": "^0.2.0" + } + } + } + }, + "rollup-plugin-terser": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-7.0.0.tgz", + "integrity": "sha512-p/N3lLiFusCjYTLfVkoaiRTOGr5AESEaljMPH12MhOtoMkmTBhIAfuadrcWy4am1U0vU4WTxO9fi0K09O4CboQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.10.4", + "jest-worker": "^26.2.1", + "serialize-javascript": "^4.0.0", + "terser": "^5.0.0" + }, + "dependencies": { + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "serialize-javascript": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz", + "integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + } + } + }, + "rollup-plugin-typescript": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/rollup-plugin-typescript/-/rollup-plugin-typescript-1.0.1.tgz", + "integrity": "sha512-rwJDNn9jv/NsKZuyBb/h0jsclP4CJ58qbvZt2Q9zDIGILF2LtdtvCqMOL+Gq9IVq5MTrTlHZNrn8h7VjQgd8tw==", + "dev": true, + "requires": { + "resolve": "^1.10.0", + "rollup-pluginutils": "^2.5.0" + }, + "dependencies": { + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "resolve": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", + "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + } + } + }, + "rollup-pluginutils": { + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz", + "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==", + "dev": true, + "requires": { + "estree-walker": "^0.6.1" + }, + "dependencies": { + "estree-walker": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", + "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", + "dev": true + } + } + }, "run-queue": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz", @@ -5005,6 +6676,12 @@ "extend-shallow": "^3.0.0" } }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true + }, "ssri": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/ssri/-/ssri-5.3.0.tgz", @@ -5190,6 +6867,31 @@ "integrity": "sha512-dQRhbNQkRnaqauC7WqSJ21EEksgT0fYZX2lqXzGkpo8JNig9zGZTYoMGvyI2nWmXlE2VSVXVDu7wLVGu/mQEsg==", "dev": true }, + "terser": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.0.0.tgz", + "integrity": "sha512-olH2DwGINoSuEpSGd+BsPuAQaA3OrHnHnFL/rDB2TVNc3srUbz/rq/j2BlF4zDXI+JqAvGr86bIm1R2cJgZ3FA==", + "dev": true, + "requires": { + "commander": "^2.20.0", + "source-map": "~0.6.1", + "source-map-support": "~0.5.12" + }, + "dependencies": { + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -5215,6 +6917,12 @@ "process": "~0.11.0" } }, + "timsort": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/timsort/-/timsort-0.3.0.tgz", + "integrity": "sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q=", + "dev": true + }, "tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", @@ -5323,9 +7031,9 @@ "dev": true }, "typescript": { - "version": "3.7.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz", - "integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==", + "version": "3.9.7", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz", + "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==", "dev": true }, "uglify-es": { @@ -5464,6 +7172,12 @@ "imurmurhash": "^0.1.4" } }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true + }, "unset-value": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", @@ -5578,6 +7292,12 @@ "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", "dev": true }, + "validator": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/validator/-/validator-8.2.0.tgz", + "integrity": "sha512-Yw5wW34fSv5spzTXNkokD6S6/Oq92d8q/t14TqsS3fAiA1RYnxSFSIZ+CY3n6PGGRCq5HhJTSepQvFUS2QUDxA==", + "dev": true + }, "vm-browserify": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", @@ -5816,6 +7536,18 @@ "requires": { "fd-slicer": "~1.0.1" } + }, + "z-schema": { + "version": "3.18.4", + "resolved": "https://registry.npmjs.org/z-schema/-/z-schema-3.18.4.tgz", + "integrity": "sha512-DUOKC/IhbkdLKKiV89gw9DUauTV8U/8yJl1sjf6MtDmzevLKOF2duNJ495S3MFVjqZarr+qNGCPbkg4mu4PpLw==", + "dev": true, + "requires": { + "commander": "^2.7.1", + "lodash.get": "^4.0.0", + "lodash.isequal": "^4.0.0", + "validator": "^8.0.0" + } } } } diff --git a/package.json b/package.json index a99aa0b8..db7d7a40 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,9 @@ "Ivan Popelyshev " ], "main": "./dist/pixi-tilemap.js", - "types": "./dist/pixi-tilemap.d.ts", + "module": "./lib/pixi-tilemap.es.js", + "bundle": "./dist/pixi-tilemap.umd.js", + "types": "./index.d.ts", "homepage": "http://www.rpgmakerweb.com/", "bugs": "https://github.com/pixijs/pixi-tilemap/issues", "license": "MIT", @@ -23,6 +25,7 @@ "prebuild": "yarn cleanup", "make:dts": "node scripts/make_dts.js", "build": "tsc && yarn make:dts", + "build:types": "rm -rf ./compile && tsc -p ./tsconfig.compile.json && api-extractor run", "docs": "typedoc --out ./docs/ --readme README.md ./src/", "check:browserify": "yarn checkpack browserify -e test/checkpack.ts", "check:webpack": "yarn checkpack webpack -e test/checkpack.ts", @@ -36,6 +39,13 @@ "README.md" ], "devDependencies": { + "@microsoft/api-extractor": "^7.9.4", + "@pixi/canvas-renderer": "^5.3.3", + "@pixi/constants": "^5.3.3", + "@pixi/core": "^5.3.3", + "@pixi/display": "^5.3.3", + "@pixi/math": "^5.3.3", + "@rollup/plugin-node-resolve": "^8.4.0", "checkpack": "^0.3", "del": "^2.2.0", "jaguarjs-jsdoc": "^1.0.1", @@ -44,7 +54,11 @@ "parallelshell": "^2.0.0", "pixi.js": "~5.2.0", "rimraf": "^2.5.3", + "rollup": "^2.23.1", + "rollup-plugin-sourcemaps": "^0.6.2", + "rollup-plugin-terser": "^7.0.0", + "rollup-plugin-typescript": "^1.0.1", "tsify": "^4.0.1", - "typescript": "^3.5.3" + "typescript": "^3.9.7" } -} +} \ No newline at end of file diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 00000000..de2c41fc --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,110 @@ +import path from 'path'; +import sourcemaps from 'rollup-plugin-sourcemaps'; +import typescript from 'rollup-plugin-typescript'; +import resolve from '@rollup/plugin-node-resolve'; +import { terser } from 'rollup-plugin-terser'; +import pkg from './package.json' + +const plugins = [ + sourcemaps(), + resolve({ + browser: true, + preferBuiltins: false + }), + typescript() +]; +const compiled = (new Date()).toUTCString().replace(/GMT/g, 'UTC'); +const banner = [ + `/*!`, + ` * ${pkg.name} - v${pkg.version}`, + ` * Compiled ${compiled}`, + ` *`, + ` * ${pkg.name} is licensed under the MIT License.`, + ` * http://www.opensource.org/licenses/mit-license`, + ` * `, + ` * Copyright 2016-20, Ivan Popelyshev All Rights Reserved`, + ` */`, +].join('\n'); +const input = path.join(__dirname, './src/index.ts'); +const freeze = false; +const sourcemap = true; + +// @SukantPal: I'm going to publish @pixi-build-tools/rollup to handle all this crap. Stay tuned! +const external = [ + 'pixi.js', + '@pixi/core', + '@pixi/display', + '@pixi/constants', + '@pixi/sprite', + '@pixi/math', + '@pixi/utils', + '@pixi/graphics' +]; +const globals = { + '@pixi/core': '_pixi_core', + '@pixi/display': '_pixi_display', + '@pixi/constants': '_pixi_constants', + '@pixi/sprite': '_pixi_sprite', + '@pixi/math': '_pixi_math', + '@pixi/utils': '_pixi_utils', + '@pixi/graphics': '_pixi_graphics' +} +const name = 'pixi_tilemap'; + +export default [ + { + plugins, + input, + external, + output: [ + { + // FIXME: dist/pixi-tilemap.js for the CJS build is an anti-pattern for PixiJS plugins. This needs to be moved + // to lib/pixi-tilemap.js in the future. + banner, + file: path.join(__dirname, 'dist/pixi-tilemap.js'), + format: 'cjs', + freeze, + sourcemap + }, + { + banner, + file: path.join(__dirname, 'lib/pixi-tilemap.es.js'), + format: 'esm', + freeze, + sourcemap + } + ] + }, + { + plugins, + input, + external, + output: [ + { + name, + globals, + banner, + file: path.join(__dirname, 'dist/pixi-tilemap.umd.js'), + format: 'iife', + freeze, + sourcemap + } + ] + }, + { + plugins: [...plugins, terser()], + input, + external, + output: [ + { + name, + globals, + banner, + file: path.join(__dirname, 'dist/pixi-tilemap.umd.min.js'), + format: 'iife', + freeze, + sourcemap + } + ] + } +] \ No newline at end of file diff --git a/src/CanvasTileRenderer.ts b/src/CanvasTileRenderer.ts index f4616f23..4a7a5204 100644 --- a/src/CanvasTileRenderer.ts +++ b/src/CanvasTileRenderer.ts @@ -1,18 +1,20 @@ -namespace pixi_tilemap { +/// - export class CanvasTileRenderer { - renderer: any; - tileAnim = [0, 0]; - dontUseTransform = false; +import { Renderer } from '@pixi/core'; - constructor(renderer: any) { - this.renderer = renderer; - this.tileAnim = [0, 0]; - } - } +export class CanvasTileRenderer { + renderer: Renderer; + tileAnim = [0, 0]; + dontUseTransform = false; - const cr = (PIXI as any).CanvasRenderer; - if (cr) { - cr.registerPlugin('tilemap', CanvasTileRenderer); + constructor(renderer: Renderer) { + this.renderer = renderer; + this.tileAnim = [0, 0]; } } + +const cr = (PIXI as any).CanvasRenderer; + +if (cr) { + cr.registerPlugin('tilemap', CanvasTileRenderer); +} diff --git a/src/CompositeRectTileLayer.ts b/src/CompositeRectTileLayer.ts index d0b41cf3..dece69d1 100644 --- a/src/CompositeRectTileLayer.ts +++ b/src/CompositeRectTileLayer.ts @@ -1,238 +1,239 @@ -/// +/// + +import { Container } from '@pixi/display'; +import { Texture, Renderer } from '@pixi/core'; +import { Matrix } from '@pixi/math'; +import { Constant } from './Constant'; +import { RectTileLayer } from './RectTileLayer'; + +export class CompositeRectTileLayer extends Container { + constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) { + super(); + this.initialize.apply(this, arguments); + } -namespace pixi_tilemap { + updateTransform() { + (this as any).displayObjectUpdateTransform(); + } - export class CompositeRectTileLayer extends PIXI.Container { + z: number; + zIndex: number; + modificationMarker = 0; + shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]); + _globalMat: Matrix = null; + _lastLayer: RectTileLayer = null; - constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) { - super(); - this.initialize.apply(this, arguments); - } + texPerChild: number; - updateTransform() { - (this as any).displayObjectUpdateTransform(); + initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) { + if (texPerChild as any === true) { + //old format, ignore it! + texPerChild = 0; } - - z: number; - zIndex: number; - modificationMarker = 0; - shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]); - _globalMat: PIXI.Matrix = null; - _lastLayer: RectTileLayer = null; - - texPerChild: number; - - initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) { - if (texPerChild as any === true) { - //old format, ignore it! - texPerChild = 0; - } - this.z = this.zIndex = zIndex; - this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures; - if (bitmaps) { - this.setBitmaps(bitmaps); - } + this.z = this.zIndex = zIndex; + this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures; + if (bitmaps) { + this.setBitmaps(bitmaps); } + } - setBitmaps(bitmaps: Array) { - for (let i=0;i 5.2.1, it does not exist there.`); - } - } - let texPerChild = this.texPerChild; - let len1 = this.children.length; - let len2 = Math.ceil(bitmaps.length / texPerChild); - let i: number; - for (i = 0; i < len1; i++) { - (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild); - } - for (i = len1; i < len2; i++) { - let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild)); - layer.compositeParent = true; - layer.offsetX = Constant.boundSize; - layer.offsetY = Constant.boundSize; - this.addChild(layer); + setBitmaps(bitmaps: Array) { + for (let i=0;i 5.2.1, it does not exist there.`); } } - - clear() { - for (let i = 0; i < this.children.length; i++) { - (this.children[i] as RectTileLayer).clear(); - } - this.modificationMarker = 0; + let texPerChild = this.texPerChild; + let len1 = this.children.length; + let len2 = Math.ceil(bitmaps.length / texPerChild); + let i: number; + for (i = 0; i < len1; i++) { + (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild); } + for (i = len1; i < len2; i++) { + let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild)); + layer.compositeParent = true; + layer.offsetX = Constant.boundSize; + layer.offsetY = Constant.boundSize; + this.addChild(layer); + } + } - addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this { - const childIndex: number = textureIndex / this.texPerChild >> 0; - const textureId: number = textureIndex % this.texPerChild; + clear() { + for (let i = 0; i < this.children.length; i++) { + (this.children[i] as RectTileLayer).clear(); + } + this.modificationMarker = 0; + } - if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) { - this._lastLayer = (this.children[childIndex] as RectTileLayer); - this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight); - } else { - this._lastLayer = null; - } + addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this { + const childIndex: number = textureIndex / this.texPerChild >> 0; + const textureId: number = textureIndex % this.texPerChild; - return this; + if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) { + this._lastLayer = (this.children[childIndex] as RectTileLayer); + this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight); + } else { + this._lastLayer = null; } - tileRotate(rotate: number): this { - if (this._lastLayer) - { - this._lastLayer.tileRotate(rotate); - } - return this; + return this; + } + + tileRotate(rotate: number): this { + if (this._lastLayer) + { + this._lastLayer.tileRotate(rotate); } + return this; + } - tileAnimX(offset: number, count: number): this { - if (this._lastLayer) - { - this._lastLayer.tileAnimX(offset, count); - } - return this; + tileAnimX(offset: number, count: number): this { + if (this._lastLayer) + { + this._lastLayer.tileAnimX(offset, count); } + return this; + } - tileAnimY(offset: number, count: number): this { - if (this._lastLayer) - { - this._lastLayer.tileAnimY(offset, count); - } - return this; + tileAnimY(offset: number, count: number): this { + if (this._lastLayer) + { + this._lastLayer.tileAnimY(offset, count); } + return this; + } - addFrame(texture_: PIXI.Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this { - let texture: PIXI.Texture; - let layer: RectTileLayer = null; - let ind: number = 0; - let children = this.children; + addFrame(texture_: Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this { + let texture: Texture; + let layer: RectTileLayer = null; + let ind: number = 0; + let children = this.children; - this._lastLayer = null; - if (typeof texture_ === "number") { - let childIndex = texture_ / this.texPerChild >> 0; - layer = children[childIndex] as RectTileLayer; + this._lastLayer = null; + if (typeof texture_ === "number") { + let childIndex = texture_ / this.texPerChild >> 0; + layer = children[childIndex] as RectTileLayer; + if (!layer) { + layer = children[0] as RectTileLayer; if (!layer) { - layer = children[0] as RectTileLayer; - if (!layer) { - return this; - } - ind = 0; - } else { - ind = texture_ % this.texPerChild; + return this; } + ind = 0; + } else { + ind = texture_ % this.texPerChild; + } - texture = layer.textures[ind]; + texture = layer.textures[ind]; + } else { + if (typeof texture_ === "string") { + texture = Texture.from(texture_); } else { - if (typeof texture_ === "string") { - texture = PIXI.Texture.from(texture_); - } else { - texture = texture_ as PIXI.Texture; + texture = texture_ as Texture; + } + + for (let i = 0; i < children.length; i++) { + let child = children[i] as RectTileLayer; + let tex = child.textures; + for (let j = 0; j < tex.length; j++) { + if (tex[j].baseTexture === texture.baseTexture) { + layer = child; + ind = j; + break; + } } + if (layer) { + break; + } + } + if (!layer) { for (let i = 0; i < children.length; i++) { let child = children[i] as RectTileLayer; - let tex = child.textures; - for (let j = 0; j < tex.length; j++) { - if (tex[j].baseTexture === texture.baseTexture) { - layer = child; - ind = j; - break; - } - } - if (layer) { + if (child.textures.length < this.texPerChild) { + layer = child; + ind = child.textures.length; + child.textures.push(texture); break; } } - if (!layer) { - for (let i = 0; i < children.length; i++) { - let child = children[i] as RectTileLayer; - if (child.textures.length < this.texPerChild) { - layer = child; - ind = child.textures.length; - child.textures.push(texture); - break; - } - } - if (!layer) { - layer = new RectTileLayer(this.zIndex, texture); - layer.compositeParent = true; - layer.offsetX = Constant.boundSize; - layer.offsetY = Constant.boundSize; - children.push(layer); - ind = 0; - } + layer = new RectTileLayer(this.zIndex, texture); + layer.compositeParent = true; + layer.offsetX = Constant.boundSize; + layer.offsetY = Constant.boundSize; + children.push(layer); + ind = 0; } } - - this._lastLayer = layer; - layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight); - return this; } - renderCanvas(renderer: any) { - if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { - return; - } - let plugin = renderer.plugins.tilemap; - if (!plugin.dontUseTransform) { - let wt = this.worldTransform; - renderer.context.setTransform( - wt.a, - wt.b, - wt.c, - wt.d, - wt.tx * renderer.resolution, - wt.ty * renderer.resolution - ); - } - let layers = this.children; - for (let i = 0; i < layers.length; i++) { - (layers[i] as RectTileLayer).renderCanvasCore(renderer); - } + this._lastLayer = layer; + layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight); + return this; + } + + renderCanvas(renderer: any) { + if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { + return; + } + let plugin = renderer.plugins.tilemap; + if (!plugin.dontUseTransform) { + let wt = this.worldTransform; + renderer.context.setTransform( + wt.a, + wt.b, + wt.c, + wt.d, + wt.tx * renderer.resolution, + wt.ty * renderer.resolution + ); } + let layers = this.children; + for (let i = 0; i < layers.length; i++) { + (layers[i] as RectTileLayer).renderCanvasCore(renderer); + } + } - render(renderer: PIXI.Renderer) { - if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { - return; - } - let plugin = (renderer.plugins as any)['tilemap']; - let shader = plugin.getShader(); - renderer.batch.setObjectRenderer(plugin); - //TODO: dont create new array, please - this._globalMat = shader.uniforms.projTransMatrix; - renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform); - shader.uniforms.shadowColor = this.shadowColor; - shader.uniforms.animationFrame = plugin.tileAnim; - renderer.shader.bind(shader, false); - let layers = this.children; - for (let i = 0; i < layers.length; i++) { - (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin); - } + render(renderer: Renderer) { + if (!this.visible || this.worldAlpha <= 0 || !this.renderable) { + return; } + let plugin = (renderer.plugins as any)['tilemap']; + let shader = plugin.getShader(); + renderer.batch.setObjectRenderer(plugin); + //TODO: dont create new array, please + this._globalMat = shader.uniforms.projTransMatrix; + renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform); + shader.uniforms.shadowColor = this.shadowColor; + shader.uniforms.animationFrame = plugin.tileAnim; + renderer.shader.bind(shader, false); + let layers = this.children; + for (let i = 0; i < layers.length; i++) { + (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin); + } + } - isModified(anim: boolean) { - let layers = this.children; - if (this.modificationMarker !== layers.length) { + isModified(anim: boolean) { + let layers = this.children; + if (this.modificationMarker !== layers.length) { + return true; + } + for (let i = 0; i < layers.length; i++) { + if ((layers[i] as RectTileLayer).isModified(anim)) { return true; } - for (let i = 0; i < layers.length; i++) { - if ((layers[i] as RectTileLayer).isModified(anim)) { - return true; - } - } - return false; } + return false; + } - clearModify() { - let layers = this.children; - this.modificationMarker = layers.length; - for (let i = 0; i < layers.length; i++) { - (layers[i] as RectTileLayer).clearModify(); - } + clearModify() { + let layers = this.children; + this.modificationMarker = layers.length; + for (let i = 0; i < layers.length; i++) { + (layers[i] as RectTileLayer).clearModify(); } } - -} +} \ No newline at end of file diff --git a/src/Constant.ts b/src/Constant.ts index afc88350..daa58fd0 100644 --- a/src/Constant.ts +++ b/src/Constant.ts @@ -1,13 +1,9 @@ -namespace pixi_tilemap { - - export const Constant = { - maxTextures: 16, - bufferSize: 2048, - boundSize: 1024, - boundCountPerBuffer: 1, - use32bitIndex: false, - SCALE_MODE: PIXI.SCALE_MODES.LINEAR, - DO_CLEAR: true - } - -} +export const Constant = { + maxTextures: 16, + bufferSize: 2048, + boundSize: 1024, + boundCountPerBuffer: 1, + use32bitIndex: false, + SCALE_MODE: PIXI.SCALE_MODES.LINEAR, + DO_CLEAR: true +}; \ No newline at end of file diff --git a/src/GraphicsLayer.ts b/src/GraphicsLayer.ts index 1e6ae3e9..7604e3f4 100644 --- a/src/GraphicsLayer.ts +++ b/src/GraphicsLayer.ts @@ -1,35 +1,37 @@ -namespace pixi_tilemap { - class GraphicsLayer extends PIXI.Graphics { - constructor(zIndex: number) { - super(); - this.zIndex = zIndex; - } +/// - renderCanvas(renderer: any) { - let wt: PIXI.Matrix = null; - if (renderer.plugins.tilemap.dontUseTransform) { - wt = this.transform.worldTransform; - this.transform.worldTransform = PIXI.Matrix.IDENTITY; - } - renderer.plugins.graphics.render(this); - if (renderer.plugins.tilemap.dontUseTransform) { - this.transform.worldTransform = wt; - } - renderer.context.globalAlpha = 1.0; - } +import { Matrix } from '@pixi/math'; +import { Graphics } from '@pixi/graphics'; - // renderWebGL(renderer: PIXI.Renderer) { - // if (!this._webGL[renderer.CONTEXT_UID]) - // this.dirty++; - // super.renderWebGL(renderer) - // } +export class GraphicsLayer extends Graphics { + constructor(zIndex: number) { + super(); + this.zIndex = zIndex; + } - isModified(anim: boolean): boolean { - return false; + renderCanvas(renderer: any) { + let wt: Matrix = null; + if (renderer.plugins.tilemap.dontUseTransform) { + wt = this.transform.worldTransform; + this.transform.worldTransform = Matrix.IDENTITY; } - - clearModify() { + renderer.plugins.graphics.render(this); + if (renderer.plugins.tilemap.dontUseTransform) { + this.transform.worldTransform = wt; } + renderer.context.globalAlpha = 1.0; } + // renderWebGL(renderer: PIXI.Renderer) { + // if (!this._webGL[renderer.CONTEXT_UID]) + // this.dirty++; + // super.renderWebGL(renderer) + // } + + isModified(anim: boolean): boolean { + return false; + } + + clearModify() { + } } diff --git a/src/MultiTextureResource.ts b/src/MultiTextureResource.ts index d853603d..39f5ed75 100644 --- a/src/MultiTextureResource.ts +++ b/src/MultiTextureResource.ts @@ -1,111 +1,116 @@ -namespace pixi_tilemap { - export interface IMultiTextureOptions { - boundCountPerBuffer: number; - boundSize: number; - bufferSize: number; - DO_CLEAR?: boolean; - } +/// - export class MultiTextureResource extends PIXI.resources.Resource { - constructor(options: IMultiTextureOptions) { - super(options.bufferSize, options.bufferSize); +import { ALPHA_MODES } from '@pixi/constants'; +import { BaseTexture, Renderer, Texture, GLTexture, resources } from '@pixi/core'; +import { Sprite } from '@pixi/sprite'; +import { Constant } from './Constant'; - const bounds = this.boundSprites; - const dirties = this.dirties; - this.boundSize = options.boundSize; - for (let j = 0; j < options.boundCountPerBuffer; j++) { - const spr = new PIXI.Sprite(); - spr.position.x = options.boundSize * (j & 1); - spr.position.y = options.boundSize * (j >> 1); - bounds.push(spr); - dirties.push(0); - } - this.DO_CLEAR = !!options.DO_CLEAR; +export interface IMultiTextureOptions { + boundCountPerBuffer: number; + boundSize: number; + bufferSize: number; + DO_CLEAR?: boolean; +} + +export class MultiTextureResource extends resources.Resource { + constructor(options: IMultiTextureOptions) { + super(options.bufferSize, options.bufferSize); + + const bounds = this.boundSprites; + const dirties = this.dirties; + this.boundSize = options.boundSize; + for (let j = 0; j < options.boundCountPerBuffer; j++) { + const spr = new Sprite(); + spr.position.x = options.boundSize * (j & 1); + spr.position.y = options.boundSize * (j >> 1); + bounds.push(spr); + dirties.push(0); } + this.DO_CLEAR = !!options.DO_CLEAR; + } - DO_CLEAR = false; - boundSize: number = 0; - _clearBuffer: Uint8Array = null; + DO_CLEAR = false; + boundSize: number = 0; + _clearBuffer: Uint8Array = null; - bind(baseTexture: PIXI.BaseTexture) { - if (this.baseTex) { - throw new Error('Only one baseTexture is allowed for this resource!') - } - this.baseTex = baseTexture; - super.bind(baseTexture); + bind(baseTexture: BaseTexture) { + if (this.baseTex) { + throw new Error('Only one baseTexture is allowed for this resource!') } + this.baseTex = baseTexture; + super.bind(baseTexture); + } - baseTex: PIXI.BaseTexture = null; - boundSprites: Array = []; - dirties: Array = []; + baseTex: BaseTexture = null; + boundSprites: Array = []; + dirties: Array = []; - setTexture(ind: number, texture: PIXI.Texture) { - const spr = this.boundSprites[ind]; - if (spr.texture.baseTexture === texture.baseTexture) { - return; - } - spr.texture = texture; - this.baseTex.update(); - this.dirties[ind] = (this.baseTex as any).dirtyId; + setTexture(ind: number, texture: Texture) { + const spr = this.boundSprites[ind]; + if (spr.texture.baseTexture === texture.baseTexture) { + return; } + spr.texture = texture; + this.baseTex.update(); + this.dirties[ind] = (this.baseTex as any).dirtyId; + } - upload(renderer: PIXI.Renderer, texture: PIXI.BaseTexture, glTexture: PIXI.GLTexture) { - const { gl } = renderer as any; + upload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture) { + const { gl } = renderer as any; - const {width, height} = this; - gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined || - texture.alphaMode === PIXI.ALPHA_MODES.UNPACK); + const {width, height} = this; + gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined || + texture.alphaMode === ALPHA_MODES.UNPACK); - if (glTexture.dirtyId < 0) { - (glTexture as any).width = width; - (glTexture as any).height = height; + if (glTexture.dirtyId < 0) { + (glTexture as any).width = width; + (glTexture as any).height = height; - gl.texImage2D(texture.target, 0, - texture.format, - width, - height, - 0, - texture.format, - texture.type, - null); - } + gl.texImage2D(texture.target, 0, + texture.format, + width, + height, + 0, + texture.format, + texture.type, + null); + } - const doClear = this.DO_CLEAR; - if (doClear && !this._clearBuffer) { - this._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4); - } + const doClear = this.DO_CLEAR; + if (doClear && !this._clearBuffer) { + this._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4); + } - const bounds = this.boundSprites; - for (let i = 0; i < bounds.length; i++) { - const spr = bounds[i]; - const tex = spr.texture.baseTexture; - if (glTexture.dirtyId >= this.dirties[i]) { - continue; - } - const res = tex.resource as any; - if (!tex.valid || !res || !res.source) { - continue; - } - if (doClear && (tex.width < this.boundSize || tex.height < this.boundSize)) - { - gl.texSubImage2D(texture.target, 0, - spr.position.x, - spr.position.y, - this.boundSize, - this.boundSize, - texture.format, - texture.type, - this._clearBuffer); - } + const bounds = this.boundSprites; + for (let i = 0; i < bounds.length; i++) { + const spr = bounds[i]; + const tex = spr.texture.baseTexture; + if (glTexture.dirtyId >= this.dirties[i]) { + continue; + } + const res = tex.resource as any; + if (!tex.valid || !res || !res.source) { + continue; + } + if (doClear && (tex.width < this.boundSize || tex.height < this.boundSize)) + { gl.texSubImage2D(texture.target, 0, spr.position.x, spr.position.y, + this.boundSize, + this.boundSize, texture.format, texture.type, - res.source); + this._clearBuffer); } - - return true; + gl.texSubImage2D(texture.target, 0, + spr.position.x, + spr.position.y, + texture.format, + texture.type, + res.source); } + + return true; } } diff --git a/src/RectTileLayer.ts b/src/RectTileLayer.ts index bf88417b..76368af8 100644 --- a/src/RectTileLayer.ts +++ b/src/RectTileLayer.ts @@ -1,365 +1,372 @@ -namespace pixi_tilemap { - import groupD8 = PIXI.groupD8; - export const POINT_STRUCT_SIZE = 12; - - export class RectTileLayer extends PIXI.Container { - constructor(zIndex: number, texture: PIXI.Texture | Array) { - super(); - this.initialize(zIndex, texture); - } +/// - zIndex = 0; - modificationMarker = 0; - shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]); - _globalMat: PIXI.Matrix = null; +import { Container } from '@pixi/display'; +import { Constant } from './Constant'; +import { DRAW_MODES } from '@pixi/constants'; +import { Texture, Renderer } from '@pixi/core'; +import { TileRenderer } from './TileRenderer'; +import { Matrix, groupD8 } from '@pixi/math'; - pointsBuf: Array = []; - hasAnim = false; - textures: Array; +import type { RectTileGeom } from './RectTileShader'; - offsetX = 0; - offsetY = 0; - compositeParent = false; +export const POINT_STRUCT_SIZE = 12; - initialize(zIndex: number, textures: PIXI.Texture | Array) { - if (!textures) { - textures = []; - } else if (!(textures instanceof Array) && (textures as PIXI.Texture).baseTexture) { - textures = [textures as PIXI.Texture]; - } - this.textures = textures as Array; - this.zIndex = zIndex; - // this.visible = false; - } +export class RectTileLayer extends Container { + constructor(zIndex: number, texture: Texture | Array) { + super(); + this.initialize(zIndex, texture); + } - clear() { - this.pointsBuf.length = 0; - this.modificationMarker = 0; - this.hasAnim = false; + zIndex = 0; + modificationMarker = 0; + shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]); + _globalMat: Matrix = null; + + pointsBuf: Array = []; + hasAnim = false; + textures: Array; + + offsetX = 0; + offsetY = 0; + compositeParent = false; + + initialize(zIndex: number, textures: Texture | Array) { + if (!textures) { + textures = []; + } else if (!(textures instanceof Array) && (textures as Texture).baseTexture) { + textures = [textures as Texture]; } + this.textures = textures as Array; + this.zIndex = zIndex; + // this.visible = false; + } - addFrame(texture_: PIXI.Texture | String | number, x: number, y: number, animX: number, animY: number) { - let texture: PIXI.Texture; - let textureIndex = 0; + clear() { + this.pointsBuf.length = 0; + this.modificationMarker = 0; + this.hasAnim = false; + } - if (typeof texture_ === "number") { - textureIndex = texture_; - texture = this.textures[textureIndex]; - } else { - if (typeof texture_ === "string") { - texture = PIXI.Texture.from(texture_); - } else { - texture = texture_ as PIXI.Texture; - } + addFrame(texture_: Texture | String | number, x: number, y: number, animX: number, animY: number) { + let texture: Texture; + let textureIndex = 0; - let found = false; - let textureList = this.textures; - for (let i = 0; i < textureList.length; i++) { - if (textureList[i].baseTexture === texture.baseTexture) { - textureIndex = i; - found = true; - break; - } - } + if (typeof texture_ === "number") { + textureIndex = texture_; + texture = this.textures[textureIndex]; + } else { + if (typeof texture_ === "string") { + texture = Texture.from(texture_); + } else { + texture = texture_ as Texture; + } - if (!found) { - // textureIndex = this.textures.length; - // this.textures.push(texture); - return false; + let found = false; + let textureList = this.textures; + for (let i = 0; i < textureList.length; i++) { + if (textureList[i].baseTexture === texture.baseTexture) { + textureIndex = i; + found = true; + break; } } - this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate); - return true; + if (!found) { + // textureIndex = this.textures.length; + // this.textures.push(texture); + return false; + } } - addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, - animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this { - let pb = this.pointsBuf; - this.hasAnim = this.hasAnim || animX > 0 || animY > 0; - pb.push(u); - pb.push(v); - pb.push(x); - pb.push(y); - pb.push(tileWidth); - pb.push(tileHeight); - pb.push(rotate); - pb.push(animX | 0); - pb.push(animY | 0); - pb.push(textureIndex); - pb.push(animCountX); - pb.push(animCountY); - - return this; - } + this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate); + return true; + } - tileRotate(rotate: number) { - const pb = this.pointsBuf; - pb[pb.length - 3] = rotate; - } + addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, + animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this { + let pb = this.pointsBuf; + this.hasAnim = this.hasAnim || animX > 0 || animY > 0; + pb.push(u); + pb.push(v); + pb.push(x); + pb.push(y); + pb.push(tileWidth); + pb.push(tileHeight); + pb.push(rotate); + pb.push(animX | 0); + pb.push(animY | 0); + pb.push(textureIndex); + pb.push(animCountX); + pb.push(animCountY); + + return this; + } - tileAnimX(offset: number, count: number) { - const pb = this.pointsBuf; + tileRotate(rotate: number) { + const pb = this.pointsBuf; + pb[pb.length - 3] = rotate; + } - pb[pb.length - 5] = offset; - pb[pb.length - 2] = count; - } + tileAnimX(offset: number, count: number) { + const pb = this.pointsBuf; - tileAnimY(offset: number, count: number) { - const pb = this.pointsBuf; + pb[pb.length - 5] = offset; + pb[pb.length - 2] = count; + } - pb[pb.length - 4] = offset; - pb[pb.length - 1] = count; - } + tileAnimY(offset: number, count: number) { + const pb = this.pointsBuf; - renderCanvas(renderer: any) { - let plugin = renderer.plugins.tilemap; - if (!plugin.dontUseTransform) { - let wt = this.worldTransform; - renderer.context.setTransform( - wt.a, - wt.b, - wt.c, - wt.d, - wt.tx * renderer.resolution, - wt.ty * renderer.resolution - ); - } - this.renderCanvasCore(renderer); + pb[pb.length - 4] = offset; + pb[pb.length - 1] = count; + } + + renderCanvas(renderer: any) { + let plugin = renderer.plugins.tilemap; + if (!plugin.dontUseTransform) { + let wt = this.worldTransform; + renderer.context.setTransform( + wt.a, + wt.b, + wt.c, + wt.d, + wt.tx * renderer.resolution, + wt.ty * renderer.resolution + ); } + this.renderCanvasCore(renderer); + } - renderCanvasCore(renderer: any) { - if (this.textures.length === 0) return; - let points = this.pointsBuf; - renderer.context.fillStyle = '#000000'; - for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) { - let x1 = points[i], y1 = points[i + 1]; - let x2 = points[i + 2], y2 = points[i + 3]; - let w = points[i + 4]; - let h = points[i + 5]; - var rotate = points[i + 6]; - x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0]; - y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1]; - let textureIndex = points[i + 9]; - // canvas does not work with rotate yet - if (textureIndex >= 0) { - renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h); - } else { - renderer.context.globalAlpha = 0.5; - renderer.context.fillRect(x2, y2, w, h); - renderer.context.globalAlpha = 1; - } + renderCanvasCore(renderer: any) { + if (this.textures.length === 0) return; + let points = this.pointsBuf; + renderer.context.fillStyle = '#000000'; + for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) { + let x1 = points[i], y1 = points[i + 1]; + let x2 = points[i + 2], y2 = points[i + 3]; + let w = points[i + 4]; + let h = points[i + 5]; + var rotate = points[i + 6]; + x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0]; + y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1]; + let textureIndex = points[i + 9]; + // canvas does not work with rotate yet + if (textureIndex >= 0) { + renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h); + } else { + renderer.context.globalAlpha = 0.5; + renderer.context.fillRect(x2, y2, w, h); + renderer.context.globalAlpha = 1; } } + } - vbId = 0; - vb: RectTileGeom = null; - vbBuffer: ArrayBuffer = null; - vbArray: Float32Array = null; - vbInts: Uint32Array = null; + vbId = 0; + vb: RectTileGeom = null; + vbBuffer: ArrayBuffer = null; + vbArray: Float32Array = null; + vbInts: Uint32Array = null; - destroyVb() { - if (this.vb) { - this.vb.destroy(); - this.vb = null; - } + destroyVb() { + if (this.vb) { + this.vb.destroy(); + this.vb = null; } + } + + render(renderer: Renderer) { + let plugin = (renderer.plugins as any)['tilemap']; + let shader = plugin.getShader(); + renderer.batch.setObjectRenderer(plugin); + this._globalMat = shader.uniforms.projTransMatrix; + renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform); + shader.uniforms.shadowColor = this.shadowColor; + shader.uniforms.animationFrame = plugin.tileAnim; + this.renderWebGLCore(renderer, plugin); + } - render(renderer: PIXI.Renderer) { - let plugin = (renderer.plugins as any)['tilemap']; - let shader = plugin.getShader(); - renderer.batch.setObjectRenderer(plugin); - this._globalMat = shader.uniforms.projTransMatrix; - renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform); - shader.uniforms.shadowColor = this.shadowColor; - shader.uniforms.animationFrame = plugin.tileAnim; - this.renderWebGLCore(renderer, plugin); + renderWebGLCore(renderer: Renderer, plugin: TileRenderer) { + let points = this.pointsBuf; + if (points.length === 0) return; + let rectsCount = points.length / POINT_STRUCT_SIZE; + + let shader = plugin.getShader(); + let textures = this.textures; + if (textures.length === 0) return; + + plugin.bindTextures(renderer, shader, textures); + renderer.shader.bind(shader, false); + + //lost context! recover! + let vb = this.vb; + if (!vb) { + vb = plugin.createVb(); + this.vb = vb; + this.vbId = (vb as any).id; + this.vbBuffer = null; + this.modificationMarker = 0; } - renderWebGLCore(renderer: PIXI.Renderer, plugin: TileRenderer) { - let points = this.pointsBuf; - if (points.length === 0) return; - let rectsCount = points.length / POINT_STRUCT_SIZE; - - let shader = plugin.getShader(); - let textures = this.textures; - if (textures.length === 0) return; - - plugin.bindTextures(renderer, shader, textures); - renderer.shader.bind(shader, false); - - //lost context! recover! - let vb = this.vb; - if (!vb) { - vb = plugin.createVb(); - this.vb = vb; - this.vbId = (vb as any).id; - this.vbBuffer = null; - this.modificationMarker = 0; + plugin.checkIndexBuffer(rectsCount, vb); + const boundCountPerBuffer = Constant.boundCountPerBuffer; + + let vertexBuf = vb.getBuffer('aVertexPosition'); + //if layer was changed, re-upload vertices + let vertices = rectsCount * vb.vertPerQuad; + if (vertices === 0) return; + if (this.modificationMarker !== vertices) { + this.modificationMarker = vertices; + let vs = vb.stride * vertices; + if (!this.vbBuffer || this.vbBuffer.byteLength < vs) { + //!@#$ happens, need resize + let bk = vb.stride; + while (bk < vs) { + bk *= 2; + } + this.vbBuffer = new ArrayBuffer(bk); + this.vbArray = new Float32Array(this.vbBuffer); + this.vbInts = new Uint32Array(this.vbBuffer); + vertexBuf.update(this.vbBuffer); } - plugin.checkIndexBuffer(rectsCount, vb); - const boundCountPerBuffer = Constant.boundCountPerBuffer; - - let vertexBuf = vb.getBuffer('aVertexPosition'); - //if layer was changed, re-upload vertices - let vertices = rectsCount * vb.vertPerQuad; - if (vertices === 0) return; - if (this.modificationMarker !== vertices) { - this.modificationMarker = vertices; - let vs = vb.stride * vertices; - if (!this.vbBuffer || this.vbBuffer.byteLength < vs) { - //!@#$ happens, need resize - let bk = vb.stride; - while (bk < vs) { - bk *= 2; + let arr = this.vbArray, ints = this.vbInts; + //upload vertices! + let sz = 0; + //let tint = 0xffffffff; + let textureId: number = 0; + let shiftU: number = this.offsetX; + let shiftV: number = this.offsetY; + + //let tint = 0xffffffff; + let tint = -1; + for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) { + let eps = 0.5; + if (this.compositeParent) { + if (boundCountPerBuffer > 1) { + //TODO: what if its more than 4? + textureId = (points[i + 9] >> 2); + shiftU = this.offsetX * (points[i + 9] & 1); + shiftV = this.offsetY * ((points[i + 9] >> 1) & 1); + } else { + textureId = points[i + 9]; + shiftU = 0; + shiftV = 0; } - this.vbBuffer = new ArrayBuffer(bk); - this.vbArray = new Float32Array(this.vbBuffer); - this.vbInts = new Uint32Array(this.vbBuffer); - vertexBuf.update(this.vbBuffer); } - - let arr = this.vbArray, ints = this.vbInts; - //upload vertices! - let sz = 0; - //let tint = 0xffffffff; - let textureId: number = 0; - let shiftU: number = this.offsetX; - let shiftV: number = this.offsetY; - - //let tint = 0xffffffff; - let tint = -1; - for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) { - let eps = 0.5; - if (this.compositeParent) { - if (boundCountPerBuffer > 1) { - //TODO: what if its more than 4? - textureId = (points[i + 9] >> 2); - shiftU = this.offsetX * (points[i + 9] & 1); - shiftV = this.offsetY * ((points[i + 9] >> 1) & 1); - } else { - textureId = points[i + 9]; - shiftU = 0; - shiftV = 0; - } - } - let x = points[i + 2], y = points[i + 3]; - let w = points[i + 4], h = points[i + 5]; - let u = points[i] + shiftU, v = points[i + 1] + shiftV; - let rotate = points[i + 6]; - - const animX = points[i + 7], animY = points[i + 8]; - const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024; - const animXEncoded = animX + (animWidth * 2048); - const animYEncoded = animY + (animHeight * 2048); - - let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number; - if (rotate === 0) { - u0 = u; - v0 = v; - u1 = u + w; - v1 = v; - u2 = u + w; - v2 = v + h; - u3 = u; - v3 = v + h; - } else { - let w2 = w / 2; - let h2 = h / 2; - if (rotate % 4 !== 0) { - w2 = h / 2; - h2 = w / 2; - } - const cX = u + w2; - const cY = v + h2; - - rotate = groupD8.add(rotate, groupD8.NW); - u0 = cX + (w2 * groupD8.uX(rotate)); - v0 = cY + (h2 * groupD8.uY(rotate)); - - rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise - u1 = cX + (w2 * groupD8.uX(rotate)); - v1 = cY + (h2 * groupD8.uY(rotate)); - - rotate = groupD8.add(rotate, 2); - u2 = cX + (w2 * groupD8.uX(rotate)); - v2 = cY + (h2 * groupD8.uY(rotate)); - - rotate = groupD8.add(rotate, 2); - u3 = cX + (w2 * groupD8.uX(rotate)); - v3 = cY + (h2 * groupD8.uY(rotate)); + let x = points[i + 2], y = points[i + 3]; + let w = points[i + 4], h = points[i + 5]; + let u = points[i] + shiftU, v = points[i + 1] + shiftV; + let rotate = points[i + 6]; + + const animX = points[i + 7], animY = points[i + 8]; + const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024; + const animXEncoded = animX + (animWidth * 2048); + const animYEncoded = animY + (animHeight * 2048); + + let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number; + if (rotate === 0) { + u0 = u; + v0 = v; + u1 = u + w; + v1 = v; + u2 = u + w; + v2 = v + h; + u3 = u; + v3 = v + h; + } else { + let w2 = w / 2; + let h2 = h / 2; + if (rotate % 4 !== 0) { + w2 = h / 2; + h2 = w / 2; } + const cX = u + w2; + const cY = v + h2; + + rotate = groupD8.add(rotate, groupD8.NW); + u0 = cX + (w2 * groupD8.uX(rotate)); + v0 = cY + (h2 * groupD8.uY(rotate)); + + rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise + u1 = cX + (w2 * groupD8.uX(rotate)); + v1 = cY + (h2 * groupD8.uY(rotate)); + + rotate = groupD8.add(rotate, 2); + u2 = cX + (w2 * groupD8.uX(rotate)); + v2 = cY + (h2 * groupD8.uY(rotate)); - arr[sz++] = x; - arr[sz++] = y; - arr[sz++] = u0; - arr[sz++] = v0; - arr[sz++] = u + eps; - arr[sz++] = v + eps; - arr[sz++] = u + w - eps; - arr[sz++] = v + h - eps; - arr[sz++] = animXEncoded; - arr[sz++] = animYEncoded; - arr[sz++] = textureId; - arr[sz++] = x + w; - arr[sz++] = y; - arr[sz++] = u1; - arr[sz++] = v1; - arr[sz++] = u + eps; - arr[sz++] = v + eps; - arr[sz++] = u + w - eps; - arr[sz++] = v + h - eps; - arr[sz++] = animXEncoded; - arr[sz++] = animYEncoded; - arr[sz++] = textureId; - arr[sz++] = x + w; - arr[sz++] = y + h; - arr[sz++] = u2; - arr[sz++] = v2; - arr[sz++] = u + eps; - arr[sz++] = v + eps; - arr[sz++] = u + w - eps; - arr[sz++] = v + h - eps; - arr[sz++] = animXEncoded; - arr[sz++] = animYEncoded; - arr[sz++] = textureId; - arr[sz++] = x; - arr[sz++] = y + h; - arr[sz++] = u3; - arr[sz++] = v3; - arr[sz++] = u + eps; - arr[sz++] = v + eps; - arr[sz++] = u + w - eps; - arr[sz++] = v + h - eps; - arr[sz++] = animXEncoded; - arr[sz++] = animYEncoded; - arr[sz++] = textureId; + rotate = groupD8.add(rotate, 2); + u3 = cX + (w2 * groupD8.uX(rotate)); + v3 = cY + (h2 * groupD8.uY(rotate)); } - vertexBuf.update(arr); + arr[sz++] = x; + arr[sz++] = y; + arr[sz++] = u0; + arr[sz++] = v0; + arr[sz++] = u + eps; + arr[sz++] = v + eps; + arr[sz++] = u + w - eps; + arr[sz++] = v + h - eps; + arr[sz++] = animXEncoded; + arr[sz++] = animYEncoded; + arr[sz++] = textureId; + arr[sz++] = x + w; + arr[sz++] = y; + arr[sz++] = u1; + arr[sz++] = v1; + arr[sz++] = u + eps; + arr[sz++] = v + eps; + arr[sz++] = u + w - eps; + arr[sz++] = v + h - eps; + arr[sz++] = animXEncoded; + arr[sz++] = animYEncoded; + arr[sz++] = textureId; + arr[sz++] = x + w; + arr[sz++] = y + h; + arr[sz++] = u2; + arr[sz++] = v2; + arr[sz++] = u + eps; + arr[sz++] = v + eps; + arr[sz++] = u + w - eps; + arr[sz++] = v + h - eps; + arr[sz++] = animXEncoded; + arr[sz++] = animYEncoded; + arr[sz++] = textureId; + arr[sz++] = x; + arr[sz++] = y + h; + arr[sz++] = u3; + arr[sz++] = v3; + arr[sz++] = u + eps; + arr[sz++] = v + eps; + arr[sz++] = u + w - eps; + arr[sz++] = v + h - eps; + arr[sz++] = animXEncoded; + arr[sz++] = animYEncoded; + arr[sz++] = textureId; } - (renderer.geometry as any).bind(vb, shader); - renderer.geometry.draw(PIXI.DRAW_MODES.TRIANGLES, rectsCount * 6, 0); + vertexBuf.update(arr); } - isModified(anim: boolean) { - if (this.modificationMarker !== this.pointsBuf.length || - anim && this.hasAnim) { - return true; - } - return false; - } + (renderer.geometry as any).bind(vb, shader); + renderer.geometry.draw(DRAW_MODES.TRIANGLES, rectsCount * 6, 0); + } - clearModify() { - this.modificationMarker = this.pointsBuf.length; + isModified(anim: boolean) { + if (this.modificationMarker !== this.pointsBuf.length || + anim && this.hasAnim) { + return true; } + return false; + } - destroy(options?: any) { - super.destroy(options); - this.destroyVb(); - } + clearModify() { + this.modificationMarker = this.pointsBuf.length; } + destroy(options?: any) { + super.destroy(options); + this.destroyVb(); + } } diff --git a/src/RectTileShader.ts b/src/RectTileShader.ts index 77ce8fff..2e3cfca7 100644 --- a/src/RectTileShader.ts +++ b/src/RectTileShader.ts @@ -1,5 +1,11 @@ -namespace pixi_tilemap { - let rectShaderFrag = ` +/// + +import * as shaderGenerator from './shaderGenerator'; + +import { Buffer, Geometry, Shader } from '@pixi/core'; +import { Matrix } from '@pixi/math'; + +let rectShaderFrag = ` varying vec2 vTextureCoord; varying vec4 vFrame; varying float vTextureId; @@ -16,8 +22,7 @@ void main(void){ gl_FragColor = color; } `; - - let rectShaderVert = ` +let rectShaderVert = ` attribute vec2 aVertexPosition; attribute vec2 aTextureCoord; attribute vec4 aFrame; @@ -43,52 +48,52 @@ void main(void){ } `; - export abstract class TilemapShader extends PIXI.Shader { - maxTextures = 0; +export abstract class TilemapShader extends Shader { + maxTextures = 0; - constructor(maxTextures: number, shaderVert: string, shaderFrag: string) { - super( - new PIXI.Program( - shaderVert, - shaderFrag), - { - animationFrame: new Float32Array(2), - uSamplers: [], - uSamplerSize: [], - projTransMatrix: new PIXI.Matrix() - } - ); - this.maxTextures = maxTextures; - shaderGenerator.fillSamplers(this, this.maxTextures); - } + constructor(maxTextures: number, shaderVert: string, shaderFrag: string) { + super( + new PIXI.Program( + shaderVert, + shaderFrag), + { + animationFrame: new Float32Array(2), + uSamplers: [], + uSamplerSize: [], + projTransMatrix: new Matrix() + } + ); + this.maxTextures = maxTextures; + shaderGenerator.fillSamplers(this, this.maxTextures); } +} - export class RectTileShader extends TilemapShader { - constructor(maxTextures: number) { - super( - maxTextures, - rectShaderVert, - shaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag) - ); - shaderGenerator.fillSamplers(this, this.maxTextures); - } +export class RectTileShader extends TilemapShader { + constructor(maxTextures: number) { + super( + maxTextures, + rectShaderVert, + shaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag) + ); + shaderGenerator.fillSamplers(this, this.maxTextures); } +} - export class RectTileGeom extends PIXI.Geometry { - vertSize = 11; - vertPerQuad = 4; - stride = this.vertSize * 4; - lastTimeAccess = 0; - constructor() { - super(); - const buf = this.buf = new PIXI.Buffer(new Float32Array(2), true, false); - this.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0) - .addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4) - .addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4) - .addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4) - .addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4); - } +export class RectTileGeom extends Geometry { + vertSize = 11; + vertPerQuad = 4; + stride = this.vertSize * 4; + lastTimeAccess = 0; - buf: PIXI.Buffer; + constructor() { + super(); + const buf = this.buf = new Buffer(new Float32Array(2), true, false); + this.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0) + .addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4) + .addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4) + .addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4) + .addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4); } -} + + buf: PIXI.Buffer; +} \ No newline at end of file diff --git a/src/TileRenderer.ts b/src/TileRenderer.ts index b04b6ea6..aa419bef 100644 --- a/src/TileRenderer.ts +++ b/src/TileRenderer.ts @@ -1,146 +1,146 @@ -namespace pixi_tilemap { - /* - * Renderer for rectangle tiles. - * - * @class - * @memberof PIXI.tilemap - * @extends PIXI.ObjectRenderer - * @param renderer {PIXI.WebGLRenderer} The renderer this sprite batch works for. - */ - - export class TileRenderer extends PIXI.ObjectRenderer { - renderer: PIXI.Renderer; - gl: WebGLRenderingContext; - sn: number = -1; - indexBuffer: PIXI.Buffer = null; - ibLen: number = 0; - tileAnim = [0, 0]; - texLoc: Array = []; - - rectShader: RectTileShader; - texResources: Array = []; - - constructor(renderer: PIXI.Renderer) { - super(renderer); - this.rectShader = new RectTileShader(Constant.maxTextures); - this.indexBuffer = new PIXI.Buffer(undefined, true, true); - this.checkIndexBuffer(2000); - this.initBounds(); - } - - initBounds() { - if (Constant.boundCountPerBuffer <= 1) { - return; - } +import { WRAP_MODES } from '@pixi/constants'; +import { BaseTexture, Buffer, resources, ObjectRenderer, Texture, Renderer } from '@pixi/core'; +import { Constant } from './Constant'; +import { RectTileGeom, RectTileShader } from './RectTileShader'; +import { MultiTextureResource } from './MultiTextureResource'; + +import type { TilemapShader } from './RectTileShader'; + +/** + * Renderer for rectangle tiles. + */ +export class TileRenderer extends ObjectRenderer { + renderer: Renderer; + gl: WebGLRenderingContext; + sn: number = -1; + indexBuffer: PIXI.Buffer = null; + ibLen: number = 0; + tileAnim = [0, 0]; + texLoc: Array = []; + + rectShader: RectTileShader; + texResources: Array = []; + + constructor(renderer: Renderer) { + super(renderer); + this.rectShader = new RectTileShader(Constant.maxTextures); + this.indexBuffer = new Buffer(undefined, true, true); + this.checkIndexBuffer(2000); + this.initBounds(); + } - const maxTextures = Constant.maxTextures; - for (let i = 0; i < maxTextures; i++) { - const resource = new MultiTextureResource(Constant); - const baseTex = new PIXI.BaseTexture(resource); - baseTex.scaleMode = Constant.SCALE_MODE; - baseTex.wrapMode = PIXI.WRAP_MODES.CLAMP; - this.texResources.push(resource); - } + initBounds() { + if (Constant.boundCountPerBuffer <= 1) { + return; } - bindTexturesWithoutRT(renderer: PIXI.Renderer, shader: TilemapShader, textures: Array) { - let samplerSize: Array = shader.uniforms.uSamplerSize; - this.texLoc.length = 0; - for (let i = 0; i < textures.length; i++) { - const texture = textures[i]; - if (!texture || !texture.valid) { - return; - } - renderer.texture.bind(textures[i], i); - //TODO: add resolution here - samplerSize[i * 2] = 1.0 / textures[i].baseTexture.width; - samplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height; - } - shader.uniforms.uSamplerSize = samplerSize; + const maxTextures = Constant.maxTextures; + for (let i = 0; i < maxTextures; i++) { + const resource = new MultiTextureResource(Constant); + const baseTex = new BaseTexture(resource); + baseTex.scaleMode = Constant.SCALE_MODE; + baseTex.wrapMode = WRAP_MODES.CLAMP; + this.texResources.push(resource); } + } - bindTextures(renderer: PIXI.Renderer, shader: TilemapShader, textures: Array) { - const len = textures.length; - const maxTextures = Constant.maxTextures; - if (len > Constant.boundCountPerBuffer * maxTextures) { + bindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array) { + let samplerSize: Array = (shader as any).uniforms.uSamplerSize; + this.texLoc.length = 0; + for (let i = 0; i < textures.length; i++) { + const texture = textures[i]; + if (!texture || !texture.valid) { return; } - if (Constant.boundCountPerBuffer <= 1) { - this.bindTexturesWithoutRT(renderer, shader, textures); - return; - } - - let i = 0; - for (; i < len; i++) { - const texture = textures[i]; - if (!texture || !texture.valid) continue; - const multi = this.texResources[i >> 2]; - multi.setTexture(i & 3, texture); - } + renderer.texture.bind(textures[i], i); + //TODO: add resolution here + samplerSize[i * 2] = 1.0 / textures[i].baseTexture.width; + samplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height; + } + (shader as any).uniforms.uSamplerSize = samplerSize; + } - let gltsUsed = (i + 3) >> 2; - for (i = 0; i < gltsUsed; i++) { - //remove "i, true" after resolving a bug - renderer.texture.bind(this.texResources[i].baseTex, i); - } + bindTextures(renderer: Renderer, shader: TilemapShader, textures: Array) { + const len = textures.length; + const maxTextures = Constant.maxTextures; + if (len > Constant.boundCountPerBuffer * maxTextures) { + return; + } + if (Constant.boundCountPerBuffer <= 1) { + this.bindTexturesWithoutRT(renderer, shader, textures); + return; } - start() { - //sorry, nothing + let i = 0; + for (; i < len; i++) { + const texture = textures[i]; + if (!texture || !texture.valid) continue; + const multi = this.texResources[i >> 2]; + multi.setTexture(i & 3, texture); } - createVb() { - const geom = new RectTileGeom(); - geom.addIndex(this.indexBuffer); - geom.lastTimeAccess = Date.now(); - return geom; + let gltsUsed = (i + 3) >> 2; + for (i = 0; i < gltsUsed; i++) { + //remove "i, true" after resolving a bug + renderer.texture.bind(this.texResources[i].baseTex, i); } + } - checkIndexBuffer(size: number, vb: RectTileGeom = null) { - const totalIndices = size * 6; + start() { + //sorry, nothing + } - if (totalIndices <= this.ibLen) { - return; - } + createVb() { + const geom = new RectTileGeom(); + geom.addIndex(this.indexBuffer); + geom.lastTimeAccess = Date.now(); + return geom; + } - let len = totalIndices; - while (len < totalIndices) { - len <<= 1; - } + checkIndexBuffer(size: number, vb: RectTileGeom = null) { + const totalIndices = size * 6; + + if (totalIndices <= this.ibLen) { + return; + } - this.ibLen = totalIndices; - this.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size, - Constant.use32bitIndex ? new Uint32Array(size * 6) : undefined)); - - // TODO: create new index buffer instead? - // if (vb) { - // const curIndex = vb.getIndex(); - // if (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) { - // this.swapIndex(vb, this.indexBuffer); - // } - // } + let len = totalIndices; + while (len < totalIndices) { + len <<= 1; } - // swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) { - // let buffers = (geom as any).buffers; - // const oldIndex = geom.getIndex(); - // let ind = buffers.indexOf(oldIndex); - // if (ind >= 0) { - // buffers.splice(ind, 1); - // } - // geom.addIndex(indexBuf); + this.ibLen = totalIndices; + this.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size, + Constant.use32bitIndex ? new Uint32Array(size * 6) : undefined)); + + // TODO: create new index buffer instead? + // if (vb) { + // const curIndex = vb.getIndex(); + // if (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) { + // this.swapIndex(vb, this.indexBuffer); + // } // } + } - getShader(): TilemapShader { - return this.rectShader; - } + // swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) { + // let buffers = (geom as any).buffers; + // const oldIndex = geom.getIndex(); + // let ind = buffers.indexOf(oldIndex); + // if (ind >= 0) { + // buffers.splice(ind, 1); + // } + // geom.addIndex(indexBuf); + // } - destroy() { - super.destroy(); - // this.rectShader.destroy(); - this.rectShader = null; - } + getShader(): TilemapShader { + return this.rectShader; } - PIXI.Renderer.registerPlugin('tilemap', TileRenderer as any); + destroy() { + super.destroy(); + // this.rectShader.destroy(); + this.rectShader = null; + } } + +Renderer.registerPlugin('tilemap', TileRenderer as any); diff --git a/src/ZLayer.ts b/src/ZLayer.ts index 50e922e1..24cd3084 100644 --- a/src/ZLayer.ts +++ b/src/ZLayer.ts @@ -1,88 +1,92 @@ -namespace pixi_tilemap { +/// - export class ZLayer extends PIXI.Container { +import { Container } from '@pixi/display'; - constructor(tilemap: PIXI.Container, zIndex: number) { - super(); - this.tilemap = tilemap; - this.z = zIndex; - } +import type { CompositeRectTileLayer } from './CompositeRectTileLayer'; +import type { Matrix } from '@pixi/math'; - tilemap: any; - z: number; - zIndex: number; - _previousLayers: number; - canvasBuffer: HTMLCanvasElement; - _tempRender: any; - _lastAnimationFrame: number = -1; - layerTransform: PIXI.Matrix; +export class ZLayer extends Container { - clear() { - let layers = this.children as Array; - for (let i = 0; i < layers.length; i++) - layers[i].clear(); - this._previousLayers = 0; - } + constructor(tilemap: Container, zIndex: number) { + super(); + this.tilemap = tilemap; + this.z = zIndex; + } - cacheIfDirty() { - let tilemap: any = this.tilemap; - let layers = this.children as Array; - let modified = this._previousLayers !== layers.length; - this._previousLayers = layers.length; - let buf = this.canvasBuffer; - let tempRender = this._tempRender; - if (!buf) { - buf = this.canvasBuffer = document.createElement('canvas'); - tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf}); - tempRender.context = tempRender.rootContext; - tempRender.plugins.tilemap.dontUseTransform = true; - } - if (buf.width !== tilemap._layerWidth || - buf.height !== tilemap._layerHeight) { - buf.width = tilemap._layerWidth; - buf.height = tilemap._layerHeight; - modified = true; - } - let i: number; - if (!modified) { - for (i = 0; i < layers.length; i++) { - if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) { - modified = true; - break; - } + tilemap: any; + z: number; + zIndex: number; + _previousLayers: number; + canvasBuffer: HTMLCanvasElement; + _tempRender: any; + _lastAnimationFrame: number = -1; + layerTransform: Matrix; + + clear() { + let layers = this.children as Array; + for (let i = 0; i < layers.length; i++) + layers[i].clear(); + this._previousLayers = 0; + } + + cacheIfDirty() { + let tilemap: any = this.tilemap; + let layers = this.children as Array; + let modified = this._previousLayers !== layers.length; + this._previousLayers = layers.length; + let buf = this.canvasBuffer; + let tempRender = this._tempRender; + if (!buf) { + buf = this.canvasBuffer = document.createElement('canvas'); + tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf}); + tempRender.context = tempRender.rootContext; + tempRender.plugins.tilemap.dontUseTransform = true; + } + if (buf.width !== tilemap._layerWidth || + buf.height !== tilemap._layerHeight) { + buf.width = tilemap._layerWidth; + buf.height = tilemap._layerHeight; + modified = true; + } + let i: number; + if (!modified) { + for (i = 0; i < layers.length; i++) { + if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) { + modified = true; + break; } } - this._lastAnimationFrame = tilemap.animationFrame; - if (modified) { - if (tilemap._hackRenderer) { - tilemap._hackRenderer(tempRender); - } - tempRender.context.clearRect(0, 0, buf.width, buf.height); - for (i = 0; i < layers.length; i++) { - layers[i].clearModify(); - layers[i].renderCanvas(tempRender); - } + } + this._lastAnimationFrame = tilemap.animationFrame; + if (modified) { + if (tilemap._hackRenderer) { + tilemap._hackRenderer(tempRender); } - this.layerTransform = this.worldTransform; + tempRender.context.clearRect(0, 0, buf.width, buf.height); for (i = 0; i < layers.length; i++) { - this.layerTransform = layers[i].worldTransform; - break; + layers[i].clearModify(); + layers[i].renderCanvas(tempRender); } } - - renderCanvas(renderer: any) { - this.cacheIfDirty(); - let wt = this.layerTransform; - renderer.context.setTransform( - wt.a, - wt.b, - wt.c, - wt.d, - wt.tx * renderer.resolution, - wt.ty * renderer.resolution - ); - let tilemap = this.tilemap; - renderer.context.drawImage(this.canvasBuffer, 0, 0); + this.layerTransform = this.worldTransform; + for (i = 0; i < layers.length; i++) { + this.layerTransform = layers[i].worldTransform; + break; } } + + renderCanvas(renderer: any) { + this.cacheIfDirty(); + let wt = this.layerTransform; + renderer.context.setTransform( + wt.a, + wt.b, + wt.c, + wt.d, + wt.tx * renderer.resolution, + wt.ty * renderer.resolution + ); + let tilemap = this.tilemap; + renderer.context.drawImage(this.canvasBuffer, 0, 0); + } } diff --git a/src/exporter.ts b/src/exporter.ts index cc311318..c6c43631 100644 --- a/src/exporter.ts +++ b/src/exporter.ts @@ -1,7 +1,8 @@ /// namespace pixi_tilemap { - (PIXI as any).tilemap = pixi_tilemap; - } + +// This makes exporter.ts a module! +export default {} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 00000000..dd7835e3 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,35 @@ +import { CanvasTileRenderer } from './CanvasTileRenderer'; +import { CompositeRectTileLayer } from './CompositeRectTileLayer'; +import { Constant } from './Constant'; +import { GraphicsLayer } from './GraphicsLayer'; +import { MultiTextureResource } from './MultiTextureResource'; +import { RectTileLayer } from './RectTileLayer'; +import { TilemapShader, RectTileShader, RectTileGeom } from './RectTileShader'; +import { TileRenderer } from './TileRenderer'; +import { ZLayer } from './ZLayer'; + +export const pixi_tilemap = { + CanvasTileRenderer, + CompositeRectTileLayer, + Constant, + GraphicsLayer, + MultiTextureResource, + RectTileLayer, + TilemapShader, + RectTileShader, + RectTileGeom, + TileRenderer, + ZLayer, +}; + +export * from './CanvasTileRenderer'; +export * from './CompositeRectTileLayer'; +export * from './Constant'; +export * from './exporter'; +export * from './GraphicsLayer'; +export * from './MultiTextureResource'; +export * from './RectTileLayer'; +export * from './RectTileShader'; +export * from './shaderGenerator'; +export * from './TileRenderer'; +export * from './ZLayer'; \ No newline at end of file diff --git a/src/shaderGenerator.ts b/src/shaderGenerator.ts index 60725174..7349b49b 100644 --- a/src/shaderGenerator.ts +++ b/src/shaderGenerator.ts @@ -1,54 +1,55 @@ -namespace pixi_tilemap.shaderGenerator { +import { Constant } from './Constant'; - export function fillSamplers(shader: TilemapShader, maxTextures: number) { - let sampleValues: Array = []; - for (let i = 0; i < maxTextures; i++) - { - sampleValues[i] = i; - } - shader.uniforms.uSamplers = sampleValues; +import type { TilemapShader } from './RectTileShader'; - let samplerSize: Array = []; - for (let i = 0; i < maxTextures; i++) { - samplerSize.push(1.0 / Constant.bufferSize); - samplerSize.push(1.0 / Constant.bufferSize); - } - shader.uniforms.uSamplerSize = samplerSize; + +export function fillSamplers(shader: TilemapShader, maxTextures: number) { + let sampleValues: Array = []; + for (let i = 0; i < maxTextures; i++) + { + sampleValues[i] = i; } + shader.uniforms.uSamplers = sampleValues; - export function generateFragmentSrc(maxTextures: number, fragmentSrc: string) { - return fragmentSrc.replace(/%count%/gi, maxTextures + "") - .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures)); + let samplerSize: Array = []; + for (let i = 0; i < maxTextures; i++) { + samplerSize.push(1.0 / Constant.bufferSize); + samplerSize.push(1.0 / Constant.bufferSize); } + shader.uniforms.uSamplerSize = samplerSize; +} - export function generateSampleSrc(maxTextures: number) { - let src = ''; +export function generateFragmentSrc(maxTextures: number, fragmentSrc: string) { + return fragmentSrc.replace(/%count%/gi, maxTextures + "") + .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures)); +} - src += '\n'; - src += '\n'; +export function generateSampleSrc(maxTextures: number) { + let src = ''; - src += 'if(vTextureId <= -1.0) {'; - src += '\n\tcolor = shadowColor;'; - src += '\n}'; + src += '\n'; + src += '\n'; - for (let i = 0; i < maxTextures; i++) - { - src += '\nelse '; + src += 'if(vTextureId <= -1.0) {'; + src += '\n\tcolor = shadowColor;'; + src += '\n}'; - if(i < maxTextures-1) - { - src += 'if(textureId == ' + i + '.0)'; - } + for (let i = 0; i < maxTextures; i++) + { + src += '\nelse '; - src += '\n{'; - src += '\n\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);'; - src += '\n}'; + if(i < maxTextures-1) + { + src += 'if(textureId == ' + i + '.0)'; } - src += '\n'; - src += '\n'; - - return src; + src += '\n{'; + src += '\n\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);'; + src += '\n}'; } + src += '\n'; + src += '\n'; + + return src; } diff --git a/src/types.d.ts b/src/types.d.ts new file mode 100644 index 00000000..4039a05a --- /dev/null +++ b/src/types.d.ts @@ -0,0 +1,51 @@ +/* + * Temporary hack until pixi.js releases typings at a per-package basis. + */ + +declare module "@pixi/constants" { + export { + ALPHA_MODES, + DRAW_MODES, + WRAP_MODES + } from 'pixi.js'; +} + +declare module "@pixi/core" { + export { + BaseTexture, + Buffer, + Texture, + ObjectRenderer, + Renderer, + GLTexture, + Geometry, + Shader, + resources + } from 'pixi.js'; +} + +declare module "@pixi/display" { + export { + DisplayObject, + Container + } from 'pixi.js'; +} + +declare module "@pixi/math" { + export { + Matrix, + groupD8 + } from 'pixi.js'; +} + +declare module "@pixi/graphics" { + export { + Graphics + } from 'pixi.js'; +} + +declare module "@pixi/sprite" { + export { + Sprite + } from 'pixi.js'; +} \ No newline at end of file diff --git a/tsconfig.compile.json b/tsconfig.compile.json new file mode 100644 index 00000000..248497fa --- /dev/null +++ b/tsconfig.compile.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "target": "es5", + "noImplicitAny": true, + "removeComments": true, + "preserveConstEnums": true, + "outDir": "compile", + "sourceMap": true, + "inlineSources": true, + "declaration": true, + "emitDeclarationOnly": true + }, + "include": [ + "src/**/*" + ], + "exclude": [ + "node_modules/**/*", + "dist" + ] +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index a7cf5a68..d2c86085 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,15 +1,14 @@ { - "compilerOptions": { - "module": "none", + "compilerOptions": { "target": "es5", - "noImplicitAny": true, - "removeComments": true, - "preserveConstEnums": true, - "outFile": "dist/pixi-tilemap.js", + "noImplicitAny": true, + "removeComments": true, + "preserveConstEnums": true, "sourceMap": true, "inlineSources": true, - "declaration": true - }, + "declaration": true, + "esModuleInterop": true + }, "include": [ "src/**/*" ], @@ -17,4 +16,4 @@ "node_modules/**/*", "dist" ] -} +} \ No newline at end of file From cce11fc7abe0803824fe166dcb4e01e7298cbd26 Mon Sep 17 00:00:00 2001 From: Shukant Pal Date: Thu, 13 Aug 2020 22:30:16 -0400 Subject: [PATCH 2/8] Update yarn.lock --- yarn.lock | 433 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 425 insertions(+), 8 deletions(-) diff --git a/yarn.lock b/yarn.lock index fd1e7bb7..d0910806 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,11 +2,61 @@ # yarn lockfile v1 +"@babel/code-frame@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a" + integrity sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg== + dependencies: + "@babel/highlight" "^7.10.4" + +"@babel/helper-validator-identifier@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz#a78c7a7251e01f616512d31b10adcf52ada5e0d2" + integrity sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw== + +"@babel/highlight@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.10.4.tgz#7d1bdfd65753538fabe6c38596cdb76d9ac60143" + integrity sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA== + dependencies: + "@babel/helper-validator-identifier" "^7.10.4" + chalk "^2.0.0" + js-tokens "^4.0.0" + "@babel/parser@^7.4.4": version "7.8.4" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.8.4.tgz#d1dbe64691d60358a974295fa53da074dd2ce8e8" integrity sha512-0fKu/QqildpXmPVaRBoXOlyBb3MC+J0A66x97qEfLOMkn3u6nfY5esWogQwi/K0BjASYy4DbnsEWnpNL6qT5Mw== +"@microsoft/api-extractor-model@7.8.14": + version "7.8.14" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.8.14.tgz#eaabb0fc9edfc190b707169b4921f1b446d3032c" + integrity sha512-M29U8lfwCf/vadMpLsNWGyE+A5HNGulMzVoQtpQhDxbigEXqw0OYUDbWFdsdoMiNGk3jzPVz+AIks+EXJJP0OQ== + dependencies: + "@microsoft/tsdoc" "0.12.19" + "@rushstack/node-core-library" "3.26.2" + +"@microsoft/api-extractor@^7.9.4": + version "7.9.4" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.9.4.tgz#d375719200777f8d7b20105cf9f5cb9ab9ff230d" + integrity sha512-r4kqFO0unCuEcKQkEVBCw/L4YuU4larQ45iDVRFOyarER03I7FGiGy/iFoTXeN9CSnFGoXOYNokt0MkqzOYjtQ== + dependencies: + "@microsoft/api-extractor-model" "7.8.14" + "@microsoft/tsdoc" "0.12.19" + "@rushstack/node-core-library" "3.26.2" + "@rushstack/ts-command-line" "4.4.7" + colors "~1.2.1" + lodash "~4.17.15" + resolve "~1.17.0" + semver "~7.3.0" + source-map "~0.6.1" + typescript "~3.9.5" + +"@microsoft/tsdoc@0.12.19": + version "0.12.19" + resolved "https://registry.yarnpkg.com/@microsoft/tsdoc/-/tsdoc-0.12.19.tgz#2173ccb92469aaf62031fa9499d21b16d07f9b57" + integrity sha512-IpgPxHrNxZiMNUSXqR1l/gePKPkfAmIKoDRP9hp7OwjU29ZR8WCJsOJ8iBKgw0Qk+pFwR+8Y1cy8ImLY6e9m4A== + "@pixi/accessibility@5.2.1": version "5.2.1" resolved "https://registry.yarnpkg.com/@pixi/accessibility/-/accessibility-5.2.1.tgz#2239f814e7c7d4e5f8ba6bd275b1fa9a6ba257ef" @@ -24,11 +74,27 @@ "@pixi/core" "5.2.1" "@pixi/display" "5.2.1" +"@pixi/canvas-renderer@^5.3.3": + version "5.3.3" + resolved "https://registry.yarnpkg.com/@pixi/canvas-renderer/-/canvas-renderer-5.3.3.tgz#a569dfa46907a41c073ce1f59050cd2ac667b08c" + integrity sha512-xAi3x2D0Jykk5vTsTMPEPTazQ7tmHnIj1pbEXL+knmNL0zmpekVpg5nY2RoztHW98oLfno5at5JNWtSQA/tiQA== + dependencies: + "@pixi/constants" "5.3.3" + "@pixi/core" "5.3.3" + "@pixi/math" "5.3.3" + "@pixi/settings" "5.3.3" + "@pixi/utils" "5.3.3" + "@pixi/constants@5.2.1": version "5.2.1" resolved "https://registry.yarnpkg.com/@pixi/constants/-/constants-5.2.1.tgz#5fa6bba0a456a5a6a09e20fca378545a88228ebf" integrity sha512-RYeP1Q5R6qVyVioM00/fhGXFAhJjD+mJW4+TOiNZQASKP0t6wF51yuIfROEIxf5a6I6INOB3aSit1jUkSpYgTA== +"@pixi/constants@5.3.3", "@pixi/constants@^5.3.3": + version "5.3.3" + resolved "https://registry.yarnpkg.com/@pixi/constants/-/constants-5.3.3.tgz#faaed2d0ce364d67fe3e69ac97e9db1f6ad6c041" + integrity sha512-IybgxzLlEPm7ihp70cLNKc3IPyqkFuW+idk9Zw2St+OayJTw5ctCnLAg9cducwIVHjPYTvN46BYDa+n0KRWZYw== + "@pixi/core@5.2.1": version "5.2.1" resolved "https://registry.yarnpkg.com/@pixi/core/-/core-5.2.1.tgz#c9ed2821608d5ef81fd01562043d5e9866ce0d89" @@ -42,6 +108,18 @@ "@pixi/ticker" "5.2.1" "@pixi/utils" "5.2.1" +"@pixi/core@5.3.3", "@pixi/core@^5.3.3": + version "5.3.3" + resolved "https://registry.yarnpkg.com/@pixi/core/-/core-5.3.3.tgz#4b973ee3d18f6324d63311e8a00a68ecb1996532" + integrity sha512-taw50LnzV+TQVMx5HQA2ZJgF9wuhZ6DeoXHW2KkevYB0ekKYnEO2VMMiRDMcmchtyvHclJebzjeHZLGqDtKDgw== + dependencies: + "@pixi/constants" "5.3.3" + "@pixi/math" "5.3.3" + "@pixi/runner" "5.3.3" + "@pixi/settings" "5.3.3" + "@pixi/ticker" "5.3.3" + "@pixi/utils" "5.3.3" + "@pixi/display@5.2.1": version "5.2.1" resolved "https://registry.yarnpkg.com/@pixi/display/-/display-5.2.1.tgz#3085523656b45ae9f76ee4dd4ccb1d075ae76f1d" @@ -51,6 +129,15 @@ "@pixi/settings" "5.2.1" "@pixi/utils" "5.2.1" +"@pixi/display@^5.3.3": + version "5.3.3" + resolved "https://registry.yarnpkg.com/@pixi/display/-/display-5.3.3.tgz#14646b35b80b8586316be3495e3c0e7fa610f499" + integrity sha512-dPm7Vk2BH9byu6RHBYsI9MtjUU8x1HNm/PIi6lIlxANhTjWnhxwfvmrGE7ZcRLThTenNdDVlZ2ke2XAXP98UgA== + dependencies: + "@pixi/math" "5.3.3" + "@pixi/settings" "5.3.3" + "@pixi/utils" "5.3.3" + "@pixi/extract@5.2.1": version "5.2.1" resolved "https://registry.yarnpkg.com/@pixi/extract/-/extract-5.2.1.tgz#0d7b77df7380b45e3a7f606b838603515bb7a08c" @@ -141,6 +228,11 @@ resolved "https://registry.yarnpkg.com/@pixi/math/-/math-5.2.1.tgz#d403ca911fbdc105060f2f9f2a8ab420d63a8c83" integrity sha512-rsAXNk0uPvog51sdmBmbRBXoN30pZLjboHLNb7s5mfuCWkMgdR/UFdbLFzd+3dwsgpFvawFuKtbQbwO0McXn+g== +"@pixi/math@5.3.3", "@pixi/math@^5.3.3": + version "5.3.3" + resolved "https://registry.yarnpkg.com/@pixi/math/-/math-5.3.3.tgz#5d40d36fa1701e195083adb84bddf2f6420c2f4c" + integrity sha512-k5C3kQpxlGm2AdBJEUjjW2l2YlSvTKf+54vNOjD4UcEfRoDevC5p4Zg49q3UAu855lrs5qw49AbkrFKsQvPIRA== + "@pixi/mesh-extras@5.2.1": version "5.2.1" resolved "https://registry.yarnpkg.com/@pixi/mesh-extras/-/mesh-extras-5.2.1.tgz#4972ec8bb53eaa5a16bd8895f7b155bf947ce124" @@ -227,6 +319,11 @@ resolved "https://registry.yarnpkg.com/@pixi/runner/-/runner-5.2.1.tgz#9f60adf9409876620191cb72764213bb9c14add8" integrity sha512-nhU3HaYb3EJ6zHU20b1jU6pD7vQp3OXoAtAVBzqPMR/oWMkeEm4dDvp1PwbCbZPUGoT7mLfQ//5maufue1MPqA== +"@pixi/runner@5.3.3": + version "5.3.3" + resolved "https://registry.yarnpkg.com/@pixi/runner/-/runner-5.3.3.tgz#79fb35b12620d7724c65f4a7aa507190ea825ac0" + integrity sha512-7eLZxxT+PwxuwzcRL1egrnEdLHwD41yFb24pMSo6XM86ppP1tdBjrv5+pLDnUuDEfNjZQxx07FAlZY+sMKANmw== + "@pixi/settings@5.2.1": version "5.2.1" resolved "https://registry.yarnpkg.com/@pixi/settings/-/settings-5.2.1.tgz#1431a20ba2e8100c71eba9ba1fb7dc3d435d343e" @@ -234,6 +331,13 @@ dependencies: ismobilejs "^1.0.3" +"@pixi/settings@5.3.3": + version "5.3.3" + resolved "https://registry.yarnpkg.com/@pixi/settings/-/settings-5.3.3.tgz#3ff5f8afc8376d12c7627be043ec317eba139dcd" + integrity sha512-1MYJokqpPUtvYEX0BVi0Pq2Xi6KGmWDV5hlQnTXY9NGv6tmqrPYvIb/uHFaDyVUWmrqsFL3xZ4W5zMo+c/dwVA== + dependencies: + ismobilejs "^1.1.0" + "@pixi/sprite-animated@5.2.1": version "5.2.1" resolved "https://registry.yarnpkg.com/@pixi/sprite-animated/-/sprite-animated-5.2.1.tgz#ea3379c7d02bbc362e9922c4e2f583b34f389a89" @@ -308,6 +412,13 @@ dependencies: "@pixi/settings" "5.2.1" +"@pixi/ticker@5.3.3": + version "5.3.3" + resolved "https://registry.yarnpkg.com/@pixi/ticker/-/ticker-5.3.3.tgz#a8766d8417879fffd7507175de869805aee25eb2" + integrity sha512-p5F/dwJGwfZWUg5cCPqOnEx5iYGW+huQlZZtrTKKd1KoVehFsrzHeRBOEp4d584jsOmBf7fjJaUTyzsFn0YtOQ== + dependencies: + "@pixi/settings" "5.3.3" + "@pixi/utils@5.2.1": version "5.2.1" resolved "https://registry.yarnpkg.com/@pixi/utils/-/utils-5.2.1.tgz#d2445a976b315a58860a7f19d754143af3659f09" @@ -319,6 +430,88 @@ eventemitter3 "^3.1.0" url "^0.11.0" +"@pixi/utils@5.3.3": + version "5.3.3" + resolved "https://registry.yarnpkg.com/@pixi/utils/-/utils-5.3.3.tgz#525321f3bb00e3e001e341020a3edee94cc0d00a" + integrity sha512-GDP2h1Mph9Uei4zmJjzDK6GZ5S9O2A09VySVfWyKgWwP3SQ/Ss0bGYm4sE6+u1NMSz1WCrLgu66H82XuXs2Cbg== + dependencies: + "@pixi/constants" "5.3.3" + "@pixi/settings" "5.3.3" + earcut "^2.1.5" + eventemitter3 "^3.1.0" + url "^0.11.0" + +"@rollup/plugin-node-resolve@^8.4.0": + version "8.4.0" + resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-8.4.0.tgz#261d79a680e9dc3d86761c14462f24126ba83575" + integrity sha512-LFqKdRLn0ShtQyf6SBYO69bGE1upV6wUhBX0vFOUnLAyzx5cwp8svA0eHUnu8+YU57XOkrMtfG63QOpQx25pHQ== + dependencies: + "@rollup/pluginutils" "^3.1.0" + "@types/resolve" "1.17.1" + builtin-modules "^3.1.0" + deep-freeze "^0.0.1" + deepmerge "^4.2.2" + is-module "^1.0.0" + resolve "^1.17.0" + +"@rollup/pluginutils@^3.0.9", "@rollup/pluginutils@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b" + integrity sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg== + dependencies: + "@types/estree" "0.0.39" + estree-walker "^1.0.1" + picomatch "^2.2.2" + +"@rushstack/node-core-library@3.26.2": + version "3.26.2" + resolved "https://registry.yarnpkg.com/@rushstack/node-core-library/-/node-core-library-3.26.2.tgz#74f9ce8f9b7af88e30c52680a50ee71147ee8d04" + integrity sha512-gm4w4L+xhYAzZmBpZIyWHvqpa5fdtt9WpvBBhi/HjyIA/z472gZA3R3gZnGNaYw4y4/w2GkZL0IYhAGqLk7Qpw== + dependencies: + "@types/node" "10.17.13" + colors "~1.2.1" + fs-extra "~7.0.1" + jju "~1.4.0" + semver "~7.3.0" + timsort "~0.3.0" + z-schema "~3.18.3" + +"@rushstack/ts-command-line@4.4.7": + version "4.4.7" + resolved "https://registry.yarnpkg.com/@rushstack/ts-command-line/-/ts-command-line-4.4.7.tgz#1ca14ee2e03474468fa504be8083f4fa871360aa" + integrity sha512-rBMMeH0a+43JvpEwtqVe1P+RlJmYe3rkHJctCIFXUHJWnmTCYNKB/Xp3LLzA/d4SsmAXXeKmbaOFXML7mwBveA== + dependencies: + "@types/argparse" "1.0.38" + argparse "~1.0.9" + colors "~1.2.1" + +"@types/argparse@1.0.38": + version "1.0.38" + resolved "https://registry.yarnpkg.com/@types/argparse/-/argparse-1.0.38.tgz#a81fd8606d481f873a3800c6ebae4f1d768a56a9" + integrity sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA== + +"@types/estree@0.0.39": + version "0.0.39" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" + integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== + +"@types/node@*": + version "14.0.27" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.27.tgz#a151873af5a5e851b51b3b065c9e63390a9e0eb1" + integrity sha512-kVrqXhbclHNHGu9ztnAwSncIgJv/FaxmzXJvGXNdcCpV1b8u1/Mi6z6m0vwy0LzKeXFTPLH0NzwmoJ3fNCIq0g== + +"@types/node@10.17.13": + version "10.17.13" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.13.tgz#ccebcdb990bd6139cd16e84c39dc2fb1023ca90c" + integrity sha512-pMCcqU2zT4TjqYFrWtYHKal7Sl30Ims6ulZ4UFXxI4xbtQqK/qqKwkDoBFCfooRqqmRu9vY3xaJRwxSh673aYg== + +"@types/resolve@1.17.1": + version "1.17.1" + resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.17.1.tgz#3afd6ad8967c77e4376c598a82ddd58f46ec45d6" + integrity sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw== + dependencies: + "@types/node" "*" + "@webassemblyjs/ast@1.8.5": version "1.8.5" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.8.5.tgz#51b1c5fe6576a34953bf4b253df9f0d490d9e359" @@ -574,7 +767,7 @@ aproba@^1.1.1: resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" integrity sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw== -argparse@^1.0.7: +argparse@^1.0.7, argparse@~1.0.9: version "1.0.10" resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911" integrity sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg== @@ -937,6 +1130,11 @@ buffer@^5.0.2: base64-js "^1.0.2" ieee754 "^1.1.4" +builtin-modules@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.1.0.tgz#aad97c15131eb76b65b50ef208e7584cd76a7484" + integrity sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw== + builtin-status-codes@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" @@ -995,7 +1193,7 @@ catharsis@^0.8.11: dependencies: lodash "^4.17.14" -chalk@^2.0.1, chalk@^2.1.0, chalk@^2.4.1: +chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.4.1: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -1106,6 +1304,11 @@ color-name@1.1.3: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= +colors@~1.2.1: + version "1.2.5" + resolved "https://registry.yarnpkg.com/colors/-/colors-1.2.5.tgz#89c7ad9a374bc030df8013241f68136ed8835afc" + integrity sha512-erNRLao/Y3Fv54qUa0LBB+//Uf3YwMUmdJinN20yMXm9zdKKqH9wt7R9IIVZ+K7ShzfpLV/Zg8+VyrBJYB4lpg== + combine-source-map@^0.8.0, combine-source-map@~0.8.0: version "0.8.0" resolved "https://registry.yarnpkg.com/combine-source-map/-/combine-source-map-0.8.0.tgz#a58d0df042c186fcf822a8e8015f5450d2d79a8b" @@ -1116,7 +1319,7 @@ combine-source-map@^0.8.0, combine-source-map@~0.8.0: lodash.memoize "~3.0.3" source-map "~0.5.3" -commander@^2.20.0: +commander@^2.20.0, commander@^2.7.1: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== @@ -1312,6 +1515,16 @@ decode-uri-component@^0.2.0: resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= +deep-freeze@^0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/deep-freeze/-/deep-freeze-0.0.1.tgz#3a0b0005de18672819dfd38cd31f91179c893e84" + integrity sha1-OgsABd4YZygZ39OM0x+RF5yJPoQ= + +deepmerge@^4.2.2: + version "4.2.2" + resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.2.2.tgz#44d2ea3679b8f4d4ffba33f03d865fc1e7bf4955" + integrity sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg== + define-properties@^1.1.2: version "1.1.3" resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" @@ -1552,6 +1765,16 @@ estraverse@^4.1.0, estraverse@^4.1.1: resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d" integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw== +estree-walker@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362" + integrity sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w== + +estree-walker@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-1.0.1.tgz#31bc5d612c96b704106b477e6dd5d8aa138cb700" + integrity sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg== + eventemitter3@^3.1.0: version "3.1.2" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7" @@ -1740,6 +1963,15 @@ from2@^2.1.0: inherits "^2.0.1" readable-stream "^2.0.0" +fs-extra@~7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" + integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== + dependencies: + graceful-fs "^4.1.2" + jsonfile "^4.0.0" + universalify "^0.1.0" + fs-write-stream-atomic@^1.0.8: version "1.0.10" resolved "https://registry.yarnpkg.com/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz#b47df53493ef911df75731e70a9ded0189db40c9" @@ -1763,6 +1995,11 @@ fsevents@^1.2.7: bindings "^1.5.0" nan "^2.12.1" +fsevents@~2.1.2: + version "2.1.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.3.tgz#fb738703ae8d2f9fe900c33836ddebee8b97f23e" + integrity sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ== + function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" @@ -1827,11 +2064,21 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.9 resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423" integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ== +graceful-fs@^4.1.6: + version "4.2.4" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" + integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== + has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + has-symbols@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" @@ -2100,6 +2347,11 @@ is-glob@^4.0.0: dependencies: is-extglob "^2.1.1" +is-module@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" + integrity sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE= + is-number@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" @@ -2168,6 +2420,11 @@ ismobilejs@^1.0.3: resolved "https://registry.yarnpkg.com/ismobilejs/-/ismobilejs-1.0.3.tgz#69ec3faccd17dfeeadd471e70955d1e192a46eb6" integrity sha512-6rTcdWK7PHIWPYlCPdTbU9eE9yzdnIQSpiH+8Ln5OqugpEszQK5KHlsjZrDae26fEhki9rPvQmsjI1q4CLuKIA== +ismobilejs@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/ismobilejs/-/ismobilejs-1.1.1.tgz#c56ca0ae8e52b24ca0f22ba5ef3215a2ddbbaa0e" + integrity sha512-VaFW53yt8QO61k2WJui0dHf4SlL8lxBofUuUmwBo0ljPk0Drz2TiuDW4jo3wDcv41qy/SxrJ+VAzJ/qYqsmzRw== + isobject@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" @@ -2188,6 +2445,25 @@ jaguarjs-jsdoc@^1.0.1: taffydb "^2.7.2" underscore "^1.7.0" +jest-worker@^26.2.1: + version "26.3.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.3.0.tgz#7c8a97e4f4364b4f05ed8bca8ca0c24de091871f" + integrity sha512-Vmpn2F6IASefL+DVBhPzI2J9/GJUsqzomdeN+P+dK8/jKxbh8R3BtFnx3FIta7wYlPU62cpJMJQo4kuOowcMnw== + dependencies: + "@types/node" "*" + merge-stream "^2.0.0" + supports-color "^7.0.0" + +jju@~1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/jju/-/jju-1.4.0.tgz#a3abe2718af241a2b2904f84a625970f389ae32a" + integrity sha1-o6vicYryQaKykE+EpiWXDzia4yo= + +js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + js2xmlparser@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/js2xmlparser/-/js2xmlparser-4.0.1.tgz#670ef71bc5661f089cc90481b99a05a1227ae3bd" @@ -2239,6 +2515,13 @@ json5@^1.0.1: dependencies: minimist "^1.2.0" +jsonfile@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss= + optionalDependencies: + graceful-fs "^4.1.6" + jsonify@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73" @@ -2332,6 +2615,16 @@ locate-path@^3.0.0: p-locate "^3.0.0" path-exists "^3.0.0" +lodash.get@^4.0.0: + version "4.4.2" + resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" + integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= + +lodash.isequal@^4.0.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" + integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA= + lodash.memoize@~3.0.3: version "3.0.4" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-3.0.4.tgz#2dcbd2c287cbc0a55cc42328bd0c736150d53e3f" @@ -2342,6 +2635,11 @@ lodash@^4.17.14, lodash@^4.17.5: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== +lodash@~4.17.15: + version "4.17.20" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" + integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== + log-symbols@^2.1.0: version "2.2.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" @@ -2456,6 +2754,11 @@ memory-fs@^0.5.0: errno "^0.1.3" readable-stream "^2.0.1" +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + micromatch@^3.1.10, micromatch@^3.1.4, micromatch@^3.1.9: version "3.1.10" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" @@ -2947,6 +3250,11 @@ pend@~1.2.0: resolved "https://registry.yarnpkg.com/pend/-/pend-1.2.0.tgz#7a57eb550a6783f9115331fcf4663d5c8e007a50" integrity sha1-elfrVQpng/kRUzH89GY9XI4AelA= +picomatch@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad" + integrity sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg== + pify@^2.0.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -3132,7 +3440,7 @@ querystring@0.2.0: resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= -randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5: +randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5, randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" integrity sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ== @@ -3255,6 +3563,13 @@ resolve@^1.1.3, resolve@^1.1.4: dependencies: path-parse "^1.0.6" +resolve@^1.10.0, resolve@^1.17.0, resolve@~1.17.0: + version "1.17.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444" + integrity sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w== + dependencies: + path-parse "^1.0.6" + resource-loader@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/resource-loader/-/resource-loader-3.0.1.tgz#33355bb5421e2994f59454bbc7f6dbff8df06d47" @@ -3283,6 +3598,46 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^3.0.0" inherits "^2.0.1" +rollup-plugin-sourcemaps@^0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/rollup-plugin-sourcemaps/-/rollup-plugin-sourcemaps-0.6.2.tgz#1eed5a3e07b833dc14c4cdb1e63b300d340f4a74" + integrity sha512-9AwTKg3yRykwzemfLt71ySe0LvrAci+bpsOL1LaTYFk5BX4HF6X7DQfpHa74ANfSja3hyjiQkXCR8goSOnW//Q== + dependencies: + "@rollup/pluginutils" "^3.0.9" + source-map-resolve "^0.6.0" + +rollup-plugin-terser@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-7.0.0.tgz#26b38ada4f0b351cd7cd872ca04c0f8532d4864f" + integrity sha512-p/N3lLiFusCjYTLfVkoaiRTOGr5AESEaljMPH12MhOtoMkmTBhIAfuadrcWy4am1U0vU4WTxO9fi0K09O4CboQ== + dependencies: + "@babel/code-frame" "^7.10.4" + jest-worker "^26.2.1" + serialize-javascript "^4.0.0" + terser "^5.0.0" + +rollup-plugin-typescript@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/rollup-plugin-typescript/-/rollup-plugin-typescript-1.0.1.tgz#86565033b714c3d1f3aba510aad3dc519f7091e9" + integrity sha512-rwJDNn9jv/NsKZuyBb/h0jsclP4CJ58qbvZt2Q9zDIGILF2LtdtvCqMOL+Gq9IVq5MTrTlHZNrn8h7VjQgd8tw== + dependencies: + resolve "^1.10.0" + rollup-pluginutils "^2.5.0" + +rollup-pluginutils@^2.5.0: + version "2.8.2" + resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz#72f2af0748b592364dbd3389e600e5a9444a351e" + integrity sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ== + dependencies: + estree-walker "^0.6.1" + +rollup@^2.23.1: + version "2.24.0" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.24.0.tgz#d51b536a67664029138ebc85705efbe88558da3a" + integrity sha512-UaTQNUUjKT9NANDGOlZ2fZW9wL7OPYH8RS6CrHjsjdwlboc//xBDET5Q7WZOD2k+cJ2iD2fEnq4fnpVo2eTjGA== + optionalDependencies: + fsevents "~2.1.2" + run-queue@^1.0.0, run-queue@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/run-queue/-/run-queue-1.0.3.tgz#e848396f057d223f24386924618e25694161ec47" @@ -3321,11 +3676,23 @@ semver@^5.1.0, semver@^5.5.0, semver@^5.6.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== +semver@~7.3.0: + version "7.3.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938" + integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ== + serialize-javascript@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-2.1.2.tgz#ecec53b0e0317bdc95ef76ab7074b7384785fa61" integrity sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ== +serialize-javascript@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-4.0.0.tgz#b525e1238489a5ecfc42afacc3fe99e666f4b1aa" + integrity sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw== + dependencies: + randombytes "^2.1.0" + set-blocking@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" @@ -3450,6 +3817,14 @@ source-map-resolve@^0.5.0: source-map-url "^0.4.0" urix "^0.1.0" +source-map-resolve@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.6.0.tgz#3d9df87e236b53f16d01e58150fc7711138e5ed2" + integrity sha512-KXBr9d/fO/bWo97NXsPIAW1bFSBOuCnjbNTBMO7N59hsv5i9yzRDfcYwwt0l04+VqnKC+EwzvJZIP/qkuMgR/w== + dependencies: + atob "^2.1.2" + decode-uri-component "^0.2.0" + source-map-support@^0.5.3, source-map-support@~0.5.12: version "0.5.16" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.16.tgz#0ae069e7fe3ba7538c64c98515e35339eac5a042" @@ -3641,6 +4016,13 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" +supports-color@^7.0.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.1.0.tgz#68e32591df73e25ad1c4b49108a2ec507962bfd1" + integrity sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g== + dependencies: + has-flag "^4.0.0" + syntax-error@^1.1.1: version "1.4.0" resolved "https://registry.yarnpkg.com/syntax-error/-/syntax-error-1.4.0.tgz#2d9d4ff5c064acb711594a3e3b95054ad51d907c" @@ -3687,6 +4069,15 @@ terser@^4.1.2: source-map "~0.6.1" source-map-support "~0.5.12" +terser@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.0.0.tgz#269640e4e92f15d628de1e5f01c4c61e1ba3d765" + integrity sha512-olH2DwGINoSuEpSGd+BsPuAQaA3OrHnHnFL/rDB2TVNc3srUbz/rq/j2BlF4zDXI+JqAvGr86bIm1R2cJgZ3FA== + dependencies: + commander "^2.20.0" + source-map "~0.6.1" + source-map-support "~0.5.12" + through2@^2.0.0: version "2.0.5" resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd" @@ -3714,6 +4105,11 @@ timers-browserify@^2.0.4: dependencies: setimmediate "^1.0.4" +timsort@~0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4" + integrity sha1-QFQRqOfmM5/mTbmiNN4R3DHgK9Q= + tmp@~0.0.33: version "0.0.33" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" @@ -3820,10 +4216,10 @@ typescript@^2.8.1: resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c" integrity sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w== -typescript@^3.5.3: - version "3.7.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.5.tgz#0692e21f65fd4108b9330238aac11dd2e177a1ae" - integrity sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw== +typescript@^3.9.7, typescript@~3.9.5: + version "3.9.7" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa" + integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw== uc.micro@^1.0.1, uc.micro@^1.0.5: version "1.0.6" @@ -3875,6 +4271,11 @@ unique-slug@^2.0.0: dependencies: imurmurhash "^0.1.4" +universalify@^0.1.0: + version "0.1.2" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" + integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== + unset-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" @@ -3944,6 +4345,11 @@ uuid@^3.1.0: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== +validator@^8.0.0: + version "8.2.0" + resolved "https://registry.yarnpkg.com/validator/-/validator-8.2.0.tgz#3c1237290e37092355344fef78c231249dab77b9" + integrity sha512-Yw5wW34fSv5spzTXNkokD6S6/Oq92d8q/t14TqsS3fAiA1RYnxSFSIZ+CY3n6PGGRCq5HhJTSepQvFUS2QUDxA== + vm-browserify@^1.0.1: version "1.1.2" resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0" @@ -4107,3 +4513,14 @@ yauzl@2.4.1: integrity sha1-lSj0QtqxsihOWLQ3m7GU4i4MQAU= dependencies: fd-slicer "~1.0.1" + +z-schema@~3.18.3: + version "3.18.4" + resolved "https://registry.yarnpkg.com/z-schema/-/z-schema-3.18.4.tgz#ea8132b279533ee60be2485a02f7e3e42541a9a2" + integrity sha512-DUOKC/IhbkdLKKiV89gw9DUauTV8U/8yJl1sjf6MtDmzevLKOF2duNJ495S3MFVjqZarr+qNGCPbkg4mu4PpLw== + dependencies: + lodash.get "^4.0.0" + lodash.isequal "^4.0.0" + validator "^8.0.0" + optionalDependencies: + commander "^2.7.1" From 2fae8f3514ed364557dbab4cd64d63a22c32e1b2 Mon Sep 17 00:00:00 2001 From: Shukant Pal Date: Thu, 13 Aug 2020 22:38:40 -0400 Subject: [PATCH 3/8] Update scripts & eslint-disable in banner --- dist/pixi-tilemap.js | 4 +++- dist/pixi-tilemap.js.map | 2 +- dist/pixi-tilemap.umd.js | 4 +++- dist/pixi-tilemap.umd.js.map | 2 +- dist/pixi-tilemap.umd.min.js | 2 +- dist/pixi-tilemap.umd.min.js.map | 2 +- lib/pixi-tilemap.es.js | 4 +++- lib/pixi-tilemap.es.js.map | 2 +- package.json | 2 +- rollup.config.js | 2 ++ 10 files changed, 17 insertions(+), 9 deletions(-) diff --git a/dist/pixi-tilemap.js b/dist/pixi-tilemap.js index bab06c06..8aae79bf 100644 --- a/dist/pixi-tilemap.js +++ b/dist/pixi-tilemap.js @@ -1,6 +1,8 @@ +/* eslint-disable */ + /*! * pixi-tilemap - v2.0.6 - * Compiled Fri, 14 Aug 2020 02:19:53 UTC + * Compiled Fri, 14 Aug 2020 02:36:52 UTC * * pixi-tilemap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license diff --git a/dist/pixi-tilemap.js.map b/dist/pixi-tilemap.js.map index 59bf8461..d89e33aa 100644 --- a/dist/pixi-tilemap.js.map +++ b/dist/pixi-tilemap.js.map @@ -1 +1 @@ -{"version":3,"file":"pixi-tilemap.js","sources":["../src/CanvasTileRenderer.ts","../node_modules/tslib/tslib.es6.js","../src/Constant.ts","../src/RectTileLayer.ts","../src/CompositeRectTileLayer.ts","../src/GraphicsLayer.ts","../src/MultiTextureResource.ts","../src/shaderGenerator.ts","../src/RectTileShader.ts","../src/TileRenderer.ts","../src/ZLayer.ts","../src/exporter.ts","../src/index.ts"],"sourcesContent":["/// \n\nimport { Renderer } from '@pixi/core';\n\nexport class CanvasTileRenderer {\n renderer: Renderer;\n tileAnim = [0, 0];\n dontUseTransform = false;\n\n constructor(renderer: Renderer) {\n this.renderer = renderer;\n this.tileAnim = [0, 0];\n }\n}\n\nconst cr = (PIXI as any).CanvasRenderer;\n\nif (cr) {\n cr.registerPlugin('tilemap', CanvasTileRenderer);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","export const Constant = {\n maxTextures: 16,\n bufferSize: 2048,\n boundSize: 1024,\n boundCountPerBuffer: 1,\n use32bitIndex: false,\n SCALE_MODE: PIXI.SCALE_MODES.LINEAR,\n DO_CLEAR: true\n};","/// \n\nimport { Container } from '@pixi/display';\nimport { Constant } from './Constant';\nimport { DRAW_MODES } from '@pixi/constants';\nimport { Texture, Renderer } from '@pixi/core';\nimport { TileRenderer } from './TileRenderer';\nimport { Matrix, groupD8 } from '@pixi/math';\n\nimport type { RectTileGeom } from './RectTileShader';\n\nexport const POINT_STRUCT_SIZE = 12;\n\nexport class RectTileLayer extends Container {\n constructor(zIndex: number, texture: Texture | Array) {\n super();\n this.initialize(zIndex, texture);\n }\n\n zIndex = 0;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n\n pointsBuf: Array = [];\n hasAnim = false;\n textures: Array;\n\n offsetX = 0;\n offsetY = 0;\n compositeParent = false;\n\n initialize(zIndex: number, textures: Texture | Array) {\n if (!textures) {\n textures = [];\n } else if (!(textures instanceof Array) && (textures as Texture).baseTexture) {\n textures = [textures as Texture];\n }\n this.textures = textures as Array;\n this.zIndex = zIndex;\n // this.visible = false;\n }\n\n clear() {\n this.pointsBuf.length = 0;\n this.modificationMarker = 0;\n this.hasAnim = false;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX: number, animY: number) {\n let texture: Texture;\n let textureIndex = 0;\n\n if (typeof texture_ === \"number\") {\n textureIndex = texture_;\n texture = this.textures[textureIndex];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n let found = false;\n let textureList = this.textures;\n for (let i = 0; i < textureList.length; i++) {\n if (textureList[i].baseTexture === texture.baseTexture) {\n textureIndex = i;\n found = true;\n break;\n }\n }\n\n if (!found) {\n // textureIndex = this.textures.length;\n // this.textures.push(texture);\n return false;\n }\n }\n\n this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate);\n return true;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number,\n animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this {\n let pb = this.pointsBuf;\n this.hasAnim = this.hasAnim || animX > 0 || animY > 0;\n pb.push(u);\n pb.push(v);\n pb.push(x);\n pb.push(y);\n pb.push(tileWidth);\n pb.push(tileHeight);\n pb.push(rotate);\n pb.push(animX | 0);\n pb.push(animY | 0);\n pb.push(textureIndex);\n pb.push(animCountX);\n pb.push(animCountY);\n\n return this;\n }\n\n tileRotate(rotate: number) {\n const pb = this.pointsBuf;\n pb[pb.length - 3] = rotate;\n }\n\n tileAnimX(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 5] = offset;\n pb[pb.length - 2] = count;\n }\n\n tileAnimY(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 4] = offset;\n pb[pb.length - 1] = count;\n }\n\n renderCanvas(renderer: any) {\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n this.renderCanvasCore(renderer);\n }\n\n renderCanvasCore(renderer: any) {\n if (this.textures.length === 0) return;\n let points = this.pointsBuf;\n renderer.context.fillStyle = '#000000';\n for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) {\n let x1 = points[i], y1 = points[i + 1];\n let x2 = points[i + 2], y2 = points[i + 3];\n let w = points[i + 4];\n let h = points[i + 5];\n var rotate = points[i + 6];\n x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0];\n y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1];\n let textureIndex = points[i + 9];\n // canvas does not work with rotate yet\n if (textureIndex >= 0) {\n renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h);\n } else {\n renderer.context.globalAlpha = 0.5;\n renderer.context.fillRect(x2, y2, w, h);\n renderer.context.globalAlpha = 1;\n }\n }\n }\n\n vbId = 0;\n vb: RectTileGeom = null;\n vbBuffer: ArrayBuffer = null;\n vbArray: Float32Array = null;\n vbInts: Uint32Array = null;\n\n destroyVb() {\n if (this.vb) {\n this.vb.destroy();\n this.vb = null;\n }\n }\n\n render(renderer: Renderer) {\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n this.renderWebGLCore(renderer, plugin);\n }\n\n renderWebGLCore(renderer: Renderer, plugin: TileRenderer) {\n let points = this.pointsBuf;\n if (points.length === 0) return;\n let rectsCount = points.length / POINT_STRUCT_SIZE;\n\n let shader = plugin.getShader();\n let textures = this.textures;\n if (textures.length === 0) return;\n\n plugin.bindTextures(renderer, shader, textures);\n renderer.shader.bind(shader, false);\n\n //lost context! recover!\n let vb = this.vb;\n if (!vb) {\n vb = plugin.createVb();\n this.vb = vb;\n this.vbId = (vb as any).id;\n this.vbBuffer = null;\n this.modificationMarker = 0;\n }\n\n plugin.checkIndexBuffer(rectsCount, vb);\n const boundCountPerBuffer = Constant.boundCountPerBuffer;\n\n let vertexBuf = vb.getBuffer('aVertexPosition');\n //if layer was changed, re-upload vertices\n let vertices = rectsCount * vb.vertPerQuad;\n if (vertices === 0) return;\n if (this.modificationMarker !== vertices) {\n this.modificationMarker = vertices;\n let vs = vb.stride * vertices;\n if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {\n //!@#$ happens, need resize\n let bk = vb.stride;\n while (bk < vs) {\n bk *= 2;\n }\n this.vbBuffer = new ArrayBuffer(bk);\n this.vbArray = new Float32Array(this.vbBuffer);\n this.vbInts = new Uint32Array(this.vbBuffer);\n vertexBuf.update(this.vbBuffer);\n }\n\n let arr = this.vbArray, ints = this.vbInts;\n //upload vertices!\n let sz = 0;\n //let tint = 0xffffffff;\n let textureId: number = 0;\n let shiftU: number = this.offsetX;\n let shiftV: number = this.offsetY;\n\n //let tint = 0xffffffff;\n let tint = -1;\n for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) {\n let eps = 0.5;\n if (this.compositeParent) {\n if (boundCountPerBuffer > 1) {\n //TODO: what if its more than 4?\n textureId = (points[i + 9] >> 2);\n shiftU = this.offsetX * (points[i + 9] & 1);\n shiftV = this.offsetY * ((points[i + 9] >> 1) & 1);\n } else {\n textureId = points[i + 9];\n shiftU = 0;\n shiftV = 0;\n }\n }\n let x = points[i + 2], y = points[i + 3];\n let w = points[i + 4], h = points[i + 5];\n let u = points[i] + shiftU, v = points[i + 1] + shiftV;\n let rotate = points[i + 6];\n\n const animX = points[i + 7], animY = points[i + 8];\n const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024;\n const animXEncoded = animX + (animWidth * 2048);\n const animYEncoded = animY + (animHeight * 2048);\n\n let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number;\n if (rotate === 0) {\n u0 = u;\n v0 = v;\n u1 = u + w;\n v1 = v;\n u2 = u + w;\n v2 = v + h;\n u3 = u;\n v3 = v + h;\n } else {\n let w2 = w / 2;\n let h2 = h / 2;\n if (rotate % 4 !== 0) {\n w2 = h / 2;\n h2 = w / 2;\n }\n const cX = u + w2;\n const cY = v + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW);\n u0 = cX + (w2 * groupD8.uX(rotate));\n v0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n u1 = cX + (w2 * groupD8.uX(rotate));\n v1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u2 = cX + (w2 * groupD8.uX(rotate));\n v2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u3 = cX + (w2 * groupD8.uX(rotate));\n v3 = cY + (h2 * groupD8.uY(rotate));\n }\n\n arr[sz++] = x;\n arr[sz++] = y;\n arr[sz++] = u0;\n arr[sz++] = v0;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y;\n arr[sz++] = u1;\n arr[sz++] = v1;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y + h;\n arr[sz++] = u2;\n arr[sz++] = v2;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x;\n arr[sz++] = y + h;\n arr[sz++] = u3;\n arr[sz++] = v3;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n }\n\n vertexBuf.update(arr);\n }\n\n (renderer.geometry as any).bind(vb, shader);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES, rectsCount * 6, 0);\n }\n\n isModified(anim: boolean) {\n if (this.modificationMarker !== this.pointsBuf.length ||\n anim && this.hasAnim) {\n return true;\n }\n return false;\n }\n\n clearModify() {\n this.modificationMarker = this.pointsBuf.length;\n }\n\n destroy(options?: any) {\n super.destroy(options);\n this.destroyVb();\n }\n}\n","/// \n\nimport { Container } from '@pixi/display';\nimport { Texture, Renderer } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { Constant } from './Constant';\nimport { RectTileLayer } from './RectTileLayer';\n\nexport class CompositeRectTileLayer extends Container {\n constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n super();\n this.initialize.apply(this, arguments);\n }\n\n updateTransform() {\n (this as any).displayObjectUpdateTransform();\n }\n\n z: number;\n zIndex: number;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n _lastLayer: RectTileLayer = null;\n\n texPerChild: number;\n\n initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n if (texPerChild as any === true) {\n //old format, ignore it!\n texPerChild = 0;\n }\n this.z = this.zIndex = zIndex;\n this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures;\n if (bitmaps) {\n this.setBitmaps(bitmaps);\n }\n }\n\n setBitmaps(bitmaps: Array) {\n for (let i=0;i 5.2.1, it does not exist there.`);\n }\n }\n let texPerChild = this.texPerChild;\n let len1 = this.children.length;\n let len2 = Math.ceil(bitmaps.length / texPerChild);\n let i: number;\n for (i = 0; i < len1; i++) {\n (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);\n }\n for (i = len1; i < len2; i++) {\n let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild));\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n this.addChild(layer);\n }\n }\n\n clear() {\n for (let i = 0; i < this.children.length; i++) {\n (this.children[i] as RectTileLayer).clear();\n }\n this.modificationMarker = 0;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this {\n const childIndex: number = textureIndex / this.texPerChild >> 0;\n const textureId: number = textureIndex % this.texPerChild;\n\n if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) {\n this._lastLayer = (this.children[childIndex] as RectTileLayer);\n this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight);\n } else {\n this._lastLayer = null;\n }\n\n return this;\n }\n\n tileRotate(rotate: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileRotate(rotate);\n }\n return this;\n }\n\n tileAnimX(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimX(offset, count);\n }\n return this;\n }\n\n tileAnimY(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimY(offset, count);\n }\n return this;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this {\n let texture: Texture;\n let layer: RectTileLayer = null;\n let ind: number = 0;\n let children = this.children;\n\n this._lastLayer = null;\n if (typeof texture_ === \"number\") {\n let childIndex = texture_ / this.texPerChild >> 0;\n layer = children[childIndex] as RectTileLayer;\n\n if (!layer) {\n layer = children[0] as RectTileLayer;\n if (!layer) {\n return this;\n }\n ind = 0;\n } else {\n ind = texture_ % this.texPerChild;\n }\n\n texture = layer.textures[ind];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n let tex = child.textures;\n for (let j = 0; j < tex.length; j++) {\n if (tex[j].baseTexture === texture.baseTexture) {\n layer = child;\n ind = j;\n break;\n }\n }\n if (layer) {\n break;\n }\n }\n\n if (!layer) {\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n if (child.textures.length < this.texPerChild) {\n layer = child;\n ind = child.textures.length;\n child.textures.push(texture);\n break;\n }\n }\n if (!layer) {\n layer = new RectTileLayer(this.zIndex, texture);\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n children.push(layer);\n ind = 0;\n }\n }\n }\n\n this._lastLayer = layer;\n layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight);\n return this;\n }\n\n renderCanvas(renderer: any) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderCanvasCore(renderer);\n }\n }\n\n render(renderer: Renderer) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n //TODO: dont create new array, please\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n renderer.shader.bind(shader, false);\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin);\n }\n }\n\n isModified(anim: boolean) {\n let layers = this.children;\n if (this.modificationMarker !== layers.length) {\n return true;\n }\n for (let i = 0; i < layers.length; i++) {\n if ((layers[i] as RectTileLayer).isModified(anim)) {\n return true;\n }\n }\n return false;\n }\n\n clearModify() {\n let layers = this.children;\n this.modificationMarker = layers.length;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).clearModify();\n }\n }\n}","/// \n\nimport { Matrix } from '@pixi/math';\nimport { Graphics } from '@pixi/graphics';\n\nexport class GraphicsLayer extends Graphics {\n constructor(zIndex: number) {\n super();\n this.zIndex = zIndex;\n }\n\n renderCanvas(renderer: any) {\n let wt: Matrix = null;\n if (renderer.plugins.tilemap.dontUseTransform) {\n wt = this.transform.worldTransform;\n this.transform.worldTransform = Matrix.IDENTITY;\n }\n renderer.plugins.graphics.render(this);\n if (renderer.plugins.tilemap.dontUseTransform) {\n this.transform.worldTransform = wt;\n }\n renderer.context.globalAlpha = 1.0;\n }\n\n // renderWebGL(renderer: PIXI.Renderer) {\n // if (!this._webGL[renderer.CONTEXT_UID])\n // this.dirty++;\n // super.renderWebGL(renderer)\n // }\n\n isModified(anim: boolean): boolean {\n return false;\n }\n\n clearModify() {\n }\n}\n","/// \n\nimport { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, Renderer, Texture, GLTexture, resources } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Constant } from './Constant';\n\nexport interface IMultiTextureOptions {\n\tboundCountPerBuffer: number;\n\tboundSize: number;\n\tbufferSize: number;\n\tDO_CLEAR?: boolean;\n}\n\nexport class MultiTextureResource extends resources.Resource {\n\tconstructor(options: IMultiTextureOptions) {\n\t\tsuper(options.bufferSize, options.bufferSize);\n\n\t\tconst bounds = this.boundSprites;\n\t\tconst dirties = this.dirties;\n\t\tthis.boundSize = options.boundSize;\n\t\tfor (let j = 0; j < options.boundCountPerBuffer; j++) {\n\t\t\tconst spr = new Sprite();\n\t\t\tspr.position.x = options.boundSize * (j & 1);\n\t\t\tspr.position.y = options.boundSize * (j >> 1);\n\t\t\tbounds.push(spr);\n\t\t\tdirties.push(0);\n\t\t}\n\t\tthis.DO_CLEAR = !!options.DO_CLEAR;\n\t}\n\n\tDO_CLEAR = false;\n\tboundSize: number = 0;\n\t_clearBuffer: Uint8Array = null;\n\n\tbind(baseTexture: BaseTexture) {\n\t\tif (this.baseTex) {\n\t\t\tthrow new Error('Only one baseTexture is allowed for this resource!')\n\t\t}\n\t\tthis.baseTex = baseTexture;\n\t\tsuper.bind(baseTexture);\n\t}\n\n\tbaseTex: BaseTexture = null;\n\tboundSprites: Array = [];\n\tdirties: Array = [];\n\n\tsetTexture(ind: number, texture: Texture) {\n\t\tconst spr = this.boundSprites[ind];\n\t\tif (spr.texture.baseTexture === texture.baseTexture) {\n\t\t\treturn;\n\t\t}\n\t\tspr.texture = texture;\n\t\tthis.baseTex.update();\n\t\tthis.dirties[ind] = (this.baseTex as any).dirtyId;\n\t}\n\n\tupload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture) {\n\t\tconst { gl } = renderer as any;\n\n\t\tconst {width, height} = this;\n\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined ||\n\t\t\ttexture.alphaMode === ALPHA_MODES.UNPACK);\n\n\t\tif (glTexture.dirtyId < 0) {\n\t\t\t(glTexture as any).width = width;\n\t\t\t(glTexture as any).height = height;\n\n\t\t\tgl.texImage2D(texture.target, 0,\n\t\t\t\ttexture.format,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\t0,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tnull);\n\t\t}\n\n\t\tconst doClear = this.DO_CLEAR;\n\t\tif (doClear && !this._clearBuffer) {\n\t\t\tthis._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4);\n\t\t}\n\n\t\tconst bounds = this.boundSprites;\n\t\tfor (let i = 0; i < bounds.length; i++) {\n\t\t\tconst spr = bounds[i];\n\t\t\tconst tex = spr.texture.baseTexture;\n\t\t\tif (glTexture.dirtyId >= this.dirties[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst res = tex.resource as any;\n\t\t\tif (!tex.valid || !res || !res.source) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (doClear && (tex.width < this.boundSize || tex.height < this.boundSize))\n\t\t\t{\n\t\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\t\tspr.position.x,\n\t\t\t\t\tspr.position.y,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\ttexture.format,\n\t\t\t\t\ttexture.type,\n\t\t\t\t\tthis._clearBuffer);\n\t\t\t}\n\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\tspr.position.x,\n\t\t\t\tspr.position.y,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tres.source);\n\t\t}\n\n\t\treturn true;\n\t}\n}\n","import { Constant } from './Constant';\n\nimport type { TilemapShader } from './RectTileShader';\n\n\nexport function fillSamplers(shader: TilemapShader, maxTextures: number) {\n let sampleValues: Array = [];\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n shader.uniforms.uSamplers = sampleValues;\n\n let samplerSize: Array = [];\n for (let i = 0; i < maxTextures; i++) {\n samplerSize.push(1.0 / Constant.bufferSize);\n samplerSize.push(1.0 / Constant.bufferSize);\n }\n shader.uniforms.uSamplerSize = samplerSize;\n}\n\nexport function generateFragmentSrc(maxTextures: number, fragmentSrc: string) {\n return fragmentSrc.replace(/%count%/gi, maxTextures + \"\")\n .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n}\n\nexport function generateSampleSrc(maxTextures: number) {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n src += 'if(vTextureId <= -1.0) {';\n src += '\\n\\tcolor = shadowColor;';\n src += '\\n}';\n\n for (let i = 0; i < maxTextures; i++)\n {\n src += '\\nelse ';\n\n if(i < maxTextures-1)\n {\n src += 'if(textureId == ' + i + '.0)';\n }\n\n src += '\\n{';\n src += '\\n\\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);';\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n}\n","/// \n\nimport * as shaderGenerator from './shaderGenerator';\n\nimport { Buffer, Geometry, Shader } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nlet rectShaderFrag = `\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n`;\nlet rectShaderVert = `\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n`;\n\nexport abstract class TilemapShader extends Shader {\n\tmaxTextures = 0;\n\n\tconstructor(maxTextures: number, shaderVert: string, shaderFrag: string) {\n\t\tsuper(\n\t\t\tnew PIXI.Program(\n\t\t\t\tshaderVert,\n\t\t\t\tshaderFrag),\n\t\t\t{\n\t\t\t\tanimationFrame: new Float32Array(2),\n\t\t\t\tuSamplers: [],\n\t\t\t\tuSamplerSize: [],\n\t\t\t\tprojTransMatrix: new Matrix()\n\t\t\t}\n\t\t);\n\t\tthis.maxTextures = maxTextures;\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileShader extends TilemapShader {\n\tconstructor(maxTextures: number) {\n\t\tsuper(\n\t\t\tmaxTextures,\n\t\t\trectShaderVert,\n\t\t\tshaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)\n\t\t);\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileGeom extends Geometry {\n\tvertSize = 11;\n\tvertPerQuad = 4;\n\tstride = this.vertSize * 4;\n\tlastTimeAccess = 0;\n\n\tconstructor() {\n\t\tsuper();\n\t\tconst buf = this.buf = new Buffer(new Float32Array(2), true, false);\n\t\tthis.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0)\n\t\t\t.addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4)\n\t\t\t.addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4)\n\t\t\t.addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4)\n\t\t\t.addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4);\n\t}\n\n\tbuf: PIXI.Buffer;\n}","import { WRAP_MODES } from '@pixi/constants';\nimport { BaseTexture, Buffer, resources, ObjectRenderer, Texture, Renderer } from '@pixi/core';\nimport { Constant } from './Constant';\nimport { RectTileGeom, RectTileShader } from './RectTileShader';\nimport { MultiTextureResource } from './MultiTextureResource';\n\nimport type { TilemapShader } from './RectTileShader';\n\n/**\n * Renderer for rectangle tiles.\n */\nexport class TileRenderer extends ObjectRenderer {\n\trenderer: Renderer;\n\tgl: WebGLRenderingContext;\n\tsn: number = -1;\n\tindexBuffer: PIXI.Buffer = null;\n\tibLen: number = 0;\n\ttileAnim = [0, 0];\n\ttexLoc: Array = [];\n\n\trectShader: RectTileShader;\n\ttexResources: Array = [];\n\n\tconstructor(renderer: Renderer) {\n\t\tsuper(renderer);\n\t\tthis.rectShader = new RectTileShader(Constant.maxTextures);\n\t\tthis.indexBuffer = new Buffer(undefined, true, true);\n\t\tthis.checkIndexBuffer(2000);\n\t\tthis.initBounds();\n\t}\n\n\tinitBounds() {\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tfor (let i = 0; i < maxTextures; i++) {\n\t\t\tconst resource = new MultiTextureResource(Constant);\n\t\t\tconst baseTex = new BaseTexture(resource);\n\t\t\tbaseTex.scaleMode = Constant.SCALE_MODE;\n\t\t\tbaseTex.wrapMode = WRAP_MODES.CLAMP;\n\t\t\tthis.texResources.push(resource);\n\t\t}\n\t}\n\n\tbindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tlet samplerSize: Array = (shader as any).uniforms.uSamplerSize;\n\t\tthis.texLoc.length = 0;\n\t\tfor (let i = 0; i < textures.length; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trenderer.texture.bind(textures[i], i);\n\t\t\t//TODO: add resolution here\n\t\t\tsamplerSize[i * 2] = 1.0 / textures[i].baseTexture.width;\n\t\t\tsamplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height;\n\t\t}\n\t\t(shader as any).uniforms.uSamplerSize = samplerSize;\n\t}\n\n\tbindTextures(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tconst len = textures.length;\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tif (len > Constant.boundCountPerBuffer * maxTextures) {\n\t\t\treturn;\n\t\t}\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\tthis.bindTexturesWithoutRT(renderer, shader, textures);\n\t\t\treturn;\n\t\t}\n\n\t\tlet i = 0;\n\t\tfor (; i < len; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) continue;\n\t\t\tconst multi = this.texResources[i >> 2];\n\t\t\tmulti.setTexture(i & 3, texture);\n\t\t}\n\n\t\tlet gltsUsed = (i + 3) >> 2;\n\t\tfor (i = 0; i < gltsUsed; i++) {\n\t\t\t//remove \"i, true\" after resolving a bug\n\t\t\trenderer.texture.bind(this.texResources[i].baseTex, i);\n\t\t}\n\t}\n\n\tstart() {\n\t\t//sorry, nothing\n\t}\n\n\tcreateVb() {\n\t\tconst geom = new RectTileGeom();\n\t\tgeom.addIndex(this.indexBuffer);\n\t\tgeom.lastTimeAccess = Date.now();\n\t\treturn geom;\n\t}\n\n\tcheckIndexBuffer(size: number, vb: RectTileGeom = null) {\n\t\tconst totalIndices = size * 6;\n\n\t\tif (totalIndices <= this.ibLen) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet len = totalIndices;\n\t\twhile (len < totalIndices) {\n\t\t\tlen <<= 1;\n\t\t}\n\n\t\tthis.ibLen = totalIndices;\n\t\tthis.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size,\n\t\t\tConstant.use32bitIndex ? new Uint32Array(size * 6) : undefined));\n\n\t\t// \tTODO: create new index buffer instead?\n\t\t// if (vb) {\n\t\t// \tconst curIndex = vb.getIndex();\n\t\t// \tif (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) {\n\t\t// \t\tthis.swapIndex(vb, this.indexBuffer);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t// swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) {\n\t\t// let buffers = (geom as any).buffers;\n\t\t// const oldIndex = geom.getIndex();\n\t\t// let ind = buffers.indexOf(oldIndex);\n\t\t// if (ind >= 0) {\n\t\t// \tbuffers.splice(ind, 1);\n\t\t// }\n\t\t// geom.addIndex(indexBuf);\n\t// }\n\n\tgetShader(): TilemapShader {\n\t\treturn this.rectShader;\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\t// this.rectShader.destroy();\n\t\tthis.rectShader = null;\n\t}\n}\n\nRenderer.registerPlugin('tilemap', TileRenderer as any);\n","/// \n\nimport { Container } from '@pixi/display';\n\nimport type { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport type { Matrix } from '@pixi/math';\n\nexport class ZLayer extends Container {\n\n constructor(tilemap: Container, zIndex: number) {\n super();\n this.tilemap = tilemap;\n this.z = zIndex;\n }\n\n tilemap: any;\n z: number;\n zIndex: number;\n _previousLayers: number;\n canvasBuffer: HTMLCanvasElement;\n _tempRender: any;\n _lastAnimationFrame: number = -1;\n layerTransform: Matrix;\n\n clear() {\n let layers = this.children as Array;\n for (let i = 0; i < layers.length; i++)\n layers[i].clear();\n this._previousLayers = 0;\n }\n\n cacheIfDirty() {\n let tilemap: any = this.tilemap;\n let layers = this.children as Array;\n let modified = this._previousLayers !== layers.length;\n this._previousLayers = layers.length;\n let buf = this.canvasBuffer;\n let tempRender = this._tempRender;\n if (!buf) {\n buf = this.canvasBuffer = document.createElement('canvas');\n tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf});\n tempRender.context = tempRender.rootContext;\n tempRender.plugins.tilemap.dontUseTransform = true;\n }\n if (buf.width !== tilemap._layerWidth ||\n buf.height !== tilemap._layerHeight) {\n buf.width = tilemap._layerWidth;\n buf.height = tilemap._layerHeight;\n modified = true;\n }\n let i: number;\n if (!modified) {\n for (i = 0; i < layers.length; i++) {\n if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) {\n modified = true;\n break;\n }\n }\n }\n this._lastAnimationFrame = tilemap.animationFrame;\n if (modified) {\n if (tilemap._hackRenderer) {\n tilemap._hackRenderer(tempRender);\n }\n tempRender.context.clearRect(0, 0, buf.width, buf.height);\n for (i = 0; i < layers.length; i++) {\n layers[i].clearModify();\n layers[i].renderCanvas(tempRender);\n }\n }\n this.layerTransform = this.worldTransform;\n for (i = 0; i < layers.length; i++) {\n this.layerTransform = layers[i].worldTransform;\n break;\n }\n }\n\n renderCanvas(renderer: any) {\n this.cacheIfDirty();\n let wt = this.layerTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n let tilemap = this.tilemap;\n renderer.context.drawImage(this.canvasBuffer, 0, 0);\n }\n}\n","/// \n\nnamespace pixi_tilemap {\n (PIXI as any).tilemap = pixi_tilemap;\n}\n\n// This makes exporter.ts a module!\nexport default {}\n","import { CanvasTileRenderer } from './CanvasTileRenderer';\nimport { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport { Constant } from './Constant';\nimport { GraphicsLayer } from './GraphicsLayer';\nimport { MultiTextureResource } from './MultiTextureResource';\nimport { RectTileLayer } from './RectTileLayer';\nimport { TilemapShader, RectTileShader, RectTileGeom } from './RectTileShader';\nimport { TileRenderer } from './TileRenderer';\nimport { ZLayer } from './ZLayer';\n\nexport const pixi_tilemap = {\n CanvasTileRenderer,\n CompositeRectTileLayer,\n Constant,\n GraphicsLayer,\n MultiTextureResource,\n RectTileLayer,\n TilemapShader,\n RectTileShader,\n RectTileGeom,\n TileRenderer,\n ZLayer,\n};\n\nexport * from './CanvasTileRenderer';\nexport * from './CompositeRectTileLayer';\nexport * from './Constant';\nexport * from './exporter';\nexport * from './GraphicsLayer';\nexport * from './MultiTextureResource';\nexport * from './RectTileLayer';\nexport * from './RectTileShader';\nexport * from './shaderGenerator';\nexport * from './TileRenderer';\nexport * from './ZLayer';"],"names":["Texture","groupD8","DRAW_MODES","Container","Matrix","Graphics","Sprite","ALPHA_MODES","resources","shaderGenerator.fillSamplers","Shader","shaderGenerator.generateFragmentSrc","Buffer","Geometry","BaseTexture","WRAP_MODES","ObjectRenderer","Renderer","pixi_tilemap"],"mappings":";;;;;;;;;;;;;;;;;;;;;IASI,4BAAY,QAAkB;QAH9B,aAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAClB,qBAAgB,GAAG,KAAK,CAAC;QAGrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KAC1B;IACL,yBAAC;AAAD,CAAC,IAAA;AAED,IAAM,EAAE,GAAI,IAAY,CAAC,cAAc,CAAC;AAExC,IAAI,EAAE,EAAE;IACJ,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;;;AClBrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE;AACnC,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc;AACzC,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC;AACpF,QAAQ,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACnF,IAAI,OAAO,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAC;AACF;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AI,EAAE,GAAG,IAAI,CAAC,cAAc,CAAC;QAC7B,QAAQ,CAAC,OAAO,CAAC,YAAY,CACzB,EAAE,CAAC,CAAC,EACJ,EAAE,CAAC,CAAC,EACJ,EAAE,CAAC,CAAC,EACJ,EAAE,CAAC,CAAC,EACJ,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,UAAU,EAC3B,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,UAAU,CAC9B,CAAC;QACF,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC3B,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;KACvD;IACL,aAAC;AAAD,CApFA,CAA4Bd,iBAAS;;ACLrC,IAAU,YAAY,CAErB;AAFD,WAAU,YAAY;IACjB,IAAY,CAAC,OAAO,GAAG,YAAY,CAAC;AACzC,CAAC,EAFS,YAAY,KAAZ,YAAY;;ICQTe,cAAY,GAAG;IACxB,kBAAkB,oBAAA;IAClB,sBAAsB,wBAAA;IACtB,QAAQ,UAAA;IACR,aAAa,eAAA;IACb,oBAAoB,sBAAA;IACpB,aAAa,eAAA;IACb,aAAa,eAAA;IACb,cAAc,gBAAA;IACd,YAAY,cAAA;IACZ,YAAY,cAAA;IACZ,MAAM,QAAA;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"pixi-tilemap.js","sources":["../src/CanvasTileRenderer.ts","../node_modules/tslib/tslib.es6.js","../src/Constant.ts","../src/RectTileLayer.ts","../src/CompositeRectTileLayer.ts","../src/GraphicsLayer.ts","../src/MultiTextureResource.ts","../src/shaderGenerator.ts","../src/RectTileShader.ts","../src/TileRenderer.ts","../src/ZLayer.ts","../src/exporter.ts","../src/index.ts"],"sourcesContent":["/// \n\nimport { Renderer } from '@pixi/core';\n\nexport class CanvasTileRenderer {\n renderer: Renderer;\n tileAnim = [0, 0];\n dontUseTransform = false;\n\n constructor(renderer: Renderer) {\n this.renderer = renderer;\n this.tileAnim = [0, 0];\n }\n}\n\nconst cr = (PIXI as any).CanvasRenderer;\n\nif (cr) {\n cr.registerPlugin('tilemap', CanvasTileRenderer);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","export const Constant = {\n maxTextures: 16,\n bufferSize: 2048,\n boundSize: 1024,\n boundCountPerBuffer: 1,\n use32bitIndex: false,\n SCALE_MODE: PIXI.SCALE_MODES.LINEAR,\n DO_CLEAR: true\n};","/// \n\nimport { Container } from '@pixi/display';\nimport { Constant } from './Constant';\nimport { DRAW_MODES } from '@pixi/constants';\nimport { Texture, Renderer } from '@pixi/core';\nimport { TileRenderer } from './TileRenderer';\nimport { Matrix, groupD8 } from '@pixi/math';\n\nimport type { RectTileGeom } from './RectTileShader';\n\nexport const POINT_STRUCT_SIZE = 12;\n\nexport class RectTileLayer extends Container {\n constructor(zIndex: number, texture: Texture | Array) {\n super();\n this.initialize(zIndex, texture);\n }\n\n zIndex = 0;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n\n pointsBuf: Array = [];\n hasAnim = false;\n textures: Array;\n\n offsetX = 0;\n offsetY = 0;\n compositeParent = false;\n\n initialize(zIndex: number, textures: Texture | Array) {\n if (!textures) {\n textures = [];\n } else if (!(textures instanceof Array) && (textures as Texture).baseTexture) {\n textures = [textures as Texture];\n }\n this.textures = textures as Array;\n this.zIndex = zIndex;\n // this.visible = false;\n }\n\n clear() {\n this.pointsBuf.length = 0;\n this.modificationMarker = 0;\n this.hasAnim = false;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX: number, animY: number) {\n let texture: Texture;\n let textureIndex = 0;\n\n if (typeof texture_ === \"number\") {\n textureIndex = texture_;\n texture = this.textures[textureIndex];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n let found = false;\n let textureList = this.textures;\n for (let i = 0; i < textureList.length; i++) {\n if (textureList[i].baseTexture === texture.baseTexture) {\n textureIndex = i;\n found = true;\n break;\n }\n }\n\n if (!found) {\n // textureIndex = this.textures.length;\n // this.textures.push(texture);\n return false;\n }\n }\n\n this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate);\n return true;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number,\n animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this {\n let pb = this.pointsBuf;\n this.hasAnim = this.hasAnim || animX > 0 || animY > 0;\n pb.push(u);\n pb.push(v);\n pb.push(x);\n pb.push(y);\n pb.push(tileWidth);\n pb.push(tileHeight);\n pb.push(rotate);\n pb.push(animX | 0);\n pb.push(animY | 0);\n pb.push(textureIndex);\n pb.push(animCountX);\n pb.push(animCountY);\n\n return this;\n }\n\n tileRotate(rotate: number) {\n const pb = this.pointsBuf;\n pb[pb.length - 3] = rotate;\n }\n\n tileAnimX(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 5] = offset;\n pb[pb.length - 2] = count;\n }\n\n tileAnimY(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 4] = offset;\n pb[pb.length - 1] = count;\n }\n\n renderCanvas(renderer: any) {\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n this.renderCanvasCore(renderer);\n }\n\n renderCanvasCore(renderer: any) {\n if (this.textures.length === 0) return;\n let points = this.pointsBuf;\n renderer.context.fillStyle = '#000000';\n for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) {\n let x1 = points[i], y1 = points[i + 1];\n let x2 = points[i + 2], y2 = points[i + 3];\n let w = points[i + 4];\n let h = points[i + 5];\n var rotate = points[i + 6];\n x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0];\n y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1];\n let textureIndex = points[i + 9];\n // canvas does not work with rotate yet\n if (textureIndex >= 0) {\n renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h);\n } else {\n renderer.context.globalAlpha = 0.5;\n renderer.context.fillRect(x2, y2, w, h);\n renderer.context.globalAlpha = 1;\n }\n }\n }\n\n vbId = 0;\n vb: RectTileGeom = null;\n vbBuffer: ArrayBuffer = null;\n vbArray: Float32Array = null;\n vbInts: Uint32Array = null;\n\n destroyVb() {\n if (this.vb) {\n this.vb.destroy();\n this.vb = null;\n }\n }\n\n render(renderer: Renderer) {\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n this.renderWebGLCore(renderer, plugin);\n }\n\n renderWebGLCore(renderer: Renderer, plugin: TileRenderer) {\n let points = this.pointsBuf;\n if (points.length === 0) return;\n let rectsCount = points.length / POINT_STRUCT_SIZE;\n\n let shader = plugin.getShader();\n let textures = this.textures;\n if (textures.length === 0) return;\n\n plugin.bindTextures(renderer, shader, textures);\n renderer.shader.bind(shader, false);\n\n //lost context! recover!\n let vb = this.vb;\n if (!vb) {\n vb = plugin.createVb();\n this.vb = vb;\n this.vbId = (vb as any).id;\n this.vbBuffer = null;\n this.modificationMarker = 0;\n }\n\n plugin.checkIndexBuffer(rectsCount, vb);\n const boundCountPerBuffer = Constant.boundCountPerBuffer;\n\n let vertexBuf = vb.getBuffer('aVertexPosition');\n //if layer was changed, re-upload vertices\n let vertices = rectsCount * vb.vertPerQuad;\n if (vertices === 0) return;\n if (this.modificationMarker !== vertices) {\n this.modificationMarker = vertices;\n let vs = vb.stride * vertices;\n if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {\n //!@#$ happens, need resize\n let bk = vb.stride;\n while (bk < vs) {\n bk *= 2;\n }\n this.vbBuffer = new ArrayBuffer(bk);\n this.vbArray = new Float32Array(this.vbBuffer);\n this.vbInts = new Uint32Array(this.vbBuffer);\n vertexBuf.update(this.vbBuffer);\n }\n\n let arr = this.vbArray, ints = this.vbInts;\n //upload vertices!\n let sz = 0;\n //let tint = 0xffffffff;\n let textureId: number = 0;\n let shiftU: number = this.offsetX;\n let shiftV: number = this.offsetY;\n\n //let tint = 0xffffffff;\n let tint = -1;\n for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) {\n let eps = 0.5;\n if (this.compositeParent) {\n if (boundCountPerBuffer > 1) {\n //TODO: what if its more than 4?\n textureId = (points[i + 9] >> 2);\n shiftU = this.offsetX * (points[i + 9] & 1);\n shiftV = this.offsetY * ((points[i + 9] >> 1) & 1);\n } else {\n textureId = points[i + 9];\n shiftU = 0;\n shiftV = 0;\n }\n }\n let x = points[i + 2], y = points[i + 3];\n let w = points[i + 4], h = points[i + 5];\n let u = points[i] + shiftU, v = points[i + 1] + shiftV;\n let rotate = points[i + 6];\n\n const animX = points[i + 7], animY = points[i + 8];\n const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024;\n const animXEncoded = animX + (animWidth * 2048);\n const animYEncoded = animY + (animHeight * 2048);\n\n let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number;\n if (rotate === 0) {\n u0 = u;\n v0 = v;\n u1 = u + w;\n v1 = v;\n u2 = u + w;\n v2 = v + h;\n u3 = u;\n v3 = v + h;\n } else {\n let w2 = w / 2;\n let h2 = h / 2;\n if (rotate % 4 !== 0) {\n w2 = h / 2;\n h2 = w / 2;\n }\n const cX = u + w2;\n const cY = v + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW);\n u0 = cX + (w2 * groupD8.uX(rotate));\n v0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n u1 = cX + (w2 * groupD8.uX(rotate));\n v1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u2 = cX + (w2 * groupD8.uX(rotate));\n v2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u3 = cX + (w2 * groupD8.uX(rotate));\n v3 = cY + (h2 * groupD8.uY(rotate));\n }\n\n arr[sz++] = x;\n arr[sz++] = y;\n arr[sz++] = u0;\n arr[sz++] = v0;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y;\n arr[sz++] = u1;\n arr[sz++] = v1;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y + h;\n arr[sz++] = u2;\n arr[sz++] = v2;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x;\n arr[sz++] = y + h;\n arr[sz++] = u3;\n arr[sz++] = v3;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n }\n\n vertexBuf.update(arr);\n }\n\n (renderer.geometry as any).bind(vb, shader);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES, rectsCount * 6, 0);\n }\n\n isModified(anim: boolean) {\n if (this.modificationMarker !== this.pointsBuf.length ||\n anim && this.hasAnim) {\n return true;\n }\n return false;\n }\n\n clearModify() {\n this.modificationMarker = this.pointsBuf.length;\n }\n\n destroy(options?: any) {\n super.destroy(options);\n this.destroyVb();\n }\n}\n","/// \n\nimport { Container } from '@pixi/display';\nimport { Texture, Renderer } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { Constant } from './Constant';\nimport { RectTileLayer } from './RectTileLayer';\n\nexport class CompositeRectTileLayer extends Container {\n constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n super();\n this.initialize.apply(this, arguments);\n }\n\n updateTransform() {\n (this as any).displayObjectUpdateTransform();\n }\n\n z: number;\n zIndex: number;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n _lastLayer: RectTileLayer = null;\n\n texPerChild: number;\n\n initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n if (texPerChild as any === true) {\n //old format, ignore it!\n texPerChild = 0;\n }\n this.z = this.zIndex = zIndex;\n this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures;\n if (bitmaps) {\n this.setBitmaps(bitmaps);\n }\n }\n\n setBitmaps(bitmaps: Array) {\n for (let i=0;i 5.2.1, it does not exist there.`);\n }\n }\n let texPerChild = this.texPerChild;\n let len1 = this.children.length;\n let len2 = Math.ceil(bitmaps.length / texPerChild);\n let i: number;\n for (i = 0; i < len1; i++) {\n (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);\n }\n for (i = len1; i < len2; i++) {\n let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild));\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n this.addChild(layer);\n }\n }\n\n clear() {\n for (let i = 0; i < this.children.length; i++) {\n (this.children[i] as RectTileLayer).clear();\n }\n this.modificationMarker = 0;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this {\n const childIndex: number = textureIndex / this.texPerChild >> 0;\n const textureId: number = textureIndex % this.texPerChild;\n\n if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) {\n this._lastLayer = (this.children[childIndex] as RectTileLayer);\n this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight);\n } else {\n this._lastLayer = null;\n }\n\n return this;\n }\n\n tileRotate(rotate: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileRotate(rotate);\n }\n return this;\n }\n\n tileAnimX(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimX(offset, count);\n }\n return this;\n }\n\n tileAnimY(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimY(offset, count);\n }\n return this;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this {\n let texture: Texture;\n let layer: RectTileLayer = null;\n let ind: number = 0;\n let children = this.children;\n\n this._lastLayer = null;\n if (typeof texture_ === \"number\") {\n let childIndex = texture_ / this.texPerChild >> 0;\n layer = children[childIndex] as RectTileLayer;\n\n if (!layer) {\n layer = children[0] as RectTileLayer;\n if (!layer) {\n return this;\n }\n ind = 0;\n } else {\n ind = texture_ % this.texPerChild;\n }\n\n texture = layer.textures[ind];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n let tex = child.textures;\n for (let j = 0; j < tex.length; j++) {\n if (tex[j].baseTexture === texture.baseTexture) {\n layer = child;\n ind = j;\n break;\n }\n }\n if (layer) {\n break;\n }\n }\n\n if (!layer) {\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n if (child.textures.length < this.texPerChild) {\n layer = child;\n ind = child.textures.length;\n child.textures.push(texture);\n break;\n }\n }\n if (!layer) {\n layer = new RectTileLayer(this.zIndex, texture);\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n children.push(layer);\n ind = 0;\n }\n }\n }\n\n this._lastLayer = layer;\n layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight);\n return this;\n }\n\n renderCanvas(renderer: any) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderCanvasCore(renderer);\n }\n }\n\n render(renderer: Renderer) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n //TODO: dont create new array, please\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n renderer.shader.bind(shader, false);\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin);\n }\n }\n\n isModified(anim: boolean) {\n let layers = this.children;\n if (this.modificationMarker !== layers.length) {\n return true;\n }\n for (let i = 0; i < layers.length; i++) {\n if ((layers[i] as RectTileLayer).isModified(anim)) {\n return true;\n }\n }\n return false;\n }\n\n clearModify() {\n let layers = this.children;\n this.modificationMarker = layers.length;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).clearModify();\n }\n }\n}","/// \n\nimport { Matrix } from '@pixi/math';\nimport { Graphics } from '@pixi/graphics';\n\nexport class GraphicsLayer extends Graphics {\n constructor(zIndex: number) {\n super();\n this.zIndex = zIndex;\n }\n\n renderCanvas(renderer: any) {\n let wt: Matrix = null;\n if (renderer.plugins.tilemap.dontUseTransform) {\n wt = this.transform.worldTransform;\n this.transform.worldTransform = Matrix.IDENTITY;\n }\n renderer.plugins.graphics.render(this);\n if (renderer.plugins.tilemap.dontUseTransform) {\n this.transform.worldTransform = wt;\n }\n renderer.context.globalAlpha = 1.0;\n }\n\n // renderWebGL(renderer: PIXI.Renderer) {\n // if (!this._webGL[renderer.CONTEXT_UID])\n // this.dirty++;\n // super.renderWebGL(renderer)\n // }\n\n isModified(anim: boolean): boolean {\n return false;\n }\n\n clearModify() {\n }\n}\n","/// \n\nimport { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, Renderer, Texture, GLTexture, resources } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Constant } from './Constant';\n\nexport interface IMultiTextureOptions {\n\tboundCountPerBuffer: number;\n\tboundSize: number;\n\tbufferSize: number;\n\tDO_CLEAR?: boolean;\n}\n\nexport class MultiTextureResource extends resources.Resource {\n\tconstructor(options: IMultiTextureOptions) {\n\t\tsuper(options.bufferSize, options.bufferSize);\n\n\t\tconst bounds = this.boundSprites;\n\t\tconst dirties = this.dirties;\n\t\tthis.boundSize = options.boundSize;\n\t\tfor (let j = 0; j < options.boundCountPerBuffer; j++) {\n\t\t\tconst spr = new Sprite();\n\t\t\tspr.position.x = options.boundSize * (j & 1);\n\t\t\tspr.position.y = options.boundSize * (j >> 1);\n\t\t\tbounds.push(spr);\n\t\t\tdirties.push(0);\n\t\t}\n\t\tthis.DO_CLEAR = !!options.DO_CLEAR;\n\t}\n\n\tDO_CLEAR = false;\n\tboundSize: number = 0;\n\t_clearBuffer: Uint8Array = null;\n\n\tbind(baseTexture: BaseTexture) {\n\t\tif (this.baseTex) {\n\t\t\tthrow new Error('Only one baseTexture is allowed for this resource!')\n\t\t}\n\t\tthis.baseTex = baseTexture;\n\t\tsuper.bind(baseTexture);\n\t}\n\n\tbaseTex: BaseTexture = null;\n\tboundSprites: Array = [];\n\tdirties: Array = [];\n\n\tsetTexture(ind: number, texture: Texture) {\n\t\tconst spr = this.boundSprites[ind];\n\t\tif (spr.texture.baseTexture === texture.baseTexture) {\n\t\t\treturn;\n\t\t}\n\t\tspr.texture = texture;\n\t\tthis.baseTex.update();\n\t\tthis.dirties[ind] = (this.baseTex as any).dirtyId;\n\t}\n\n\tupload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture) {\n\t\tconst { gl } = renderer as any;\n\n\t\tconst {width, height} = this;\n\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined ||\n\t\t\ttexture.alphaMode === ALPHA_MODES.UNPACK);\n\n\t\tif (glTexture.dirtyId < 0) {\n\t\t\t(glTexture as any).width = width;\n\t\t\t(glTexture as any).height = height;\n\n\t\t\tgl.texImage2D(texture.target, 0,\n\t\t\t\ttexture.format,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\t0,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tnull);\n\t\t}\n\n\t\tconst doClear = this.DO_CLEAR;\n\t\tif (doClear && !this._clearBuffer) {\n\t\t\tthis._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4);\n\t\t}\n\n\t\tconst bounds = this.boundSprites;\n\t\tfor (let i = 0; i < bounds.length; i++) {\n\t\t\tconst spr = bounds[i];\n\t\t\tconst tex = spr.texture.baseTexture;\n\t\t\tif (glTexture.dirtyId >= this.dirties[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst res = tex.resource as any;\n\t\t\tif (!tex.valid || !res || !res.source) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (doClear && (tex.width < this.boundSize || tex.height < this.boundSize))\n\t\t\t{\n\t\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\t\tspr.position.x,\n\t\t\t\t\tspr.position.y,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\ttexture.format,\n\t\t\t\t\ttexture.type,\n\t\t\t\t\tthis._clearBuffer);\n\t\t\t}\n\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\tspr.position.x,\n\t\t\t\tspr.position.y,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tres.source);\n\t\t}\n\n\t\treturn true;\n\t}\n}\n","import { Constant } from './Constant';\n\nimport type { TilemapShader } from './RectTileShader';\n\n\nexport function fillSamplers(shader: TilemapShader, maxTextures: number) {\n let sampleValues: Array = [];\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n shader.uniforms.uSamplers = sampleValues;\n\n let samplerSize: Array = [];\n for (let i = 0; i < maxTextures; i++) {\n samplerSize.push(1.0 / Constant.bufferSize);\n samplerSize.push(1.0 / Constant.bufferSize);\n }\n shader.uniforms.uSamplerSize = samplerSize;\n}\n\nexport function generateFragmentSrc(maxTextures: number, fragmentSrc: string) {\n return fragmentSrc.replace(/%count%/gi, maxTextures + \"\")\n .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n}\n\nexport function generateSampleSrc(maxTextures: number) {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n src += 'if(vTextureId <= -1.0) {';\n src += '\\n\\tcolor = shadowColor;';\n src += '\\n}';\n\n for (let i = 0; i < maxTextures; i++)\n {\n src += '\\nelse ';\n\n if(i < maxTextures-1)\n {\n src += 'if(textureId == ' + i + '.0)';\n }\n\n src += '\\n{';\n src += '\\n\\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);';\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n}\n","/// \n\nimport * as shaderGenerator from './shaderGenerator';\n\nimport { Buffer, Geometry, Shader } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nlet rectShaderFrag = `\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n`;\nlet rectShaderVert = `\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n`;\n\nexport abstract class TilemapShader extends Shader {\n\tmaxTextures = 0;\n\n\tconstructor(maxTextures: number, shaderVert: string, shaderFrag: string) {\n\t\tsuper(\n\t\t\tnew PIXI.Program(\n\t\t\t\tshaderVert,\n\t\t\t\tshaderFrag),\n\t\t\t{\n\t\t\t\tanimationFrame: new Float32Array(2),\n\t\t\t\tuSamplers: [],\n\t\t\t\tuSamplerSize: [],\n\t\t\t\tprojTransMatrix: new Matrix()\n\t\t\t}\n\t\t);\n\t\tthis.maxTextures = maxTextures;\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileShader extends TilemapShader {\n\tconstructor(maxTextures: number) {\n\t\tsuper(\n\t\t\tmaxTextures,\n\t\t\trectShaderVert,\n\t\t\tshaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)\n\t\t);\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileGeom extends Geometry {\n\tvertSize = 11;\n\tvertPerQuad = 4;\n\tstride = this.vertSize * 4;\n\tlastTimeAccess = 0;\n\n\tconstructor() {\n\t\tsuper();\n\t\tconst buf = this.buf = new Buffer(new Float32Array(2), true, false);\n\t\tthis.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0)\n\t\t\t.addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4)\n\t\t\t.addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4)\n\t\t\t.addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4)\n\t\t\t.addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4);\n\t}\n\n\tbuf: PIXI.Buffer;\n}","import { WRAP_MODES } from '@pixi/constants';\nimport { BaseTexture, Buffer, resources, ObjectRenderer, Texture, Renderer } from '@pixi/core';\nimport { Constant } from './Constant';\nimport { RectTileGeom, RectTileShader } from './RectTileShader';\nimport { MultiTextureResource } from './MultiTextureResource';\n\nimport type { TilemapShader } from './RectTileShader';\n\n/**\n * Renderer for rectangle tiles.\n */\nexport class TileRenderer extends ObjectRenderer {\n\trenderer: Renderer;\n\tgl: WebGLRenderingContext;\n\tsn: number = -1;\n\tindexBuffer: PIXI.Buffer = null;\n\tibLen: number = 0;\n\ttileAnim = [0, 0];\n\ttexLoc: Array = [];\n\n\trectShader: RectTileShader;\n\ttexResources: Array = [];\n\n\tconstructor(renderer: Renderer) {\n\t\tsuper(renderer);\n\t\tthis.rectShader = new RectTileShader(Constant.maxTextures);\n\t\tthis.indexBuffer = new Buffer(undefined, true, true);\n\t\tthis.checkIndexBuffer(2000);\n\t\tthis.initBounds();\n\t}\n\n\tinitBounds() {\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tfor (let i = 0; i < maxTextures; i++) {\n\t\t\tconst resource = new MultiTextureResource(Constant);\n\t\t\tconst baseTex = new BaseTexture(resource);\n\t\t\tbaseTex.scaleMode = Constant.SCALE_MODE;\n\t\t\tbaseTex.wrapMode = WRAP_MODES.CLAMP;\n\t\t\tthis.texResources.push(resource);\n\t\t}\n\t}\n\n\tbindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tlet samplerSize: Array = (shader as any).uniforms.uSamplerSize;\n\t\tthis.texLoc.length = 0;\n\t\tfor (let i = 0; i < textures.length; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trenderer.texture.bind(textures[i], i);\n\t\t\t//TODO: add resolution here\n\t\t\tsamplerSize[i * 2] = 1.0 / textures[i].baseTexture.width;\n\t\t\tsamplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height;\n\t\t}\n\t\t(shader as any).uniforms.uSamplerSize = samplerSize;\n\t}\n\n\tbindTextures(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tconst len = textures.length;\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tif (len > Constant.boundCountPerBuffer * maxTextures) {\n\t\t\treturn;\n\t\t}\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\tthis.bindTexturesWithoutRT(renderer, shader, textures);\n\t\t\treturn;\n\t\t}\n\n\t\tlet i = 0;\n\t\tfor (; i < len; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) continue;\n\t\t\tconst multi = this.texResources[i >> 2];\n\t\t\tmulti.setTexture(i & 3, texture);\n\t\t}\n\n\t\tlet gltsUsed = (i + 3) >> 2;\n\t\tfor (i = 0; i < gltsUsed; i++) {\n\t\t\t//remove \"i, true\" after resolving a bug\n\t\t\trenderer.texture.bind(this.texResources[i].baseTex, i);\n\t\t}\n\t}\n\n\tstart() {\n\t\t//sorry, nothing\n\t}\n\n\tcreateVb() {\n\t\tconst geom = new RectTileGeom();\n\t\tgeom.addIndex(this.indexBuffer);\n\t\tgeom.lastTimeAccess = Date.now();\n\t\treturn geom;\n\t}\n\n\tcheckIndexBuffer(size: number, vb: RectTileGeom = null) {\n\t\tconst totalIndices = size * 6;\n\n\t\tif (totalIndices <= this.ibLen) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet len = totalIndices;\n\t\twhile (len < totalIndices) {\n\t\t\tlen <<= 1;\n\t\t}\n\n\t\tthis.ibLen = totalIndices;\n\t\tthis.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size,\n\t\t\tConstant.use32bitIndex ? new Uint32Array(size * 6) : undefined));\n\n\t\t// \tTODO: create new index buffer instead?\n\t\t// if (vb) {\n\t\t// \tconst curIndex = vb.getIndex();\n\t\t// \tif (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) {\n\t\t// \t\tthis.swapIndex(vb, this.indexBuffer);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t// swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) {\n\t\t// let buffers = (geom as any).buffers;\n\t\t// const oldIndex = geom.getIndex();\n\t\t// let ind = buffers.indexOf(oldIndex);\n\t\t// if (ind >= 0) {\n\t\t// \tbuffers.splice(ind, 1);\n\t\t// }\n\t\t// geom.addIndex(indexBuf);\n\t// }\n\n\tgetShader(): TilemapShader {\n\t\treturn this.rectShader;\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\t// this.rectShader.destroy();\n\t\tthis.rectShader = null;\n\t}\n}\n\nRenderer.registerPlugin('tilemap', TileRenderer as any);\n","/// \n\nimport { Container } from '@pixi/display';\n\nimport type { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport type { Matrix } from '@pixi/math';\n\nexport class ZLayer extends Container {\n\n constructor(tilemap: Container, zIndex: number) {\n super();\n this.tilemap = tilemap;\n this.z = zIndex;\n }\n\n tilemap: any;\n z: number;\n zIndex: number;\n _previousLayers: number;\n canvasBuffer: HTMLCanvasElement;\n _tempRender: any;\n _lastAnimationFrame: number = -1;\n layerTransform: Matrix;\n\n clear() {\n let layers = this.children as Array;\n for (let i = 0; i < layers.length; i++)\n layers[i].clear();\n this._previousLayers = 0;\n }\n\n cacheIfDirty() {\n let tilemap: any = this.tilemap;\n let layers = this.children as Array;\n let modified = this._previousLayers !== layers.length;\n this._previousLayers = layers.length;\n let buf = this.canvasBuffer;\n let tempRender = this._tempRender;\n if (!buf) {\n buf = this.canvasBuffer = document.createElement('canvas');\n tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf});\n tempRender.context = tempRender.rootContext;\n tempRender.plugins.tilemap.dontUseTransform = true;\n }\n if (buf.width !== tilemap._layerWidth ||\n buf.height !== tilemap._layerHeight) {\n buf.width = tilemap._layerWidth;\n buf.height = tilemap._layerHeight;\n modified = true;\n }\n let i: number;\n if (!modified) {\n for (i = 0; i < layers.length; i++) {\n if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) {\n modified = true;\n break;\n }\n }\n }\n this._lastAnimationFrame = tilemap.animationFrame;\n if (modified) {\n if (tilemap._hackRenderer) {\n tilemap._hackRenderer(tempRender);\n }\n tempRender.context.clearRect(0, 0, buf.width, buf.height);\n for (i = 0; i < layers.length; i++) {\n layers[i].clearModify();\n layers[i].renderCanvas(tempRender);\n }\n }\n this.layerTransform = this.worldTransform;\n for (i = 0; i < layers.length; i++) {\n this.layerTransform = layers[i].worldTransform;\n break;\n }\n }\n\n renderCanvas(renderer: any) {\n this.cacheIfDirty();\n let wt = this.layerTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n let tilemap = this.tilemap;\n renderer.context.drawImage(this.canvasBuffer, 0, 0);\n }\n}\n","/// \n\nnamespace pixi_tilemap {\n (PIXI as any).tilemap = pixi_tilemap;\n}\n\n// This makes exporter.ts a module!\nexport default {}\n","import { CanvasTileRenderer } from './CanvasTileRenderer';\nimport { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport { Constant } from './Constant';\nimport { GraphicsLayer } from './GraphicsLayer';\nimport { MultiTextureResource } from './MultiTextureResource';\nimport { RectTileLayer } from './RectTileLayer';\nimport { TilemapShader, RectTileShader, RectTileGeom } from './RectTileShader';\nimport { TileRenderer } from './TileRenderer';\nimport { ZLayer } from './ZLayer';\n\nexport const pixi_tilemap = {\n CanvasTileRenderer,\n CompositeRectTileLayer,\n Constant,\n GraphicsLayer,\n MultiTextureResource,\n RectTileLayer,\n TilemapShader,\n RectTileShader,\n RectTileGeom,\n TileRenderer,\n ZLayer,\n};\n\nexport * from './CanvasTileRenderer';\nexport * from './CompositeRectTileLayer';\nexport * from './Constant';\nexport * from './exporter';\nexport * from './GraphicsLayer';\nexport * from './MultiTextureResource';\nexport * from './RectTileLayer';\nexport * from './RectTileShader';\nexport * from './shaderGenerator';\nexport * from './TileRenderer';\nexport * from './ZLayer';"],"names":["Texture","groupD8","DRAW_MODES","Container","Matrix","Graphics","Sprite","ALPHA_MODES","resources","shaderGenerator.fillSamplers","Shader","shaderGenerator.generateFragmentSrc","Buffer","Geometry","BaseTexture","WRAP_MODES","ObjectRenderer","Renderer","pixi_tilemap"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;IASI,4BAAY,QAAkB;QAH9B,aAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAClB,qBAAgB,GAAG,KAAK,CAAC;QAGrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KAC1B;IACL,yBAAC;AAAD,CAAC,IAAA;AAED,IAAM,EAAE,GAAI,IAAY,CAAC,cAAc,CAAC;AAExC,IAAI,EAAE,EAAE;IACJ,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;;;AClBrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE;AACnC,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc;AACzC,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC;AACpF,QAAQ,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACnF,IAAI,OAAO,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAC;AACF;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AI,EAAE,GAAG,IAAI,CAAC,cAAc,CAAC;QAC7B,QAAQ,CAAC,OAAO,CAAC,YAAY,CACzB,EAAE,CAAC,CAAC,EACJ,EAAE,CAAC,CAAC,EACJ,EAAE,CAAC,CAAC,EACJ,EAAE,CAAC,CAAC,EACJ,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,UAAU,EAC3B,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,UAAU,CAC9B,CAAC;QACF,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC3B,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;KACvD;IACL,aAAC;AAAD,CApFA,CAA4Bd,iBAAS;;ACLrC,IAAU,YAAY,CAErB;AAFD,WAAU,YAAY;IACjB,IAAY,CAAC,OAAO,GAAG,YAAY,CAAC;AACzC,CAAC,EAFS,YAAY,KAAZ,YAAY;;ICQTe,cAAY,GAAG;IACxB,kBAAkB,oBAAA;IAClB,sBAAsB,wBAAA;IACtB,QAAQ,UAAA;IACR,aAAa,eAAA;IACb,oBAAoB,sBAAA;IACpB,aAAa,eAAA;IACb,aAAa,eAAA;IACb,cAAc,gBAAA;IACd,YAAY,cAAA;IACZ,YAAY,cAAA;IACZ,MAAM,QAAA;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/pixi-tilemap.umd.js b/dist/pixi-tilemap.umd.js index 96169a07..aa4027bc 100644 --- a/dist/pixi-tilemap.umd.js +++ b/dist/pixi-tilemap.umd.js @@ -1,6 +1,8 @@ +/* eslint-disable */ + /*! * pixi-tilemap - v2.0.6 - * Compiled Fri, 14 Aug 2020 02:19:53 UTC + * Compiled Fri, 14 Aug 2020 02:36:52 UTC * * pixi-tilemap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license diff --git a/dist/pixi-tilemap.umd.js.map b/dist/pixi-tilemap.umd.js.map index 8ac2512c..a8eeca56 100644 --- a/dist/pixi-tilemap.umd.js.map +++ b/dist/pixi-tilemap.umd.js.map @@ -1 +1 @@ -{"version":3,"file":"pixi-tilemap.umd.js","sources":["../src/CanvasTileRenderer.ts","../node_modules/tslib/tslib.es6.js","../src/Constant.ts","../src/RectTileLayer.ts","../src/CompositeRectTileLayer.ts","../src/GraphicsLayer.ts","../src/MultiTextureResource.ts","../src/shaderGenerator.ts","../src/RectTileShader.ts","../src/TileRenderer.ts","../src/ZLayer.ts","../src/exporter.ts","../src/index.ts"],"sourcesContent":["/// \n\nimport { Renderer } from '@pixi/core';\n\nexport class CanvasTileRenderer {\n renderer: Renderer;\n tileAnim = [0, 0];\n dontUseTransform = false;\n\n constructor(renderer: Renderer) {\n this.renderer = renderer;\n this.tileAnim = [0, 0];\n }\n}\n\nconst cr = (PIXI as any).CanvasRenderer;\n\nif (cr) {\n cr.registerPlugin('tilemap', CanvasTileRenderer);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","export const Constant = {\n maxTextures: 16,\n bufferSize: 2048,\n boundSize: 1024,\n boundCountPerBuffer: 1,\n use32bitIndex: false,\n SCALE_MODE: PIXI.SCALE_MODES.LINEAR,\n DO_CLEAR: true\n};","/// \n\nimport { Container } from '@pixi/display';\nimport { Constant } from './Constant';\nimport { DRAW_MODES } from '@pixi/constants';\nimport { Texture, Renderer } from '@pixi/core';\nimport { TileRenderer } from './TileRenderer';\nimport { Matrix, groupD8 } from '@pixi/math';\n\nimport type { RectTileGeom } from './RectTileShader';\n\nexport const POINT_STRUCT_SIZE = 12;\n\nexport class RectTileLayer extends Container {\n constructor(zIndex: number, texture: Texture | Array) {\n super();\n this.initialize(zIndex, texture);\n }\n\n zIndex = 0;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n\n pointsBuf: Array = [];\n hasAnim = false;\n textures: Array;\n\n offsetX = 0;\n offsetY = 0;\n compositeParent = false;\n\n initialize(zIndex: number, textures: Texture | Array) {\n if (!textures) {\n textures = [];\n } else if (!(textures instanceof Array) && (textures as Texture).baseTexture) {\n textures = [textures as Texture];\n }\n this.textures = textures as Array;\n this.zIndex = zIndex;\n // this.visible = false;\n }\n\n clear() {\n this.pointsBuf.length = 0;\n this.modificationMarker = 0;\n this.hasAnim = false;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX: number, animY: number) {\n let texture: Texture;\n let textureIndex = 0;\n\n if (typeof texture_ === \"number\") {\n textureIndex = texture_;\n texture = this.textures[textureIndex];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n let found = false;\n let textureList = this.textures;\n for (let i = 0; i < textureList.length; i++) {\n if (textureList[i].baseTexture === texture.baseTexture) {\n textureIndex = i;\n found = true;\n break;\n }\n }\n\n if (!found) {\n // textureIndex = this.textures.length;\n // this.textures.push(texture);\n return false;\n }\n }\n\n this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate);\n return true;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number,\n animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this {\n let pb = this.pointsBuf;\n this.hasAnim = this.hasAnim || animX > 0 || animY > 0;\n pb.push(u);\n pb.push(v);\n pb.push(x);\n pb.push(y);\n pb.push(tileWidth);\n pb.push(tileHeight);\n pb.push(rotate);\n pb.push(animX | 0);\n pb.push(animY | 0);\n pb.push(textureIndex);\n pb.push(animCountX);\n pb.push(animCountY);\n\n return this;\n }\n\n tileRotate(rotate: number) {\n const pb = this.pointsBuf;\n pb[pb.length - 3] = rotate;\n }\n\n tileAnimX(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 5] = offset;\n pb[pb.length - 2] = count;\n }\n\n tileAnimY(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 4] = offset;\n pb[pb.length - 1] = count;\n }\n\n renderCanvas(renderer: any) {\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n this.renderCanvasCore(renderer);\n }\n\n renderCanvasCore(renderer: any) {\n if (this.textures.length === 0) return;\n let points = this.pointsBuf;\n renderer.context.fillStyle = '#000000';\n for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) {\n let x1 = points[i], y1 = points[i + 1];\n let x2 = points[i + 2], y2 = points[i + 3];\n let w = points[i + 4];\n let h = points[i + 5];\n var rotate = points[i + 6];\n x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0];\n y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1];\n let textureIndex = points[i + 9];\n // canvas does not work with rotate yet\n if (textureIndex >= 0) {\n renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h);\n } else {\n renderer.context.globalAlpha = 0.5;\n renderer.context.fillRect(x2, y2, w, h);\n renderer.context.globalAlpha = 1;\n }\n }\n }\n\n vbId = 0;\n vb: RectTileGeom = null;\n vbBuffer: ArrayBuffer = null;\n vbArray: Float32Array = null;\n vbInts: Uint32Array = null;\n\n destroyVb() {\n if (this.vb) {\n this.vb.destroy();\n this.vb = null;\n }\n }\n\n render(renderer: Renderer) {\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n this.renderWebGLCore(renderer, plugin);\n }\n\n renderWebGLCore(renderer: Renderer, plugin: TileRenderer) {\n let points = this.pointsBuf;\n if (points.length === 0) return;\n let rectsCount = points.length / POINT_STRUCT_SIZE;\n\n let shader = plugin.getShader();\n let textures = this.textures;\n if (textures.length === 0) return;\n\n plugin.bindTextures(renderer, shader, textures);\n renderer.shader.bind(shader, false);\n\n //lost context! recover!\n let vb = this.vb;\n if (!vb) {\n vb = plugin.createVb();\n this.vb = vb;\n this.vbId = (vb as any).id;\n this.vbBuffer = null;\n this.modificationMarker = 0;\n }\n\n plugin.checkIndexBuffer(rectsCount, vb);\n const boundCountPerBuffer = Constant.boundCountPerBuffer;\n\n let vertexBuf = vb.getBuffer('aVertexPosition');\n //if layer was changed, re-upload vertices\n let vertices = rectsCount * vb.vertPerQuad;\n if (vertices === 0) return;\n if (this.modificationMarker !== vertices) {\n this.modificationMarker = vertices;\n let vs = vb.stride * vertices;\n if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {\n //!@#$ happens, need resize\n let bk = vb.stride;\n while (bk < vs) {\n bk *= 2;\n }\n this.vbBuffer = new ArrayBuffer(bk);\n this.vbArray = new Float32Array(this.vbBuffer);\n this.vbInts = new Uint32Array(this.vbBuffer);\n vertexBuf.update(this.vbBuffer);\n }\n\n let arr = this.vbArray, ints = this.vbInts;\n //upload vertices!\n let sz = 0;\n //let tint = 0xffffffff;\n let textureId: number = 0;\n let shiftU: number = this.offsetX;\n let shiftV: number = this.offsetY;\n\n //let tint = 0xffffffff;\n let tint = -1;\n for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) {\n let eps = 0.5;\n if (this.compositeParent) {\n if (boundCountPerBuffer > 1) {\n //TODO: what if its more than 4?\n textureId = (points[i + 9] >> 2);\n shiftU = this.offsetX * (points[i + 9] & 1);\n shiftV = this.offsetY * ((points[i + 9] >> 1) & 1);\n } else {\n textureId = points[i + 9];\n shiftU = 0;\n shiftV = 0;\n }\n }\n let x = points[i + 2], y = points[i + 3];\n let w = points[i + 4], h = points[i + 5];\n let u = points[i] + shiftU, v = points[i + 1] + shiftV;\n let rotate = points[i + 6];\n\n const animX = points[i + 7], animY = points[i + 8];\n const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024;\n const animXEncoded = animX + (animWidth * 2048);\n const animYEncoded = animY + (animHeight * 2048);\n\n let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number;\n if (rotate === 0) {\n u0 = u;\n v0 = v;\n u1 = u + w;\n v1 = v;\n u2 = u + w;\n v2 = v + h;\n u3 = u;\n v3 = v + h;\n } else {\n let w2 = w / 2;\n let h2 = h / 2;\n if (rotate % 4 !== 0) {\n w2 = h / 2;\n h2 = w / 2;\n }\n const cX = u + w2;\n const cY = v + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW);\n u0 = cX + (w2 * groupD8.uX(rotate));\n v0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n u1 = cX + (w2 * groupD8.uX(rotate));\n v1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u2 = cX + (w2 * groupD8.uX(rotate));\n v2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u3 = cX + (w2 * groupD8.uX(rotate));\n v3 = cY + (h2 * groupD8.uY(rotate));\n }\n\n arr[sz++] = x;\n arr[sz++] = y;\n arr[sz++] = u0;\n arr[sz++] = v0;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y;\n arr[sz++] = u1;\n arr[sz++] = v1;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y + h;\n arr[sz++] = u2;\n arr[sz++] = v2;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x;\n arr[sz++] = y + h;\n arr[sz++] = u3;\n arr[sz++] = v3;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n }\n\n vertexBuf.update(arr);\n }\n\n (renderer.geometry as any).bind(vb, shader);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES, rectsCount * 6, 0);\n }\n\n isModified(anim: boolean) {\n if (this.modificationMarker !== this.pointsBuf.length ||\n anim && this.hasAnim) {\n return true;\n }\n return false;\n }\n\n clearModify() {\n this.modificationMarker = this.pointsBuf.length;\n }\n\n destroy(options?: any) {\n super.destroy(options);\n this.destroyVb();\n }\n}\n","/// \n\nimport { Container } from '@pixi/display';\nimport { Texture, Renderer } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { Constant } from './Constant';\nimport { RectTileLayer } from './RectTileLayer';\n\nexport class CompositeRectTileLayer extends Container {\n constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n super();\n this.initialize.apply(this, arguments);\n }\n\n updateTransform() {\n (this as any).displayObjectUpdateTransform();\n }\n\n z: number;\n zIndex: number;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n _lastLayer: RectTileLayer = null;\n\n texPerChild: number;\n\n initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n if (texPerChild as any === true) {\n //old format, ignore it!\n texPerChild = 0;\n }\n this.z = this.zIndex = zIndex;\n this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures;\n if (bitmaps) {\n this.setBitmaps(bitmaps);\n }\n }\n\n setBitmaps(bitmaps: Array) {\n for (let i=0;i 5.2.1, it does not exist there.`);\n }\n }\n let texPerChild = this.texPerChild;\n let len1 = this.children.length;\n let len2 = Math.ceil(bitmaps.length / texPerChild);\n let i: number;\n for (i = 0; i < len1; i++) {\n (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);\n }\n for (i = len1; i < len2; i++) {\n let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild));\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n this.addChild(layer);\n }\n }\n\n clear() {\n for (let i = 0; i < this.children.length; i++) {\n (this.children[i] as RectTileLayer).clear();\n }\n this.modificationMarker = 0;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this {\n const childIndex: number = textureIndex / this.texPerChild >> 0;\n const textureId: number = textureIndex % this.texPerChild;\n\n if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) {\n this._lastLayer = (this.children[childIndex] as RectTileLayer);\n this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight);\n } else {\n this._lastLayer = null;\n }\n\n return this;\n }\n\n tileRotate(rotate: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileRotate(rotate);\n }\n return this;\n }\n\n tileAnimX(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimX(offset, count);\n }\n return this;\n }\n\n tileAnimY(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimY(offset, count);\n }\n return this;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this {\n let texture: Texture;\n let layer: RectTileLayer = null;\n let ind: number = 0;\n let children = this.children;\n\n this._lastLayer = null;\n if (typeof texture_ === \"number\") {\n let childIndex = texture_ / this.texPerChild >> 0;\n layer = children[childIndex] as RectTileLayer;\n\n if (!layer) {\n layer = children[0] as RectTileLayer;\n if (!layer) {\n return this;\n }\n ind = 0;\n } else {\n ind = texture_ % this.texPerChild;\n }\n\n texture = layer.textures[ind];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n let tex = child.textures;\n for (let j = 0; j < tex.length; j++) {\n if (tex[j].baseTexture === texture.baseTexture) {\n layer = child;\n ind = j;\n break;\n }\n }\n if (layer) {\n break;\n }\n }\n\n if (!layer) {\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n if (child.textures.length < this.texPerChild) {\n layer = child;\n ind = child.textures.length;\n child.textures.push(texture);\n break;\n }\n }\n if (!layer) {\n layer = new RectTileLayer(this.zIndex, texture);\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n children.push(layer);\n ind = 0;\n }\n }\n }\n\n this._lastLayer = layer;\n layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight);\n return this;\n }\n\n renderCanvas(renderer: any) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderCanvasCore(renderer);\n }\n }\n\n render(renderer: Renderer) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n //TODO: dont create new array, please\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n renderer.shader.bind(shader, false);\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin);\n }\n }\n\n isModified(anim: boolean) {\n let layers = this.children;\n if (this.modificationMarker !== layers.length) {\n return true;\n }\n for (let i = 0; i < layers.length; i++) {\n if ((layers[i] as RectTileLayer).isModified(anim)) {\n return true;\n }\n }\n return false;\n }\n\n clearModify() {\n let layers = this.children;\n this.modificationMarker = layers.length;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).clearModify();\n }\n }\n}","/// \n\nimport { Matrix } from '@pixi/math';\nimport { Graphics } from '@pixi/graphics';\n\nexport class GraphicsLayer extends Graphics {\n constructor(zIndex: number) {\n super();\n this.zIndex = zIndex;\n }\n\n renderCanvas(renderer: any) {\n let wt: Matrix = null;\n if (renderer.plugins.tilemap.dontUseTransform) {\n wt = this.transform.worldTransform;\n this.transform.worldTransform = Matrix.IDENTITY;\n }\n renderer.plugins.graphics.render(this);\n if (renderer.plugins.tilemap.dontUseTransform) {\n this.transform.worldTransform = wt;\n }\n renderer.context.globalAlpha = 1.0;\n }\n\n // renderWebGL(renderer: PIXI.Renderer) {\n // if (!this._webGL[renderer.CONTEXT_UID])\n // this.dirty++;\n // super.renderWebGL(renderer)\n // }\n\n isModified(anim: boolean): boolean {\n return false;\n }\n\n clearModify() {\n }\n}\n","/// \n\nimport { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, Renderer, Texture, GLTexture, resources } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Constant } from './Constant';\n\nexport interface IMultiTextureOptions {\n\tboundCountPerBuffer: number;\n\tboundSize: number;\n\tbufferSize: number;\n\tDO_CLEAR?: boolean;\n}\n\nexport class MultiTextureResource extends resources.Resource {\n\tconstructor(options: IMultiTextureOptions) {\n\t\tsuper(options.bufferSize, options.bufferSize);\n\n\t\tconst bounds = this.boundSprites;\n\t\tconst dirties = this.dirties;\n\t\tthis.boundSize = options.boundSize;\n\t\tfor (let j = 0; j < options.boundCountPerBuffer; j++) {\n\t\t\tconst spr = new Sprite();\n\t\t\tspr.position.x = options.boundSize * (j & 1);\n\t\t\tspr.position.y = options.boundSize * (j >> 1);\n\t\t\tbounds.push(spr);\n\t\t\tdirties.push(0);\n\t\t}\n\t\tthis.DO_CLEAR = !!options.DO_CLEAR;\n\t}\n\n\tDO_CLEAR = false;\n\tboundSize: number = 0;\n\t_clearBuffer: Uint8Array = null;\n\n\tbind(baseTexture: BaseTexture) {\n\t\tif (this.baseTex) {\n\t\t\tthrow new Error('Only one baseTexture is allowed for this resource!')\n\t\t}\n\t\tthis.baseTex = baseTexture;\n\t\tsuper.bind(baseTexture);\n\t}\n\n\tbaseTex: BaseTexture = null;\n\tboundSprites: Array = [];\n\tdirties: Array = [];\n\n\tsetTexture(ind: number, texture: Texture) {\n\t\tconst spr = this.boundSprites[ind];\n\t\tif (spr.texture.baseTexture === texture.baseTexture) {\n\t\t\treturn;\n\t\t}\n\t\tspr.texture = texture;\n\t\tthis.baseTex.update();\n\t\tthis.dirties[ind] = (this.baseTex as any).dirtyId;\n\t}\n\n\tupload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture) {\n\t\tconst { gl } = renderer as any;\n\n\t\tconst {width, height} = this;\n\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined ||\n\t\t\ttexture.alphaMode === ALPHA_MODES.UNPACK);\n\n\t\tif (glTexture.dirtyId < 0) {\n\t\t\t(glTexture as any).width = width;\n\t\t\t(glTexture as any).height = height;\n\n\t\t\tgl.texImage2D(texture.target, 0,\n\t\t\t\ttexture.format,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\t0,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tnull);\n\t\t}\n\n\t\tconst doClear = this.DO_CLEAR;\n\t\tif (doClear && !this._clearBuffer) {\n\t\t\tthis._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4);\n\t\t}\n\n\t\tconst bounds = this.boundSprites;\n\t\tfor (let i = 0; i < bounds.length; i++) {\n\t\t\tconst spr = bounds[i];\n\t\t\tconst tex = spr.texture.baseTexture;\n\t\t\tif (glTexture.dirtyId >= this.dirties[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst res = tex.resource as any;\n\t\t\tif (!tex.valid || !res || !res.source) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (doClear && (tex.width < this.boundSize || tex.height < this.boundSize))\n\t\t\t{\n\t\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\t\tspr.position.x,\n\t\t\t\t\tspr.position.y,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\ttexture.format,\n\t\t\t\t\ttexture.type,\n\t\t\t\t\tthis._clearBuffer);\n\t\t\t}\n\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\tspr.position.x,\n\t\t\t\tspr.position.y,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tres.source);\n\t\t}\n\n\t\treturn true;\n\t}\n}\n","import { Constant } from './Constant';\n\nimport type { TilemapShader } from './RectTileShader';\n\n\nexport function fillSamplers(shader: TilemapShader, maxTextures: number) {\n let sampleValues: Array = [];\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n shader.uniforms.uSamplers = sampleValues;\n\n let samplerSize: Array = [];\n for (let i = 0; i < maxTextures; i++) {\n samplerSize.push(1.0 / Constant.bufferSize);\n samplerSize.push(1.0 / Constant.bufferSize);\n }\n shader.uniforms.uSamplerSize = samplerSize;\n}\n\nexport function generateFragmentSrc(maxTextures: number, fragmentSrc: string) {\n return fragmentSrc.replace(/%count%/gi, maxTextures + \"\")\n .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n}\n\nexport function generateSampleSrc(maxTextures: number) {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n src += 'if(vTextureId <= -1.0) {';\n src += '\\n\\tcolor = shadowColor;';\n src += '\\n}';\n\n for (let i = 0; i < maxTextures; i++)\n {\n src += '\\nelse ';\n\n if(i < maxTextures-1)\n {\n src += 'if(textureId == ' + i + '.0)';\n }\n\n src += '\\n{';\n src += '\\n\\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);';\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n}\n","/// \n\nimport * as shaderGenerator from './shaderGenerator';\n\nimport { Buffer, Geometry, Shader } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nlet rectShaderFrag = `\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n`;\nlet rectShaderVert = `\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n`;\n\nexport abstract class TilemapShader extends Shader {\n\tmaxTextures = 0;\n\n\tconstructor(maxTextures: number, shaderVert: string, shaderFrag: string) {\n\t\tsuper(\n\t\t\tnew PIXI.Program(\n\t\t\t\tshaderVert,\n\t\t\t\tshaderFrag),\n\t\t\t{\n\t\t\t\tanimationFrame: new Float32Array(2),\n\t\t\t\tuSamplers: [],\n\t\t\t\tuSamplerSize: [],\n\t\t\t\tprojTransMatrix: new Matrix()\n\t\t\t}\n\t\t);\n\t\tthis.maxTextures = maxTextures;\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileShader extends TilemapShader {\n\tconstructor(maxTextures: number) {\n\t\tsuper(\n\t\t\tmaxTextures,\n\t\t\trectShaderVert,\n\t\t\tshaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)\n\t\t);\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileGeom extends Geometry {\n\tvertSize = 11;\n\tvertPerQuad = 4;\n\tstride = this.vertSize * 4;\n\tlastTimeAccess = 0;\n\n\tconstructor() {\n\t\tsuper();\n\t\tconst buf = this.buf = new Buffer(new Float32Array(2), true, false);\n\t\tthis.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0)\n\t\t\t.addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4)\n\t\t\t.addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4)\n\t\t\t.addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4)\n\t\t\t.addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4);\n\t}\n\n\tbuf: PIXI.Buffer;\n}","import { WRAP_MODES } from '@pixi/constants';\nimport { BaseTexture, Buffer, resources, ObjectRenderer, Texture, Renderer } from '@pixi/core';\nimport { Constant } from './Constant';\nimport { RectTileGeom, RectTileShader } from './RectTileShader';\nimport { MultiTextureResource } from './MultiTextureResource';\n\nimport type { TilemapShader } from './RectTileShader';\n\n/**\n * Renderer for rectangle tiles.\n */\nexport class TileRenderer extends ObjectRenderer {\n\trenderer: Renderer;\n\tgl: WebGLRenderingContext;\n\tsn: number = -1;\n\tindexBuffer: PIXI.Buffer = null;\n\tibLen: number = 0;\n\ttileAnim = [0, 0];\n\ttexLoc: Array = [];\n\n\trectShader: RectTileShader;\n\ttexResources: Array = [];\n\n\tconstructor(renderer: Renderer) {\n\t\tsuper(renderer);\n\t\tthis.rectShader = new RectTileShader(Constant.maxTextures);\n\t\tthis.indexBuffer = new Buffer(undefined, true, true);\n\t\tthis.checkIndexBuffer(2000);\n\t\tthis.initBounds();\n\t}\n\n\tinitBounds() {\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tfor (let i = 0; i < maxTextures; i++) {\n\t\t\tconst resource = new MultiTextureResource(Constant);\n\t\t\tconst baseTex = new BaseTexture(resource);\n\t\t\tbaseTex.scaleMode = Constant.SCALE_MODE;\n\t\t\tbaseTex.wrapMode = WRAP_MODES.CLAMP;\n\t\t\tthis.texResources.push(resource);\n\t\t}\n\t}\n\n\tbindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tlet samplerSize: Array = (shader as any).uniforms.uSamplerSize;\n\t\tthis.texLoc.length = 0;\n\t\tfor (let i = 0; i < textures.length; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trenderer.texture.bind(textures[i], i);\n\t\t\t//TODO: add resolution here\n\t\t\tsamplerSize[i * 2] = 1.0 / textures[i].baseTexture.width;\n\t\t\tsamplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height;\n\t\t}\n\t\t(shader as any).uniforms.uSamplerSize = samplerSize;\n\t}\n\n\tbindTextures(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tconst len = textures.length;\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tif (len > Constant.boundCountPerBuffer * maxTextures) {\n\t\t\treturn;\n\t\t}\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\tthis.bindTexturesWithoutRT(renderer, shader, textures);\n\t\t\treturn;\n\t\t}\n\n\t\tlet i = 0;\n\t\tfor (; i < len; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) continue;\n\t\t\tconst multi = this.texResources[i >> 2];\n\t\t\tmulti.setTexture(i & 3, texture);\n\t\t}\n\n\t\tlet gltsUsed = (i + 3) >> 2;\n\t\tfor (i = 0; i < gltsUsed; i++) {\n\t\t\t//remove \"i, true\" after resolving a bug\n\t\t\trenderer.texture.bind(this.texResources[i].baseTex, i);\n\t\t}\n\t}\n\n\tstart() {\n\t\t//sorry, nothing\n\t}\n\n\tcreateVb() {\n\t\tconst geom = new RectTileGeom();\n\t\tgeom.addIndex(this.indexBuffer);\n\t\tgeom.lastTimeAccess = Date.now();\n\t\treturn geom;\n\t}\n\n\tcheckIndexBuffer(size: number, vb: RectTileGeom = null) {\n\t\tconst totalIndices = size * 6;\n\n\t\tif (totalIndices <= this.ibLen) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet len = totalIndices;\n\t\twhile (len < totalIndices) {\n\t\t\tlen <<= 1;\n\t\t}\n\n\t\tthis.ibLen = totalIndices;\n\t\tthis.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size,\n\t\t\tConstant.use32bitIndex ? new Uint32Array(size * 6) : undefined));\n\n\t\t// \tTODO: create new index buffer instead?\n\t\t// if (vb) {\n\t\t// \tconst curIndex = vb.getIndex();\n\t\t// \tif (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) {\n\t\t// \t\tthis.swapIndex(vb, this.indexBuffer);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t// swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) {\n\t\t// let buffers = (geom as any).buffers;\n\t\t// const oldIndex = geom.getIndex();\n\t\t// let ind = buffers.indexOf(oldIndex);\n\t\t// if (ind >= 0) {\n\t\t// \tbuffers.splice(ind, 1);\n\t\t// }\n\t\t// geom.addIndex(indexBuf);\n\t// }\n\n\tgetShader(): TilemapShader {\n\t\treturn this.rectShader;\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\t// this.rectShader.destroy();\n\t\tthis.rectShader = null;\n\t}\n}\n\nRenderer.registerPlugin('tilemap', TileRenderer as any);\n","/// \n\nimport { Container } from '@pixi/display';\n\nimport type { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport type { Matrix } from '@pixi/math';\n\nexport class ZLayer extends Container {\n\n constructor(tilemap: Container, zIndex: number) {\n super();\n this.tilemap = tilemap;\n this.z = zIndex;\n }\n\n tilemap: any;\n z: number;\n zIndex: number;\n _previousLayers: number;\n canvasBuffer: HTMLCanvasElement;\n _tempRender: any;\n _lastAnimationFrame: number = -1;\n layerTransform: Matrix;\n\n clear() {\n let layers = this.children as Array;\n for (let i = 0; i < layers.length; i++)\n layers[i].clear();\n this._previousLayers = 0;\n }\n\n cacheIfDirty() {\n let tilemap: any = this.tilemap;\n let layers = this.children as Array;\n let modified = this._previousLayers !== layers.length;\n this._previousLayers = layers.length;\n let buf = this.canvasBuffer;\n let tempRender = this._tempRender;\n if (!buf) {\n buf = this.canvasBuffer = document.createElement('canvas');\n tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf});\n tempRender.context = tempRender.rootContext;\n tempRender.plugins.tilemap.dontUseTransform = true;\n }\n if (buf.width !== tilemap._layerWidth ||\n buf.height !== tilemap._layerHeight) {\n buf.width = tilemap._layerWidth;\n buf.height = tilemap._layerHeight;\n modified = true;\n }\n let i: number;\n if (!modified) {\n for (i = 0; i < layers.length; i++) {\n if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) {\n modified = true;\n break;\n }\n }\n }\n this._lastAnimationFrame = tilemap.animationFrame;\n if (modified) {\n if (tilemap._hackRenderer) {\n tilemap._hackRenderer(tempRender);\n }\n tempRender.context.clearRect(0, 0, buf.width, buf.height);\n for (i = 0; i < layers.length; i++) {\n layers[i].clearModify();\n layers[i].renderCanvas(tempRender);\n }\n }\n this.layerTransform = this.worldTransform;\n for (i = 0; i < layers.length; i++) {\n this.layerTransform = layers[i].worldTransform;\n break;\n }\n }\n\n renderCanvas(renderer: any) {\n this.cacheIfDirty();\n let wt = this.layerTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n let tilemap = this.tilemap;\n renderer.context.drawImage(this.canvasBuffer, 0, 0);\n }\n}\n","/// \n\nnamespace pixi_tilemap {\n (PIXI as any).tilemap = pixi_tilemap;\n}\n\n// This makes exporter.ts a module!\nexport default {}\n","import { CanvasTileRenderer } from './CanvasTileRenderer';\nimport { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport { Constant } from './Constant';\nimport { GraphicsLayer } from './GraphicsLayer';\nimport { MultiTextureResource } from './MultiTextureResource';\nimport { RectTileLayer } from './RectTileLayer';\nimport { TilemapShader, RectTileShader, RectTileGeom } from './RectTileShader';\nimport { TileRenderer } from './TileRenderer';\nimport { ZLayer } from './ZLayer';\n\nexport const pixi_tilemap = {\n CanvasTileRenderer,\n CompositeRectTileLayer,\n Constant,\n GraphicsLayer,\n MultiTextureResource,\n RectTileLayer,\n TilemapShader,\n RectTileShader,\n RectTileGeom,\n TileRenderer,\n ZLayer,\n};\n\nexport * from './CanvasTileRenderer';\nexport * from './CompositeRectTileLayer';\nexport * from './Constant';\nexport * from './exporter';\nexport * from './GraphicsLayer';\nexport * from './MultiTextureResource';\nexport * from './RectTileLayer';\nexport * from './RectTileShader';\nexport * from './shaderGenerator';\nexport * from './TileRenderer';\nexport * from './ZLayer';"],"names":["Texture","groupD8","DRAW_MODES","Container","Matrix","Graphics","Sprite","ALPHA_MODES","resources","shaderGenerator.fillSamplers","Shader","shaderGenerator.generateFragmentSrc","Buffer","Geometry","BaseTexture","WRAP_MODES","ObjectRenderer","Renderer","pixi_tilemap"],"mappings":";;;;;;;;;;;;;QASI,4BAAY,QAAkB;YAH9B,aAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAClB,qBAAgB,GAAG,KAAK,CAAC;YAGrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SAC1B;QACL,yBAAC;IAAD,CAAC,IAAA;IAED,IAAM,EAAE,GAAI,IAAY,CAAC,cAAc,CAAC;IAExC,IAAI,EAAE,EAAE;QACJ,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;;;IClBrD;IACA;IACA;IACA;IACA;AACA;IACA;IACA;IACA;IACA;AACA;IACA;IACA;IACA;IACA;AACA;IACA,IAAI,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE;IACnC,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc;IACzC,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC;IACpF,QAAQ,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CA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;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"pixi-tilemap.umd.js","sources":["../src/CanvasTileRenderer.ts","../node_modules/tslib/tslib.es6.js","../src/Constant.ts","../src/RectTileLayer.ts","../src/CompositeRectTileLayer.ts","../src/GraphicsLayer.ts","../src/MultiTextureResource.ts","../src/shaderGenerator.ts","../src/RectTileShader.ts","../src/TileRenderer.ts","../src/ZLayer.ts","../src/exporter.ts","../src/index.ts"],"sourcesContent":["/// \n\nimport { Renderer } from '@pixi/core';\n\nexport class CanvasTileRenderer {\n renderer: Renderer;\n tileAnim = [0, 0];\n dontUseTransform = false;\n\n constructor(renderer: Renderer) {\n this.renderer = renderer;\n this.tileAnim = [0, 0];\n }\n}\n\nconst cr = (PIXI as any).CanvasRenderer;\n\nif (cr) {\n cr.registerPlugin('tilemap', CanvasTileRenderer);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","export const Constant = {\n maxTextures: 16,\n bufferSize: 2048,\n boundSize: 1024,\n boundCountPerBuffer: 1,\n use32bitIndex: false,\n SCALE_MODE: PIXI.SCALE_MODES.LINEAR,\n DO_CLEAR: true\n};","/// \n\nimport { Container } from '@pixi/display';\nimport { Constant } from './Constant';\nimport { DRAW_MODES } from '@pixi/constants';\nimport { Texture, Renderer } from '@pixi/core';\nimport { TileRenderer } from './TileRenderer';\nimport { Matrix, groupD8 } from '@pixi/math';\n\nimport type { RectTileGeom } from './RectTileShader';\n\nexport const POINT_STRUCT_SIZE = 12;\n\nexport class RectTileLayer extends Container {\n constructor(zIndex: number, texture: Texture | Array) {\n super();\n this.initialize(zIndex, texture);\n }\n\n zIndex = 0;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n\n pointsBuf: Array = [];\n hasAnim = false;\n textures: Array;\n\n offsetX = 0;\n offsetY = 0;\n compositeParent = false;\n\n initialize(zIndex: number, textures: Texture | Array) {\n if (!textures) {\n textures = [];\n } else if (!(textures instanceof Array) && (textures as Texture).baseTexture) {\n textures = [textures as Texture];\n }\n this.textures = textures as Array;\n this.zIndex = zIndex;\n // this.visible = false;\n }\n\n clear() {\n this.pointsBuf.length = 0;\n this.modificationMarker = 0;\n this.hasAnim = false;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX: number, animY: number) {\n let texture: Texture;\n let textureIndex = 0;\n\n if (typeof texture_ === \"number\") {\n textureIndex = texture_;\n texture = this.textures[textureIndex];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n let found = false;\n let textureList = this.textures;\n for (let i = 0; i < textureList.length; i++) {\n if (textureList[i].baseTexture === texture.baseTexture) {\n textureIndex = i;\n found = true;\n break;\n }\n }\n\n if (!found) {\n // textureIndex = this.textures.length;\n // this.textures.push(texture);\n return false;\n }\n }\n\n this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate);\n return true;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number,\n animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this {\n let pb = this.pointsBuf;\n this.hasAnim = this.hasAnim || animX > 0 || animY > 0;\n pb.push(u);\n pb.push(v);\n pb.push(x);\n pb.push(y);\n pb.push(tileWidth);\n pb.push(tileHeight);\n pb.push(rotate);\n pb.push(animX | 0);\n pb.push(animY | 0);\n pb.push(textureIndex);\n pb.push(animCountX);\n pb.push(animCountY);\n\n return this;\n }\n\n tileRotate(rotate: number) {\n const pb = this.pointsBuf;\n pb[pb.length - 3] = rotate;\n }\n\n tileAnimX(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 5] = offset;\n pb[pb.length - 2] = count;\n }\n\n tileAnimY(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 4] = offset;\n pb[pb.length - 1] = count;\n }\n\n renderCanvas(renderer: any) {\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n this.renderCanvasCore(renderer);\n }\n\n renderCanvasCore(renderer: any) {\n if (this.textures.length === 0) return;\n let points = this.pointsBuf;\n renderer.context.fillStyle = '#000000';\n for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) {\n let x1 = points[i], y1 = points[i + 1];\n let x2 = points[i + 2], y2 = points[i + 3];\n let w = points[i + 4];\n let h = points[i + 5];\n var rotate = points[i + 6];\n x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0];\n y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1];\n let textureIndex = points[i + 9];\n // canvas does not work with rotate yet\n if (textureIndex >= 0) {\n renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h);\n } else {\n renderer.context.globalAlpha = 0.5;\n renderer.context.fillRect(x2, y2, w, h);\n renderer.context.globalAlpha = 1;\n }\n }\n }\n\n vbId = 0;\n vb: RectTileGeom = null;\n vbBuffer: ArrayBuffer = null;\n vbArray: Float32Array = null;\n vbInts: Uint32Array = null;\n\n destroyVb() {\n if (this.vb) {\n this.vb.destroy();\n this.vb = null;\n }\n }\n\n render(renderer: Renderer) {\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n this.renderWebGLCore(renderer, plugin);\n }\n\n renderWebGLCore(renderer: Renderer, plugin: TileRenderer) {\n let points = this.pointsBuf;\n if (points.length === 0) return;\n let rectsCount = points.length / POINT_STRUCT_SIZE;\n\n let shader = plugin.getShader();\n let textures = this.textures;\n if (textures.length === 0) return;\n\n plugin.bindTextures(renderer, shader, textures);\n renderer.shader.bind(shader, false);\n\n //lost context! recover!\n let vb = this.vb;\n if (!vb) {\n vb = plugin.createVb();\n this.vb = vb;\n this.vbId = (vb as any).id;\n this.vbBuffer = null;\n this.modificationMarker = 0;\n }\n\n plugin.checkIndexBuffer(rectsCount, vb);\n const boundCountPerBuffer = Constant.boundCountPerBuffer;\n\n let vertexBuf = vb.getBuffer('aVertexPosition');\n //if layer was changed, re-upload vertices\n let vertices = rectsCount * vb.vertPerQuad;\n if (vertices === 0) return;\n if (this.modificationMarker !== vertices) {\n this.modificationMarker = vertices;\n let vs = vb.stride * vertices;\n if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {\n //!@#$ happens, need resize\n let bk = vb.stride;\n while (bk < vs) {\n bk *= 2;\n }\n this.vbBuffer = new ArrayBuffer(bk);\n this.vbArray = new Float32Array(this.vbBuffer);\n this.vbInts = new Uint32Array(this.vbBuffer);\n vertexBuf.update(this.vbBuffer);\n }\n\n let arr = this.vbArray, ints = this.vbInts;\n //upload vertices!\n let sz = 0;\n //let tint = 0xffffffff;\n let textureId: number = 0;\n let shiftU: number = this.offsetX;\n let shiftV: number = this.offsetY;\n\n //let tint = 0xffffffff;\n let tint = -1;\n for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) {\n let eps = 0.5;\n if (this.compositeParent) {\n if (boundCountPerBuffer > 1) {\n //TODO: what if its more than 4?\n textureId = (points[i + 9] >> 2);\n shiftU = this.offsetX * (points[i + 9] & 1);\n shiftV = this.offsetY * ((points[i + 9] >> 1) & 1);\n } else {\n textureId = points[i + 9];\n shiftU = 0;\n shiftV = 0;\n }\n }\n let x = points[i + 2], y = points[i + 3];\n let w = points[i + 4], h = points[i + 5];\n let u = points[i] + shiftU, v = points[i + 1] + shiftV;\n let rotate = points[i + 6];\n\n const animX = points[i + 7], animY = points[i + 8];\n const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024;\n const animXEncoded = animX + (animWidth * 2048);\n const animYEncoded = animY + (animHeight * 2048);\n\n let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number;\n if (rotate === 0) {\n u0 = u;\n v0 = v;\n u1 = u + w;\n v1 = v;\n u2 = u + w;\n v2 = v + h;\n u3 = u;\n v3 = v + h;\n } else {\n let w2 = w / 2;\n let h2 = h / 2;\n if (rotate % 4 !== 0) {\n w2 = h / 2;\n h2 = w / 2;\n }\n const cX = u + w2;\n const cY = v + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW);\n u0 = cX + (w2 * groupD8.uX(rotate));\n v0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n u1 = cX + (w2 * groupD8.uX(rotate));\n v1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u2 = cX + (w2 * groupD8.uX(rotate));\n v2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u3 = cX + (w2 * groupD8.uX(rotate));\n v3 = cY + (h2 * groupD8.uY(rotate));\n }\n\n arr[sz++] = x;\n arr[sz++] = y;\n arr[sz++] = u0;\n arr[sz++] = v0;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y;\n arr[sz++] = u1;\n arr[sz++] = v1;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y + h;\n arr[sz++] = u2;\n arr[sz++] = v2;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x;\n arr[sz++] = y + h;\n arr[sz++] = u3;\n arr[sz++] = v3;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n }\n\n vertexBuf.update(arr);\n }\n\n (renderer.geometry as any).bind(vb, shader);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES, rectsCount * 6, 0);\n }\n\n isModified(anim: boolean) {\n if (this.modificationMarker !== this.pointsBuf.length ||\n anim && this.hasAnim) {\n return true;\n }\n return false;\n }\n\n clearModify() {\n this.modificationMarker = this.pointsBuf.length;\n }\n\n destroy(options?: any) {\n super.destroy(options);\n this.destroyVb();\n }\n}\n","/// \n\nimport { Container } from '@pixi/display';\nimport { Texture, Renderer } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { Constant } from './Constant';\nimport { RectTileLayer } from './RectTileLayer';\n\nexport class CompositeRectTileLayer extends Container {\n constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n super();\n this.initialize.apply(this, arguments);\n }\n\n updateTransform() {\n (this as any).displayObjectUpdateTransform();\n }\n\n z: number;\n zIndex: number;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n _lastLayer: RectTileLayer = null;\n\n texPerChild: number;\n\n initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n if (texPerChild as any === true) {\n //old format, ignore it!\n texPerChild = 0;\n }\n this.z = this.zIndex = zIndex;\n this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures;\n if (bitmaps) {\n this.setBitmaps(bitmaps);\n }\n }\n\n setBitmaps(bitmaps: Array) {\n for (let i=0;i 5.2.1, it does not exist there.`);\n }\n }\n let texPerChild = this.texPerChild;\n let len1 = this.children.length;\n let len2 = Math.ceil(bitmaps.length / texPerChild);\n let i: number;\n for (i = 0; i < len1; i++) {\n (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);\n }\n for (i = len1; i < len2; i++) {\n let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild));\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n this.addChild(layer);\n }\n }\n\n clear() {\n for (let i = 0; i < this.children.length; i++) {\n (this.children[i] as RectTileLayer).clear();\n }\n this.modificationMarker = 0;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this {\n const childIndex: number = textureIndex / this.texPerChild >> 0;\n const textureId: number = textureIndex % this.texPerChild;\n\n if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) {\n this._lastLayer = (this.children[childIndex] as RectTileLayer);\n this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight);\n } else {\n this._lastLayer = null;\n }\n\n return this;\n }\n\n tileRotate(rotate: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileRotate(rotate);\n }\n return this;\n }\n\n tileAnimX(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimX(offset, count);\n }\n return this;\n }\n\n tileAnimY(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimY(offset, count);\n }\n return this;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this {\n let texture: Texture;\n let layer: RectTileLayer = null;\n let ind: number = 0;\n let children = this.children;\n\n this._lastLayer = null;\n if (typeof texture_ === \"number\") {\n let childIndex = texture_ / this.texPerChild >> 0;\n layer = children[childIndex] as RectTileLayer;\n\n if (!layer) {\n layer = children[0] as RectTileLayer;\n if (!layer) {\n return this;\n }\n ind = 0;\n } else {\n ind = texture_ % this.texPerChild;\n }\n\n texture = layer.textures[ind];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n let tex = child.textures;\n for (let j = 0; j < tex.length; j++) {\n if (tex[j].baseTexture === texture.baseTexture) {\n layer = child;\n ind = j;\n break;\n }\n }\n if (layer) {\n break;\n }\n }\n\n if (!layer) {\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n if (child.textures.length < this.texPerChild) {\n layer = child;\n ind = child.textures.length;\n child.textures.push(texture);\n break;\n }\n }\n if (!layer) {\n layer = new RectTileLayer(this.zIndex, texture);\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n children.push(layer);\n ind = 0;\n }\n }\n }\n\n this._lastLayer = layer;\n layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight);\n return this;\n }\n\n renderCanvas(renderer: any) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderCanvasCore(renderer);\n }\n }\n\n render(renderer: Renderer) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n //TODO: dont create new array, please\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n renderer.shader.bind(shader, false);\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin);\n }\n }\n\n isModified(anim: boolean) {\n let layers = this.children;\n if (this.modificationMarker !== layers.length) {\n return true;\n }\n for (let i = 0; i < layers.length; i++) {\n if ((layers[i] as RectTileLayer).isModified(anim)) {\n return true;\n }\n }\n return false;\n }\n\n clearModify() {\n let layers = this.children;\n this.modificationMarker = layers.length;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).clearModify();\n }\n }\n}","/// \n\nimport { Matrix } from '@pixi/math';\nimport { Graphics } from '@pixi/graphics';\n\nexport class GraphicsLayer extends Graphics {\n constructor(zIndex: number) {\n super();\n this.zIndex = zIndex;\n }\n\n renderCanvas(renderer: any) {\n let wt: Matrix = null;\n if (renderer.plugins.tilemap.dontUseTransform) {\n wt = this.transform.worldTransform;\n this.transform.worldTransform = Matrix.IDENTITY;\n }\n renderer.plugins.graphics.render(this);\n if (renderer.plugins.tilemap.dontUseTransform) {\n this.transform.worldTransform = wt;\n }\n renderer.context.globalAlpha = 1.0;\n }\n\n // renderWebGL(renderer: PIXI.Renderer) {\n // if (!this._webGL[renderer.CONTEXT_UID])\n // this.dirty++;\n // super.renderWebGL(renderer)\n // }\n\n isModified(anim: boolean): boolean {\n return false;\n }\n\n clearModify() {\n }\n}\n","/// \n\nimport { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, Renderer, Texture, GLTexture, resources } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Constant } from './Constant';\n\nexport interface IMultiTextureOptions {\n\tboundCountPerBuffer: number;\n\tboundSize: number;\n\tbufferSize: number;\n\tDO_CLEAR?: boolean;\n}\n\nexport class MultiTextureResource extends resources.Resource {\n\tconstructor(options: IMultiTextureOptions) {\n\t\tsuper(options.bufferSize, options.bufferSize);\n\n\t\tconst bounds = this.boundSprites;\n\t\tconst dirties = this.dirties;\n\t\tthis.boundSize = options.boundSize;\n\t\tfor (let j = 0; j < options.boundCountPerBuffer; j++) {\n\t\t\tconst spr = new Sprite();\n\t\t\tspr.position.x = options.boundSize * (j & 1);\n\t\t\tspr.position.y = options.boundSize * (j >> 1);\n\t\t\tbounds.push(spr);\n\t\t\tdirties.push(0);\n\t\t}\n\t\tthis.DO_CLEAR = !!options.DO_CLEAR;\n\t}\n\n\tDO_CLEAR = false;\n\tboundSize: number = 0;\n\t_clearBuffer: Uint8Array = null;\n\n\tbind(baseTexture: BaseTexture) {\n\t\tif (this.baseTex) {\n\t\t\tthrow new Error('Only one baseTexture is allowed for this resource!')\n\t\t}\n\t\tthis.baseTex = baseTexture;\n\t\tsuper.bind(baseTexture);\n\t}\n\n\tbaseTex: BaseTexture = null;\n\tboundSprites: Array = [];\n\tdirties: Array = [];\n\n\tsetTexture(ind: number, texture: Texture) {\n\t\tconst spr = this.boundSprites[ind];\n\t\tif (spr.texture.baseTexture === texture.baseTexture) {\n\t\t\treturn;\n\t\t}\n\t\tspr.texture = texture;\n\t\tthis.baseTex.update();\n\t\tthis.dirties[ind] = (this.baseTex as any).dirtyId;\n\t}\n\n\tupload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture) {\n\t\tconst { gl } = renderer as any;\n\n\t\tconst {width, height} = this;\n\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined ||\n\t\t\ttexture.alphaMode === ALPHA_MODES.UNPACK);\n\n\t\tif (glTexture.dirtyId < 0) {\n\t\t\t(glTexture as any).width = width;\n\t\t\t(glTexture as any).height = height;\n\n\t\t\tgl.texImage2D(texture.target, 0,\n\t\t\t\ttexture.format,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\t0,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tnull);\n\t\t}\n\n\t\tconst doClear = this.DO_CLEAR;\n\t\tif (doClear && !this._clearBuffer) {\n\t\t\tthis._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4);\n\t\t}\n\n\t\tconst bounds = this.boundSprites;\n\t\tfor (let i = 0; i < bounds.length; i++) {\n\t\t\tconst spr = bounds[i];\n\t\t\tconst tex = spr.texture.baseTexture;\n\t\t\tif (glTexture.dirtyId >= this.dirties[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst res = tex.resource as any;\n\t\t\tif (!tex.valid || !res || !res.source) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (doClear && (tex.width < this.boundSize || tex.height < this.boundSize))\n\t\t\t{\n\t\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\t\tspr.position.x,\n\t\t\t\t\tspr.position.y,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\ttexture.format,\n\t\t\t\t\ttexture.type,\n\t\t\t\t\tthis._clearBuffer);\n\t\t\t}\n\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\tspr.position.x,\n\t\t\t\tspr.position.y,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tres.source);\n\t\t}\n\n\t\treturn true;\n\t}\n}\n","import { Constant } from './Constant';\n\nimport type { TilemapShader } from './RectTileShader';\n\n\nexport function fillSamplers(shader: TilemapShader, maxTextures: number) {\n let sampleValues: Array = [];\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n shader.uniforms.uSamplers = sampleValues;\n\n let samplerSize: Array = [];\n for (let i = 0; i < maxTextures; i++) {\n samplerSize.push(1.0 / Constant.bufferSize);\n samplerSize.push(1.0 / Constant.bufferSize);\n }\n shader.uniforms.uSamplerSize = samplerSize;\n}\n\nexport function generateFragmentSrc(maxTextures: number, fragmentSrc: string) {\n return fragmentSrc.replace(/%count%/gi, maxTextures + \"\")\n .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n}\n\nexport function generateSampleSrc(maxTextures: number) {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n src += 'if(vTextureId <= -1.0) {';\n src += '\\n\\tcolor = shadowColor;';\n src += '\\n}';\n\n for (let i = 0; i < maxTextures; i++)\n {\n src += '\\nelse ';\n\n if(i < maxTextures-1)\n {\n src += 'if(textureId == ' + i + '.0)';\n }\n\n src += '\\n{';\n src += '\\n\\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);';\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n}\n","/// \n\nimport * as shaderGenerator from './shaderGenerator';\n\nimport { Buffer, Geometry, Shader } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nlet rectShaderFrag = `\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n`;\nlet rectShaderVert = `\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n`;\n\nexport abstract class TilemapShader extends Shader {\n\tmaxTextures = 0;\n\n\tconstructor(maxTextures: number, shaderVert: string, shaderFrag: string) {\n\t\tsuper(\n\t\t\tnew PIXI.Program(\n\t\t\t\tshaderVert,\n\t\t\t\tshaderFrag),\n\t\t\t{\n\t\t\t\tanimationFrame: new Float32Array(2),\n\t\t\t\tuSamplers: [],\n\t\t\t\tuSamplerSize: [],\n\t\t\t\tprojTransMatrix: new Matrix()\n\t\t\t}\n\t\t);\n\t\tthis.maxTextures = maxTextures;\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileShader extends TilemapShader {\n\tconstructor(maxTextures: number) {\n\t\tsuper(\n\t\t\tmaxTextures,\n\t\t\trectShaderVert,\n\t\t\tshaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)\n\t\t);\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileGeom extends Geometry {\n\tvertSize = 11;\n\tvertPerQuad = 4;\n\tstride = this.vertSize * 4;\n\tlastTimeAccess = 0;\n\n\tconstructor() {\n\t\tsuper();\n\t\tconst buf = this.buf = new Buffer(new Float32Array(2), true, false);\n\t\tthis.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0)\n\t\t\t.addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4)\n\t\t\t.addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4)\n\t\t\t.addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4)\n\t\t\t.addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4);\n\t}\n\n\tbuf: PIXI.Buffer;\n}","import { WRAP_MODES } from '@pixi/constants';\nimport { BaseTexture, Buffer, resources, ObjectRenderer, Texture, Renderer } from '@pixi/core';\nimport { Constant } from './Constant';\nimport { RectTileGeom, RectTileShader } from './RectTileShader';\nimport { MultiTextureResource } from './MultiTextureResource';\n\nimport type { TilemapShader } from './RectTileShader';\n\n/**\n * Renderer for rectangle tiles.\n */\nexport class TileRenderer extends ObjectRenderer {\n\trenderer: Renderer;\n\tgl: WebGLRenderingContext;\n\tsn: number = -1;\n\tindexBuffer: PIXI.Buffer = null;\n\tibLen: number = 0;\n\ttileAnim = [0, 0];\n\ttexLoc: Array = [];\n\n\trectShader: RectTileShader;\n\ttexResources: Array = [];\n\n\tconstructor(renderer: Renderer) {\n\t\tsuper(renderer);\n\t\tthis.rectShader = new RectTileShader(Constant.maxTextures);\n\t\tthis.indexBuffer = new Buffer(undefined, true, true);\n\t\tthis.checkIndexBuffer(2000);\n\t\tthis.initBounds();\n\t}\n\n\tinitBounds() {\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tfor (let i = 0; i < maxTextures; i++) {\n\t\t\tconst resource = new MultiTextureResource(Constant);\n\t\t\tconst baseTex = new BaseTexture(resource);\n\t\t\tbaseTex.scaleMode = Constant.SCALE_MODE;\n\t\t\tbaseTex.wrapMode = WRAP_MODES.CLAMP;\n\t\t\tthis.texResources.push(resource);\n\t\t}\n\t}\n\n\tbindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tlet samplerSize: Array = (shader as any).uniforms.uSamplerSize;\n\t\tthis.texLoc.length = 0;\n\t\tfor (let i = 0; i < textures.length; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trenderer.texture.bind(textures[i], i);\n\t\t\t//TODO: add resolution here\n\t\t\tsamplerSize[i * 2] = 1.0 / textures[i].baseTexture.width;\n\t\t\tsamplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height;\n\t\t}\n\t\t(shader as any).uniforms.uSamplerSize = samplerSize;\n\t}\n\n\tbindTextures(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tconst len = textures.length;\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tif (len > Constant.boundCountPerBuffer * maxTextures) {\n\t\t\treturn;\n\t\t}\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\tthis.bindTexturesWithoutRT(renderer, shader, textures);\n\t\t\treturn;\n\t\t}\n\n\t\tlet i = 0;\n\t\tfor (; i < len; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) continue;\n\t\t\tconst multi = this.texResources[i >> 2];\n\t\t\tmulti.setTexture(i & 3, texture);\n\t\t}\n\n\t\tlet gltsUsed = (i + 3) >> 2;\n\t\tfor (i = 0; i < gltsUsed; i++) {\n\t\t\t//remove \"i, true\" after resolving a bug\n\t\t\trenderer.texture.bind(this.texResources[i].baseTex, i);\n\t\t}\n\t}\n\n\tstart() {\n\t\t//sorry, nothing\n\t}\n\n\tcreateVb() {\n\t\tconst geom = new RectTileGeom();\n\t\tgeom.addIndex(this.indexBuffer);\n\t\tgeom.lastTimeAccess = Date.now();\n\t\treturn geom;\n\t}\n\n\tcheckIndexBuffer(size: number, vb: RectTileGeom = null) {\n\t\tconst totalIndices = size * 6;\n\n\t\tif (totalIndices <= this.ibLen) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet len = totalIndices;\n\t\twhile (len < totalIndices) {\n\t\t\tlen <<= 1;\n\t\t}\n\n\t\tthis.ibLen = totalIndices;\n\t\tthis.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size,\n\t\t\tConstant.use32bitIndex ? new Uint32Array(size * 6) : undefined));\n\n\t\t// \tTODO: create new index buffer instead?\n\t\t// if (vb) {\n\t\t// \tconst curIndex = vb.getIndex();\n\t\t// \tif (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) {\n\t\t// \t\tthis.swapIndex(vb, this.indexBuffer);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t// swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) {\n\t\t// let buffers = (geom as any).buffers;\n\t\t// const oldIndex = geom.getIndex();\n\t\t// let ind = buffers.indexOf(oldIndex);\n\t\t// if (ind >= 0) {\n\t\t// \tbuffers.splice(ind, 1);\n\t\t// }\n\t\t// geom.addIndex(indexBuf);\n\t// }\n\n\tgetShader(): TilemapShader {\n\t\treturn this.rectShader;\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\t// this.rectShader.destroy();\n\t\tthis.rectShader = null;\n\t}\n}\n\nRenderer.registerPlugin('tilemap', TileRenderer as any);\n","/// \n\nimport { Container } from '@pixi/display';\n\nimport type { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport type { Matrix } from '@pixi/math';\n\nexport class ZLayer extends Container {\n\n constructor(tilemap: Container, zIndex: number) {\n super();\n this.tilemap = tilemap;\n this.z = zIndex;\n }\n\n tilemap: any;\n z: number;\n zIndex: number;\n _previousLayers: number;\n canvasBuffer: HTMLCanvasElement;\n _tempRender: any;\n _lastAnimationFrame: number = -1;\n layerTransform: Matrix;\n\n clear() {\n let layers = this.children as Array;\n for (let i = 0; i < layers.length; i++)\n layers[i].clear();\n this._previousLayers = 0;\n }\n\n cacheIfDirty() {\n let tilemap: any = this.tilemap;\n let layers = this.children as Array;\n let modified = this._previousLayers !== layers.length;\n this._previousLayers = layers.length;\n let buf = this.canvasBuffer;\n let tempRender = this._tempRender;\n if (!buf) {\n buf = this.canvasBuffer = document.createElement('canvas');\n tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf});\n tempRender.context = tempRender.rootContext;\n tempRender.plugins.tilemap.dontUseTransform = true;\n }\n if (buf.width !== tilemap._layerWidth ||\n buf.height !== tilemap._layerHeight) {\n buf.width = tilemap._layerWidth;\n buf.height = tilemap._layerHeight;\n modified = true;\n }\n let i: number;\n if (!modified) {\n for (i = 0; i < layers.length; i++) {\n if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) {\n modified = true;\n break;\n }\n }\n }\n this._lastAnimationFrame = tilemap.animationFrame;\n if (modified) {\n if (tilemap._hackRenderer) {\n tilemap._hackRenderer(tempRender);\n }\n tempRender.context.clearRect(0, 0, buf.width, buf.height);\n for (i = 0; i < layers.length; i++) {\n layers[i].clearModify();\n layers[i].renderCanvas(tempRender);\n }\n }\n this.layerTransform = this.worldTransform;\n for (i = 0; i < layers.length; i++) {\n this.layerTransform = layers[i].worldTransform;\n break;\n }\n }\n\n renderCanvas(renderer: any) {\n this.cacheIfDirty();\n let wt = this.layerTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n let tilemap = this.tilemap;\n renderer.context.drawImage(this.canvasBuffer, 0, 0);\n }\n}\n","/// \n\nnamespace pixi_tilemap {\n (PIXI as any).tilemap = pixi_tilemap;\n}\n\n// This makes exporter.ts a module!\nexport default {}\n","import { CanvasTileRenderer } from './CanvasTileRenderer';\nimport { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport { Constant } from './Constant';\nimport { GraphicsLayer } from './GraphicsLayer';\nimport { MultiTextureResource } from './MultiTextureResource';\nimport { RectTileLayer } from './RectTileLayer';\nimport { TilemapShader, RectTileShader, RectTileGeom } from './RectTileShader';\nimport { TileRenderer } from './TileRenderer';\nimport { ZLayer } from './ZLayer';\n\nexport const pixi_tilemap = {\n CanvasTileRenderer,\n CompositeRectTileLayer,\n Constant,\n GraphicsLayer,\n MultiTextureResource,\n RectTileLayer,\n TilemapShader,\n RectTileShader,\n RectTileGeom,\n TileRenderer,\n ZLayer,\n};\n\nexport * from './CanvasTileRenderer';\nexport * from './CompositeRectTileLayer';\nexport * from './Constant';\nexport * from './exporter';\nexport * from './GraphicsLayer';\nexport * from './MultiTextureResource';\nexport * from './RectTileLayer';\nexport * from './RectTileShader';\nexport * from './shaderGenerator';\nexport * from './TileRenderer';\nexport * from './ZLayer';"],"names":["Texture","groupD8","DRAW_MODES","Container","Matrix","Graphics","Sprite","ALPHA_MODES","resources","shaderGenerator.fillSamplers","Shader","shaderGenerator.generateFragmentSrc","Buffer","Geometry","BaseTexture","WRAP_MODES","ObjectRenderer","Renderer","pixi_tilemap"],"mappings":";;;;;;;;;;;;;;;QASI,4BAAY,QAAkB;YAH9B,aAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAClB,qBAAgB,GAAG,KAAK,CAAC;YAGrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SAC1B;QACL,yBAAC;IAAD,CAAC,IAAA;IAED,IAAM,EAAE,GAAI,IAAY,CAAC,cAAc,CAAC;IAExC,IAAI,EAAE,EAAE;QACJ,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;;;IClBrD;IACA;IACA;IACA;IACA;AACA;IACA;IACA;IACA;IACA;AACA;IACA;IACA;IACA;IACA;AACA;IACA,IAAI,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE;IACnC,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc;IACzC,SAAS,EAAE,SAAS,EAAE,EAA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,kBAAkB,oBAAA;QAClB,sBAAsB,wBAAA;QACtB,QAAQ,UAAA;QACR,aAAa,eAAA;QACb,oBAAoB,sBAAA;QACpB,aAAa,eAAA;QACb,aAAa,eAAA;QACb,cAAc,gBAAA;QACd,YAAY,cAAA;QACZ,YAAY,cAAA;QACZ,MAAM,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/pixi-tilemap.umd.min.js b/dist/pixi-tilemap.umd.min.js index ec7abdce..2b5932e8 100644 --- a/dist/pixi-tilemap.umd.min.js +++ b/dist/pixi-tilemap.umd.min.js @@ -1,6 +1,6 @@ /*! * pixi-tilemap - v2.0.6 - * Compiled Fri, 14 Aug 2020 02:19:53 UTC + * Compiled Fri, 14 Aug 2020 02:36:52 UTC * * pixi-tilemap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license diff --git a/dist/pixi-tilemap.umd.min.js.map b/dist/pixi-tilemap.umd.min.js.map index 412b2934..8504f2c1 100644 --- a/dist/pixi-tilemap.umd.min.js.map +++ b/dist/pixi-tilemap.umd.min.js.map @@ -1 +1 @@ -{"version":3,"file":"pixi-tilemap.umd.min.js","sources":["../src/CanvasTileRenderer.ts","../node_modules/tslib/tslib.es6.js","../src/Constant.ts","../src/RectTileLayer.ts","../src/CompositeRectTileLayer.ts","../src/GraphicsLayer.ts","../src/MultiTextureResource.ts","../src/shaderGenerator.ts","../src/RectTileShader.ts","../src/TileRenderer.ts","../src/exporter.ts","../src/ZLayer.ts","../src/index.ts"],"sourcesContent":["/// \n\nimport { Renderer } from '@pixi/core';\n\nexport class CanvasTileRenderer {\n renderer: Renderer;\n tileAnim = [0, 0];\n dontUseTransform = false;\n\n constructor(renderer: Renderer) {\n this.renderer = renderer;\n this.tileAnim = [0, 0];\n }\n}\n\nconst cr = (PIXI as any).CanvasRenderer;\n\nif (cr) {\n cr.registerPlugin('tilemap', CanvasTileRenderer);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","export const Constant = {\n maxTextures: 16,\n bufferSize: 2048,\n boundSize: 1024,\n boundCountPerBuffer: 1,\n use32bitIndex: false,\n SCALE_MODE: PIXI.SCALE_MODES.LINEAR,\n DO_CLEAR: true\n};","/// \n\nimport { Container } from '@pixi/display';\nimport { Constant } from './Constant';\nimport { DRAW_MODES } from '@pixi/constants';\nimport { Texture, Renderer } from '@pixi/core';\nimport { TileRenderer } from './TileRenderer';\nimport { Matrix, groupD8 } from '@pixi/math';\n\nimport type { RectTileGeom } from './RectTileShader';\n\nexport const POINT_STRUCT_SIZE = 12;\n\nexport class RectTileLayer extends Container {\n constructor(zIndex: number, texture: Texture | Array) {\n super();\n this.initialize(zIndex, texture);\n }\n\n zIndex = 0;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n\n pointsBuf: Array = [];\n hasAnim = false;\n textures: Array;\n\n offsetX = 0;\n offsetY = 0;\n compositeParent = false;\n\n initialize(zIndex: number, textures: Texture | Array) {\n if (!textures) {\n textures = [];\n } else if (!(textures instanceof Array) && (textures as Texture).baseTexture) {\n textures = [textures as Texture];\n }\n this.textures = textures as Array;\n this.zIndex = zIndex;\n // this.visible = false;\n }\n\n clear() {\n this.pointsBuf.length = 0;\n this.modificationMarker = 0;\n this.hasAnim = false;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX: number, animY: number) {\n let texture: Texture;\n let textureIndex = 0;\n\n if (typeof texture_ === \"number\") {\n textureIndex = texture_;\n texture = this.textures[textureIndex];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n let found = false;\n let textureList = this.textures;\n for (let i = 0; i < textureList.length; i++) {\n if (textureList[i].baseTexture === texture.baseTexture) {\n textureIndex = i;\n found = true;\n break;\n }\n }\n\n if (!found) {\n // textureIndex = this.textures.length;\n // this.textures.push(texture);\n return false;\n }\n }\n\n this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate);\n return true;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number,\n animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this {\n let pb = this.pointsBuf;\n this.hasAnim = this.hasAnim || animX > 0 || animY > 0;\n pb.push(u);\n pb.push(v);\n pb.push(x);\n pb.push(y);\n pb.push(tileWidth);\n pb.push(tileHeight);\n pb.push(rotate);\n pb.push(animX | 0);\n pb.push(animY | 0);\n pb.push(textureIndex);\n pb.push(animCountX);\n pb.push(animCountY);\n\n return this;\n }\n\n tileRotate(rotate: number) {\n const pb = this.pointsBuf;\n pb[pb.length - 3] = rotate;\n }\n\n tileAnimX(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 5] = offset;\n pb[pb.length - 2] = count;\n }\n\n tileAnimY(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 4] = offset;\n pb[pb.length - 1] = count;\n }\n\n renderCanvas(renderer: any) {\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n this.renderCanvasCore(renderer);\n }\n\n renderCanvasCore(renderer: any) {\n if (this.textures.length === 0) return;\n let points = this.pointsBuf;\n renderer.context.fillStyle = '#000000';\n for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) {\n let x1 = points[i], y1 = points[i + 1];\n let x2 = points[i + 2], y2 = points[i + 3];\n let w = points[i + 4];\n let h = points[i + 5];\n var rotate = points[i + 6];\n x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0];\n y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1];\n let textureIndex = points[i + 9];\n // canvas does not work with rotate yet\n if (textureIndex >= 0) {\n renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h);\n } else {\n renderer.context.globalAlpha = 0.5;\n renderer.context.fillRect(x2, y2, w, h);\n renderer.context.globalAlpha = 1;\n }\n }\n }\n\n vbId = 0;\n vb: RectTileGeom = null;\n vbBuffer: ArrayBuffer = null;\n vbArray: Float32Array = null;\n vbInts: Uint32Array = null;\n\n destroyVb() {\n if (this.vb) {\n this.vb.destroy();\n this.vb = null;\n }\n }\n\n render(renderer: Renderer) {\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n this.renderWebGLCore(renderer, plugin);\n }\n\n renderWebGLCore(renderer: Renderer, plugin: TileRenderer) {\n let points = this.pointsBuf;\n if (points.length === 0) return;\n let rectsCount = points.length / POINT_STRUCT_SIZE;\n\n let shader = plugin.getShader();\n let textures = this.textures;\n if (textures.length === 0) return;\n\n plugin.bindTextures(renderer, shader, textures);\n renderer.shader.bind(shader, false);\n\n //lost context! recover!\n let vb = this.vb;\n if (!vb) {\n vb = plugin.createVb();\n this.vb = vb;\n this.vbId = (vb as any).id;\n this.vbBuffer = null;\n this.modificationMarker = 0;\n }\n\n plugin.checkIndexBuffer(rectsCount, vb);\n const boundCountPerBuffer = Constant.boundCountPerBuffer;\n\n let vertexBuf = vb.getBuffer('aVertexPosition');\n //if layer was changed, re-upload vertices\n let vertices = rectsCount * vb.vertPerQuad;\n if (vertices === 0) return;\n if (this.modificationMarker !== vertices) {\n this.modificationMarker = vertices;\n let vs = vb.stride * vertices;\n if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {\n //!@#$ happens, need resize\n let bk = vb.stride;\n while (bk < vs) {\n bk *= 2;\n }\n this.vbBuffer = new ArrayBuffer(bk);\n this.vbArray = new Float32Array(this.vbBuffer);\n this.vbInts = new Uint32Array(this.vbBuffer);\n vertexBuf.update(this.vbBuffer);\n }\n\n let arr = this.vbArray, ints = this.vbInts;\n //upload vertices!\n let sz = 0;\n //let tint = 0xffffffff;\n let textureId: number = 0;\n let shiftU: number = this.offsetX;\n let shiftV: number = this.offsetY;\n\n //let tint = 0xffffffff;\n let tint = -1;\n for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) {\n let eps = 0.5;\n if (this.compositeParent) {\n if (boundCountPerBuffer > 1) {\n //TODO: what if its more than 4?\n textureId = (points[i + 9] >> 2);\n shiftU = this.offsetX * (points[i + 9] & 1);\n shiftV = this.offsetY * ((points[i + 9] >> 1) & 1);\n } else {\n textureId = points[i + 9];\n shiftU = 0;\n shiftV = 0;\n }\n }\n let x = points[i + 2], y = points[i + 3];\n let w = points[i + 4], h = points[i + 5];\n let u = points[i] + shiftU, v = points[i + 1] + shiftV;\n let rotate = points[i + 6];\n\n const animX = points[i + 7], animY = points[i + 8];\n const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024;\n const animXEncoded = animX + (animWidth * 2048);\n const animYEncoded = animY + (animHeight * 2048);\n\n let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number;\n if (rotate === 0) {\n u0 = u;\n v0 = v;\n u1 = u + w;\n v1 = v;\n u2 = u + w;\n v2 = v + h;\n u3 = u;\n v3 = v + h;\n } else {\n let w2 = w / 2;\n let h2 = h / 2;\n if (rotate % 4 !== 0) {\n w2 = h / 2;\n h2 = w / 2;\n }\n const cX = u + w2;\n const cY = v + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW);\n u0 = cX + (w2 * groupD8.uX(rotate));\n v0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n u1 = cX + (w2 * groupD8.uX(rotate));\n v1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u2 = cX + (w2 * groupD8.uX(rotate));\n v2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u3 = cX + (w2 * groupD8.uX(rotate));\n v3 = cY + (h2 * groupD8.uY(rotate));\n }\n\n arr[sz++] = x;\n arr[sz++] = y;\n arr[sz++] = u0;\n arr[sz++] = v0;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y;\n arr[sz++] = u1;\n arr[sz++] = v1;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y + h;\n arr[sz++] = u2;\n arr[sz++] = v2;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x;\n arr[sz++] = y + h;\n arr[sz++] = u3;\n arr[sz++] = v3;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n }\n\n vertexBuf.update(arr);\n }\n\n (renderer.geometry as any).bind(vb, shader);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES, rectsCount * 6, 0);\n }\n\n isModified(anim: boolean) {\n if (this.modificationMarker !== this.pointsBuf.length ||\n anim && this.hasAnim) {\n return true;\n }\n return false;\n }\n\n clearModify() {\n this.modificationMarker = this.pointsBuf.length;\n }\n\n destroy(options?: any) {\n super.destroy(options);\n this.destroyVb();\n }\n}\n","/// \n\nimport { Container } from '@pixi/display';\nimport { Texture, Renderer } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { Constant } from './Constant';\nimport { RectTileLayer } from './RectTileLayer';\n\nexport class CompositeRectTileLayer extends Container {\n constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n super();\n this.initialize.apply(this, arguments);\n }\n\n updateTransform() {\n (this as any).displayObjectUpdateTransform();\n }\n\n z: number;\n zIndex: number;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n _lastLayer: RectTileLayer = null;\n\n texPerChild: number;\n\n initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n if (texPerChild as any === true) {\n //old format, ignore it!\n texPerChild = 0;\n }\n this.z = this.zIndex = zIndex;\n this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures;\n if (bitmaps) {\n this.setBitmaps(bitmaps);\n }\n }\n\n setBitmaps(bitmaps: Array) {\n for (let i=0;i 5.2.1, it does not exist there.`);\n }\n }\n let texPerChild = this.texPerChild;\n let len1 = this.children.length;\n let len2 = Math.ceil(bitmaps.length / texPerChild);\n let i: number;\n for (i = 0; i < len1; i++) {\n (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);\n }\n for (i = len1; i < len2; i++) {\n let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild));\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n this.addChild(layer);\n }\n }\n\n clear() {\n for (let i = 0; i < this.children.length; i++) {\n (this.children[i] as RectTileLayer).clear();\n }\n this.modificationMarker = 0;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this {\n const childIndex: number = textureIndex / this.texPerChild >> 0;\n const textureId: number = textureIndex % this.texPerChild;\n\n if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) {\n this._lastLayer = (this.children[childIndex] as RectTileLayer);\n this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight);\n } else {\n this._lastLayer = null;\n }\n\n return this;\n }\n\n tileRotate(rotate: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileRotate(rotate);\n }\n return this;\n }\n\n tileAnimX(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimX(offset, count);\n }\n return this;\n }\n\n tileAnimY(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimY(offset, count);\n }\n return this;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this {\n let texture: Texture;\n let layer: RectTileLayer = null;\n let ind: number = 0;\n let children = this.children;\n\n this._lastLayer = null;\n if (typeof texture_ === \"number\") {\n let childIndex = texture_ / this.texPerChild >> 0;\n layer = children[childIndex] as RectTileLayer;\n\n if (!layer) {\n layer = children[0] as RectTileLayer;\n if (!layer) {\n return this;\n }\n ind = 0;\n } else {\n ind = texture_ % this.texPerChild;\n }\n\n texture = layer.textures[ind];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n let tex = child.textures;\n for (let j = 0; j < tex.length; j++) {\n if (tex[j].baseTexture === texture.baseTexture) {\n layer = child;\n ind = j;\n break;\n }\n }\n if (layer) {\n break;\n }\n }\n\n if (!layer) {\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n if (child.textures.length < this.texPerChild) {\n layer = child;\n ind = child.textures.length;\n child.textures.push(texture);\n break;\n }\n }\n if (!layer) {\n layer = new RectTileLayer(this.zIndex, texture);\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n children.push(layer);\n ind = 0;\n }\n }\n }\n\n this._lastLayer = layer;\n layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight);\n return this;\n }\n\n renderCanvas(renderer: any) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderCanvasCore(renderer);\n }\n }\n\n render(renderer: Renderer) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n //TODO: dont create new array, please\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n renderer.shader.bind(shader, false);\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin);\n }\n }\n\n isModified(anim: boolean) {\n let layers = this.children;\n if (this.modificationMarker !== layers.length) {\n return true;\n }\n for (let i = 0; i < layers.length; i++) {\n if ((layers[i] as RectTileLayer).isModified(anim)) {\n return true;\n }\n }\n return false;\n }\n\n clearModify() {\n let layers = this.children;\n this.modificationMarker = layers.length;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).clearModify();\n }\n }\n}","/// \n\nimport { Matrix } from '@pixi/math';\nimport { Graphics } from '@pixi/graphics';\n\nexport class GraphicsLayer extends Graphics {\n constructor(zIndex: number) {\n super();\n this.zIndex = zIndex;\n }\n\n renderCanvas(renderer: any) {\n let wt: Matrix = null;\n if (renderer.plugins.tilemap.dontUseTransform) {\n wt = this.transform.worldTransform;\n this.transform.worldTransform = Matrix.IDENTITY;\n }\n renderer.plugins.graphics.render(this);\n if (renderer.plugins.tilemap.dontUseTransform) {\n this.transform.worldTransform = wt;\n }\n renderer.context.globalAlpha = 1.0;\n }\n\n // renderWebGL(renderer: PIXI.Renderer) {\n // if (!this._webGL[renderer.CONTEXT_UID])\n // this.dirty++;\n // super.renderWebGL(renderer)\n // }\n\n isModified(anim: boolean): boolean {\n return false;\n }\n\n clearModify() {\n }\n}\n","/// \n\nimport { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, Renderer, Texture, GLTexture, resources } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Constant } from './Constant';\n\nexport interface IMultiTextureOptions {\n\tboundCountPerBuffer: number;\n\tboundSize: number;\n\tbufferSize: number;\n\tDO_CLEAR?: boolean;\n}\n\nexport class MultiTextureResource extends resources.Resource {\n\tconstructor(options: IMultiTextureOptions) {\n\t\tsuper(options.bufferSize, options.bufferSize);\n\n\t\tconst bounds = this.boundSprites;\n\t\tconst dirties = this.dirties;\n\t\tthis.boundSize = options.boundSize;\n\t\tfor (let j = 0; j < options.boundCountPerBuffer; j++) {\n\t\t\tconst spr = new Sprite();\n\t\t\tspr.position.x = options.boundSize * (j & 1);\n\t\t\tspr.position.y = options.boundSize * (j >> 1);\n\t\t\tbounds.push(spr);\n\t\t\tdirties.push(0);\n\t\t}\n\t\tthis.DO_CLEAR = !!options.DO_CLEAR;\n\t}\n\n\tDO_CLEAR = false;\n\tboundSize: number = 0;\n\t_clearBuffer: Uint8Array = null;\n\n\tbind(baseTexture: BaseTexture) {\n\t\tif (this.baseTex) {\n\t\t\tthrow new Error('Only one baseTexture is allowed for this resource!')\n\t\t}\n\t\tthis.baseTex = baseTexture;\n\t\tsuper.bind(baseTexture);\n\t}\n\n\tbaseTex: BaseTexture = null;\n\tboundSprites: Array = [];\n\tdirties: Array = [];\n\n\tsetTexture(ind: number, texture: Texture) {\n\t\tconst spr = this.boundSprites[ind];\n\t\tif (spr.texture.baseTexture === texture.baseTexture) {\n\t\t\treturn;\n\t\t}\n\t\tspr.texture = texture;\n\t\tthis.baseTex.update();\n\t\tthis.dirties[ind] = (this.baseTex as any).dirtyId;\n\t}\n\n\tupload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture) {\n\t\tconst { gl } = renderer as any;\n\n\t\tconst {width, height} = this;\n\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined ||\n\t\t\ttexture.alphaMode === ALPHA_MODES.UNPACK);\n\n\t\tif (glTexture.dirtyId < 0) {\n\t\t\t(glTexture as any).width = width;\n\t\t\t(glTexture as any).height = height;\n\n\t\t\tgl.texImage2D(texture.target, 0,\n\t\t\t\ttexture.format,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\t0,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tnull);\n\t\t}\n\n\t\tconst doClear = this.DO_CLEAR;\n\t\tif (doClear && !this._clearBuffer) {\n\t\t\tthis._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4);\n\t\t}\n\n\t\tconst bounds = this.boundSprites;\n\t\tfor (let i = 0; i < bounds.length; i++) {\n\t\t\tconst spr = bounds[i];\n\t\t\tconst tex = spr.texture.baseTexture;\n\t\t\tif (glTexture.dirtyId >= this.dirties[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst res = tex.resource as any;\n\t\t\tif (!tex.valid || !res || !res.source) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (doClear && (tex.width < this.boundSize || tex.height < this.boundSize))\n\t\t\t{\n\t\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\t\tspr.position.x,\n\t\t\t\t\tspr.position.y,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\ttexture.format,\n\t\t\t\t\ttexture.type,\n\t\t\t\t\tthis._clearBuffer);\n\t\t\t}\n\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\tspr.position.x,\n\t\t\t\tspr.position.y,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tres.source);\n\t\t}\n\n\t\treturn true;\n\t}\n}\n","import { Constant } from './Constant';\n\nimport type { TilemapShader } from './RectTileShader';\n\n\nexport function fillSamplers(shader: TilemapShader, maxTextures: number) {\n let sampleValues: Array = [];\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n shader.uniforms.uSamplers = sampleValues;\n\n let samplerSize: Array = [];\n for (let i = 0; i < maxTextures; i++) {\n samplerSize.push(1.0 / Constant.bufferSize);\n samplerSize.push(1.0 / Constant.bufferSize);\n }\n shader.uniforms.uSamplerSize = samplerSize;\n}\n\nexport function generateFragmentSrc(maxTextures: number, fragmentSrc: string) {\n return fragmentSrc.replace(/%count%/gi, maxTextures + \"\")\n .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n}\n\nexport function generateSampleSrc(maxTextures: number) {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n src += 'if(vTextureId <= -1.0) {';\n src += '\\n\\tcolor = shadowColor;';\n src += '\\n}';\n\n for (let i = 0; i < maxTextures; i++)\n {\n src += '\\nelse ';\n\n if(i < maxTextures-1)\n {\n src += 'if(textureId == ' + i + '.0)';\n }\n\n src += '\\n{';\n src += '\\n\\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);';\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n}\n","/// \n\nimport * as shaderGenerator from './shaderGenerator';\n\nimport { Buffer, Geometry, Shader } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nlet rectShaderFrag = `\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n`;\nlet rectShaderVert = `\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n`;\n\nexport abstract class TilemapShader extends Shader {\n\tmaxTextures = 0;\n\n\tconstructor(maxTextures: number, shaderVert: string, shaderFrag: string) {\n\t\tsuper(\n\t\t\tnew PIXI.Program(\n\t\t\t\tshaderVert,\n\t\t\t\tshaderFrag),\n\t\t\t{\n\t\t\t\tanimationFrame: new Float32Array(2),\n\t\t\t\tuSamplers: [],\n\t\t\t\tuSamplerSize: [],\n\t\t\t\tprojTransMatrix: new Matrix()\n\t\t\t}\n\t\t);\n\t\tthis.maxTextures = maxTextures;\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileShader extends TilemapShader {\n\tconstructor(maxTextures: number) {\n\t\tsuper(\n\t\t\tmaxTextures,\n\t\t\trectShaderVert,\n\t\t\tshaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)\n\t\t);\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileGeom extends Geometry {\n\tvertSize = 11;\n\tvertPerQuad = 4;\n\tstride = this.vertSize * 4;\n\tlastTimeAccess = 0;\n\n\tconstructor() {\n\t\tsuper();\n\t\tconst buf = this.buf = new Buffer(new Float32Array(2), true, false);\n\t\tthis.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0)\n\t\t\t.addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4)\n\t\t\t.addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4)\n\t\t\t.addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4)\n\t\t\t.addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4);\n\t}\n\n\tbuf: PIXI.Buffer;\n}","import { WRAP_MODES } from '@pixi/constants';\nimport { BaseTexture, Buffer, resources, ObjectRenderer, Texture, Renderer } from '@pixi/core';\nimport { Constant } from './Constant';\nimport { RectTileGeom, RectTileShader } from './RectTileShader';\nimport { MultiTextureResource } from './MultiTextureResource';\n\nimport type { TilemapShader } from './RectTileShader';\n\n/**\n * Renderer for rectangle tiles.\n */\nexport class TileRenderer extends ObjectRenderer {\n\trenderer: Renderer;\n\tgl: WebGLRenderingContext;\n\tsn: number = -1;\n\tindexBuffer: PIXI.Buffer = null;\n\tibLen: number = 0;\n\ttileAnim = [0, 0];\n\ttexLoc: Array = [];\n\n\trectShader: RectTileShader;\n\ttexResources: Array = [];\n\n\tconstructor(renderer: Renderer) {\n\t\tsuper(renderer);\n\t\tthis.rectShader = new RectTileShader(Constant.maxTextures);\n\t\tthis.indexBuffer = new Buffer(undefined, true, true);\n\t\tthis.checkIndexBuffer(2000);\n\t\tthis.initBounds();\n\t}\n\n\tinitBounds() {\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tfor (let i = 0; i < maxTextures; i++) {\n\t\t\tconst resource = new MultiTextureResource(Constant);\n\t\t\tconst baseTex = new BaseTexture(resource);\n\t\t\tbaseTex.scaleMode = Constant.SCALE_MODE;\n\t\t\tbaseTex.wrapMode = WRAP_MODES.CLAMP;\n\t\t\tthis.texResources.push(resource);\n\t\t}\n\t}\n\n\tbindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tlet samplerSize: Array = (shader as any).uniforms.uSamplerSize;\n\t\tthis.texLoc.length = 0;\n\t\tfor (let i = 0; i < textures.length; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trenderer.texture.bind(textures[i], i);\n\t\t\t//TODO: add resolution here\n\t\t\tsamplerSize[i * 2] = 1.0 / textures[i].baseTexture.width;\n\t\t\tsamplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height;\n\t\t}\n\t\t(shader as any).uniforms.uSamplerSize = samplerSize;\n\t}\n\n\tbindTextures(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tconst len = textures.length;\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tif (len > Constant.boundCountPerBuffer * maxTextures) {\n\t\t\treturn;\n\t\t}\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\tthis.bindTexturesWithoutRT(renderer, shader, textures);\n\t\t\treturn;\n\t\t}\n\n\t\tlet i = 0;\n\t\tfor (; i < len; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) continue;\n\t\t\tconst multi = this.texResources[i >> 2];\n\t\t\tmulti.setTexture(i & 3, texture);\n\t\t}\n\n\t\tlet gltsUsed = (i + 3) >> 2;\n\t\tfor (i = 0; i < gltsUsed; i++) {\n\t\t\t//remove \"i, true\" after resolving a bug\n\t\t\trenderer.texture.bind(this.texResources[i].baseTex, i);\n\t\t}\n\t}\n\n\tstart() {\n\t\t//sorry, nothing\n\t}\n\n\tcreateVb() {\n\t\tconst geom = new RectTileGeom();\n\t\tgeom.addIndex(this.indexBuffer);\n\t\tgeom.lastTimeAccess = Date.now();\n\t\treturn geom;\n\t}\n\n\tcheckIndexBuffer(size: number, vb: RectTileGeom = null) {\n\t\tconst totalIndices = size * 6;\n\n\t\tif (totalIndices <= this.ibLen) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet len = totalIndices;\n\t\twhile (len < totalIndices) {\n\t\t\tlen <<= 1;\n\t\t}\n\n\t\tthis.ibLen = totalIndices;\n\t\tthis.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size,\n\t\t\tConstant.use32bitIndex ? new Uint32Array(size * 6) : undefined));\n\n\t\t// \tTODO: create new index buffer instead?\n\t\t// if (vb) {\n\t\t// \tconst curIndex = vb.getIndex();\n\t\t// \tif (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) {\n\t\t// \t\tthis.swapIndex(vb, this.indexBuffer);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t// swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) {\n\t\t// let buffers = (geom as any).buffers;\n\t\t// const oldIndex = geom.getIndex();\n\t\t// let ind = buffers.indexOf(oldIndex);\n\t\t// if (ind >= 0) {\n\t\t// \tbuffers.splice(ind, 1);\n\t\t// }\n\t\t// geom.addIndex(indexBuf);\n\t// }\n\n\tgetShader(): TilemapShader {\n\t\treturn this.rectShader;\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\t// this.rectShader.destroy();\n\t\tthis.rectShader = null;\n\t}\n}\n\nRenderer.registerPlugin('tilemap', TileRenderer as any);\n","/// \n\nnamespace pixi_tilemap {\n (PIXI as any).tilemap = pixi_tilemap;\n}\n\n// This makes exporter.ts a module!\nexport default {}\n","/// \n\nimport { Container } from '@pixi/display';\n\nimport type { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport type { Matrix } from '@pixi/math';\n\nexport class ZLayer extends Container {\n\n constructor(tilemap: Container, zIndex: number) {\n super();\n this.tilemap = tilemap;\n this.z = zIndex;\n }\n\n tilemap: any;\n z: number;\n zIndex: number;\n _previousLayers: number;\n canvasBuffer: HTMLCanvasElement;\n _tempRender: any;\n _lastAnimationFrame: number = -1;\n layerTransform: Matrix;\n\n clear() {\n let layers = this.children as Array;\n for (let i = 0; i < layers.length; i++)\n layers[i].clear();\n this._previousLayers = 0;\n }\n\n cacheIfDirty() {\n let tilemap: any = this.tilemap;\n let layers = this.children as Array;\n let modified = this._previousLayers !== layers.length;\n this._previousLayers = layers.length;\n let buf = this.canvasBuffer;\n let tempRender = this._tempRender;\n if (!buf) {\n buf = this.canvasBuffer = document.createElement('canvas');\n tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf});\n tempRender.context = tempRender.rootContext;\n tempRender.plugins.tilemap.dontUseTransform = true;\n }\n if (buf.width !== tilemap._layerWidth ||\n buf.height !== tilemap._layerHeight) {\n buf.width = tilemap._layerWidth;\n buf.height = tilemap._layerHeight;\n modified = true;\n }\n let i: number;\n if (!modified) {\n for (i = 0; i < layers.length; i++) {\n if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) {\n modified = true;\n break;\n }\n }\n }\n this._lastAnimationFrame = tilemap.animationFrame;\n if (modified) {\n if (tilemap._hackRenderer) {\n tilemap._hackRenderer(tempRender);\n }\n tempRender.context.clearRect(0, 0, buf.width, buf.height);\n for (i = 0; i < layers.length; i++) {\n layers[i].clearModify();\n layers[i].renderCanvas(tempRender);\n }\n }\n this.layerTransform = this.worldTransform;\n for (i = 0; i < layers.length; i++) {\n this.layerTransform = layers[i].worldTransform;\n break;\n }\n }\n\n renderCanvas(renderer: any) {\n this.cacheIfDirty();\n let wt = this.layerTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n let tilemap = this.tilemap;\n renderer.context.drawImage(this.canvasBuffer, 0, 0);\n }\n}\n","import { CanvasTileRenderer } from './CanvasTileRenderer';\nimport { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport { Constant } from './Constant';\nimport { GraphicsLayer } from './GraphicsLayer';\nimport { MultiTextureResource } from './MultiTextureResource';\nimport { RectTileLayer } from './RectTileLayer';\nimport { TilemapShader, RectTileShader, RectTileGeom } from './RectTileShader';\nimport { TileRenderer } from './TileRenderer';\nimport { ZLayer } from './ZLayer';\n\nexport const pixi_tilemap = {\n CanvasTileRenderer,\n CompositeRectTileLayer,\n Constant,\n GraphicsLayer,\n MultiTextureResource,\n RectTileLayer,\n TilemapShader,\n RectTileShader,\n RectTileGeom,\n TileRenderer,\n ZLayer,\n};\n\nexport * from './CanvasTileRenderer';\nexport * from './CompositeRectTileLayer';\nexport * from './Constant';\nexport * from './exporter';\nexport * from './GraphicsLayer';\nexport * from './MultiTextureResource';\nexport * from './RectTileLayer';\nexport * from './RectTileShader';\nexport * from './shaderGenerator';\nexport * from './TileRenderer';\nexport * from './ZLayer';"],"names":["renderer","this","tileAnim","cr","PIXI","CanvasRenderer","registerPlugin","CanvasTileRenderer","extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","__extends","__","constructor","prototype","create","Constant","maxTextures","bufferSize","boundSize","boundCountPerBuffer","use32bitIndex","SCALE_MODE","SCALE_MODES","LINEAR","DO_CLEAR","zIndex","texture","_super","_this","Float32Array","initialize","RectTileLayer","textures","baseTexture","pointsBuf","length","modificationMarker","hasAnim","texture_","x","y","animX","animY","textureIndex","Texture","from","found","textureList","i","addRect","frame","orig","width","height","rotate","u","v","tileWidth","tileHeight","animCountX","animCountY","pb","push","offset","count","plugins","tilemap","dontUseTransform","wt","worldTransform","context","setTransform","a","c","tx","resolution","ty","renderCanvasCore","points","fillStyle","n","x1","y1","x2","y2","w","h","drawImage","getDrawableSource","globalAlpha","fillRect","vb","destroy","plugin","shader","getShader","batch","setObjectRenderer","_globalMat","uniforms","projTransMatrix","globalUniforms","projectionMatrix","copyTo","append","shadowColor","animationFrame","renderWebGLCore","rectsCount","bindTextures","bind","createVb","vbId","id","vbBuffer","checkIndexBuffer","vertexBuf","getBuffer","vertices","vertPerQuad","vs","stride","byteLength","bk","ArrayBuffer","vbArray","vbInts","Uint32Array","update","arr","sz","textureId","shiftU","offsetX","shiftV","offsetY","compositeParent","animXEncoded","animYEncoded","u0","v0","u1","v1","u2","v2","u3","v3","w2","h2","cX","cY","groupD8","add","NW","uX","uY","geometry","draw","DRAW_MODES","TRIANGLES","anim","options","destroyVb","Container","bitmaps","texPerChild","apply","arguments","CompositeRectTileLayer","displayObjectUpdateTransform","z","setBitmaps","i_1","Error","len1","children","len2","Math","ceil","slice","layer","addChild","clear","animWidth","animHeight","childIndex","_lastLayer","tileRotate","tileAnimX","tileAnimY","ind","tex","child","j","visible","worldAlpha","renderable","layers","isModified","clearModify","GraphicsLayer","transform","Matrix","IDENTITY","graphics","render","Graphics","bounds","boundSprites","dirties","spr","Sprite","position","MultiTextureResource","baseTex","dirtyId","glTexture","gl","pixelStorei","UNPACK_PREMULTIPLY_ALPHA_WEBGL","undefined","alphaMode","ALPHA_MODES","UNPACK","texImage2D","target","format","type","doClear","_clearBuffer","Uint8Array","res","resource","valid","source","texSubImage2D","resources","Resource","fillSamplers","sampleValues","uSamplers","samplerSize","uSamplerSize","generateFragmentSrc","fragmentSrc","replace","generateSampleSrc","shaderVert","shaderFrag","Program","shaderGenerator.fillSamplers","Shader","shaderGenerator.generateFragmentSrc","TilemapShader","vertSize","buf","Buffer","addAttribute","Geometry","rectShader","RectTileShader","indexBuffer","initBounds","TileRenderer","BaseTexture","scaleMode","wrapMode","WRAP_MODES","CLAMP","texResources","texLoc","len","bindTexturesWithoutRT","setTexture","gltsUsed","geom","RectTileGeom","addIndex","lastTimeAccess","Date","now","size","totalIndices","ibLen","utils","createIndicesForQuads","ObjectRenderer","pixi_tilemap","ZLayer","_previousLayers","modified","canvasBuffer","tempRender","_tempRender","document","createElement","view","rootContext","_layerWidth","_layerHeight","_lastAnimationFrame","_hackRenderer","clearRect","renderCanvas","layerTransform","cacheIfDirty","src"],"mappings":";;;;;;;;;4DASI,SAAYA,GAHZC,cAAW,CAAC,EAAG,GACfA,uBAAmB,EAGfA,KAAKD,SAAWA,EAChBC,KAAKC,SAAW,CAAC,EAAG,IAItBC,EAAMC,KAAaC,eAErBF,GACAA,EAAGG,eAAe,UAAWC;;;;;;;;;;;;;;qFCFjC,IAAIC,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,IACvE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOA,EAAEM,eAAeD,KAAIN,EAAEM,GAAKL,EAAEK,MACpDN,EAAGC,IAGrB,SAASO,EAAUR,EAAGC,GAEzB,SAASQ,IAAOjB,KAAKkB,YAAcV,EADnCD,EAAcC,EAAGC,GAEjBD,EAAEW,UAAkB,OAANV,EAAaC,OAAOU,OAAOX,IAAMQ,EAAGE,UAAYV,EAAEU,UAAW,IAAIF,OC1BtEI,EAAW,CACpBC,YAAa,GACbC,WAAY,KACZC,UAAW,KACXC,oBAAqB,EACrBC,eAAe,EACfC,WAAYxB,KAAKyB,YAAYC,OAC7BC,UAAU,iBCOV,WAAYC,EAAgBC,GAA5B,MACIC,0BAIJC,SAAS,EACTA,qBAAqB,EACrBA,cAAc,IAAIC,aAAa,CAAC,EAAK,EAAK,EAAK,KAC/CD,aAAqB,KAErBA,YAA2B,GAC3BA,WAAU,EAGVA,UAAU,EACVA,UAAU,EACV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uJ,cACVF,EAAOrJ,GAAG+P,aAAaX,GAI/B,IADA1S,KAAKsT,eAAiBtT,KAAK2E,eACtBrB,EAAI,EAAGA,EAAIqJ,EAAOlK,OAAQa,IAAK,CAChCtD,KAAKsT,eAAiB3G,EAAOrJ,GAAGqB,eAChC,QAIR2N,yBAAA,SAAavS,GACTC,KAAKuT,eACL,IAAI7O,EAAK1E,KAAKsT,eACdvT,EAAS6E,QAAQC,aACbH,EAAGI,EACHJ,EAAGjE,EACHiE,EAAGK,EACHL,EAAGlE,EACHkE,EAAGM,GAAKjF,EAASkF,WACjBP,EAAGQ,GAAKnF,EAASkF,YAEPjF,KAAKwE,QACnBzE,EAAS6E,QAAQiB,UAAU7F,KAAKyS,aAAc,EAAG,OAlF7BhI,cDL5B,SAAU4H,GACLlS,KAAaqE,QAAU6N,EAD5B,CAAUA,IAAAA,WEQGA,EAAe,CACxB/R,qBACAwK,yBACAzJ,WACAyL,gBACAa,uBACAtL,gBACA8N,gBACAO,iBACAgB,eACAb,eACAyB,+ITV6B,6KIeChR,GAC9B,IAAIkS,EAAM,GAEVA,GAAO,KACPA,GAAO,KAEPA,GAAO,2BACPA,GAAO,2BACPA,GAAO,MAEP,IAAK,IAAIlQ,EAAI,EAAGA,EAAIhC,EAAagC,IAE7BkQ,GAAO,UAEJlQ,EAAIhC,EAAY,IAEfkS,GAAO,mBAAqBlQ,EAAI,OAGpCkQ,GAAO,MACPA,GAAO,mCAAmClQ,EAAE,kCAAkCA,EAAE,MAChFkQ,GAAO,MAMX,OAHAA,GAAO,KACPA,GAAO"} \ No newline at end of file +{"version":3,"file":"pixi-tilemap.umd.min.js","sources":["../src/CanvasTileRenderer.ts","../node_modules/tslib/tslib.es6.js","../src/Constant.ts","../src/RectTileLayer.ts","../src/CompositeRectTileLayer.ts","../src/GraphicsLayer.ts","../src/MultiTextureResource.ts","../src/shaderGenerator.ts","../src/RectTileShader.ts","../src/TileRenderer.ts","../src/exporter.ts","../src/ZLayer.ts","../src/index.ts"],"sourcesContent":["/// \n\nimport { Renderer } from '@pixi/core';\n\nexport class CanvasTileRenderer {\n renderer: Renderer;\n tileAnim = [0, 0];\n dontUseTransform = false;\n\n constructor(renderer: Renderer) {\n this.renderer = renderer;\n this.tileAnim = [0, 0];\n }\n}\n\nconst cr = (PIXI as any).CanvasRenderer;\n\nif (cr) {\n cr.registerPlugin('tilemap', CanvasTileRenderer);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","export const Constant = {\n maxTextures: 16,\n bufferSize: 2048,\n boundSize: 1024,\n boundCountPerBuffer: 1,\n use32bitIndex: false,\n SCALE_MODE: PIXI.SCALE_MODES.LINEAR,\n DO_CLEAR: true\n};","/// \n\nimport { Container } from '@pixi/display';\nimport { Constant } from './Constant';\nimport { DRAW_MODES } from '@pixi/constants';\nimport { Texture, Renderer } from '@pixi/core';\nimport { TileRenderer } from './TileRenderer';\nimport { Matrix, groupD8 } from '@pixi/math';\n\nimport type { RectTileGeom } from './RectTileShader';\n\nexport const POINT_STRUCT_SIZE = 12;\n\nexport class RectTileLayer extends Container {\n constructor(zIndex: number, texture: Texture | Array) {\n super();\n this.initialize(zIndex, texture);\n }\n\n zIndex = 0;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n\n pointsBuf: Array = [];\n hasAnim = false;\n textures: Array;\n\n offsetX = 0;\n offsetY = 0;\n compositeParent = false;\n\n initialize(zIndex: number, textures: Texture | Array) {\n if (!textures) {\n textures = [];\n } else if (!(textures instanceof Array) && (textures as Texture).baseTexture) {\n textures = [textures as Texture];\n }\n this.textures = textures as Array;\n this.zIndex = zIndex;\n // this.visible = false;\n }\n\n clear() {\n this.pointsBuf.length = 0;\n this.modificationMarker = 0;\n this.hasAnim = false;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX: number, animY: number) {\n let texture: Texture;\n let textureIndex = 0;\n\n if (typeof texture_ === \"number\") {\n textureIndex = texture_;\n texture = this.textures[textureIndex];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n let found = false;\n let textureList = this.textures;\n for (let i = 0; i < textureList.length; i++) {\n if (textureList[i].baseTexture === texture.baseTexture) {\n textureIndex = i;\n found = true;\n break;\n }\n }\n\n if (!found) {\n // textureIndex = this.textures.length;\n // this.textures.push(texture);\n return false;\n }\n }\n\n this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate);\n return true;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number,\n animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this {\n let pb = this.pointsBuf;\n this.hasAnim = this.hasAnim || animX > 0 || animY > 0;\n pb.push(u);\n pb.push(v);\n pb.push(x);\n pb.push(y);\n pb.push(tileWidth);\n pb.push(tileHeight);\n pb.push(rotate);\n pb.push(animX | 0);\n pb.push(animY | 0);\n pb.push(textureIndex);\n pb.push(animCountX);\n pb.push(animCountY);\n\n return this;\n }\n\n tileRotate(rotate: number) {\n const pb = this.pointsBuf;\n pb[pb.length - 3] = rotate;\n }\n\n tileAnimX(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 5] = offset;\n pb[pb.length - 2] = count;\n }\n\n tileAnimY(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 4] = offset;\n pb[pb.length - 1] = count;\n }\n\n renderCanvas(renderer: any) {\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n this.renderCanvasCore(renderer);\n }\n\n renderCanvasCore(renderer: any) {\n if (this.textures.length === 0) return;\n let points = this.pointsBuf;\n renderer.context.fillStyle = '#000000';\n for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) {\n let x1 = points[i], y1 = points[i + 1];\n let x2 = points[i + 2], y2 = points[i + 3];\n let w = points[i + 4];\n let h = points[i + 5];\n var rotate = points[i + 6];\n x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0];\n y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1];\n let textureIndex = points[i + 9];\n // canvas does not work with rotate yet\n if (textureIndex >= 0) {\n renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h);\n } else {\n renderer.context.globalAlpha = 0.5;\n renderer.context.fillRect(x2, y2, w, h);\n renderer.context.globalAlpha = 1;\n }\n }\n }\n\n vbId = 0;\n vb: RectTileGeom = null;\n vbBuffer: ArrayBuffer = null;\n vbArray: Float32Array = null;\n vbInts: Uint32Array = null;\n\n destroyVb() {\n if (this.vb) {\n this.vb.destroy();\n this.vb = null;\n }\n }\n\n render(renderer: Renderer) {\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n this.renderWebGLCore(renderer, plugin);\n }\n\n renderWebGLCore(renderer: Renderer, plugin: TileRenderer) {\n let points = this.pointsBuf;\n if (points.length === 0) return;\n let rectsCount = points.length / POINT_STRUCT_SIZE;\n\n let shader = plugin.getShader();\n let textures = this.textures;\n if (textures.length === 0) return;\n\n plugin.bindTextures(renderer, shader, textures);\n renderer.shader.bind(shader, false);\n\n //lost context! recover!\n let vb = this.vb;\n if (!vb) {\n vb = plugin.createVb();\n this.vb = vb;\n this.vbId = (vb as any).id;\n this.vbBuffer = null;\n this.modificationMarker = 0;\n }\n\n plugin.checkIndexBuffer(rectsCount, vb);\n const boundCountPerBuffer = Constant.boundCountPerBuffer;\n\n let vertexBuf = vb.getBuffer('aVertexPosition');\n //if layer was changed, re-upload vertices\n let vertices = rectsCount * vb.vertPerQuad;\n if (vertices === 0) return;\n if (this.modificationMarker !== vertices) {\n this.modificationMarker = vertices;\n let vs = vb.stride * vertices;\n if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {\n //!@#$ happens, need resize\n let bk = vb.stride;\n while (bk < vs) {\n bk *= 2;\n }\n this.vbBuffer = new ArrayBuffer(bk);\n this.vbArray = new Float32Array(this.vbBuffer);\n this.vbInts = new Uint32Array(this.vbBuffer);\n vertexBuf.update(this.vbBuffer);\n }\n\n let arr = this.vbArray, ints = this.vbInts;\n //upload vertices!\n let sz = 0;\n //let tint = 0xffffffff;\n let textureId: number = 0;\n let shiftU: number = this.offsetX;\n let shiftV: number = this.offsetY;\n\n //let tint = 0xffffffff;\n let tint = -1;\n for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) {\n let eps = 0.5;\n if (this.compositeParent) {\n if (boundCountPerBuffer > 1) {\n //TODO: what if its more than 4?\n textureId = (points[i + 9] >> 2);\n shiftU = this.offsetX * (points[i + 9] & 1);\n shiftV = this.offsetY * ((points[i + 9] >> 1) & 1);\n } else {\n textureId = points[i + 9];\n shiftU = 0;\n shiftV = 0;\n }\n }\n let x = points[i + 2], y = points[i + 3];\n let w = points[i + 4], h = points[i + 5];\n let u = points[i] + shiftU, v = points[i + 1] + shiftV;\n let rotate = points[i + 6];\n\n const animX = points[i + 7], animY = points[i + 8];\n const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024;\n const animXEncoded = animX + (animWidth * 2048);\n const animYEncoded = animY + (animHeight * 2048);\n\n let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number;\n if (rotate === 0) {\n u0 = u;\n v0 = v;\n u1 = u + w;\n v1 = v;\n u2 = u + w;\n v2 = v + h;\n u3 = u;\n v3 = v + h;\n } else {\n let w2 = w / 2;\n let h2 = h / 2;\n if (rotate % 4 !== 0) {\n w2 = h / 2;\n h2 = w / 2;\n }\n const cX = u + w2;\n const cY = v + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW);\n u0 = cX + (w2 * groupD8.uX(rotate));\n v0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n u1 = cX + (w2 * groupD8.uX(rotate));\n v1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u2 = cX + (w2 * groupD8.uX(rotate));\n v2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u3 = cX + (w2 * groupD8.uX(rotate));\n v3 = cY + (h2 * groupD8.uY(rotate));\n }\n\n arr[sz++] = x;\n arr[sz++] = y;\n arr[sz++] = u0;\n arr[sz++] = v0;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y;\n arr[sz++] = u1;\n arr[sz++] = v1;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y + h;\n arr[sz++] = u2;\n arr[sz++] = v2;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x;\n arr[sz++] = y + h;\n arr[sz++] = u3;\n arr[sz++] = v3;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n }\n\n vertexBuf.update(arr);\n }\n\n (renderer.geometry as any).bind(vb, shader);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES, rectsCount * 6, 0);\n }\n\n isModified(anim: boolean) {\n if (this.modificationMarker !== this.pointsBuf.length ||\n anim && this.hasAnim) {\n return true;\n }\n return false;\n }\n\n clearModify() {\n this.modificationMarker = this.pointsBuf.length;\n }\n\n destroy(options?: any) {\n super.destroy(options);\n this.destroyVb();\n }\n}\n","/// \n\nimport { Container } from '@pixi/display';\nimport { Texture, Renderer } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { Constant } from './Constant';\nimport { RectTileLayer } from './RectTileLayer';\n\nexport class CompositeRectTileLayer extends Container {\n constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n super();\n this.initialize.apply(this, arguments);\n }\n\n updateTransform() {\n (this as any).displayObjectUpdateTransform();\n }\n\n z: number;\n zIndex: number;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n _lastLayer: RectTileLayer = null;\n\n texPerChild: number;\n\n initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n if (texPerChild as any === true) {\n //old format, ignore it!\n texPerChild = 0;\n }\n this.z = this.zIndex = zIndex;\n this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures;\n if (bitmaps) {\n this.setBitmaps(bitmaps);\n }\n }\n\n setBitmaps(bitmaps: Array) {\n for (let i=0;i 5.2.1, it does not exist there.`);\n }\n }\n let texPerChild = this.texPerChild;\n let len1 = this.children.length;\n let len2 = Math.ceil(bitmaps.length / texPerChild);\n let i: number;\n for (i = 0; i < len1; i++) {\n (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);\n }\n for (i = len1; i < len2; i++) {\n let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild));\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n this.addChild(layer);\n }\n }\n\n clear() {\n for (let i = 0; i < this.children.length; i++) {\n (this.children[i] as RectTileLayer).clear();\n }\n this.modificationMarker = 0;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this {\n const childIndex: number = textureIndex / this.texPerChild >> 0;\n const textureId: number = textureIndex % this.texPerChild;\n\n if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) {\n this._lastLayer = (this.children[childIndex] as RectTileLayer);\n this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight);\n } else {\n this._lastLayer = null;\n }\n\n return this;\n }\n\n tileRotate(rotate: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileRotate(rotate);\n }\n return this;\n }\n\n tileAnimX(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimX(offset, count);\n }\n return this;\n }\n\n tileAnimY(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimY(offset, count);\n }\n return this;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this {\n let texture: Texture;\n let layer: RectTileLayer = null;\n let ind: number = 0;\n let children = this.children;\n\n this._lastLayer = null;\n if (typeof texture_ === \"number\") {\n let childIndex = texture_ / this.texPerChild >> 0;\n layer = children[childIndex] as RectTileLayer;\n\n if (!layer) {\n layer = children[0] as RectTileLayer;\n if (!layer) {\n return this;\n }\n ind = 0;\n } else {\n ind = texture_ % this.texPerChild;\n }\n\n texture = layer.textures[ind];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n let tex = child.textures;\n for (let j = 0; j < tex.length; j++) {\n if (tex[j].baseTexture === texture.baseTexture) {\n layer = child;\n ind = j;\n break;\n }\n }\n if (layer) {\n break;\n }\n }\n\n if (!layer) {\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n if (child.textures.length < this.texPerChild) {\n layer = child;\n ind = child.textures.length;\n child.textures.push(texture);\n break;\n }\n }\n if (!layer) {\n layer = new RectTileLayer(this.zIndex, texture);\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n children.push(layer);\n ind = 0;\n }\n }\n }\n\n this._lastLayer = layer;\n layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight);\n return this;\n }\n\n renderCanvas(renderer: any) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderCanvasCore(renderer);\n }\n }\n\n render(renderer: Renderer) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n //TODO: dont create new array, please\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n renderer.shader.bind(shader, false);\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin);\n }\n }\n\n isModified(anim: boolean) {\n let layers = this.children;\n if (this.modificationMarker !== layers.length) {\n return true;\n }\n for (let i = 0; i < layers.length; i++) {\n if ((layers[i] as RectTileLayer).isModified(anim)) {\n return true;\n }\n }\n return false;\n }\n\n clearModify() {\n let layers = this.children;\n this.modificationMarker = layers.length;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).clearModify();\n }\n }\n}","/// \n\nimport { Matrix } from '@pixi/math';\nimport { Graphics } from '@pixi/graphics';\n\nexport class GraphicsLayer extends Graphics {\n constructor(zIndex: number) {\n super();\n this.zIndex = zIndex;\n }\n\n renderCanvas(renderer: any) {\n let wt: Matrix = null;\n if (renderer.plugins.tilemap.dontUseTransform) {\n wt = this.transform.worldTransform;\n this.transform.worldTransform = Matrix.IDENTITY;\n }\n renderer.plugins.graphics.render(this);\n if (renderer.plugins.tilemap.dontUseTransform) {\n this.transform.worldTransform = wt;\n }\n renderer.context.globalAlpha = 1.0;\n }\n\n // renderWebGL(renderer: PIXI.Renderer) {\n // if (!this._webGL[renderer.CONTEXT_UID])\n // this.dirty++;\n // super.renderWebGL(renderer)\n // }\n\n isModified(anim: boolean): boolean {\n return false;\n }\n\n clearModify() {\n }\n}\n","/// \n\nimport { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, Renderer, Texture, GLTexture, resources } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Constant } from './Constant';\n\nexport interface IMultiTextureOptions {\n\tboundCountPerBuffer: number;\n\tboundSize: number;\n\tbufferSize: number;\n\tDO_CLEAR?: boolean;\n}\n\nexport class MultiTextureResource extends resources.Resource {\n\tconstructor(options: IMultiTextureOptions) {\n\t\tsuper(options.bufferSize, options.bufferSize);\n\n\t\tconst bounds = this.boundSprites;\n\t\tconst dirties = this.dirties;\n\t\tthis.boundSize = options.boundSize;\n\t\tfor (let j = 0; j < options.boundCountPerBuffer; j++) {\n\t\t\tconst spr = new Sprite();\n\t\t\tspr.position.x = options.boundSize * (j & 1);\n\t\t\tspr.position.y = options.boundSize * (j >> 1);\n\t\t\tbounds.push(spr);\n\t\t\tdirties.push(0);\n\t\t}\n\t\tthis.DO_CLEAR = !!options.DO_CLEAR;\n\t}\n\n\tDO_CLEAR = false;\n\tboundSize: number = 0;\n\t_clearBuffer: Uint8Array = null;\n\n\tbind(baseTexture: BaseTexture) {\n\t\tif (this.baseTex) {\n\t\t\tthrow new Error('Only one baseTexture is allowed for this resource!')\n\t\t}\n\t\tthis.baseTex = baseTexture;\n\t\tsuper.bind(baseTexture);\n\t}\n\n\tbaseTex: BaseTexture = null;\n\tboundSprites: Array = [];\n\tdirties: Array = [];\n\n\tsetTexture(ind: number, texture: Texture) {\n\t\tconst spr = this.boundSprites[ind];\n\t\tif (spr.texture.baseTexture === texture.baseTexture) {\n\t\t\treturn;\n\t\t}\n\t\tspr.texture = texture;\n\t\tthis.baseTex.update();\n\t\tthis.dirties[ind] = (this.baseTex as any).dirtyId;\n\t}\n\n\tupload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture) {\n\t\tconst { gl } = renderer as any;\n\n\t\tconst {width, height} = this;\n\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined ||\n\t\t\ttexture.alphaMode === ALPHA_MODES.UNPACK);\n\n\t\tif (glTexture.dirtyId < 0) {\n\t\t\t(glTexture as any).width = width;\n\t\t\t(glTexture as any).height = height;\n\n\t\t\tgl.texImage2D(texture.target, 0,\n\t\t\t\ttexture.format,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\t0,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tnull);\n\t\t}\n\n\t\tconst doClear = this.DO_CLEAR;\n\t\tif (doClear && !this._clearBuffer) {\n\t\t\tthis._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4);\n\t\t}\n\n\t\tconst bounds = this.boundSprites;\n\t\tfor (let i = 0; i < bounds.length; i++) {\n\t\t\tconst spr = bounds[i];\n\t\t\tconst tex = spr.texture.baseTexture;\n\t\t\tif (glTexture.dirtyId >= this.dirties[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst res = tex.resource as any;\n\t\t\tif (!tex.valid || !res || !res.source) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (doClear && (tex.width < this.boundSize || tex.height < this.boundSize))\n\t\t\t{\n\t\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\t\tspr.position.x,\n\t\t\t\t\tspr.position.y,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\ttexture.format,\n\t\t\t\t\ttexture.type,\n\t\t\t\t\tthis._clearBuffer);\n\t\t\t}\n\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\tspr.position.x,\n\t\t\t\tspr.position.y,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tres.source);\n\t\t}\n\n\t\treturn true;\n\t}\n}\n","import { Constant } from './Constant';\n\nimport type { TilemapShader } from './RectTileShader';\n\n\nexport function fillSamplers(shader: TilemapShader, maxTextures: number) {\n let sampleValues: Array = [];\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n shader.uniforms.uSamplers = sampleValues;\n\n let samplerSize: Array = [];\n for (let i = 0; i < maxTextures; i++) {\n samplerSize.push(1.0 / Constant.bufferSize);\n samplerSize.push(1.0 / Constant.bufferSize);\n }\n shader.uniforms.uSamplerSize = samplerSize;\n}\n\nexport function generateFragmentSrc(maxTextures: number, fragmentSrc: string) {\n return fragmentSrc.replace(/%count%/gi, maxTextures + \"\")\n .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n}\n\nexport function generateSampleSrc(maxTextures: number) {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n src += 'if(vTextureId <= -1.0) {';\n src += '\\n\\tcolor = shadowColor;';\n src += '\\n}';\n\n for (let i = 0; i < maxTextures; i++)\n {\n src += '\\nelse ';\n\n if(i < maxTextures-1)\n {\n src += 'if(textureId == ' + i + '.0)';\n }\n\n src += '\\n{';\n src += '\\n\\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);';\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n}\n","/// \n\nimport * as shaderGenerator from './shaderGenerator';\n\nimport { Buffer, Geometry, Shader } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nlet rectShaderFrag = `\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n`;\nlet rectShaderVert = `\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n`;\n\nexport abstract class TilemapShader extends Shader {\n\tmaxTextures = 0;\n\n\tconstructor(maxTextures: number, shaderVert: string, shaderFrag: string) {\n\t\tsuper(\n\t\t\tnew PIXI.Program(\n\t\t\t\tshaderVert,\n\t\t\t\tshaderFrag),\n\t\t\t{\n\t\t\t\tanimationFrame: new Float32Array(2),\n\t\t\t\tuSamplers: [],\n\t\t\t\tuSamplerSize: [],\n\t\t\t\tprojTransMatrix: new Matrix()\n\t\t\t}\n\t\t);\n\t\tthis.maxTextures = maxTextures;\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileShader extends TilemapShader {\n\tconstructor(maxTextures: number) {\n\t\tsuper(\n\t\t\tmaxTextures,\n\t\t\trectShaderVert,\n\t\t\tshaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)\n\t\t);\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileGeom extends Geometry {\n\tvertSize = 11;\n\tvertPerQuad = 4;\n\tstride = this.vertSize * 4;\n\tlastTimeAccess = 0;\n\n\tconstructor() {\n\t\tsuper();\n\t\tconst buf = this.buf = new Buffer(new Float32Array(2), true, false);\n\t\tthis.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0)\n\t\t\t.addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4)\n\t\t\t.addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4)\n\t\t\t.addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4)\n\t\t\t.addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4);\n\t}\n\n\tbuf: PIXI.Buffer;\n}","import { WRAP_MODES } from '@pixi/constants';\nimport { BaseTexture, Buffer, resources, ObjectRenderer, Texture, Renderer } from '@pixi/core';\nimport { Constant } from './Constant';\nimport { RectTileGeom, RectTileShader } from './RectTileShader';\nimport { MultiTextureResource } from './MultiTextureResource';\n\nimport type { TilemapShader } from './RectTileShader';\n\n/**\n * Renderer for rectangle tiles.\n */\nexport class TileRenderer extends ObjectRenderer {\n\trenderer: Renderer;\n\tgl: WebGLRenderingContext;\n\tsn: number = -1;\n\tindexBuffer: PIXI.Buffer = null;\n\tibLen: number = 0;\n\ttileAnim = [0, 0];\n\ttexLoc: Array = [];\n\n\trectShader: RectTileShader;\n\ttexResources: Array = [];\n\n\tconstructor(renderer: Renderer) {\n\t\tsuper(renderer);\n\t\tthis.rectShader = new RectTileShader(Constant.maxTextures);\n\t\tthis.indexBuffer = new Buffer(undefined, true, true);\n\t\tthis.checkIndexBuffer(2000);\n\t\tthis.initBounds();\n\t}\n\n\tinitBounds() {\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tfor (let i = 0; i < maxTextures; i++) {\n\t\t\tconst resource = new MultiTextureResource(Constant);\n\t\t\tconst baseTex = new BaseTexture(resource);\n\t\t\tbaseTex.scaleMode = Constant.SCALE_MODE;\n\t\t\tbaseTex.wrapMode = WRAP_MODES.CLAMP;\n\t\t\tthis.texResources.push(resource);\n\t\t}\n\t}\n\n\tbindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tlet samplerSize: Array = (shader as any).uniforms.uSamplerSize;\n\t\tthis.texLoc.length = 0;\n\t\tfor (let i = 0; i < textures.length; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trenderer.texture.bind(textures[i], i);\n\t\t\t//TODO: add resolution here\n\t\t\tsamplerSize[i * 2] = 1.0 / textures[i].baseTexture.width;\n\t\t\tsamplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height;\n\t\t}\n\t\t(shader as any).uniforms.uSamplerSize = samplerSize;\n\t}\n\n\tbindTextures(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tconst len = textures.length;\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tif (len > Constant.boundCountPerBuffer * maxTextures) {\n\t\t\treturn;\n\t\t}\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\tthis.bindTexturesWithoutRT(renderer, shader, textures);\n\t\t\treturn;\n\t\t}\n\n\t\tlet i = 0;\n\t\tfor (; i < len; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) continue;\n\t\t\tconst multi = this.texResources[i >> 2];\n\t\t\tmulti.setTexture(i & 3, texture);\n\t\t}\n\n\t\tlet gltsUsed = (i + 3) >> 2;\n\t\tfor (i = 0; i < gltsUsed; i++) {\n\t\t\t//remove \"i, true\" after resolving a bug\n\t\t\trenderer.texture.bind(this.texResources[i].baseTex, i);\n\t\t}\n\t}\n\n\tstart() {\n\t\t//sorry, nothing\n\t}\n\n\tcreateVb() {\n\t\tconst geom = new RectTileGeom();\n\t\tgeom.addIndex(this.indexBuffer);\n\t\tgeom.lastTimeAccess = Date.now();\n\t\treturn geom;\n\t}\n\n\tcheckIndexBuffer(size: number, vb: RectTileGeom = null) {\n\t\tconst totalIndices = size * 6;\n\n\t\tif (totalIndices <= this.ibLen) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet len = totalIndices;\n\t\twhile (len < totalIndices) {\n\t\t\tlen <<= 1;\n\t\t}\n\n\t\tthis.ibLen = totalIndices;\n\t\tthis.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size,\n\t\t\tConstant.use32bitIndex ? new Uint32Array(size * 6) : undefined));\n\n\t\t// \tTODO: create new index buffer instead?\n\t\t// if (vb) {\n\t\t// \tconst curIndex = vb.getIndex();\n\t\t// \tif (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) {\n\t\t// \t\tthis.swapIndex(vb, this.indexBuffer);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t// swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) {\n\t\t// let buffers = (geom as any).buffers;\n\t\t// const oldIndex = geom.getIndex();\n\t\t// let ind = buffers.indexOf(oldIndex);\n\t\t// if (ind >= 0) {\n\t\t// \tbuffers.splice(ind, 1);\n\t\t// }\n\t\t// geom.addIndex(indexBuf);\n\t// }\n\n\tgetShader(): TilemapShader {\n\t\treturn this.rectShader;\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\t// this.rectShader.destroy();\n\t\tthis.rectShader = null;\n\t}\n}\n\nRenderer.registerPlugin('tilemap', TileRenderer as any);\n","/// \n\nnamespace pixi_tilemap {\n (PIXI as any).tilemap = pixi_tilemap;\n}\n\n// This makes exporter.ts a module!\nexport default {}\n","/// \n\nimport { Container } from '@pixi/display';\n\nimport type { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport type { Matrix } from '@pixi/math';\n\nexport class ZLayer extends Container {\n\n constructor(tilemap: Container, zIndex: number) {\n super();\n this.tilemap = tilemap;\n this.z = zIndex;\n }\n\n tilemap: any;\n z: number;\n zIndex: number;\n _previousLayers: number;\n canvasBuffer: HTMLCanvasElement;\n _tempRender: any;\n _lastAnimationFrame: number = -1;\n layerTransform: Matrix;\n\n clear() {\n let layers = this.children as Array;\n for (let i = 0; i < layers.length; i++)\n layers[i].clear();\n this._previousLayers = 0;\n }\n\n cacheIfDirty() {\n let tilemap: any = this.tilemap;\n let layers = this.children as Array;\n let modified = this._previousLayers !== layers.length;\n this._previousLayers = layers.length;\n let buf = this.canvasBuffer;\n let tempRender = this._tempRender;\n if (!buf) {\n buf = this.canvasBuffer = document.createElement('canvas');\n tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf});\n tempRender.context = tempRender.rootContext;\n tempRender.plugins.tilemap.dontUseTransform = true;\n }\n if (buf.width !== tilemap._layerWidth ||\n buf.height !== tilemap._layerHeight) {\n buf.width = tilemap._layerWidth;\n buf.height = tilemap._layerHeight;\n modified = true;\n }\n let i: number;\n if (!modified) {\n for (i = 0; i < layers.length; i++) {\n if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) {\n modified = true;\n break;\n }\n }\n }\n this._lastAnimationFrame = tilemap.animationFrame;\n if (modified) {\n if (tilemap._hackRenderer) {\n tilemap._hackRenderer(tempRender);\n }\n tempRender.context.clearRect(0, 0, buf.width, buf.height);\n for (i = 0; i < layers.length; i++) {\n layers[i].clearModify();\n layers[i].renderCanvas(tempRender);\n }\n }\n this.layerTransform = this.worldTransform;\n for (i = 0; i < layers.length; i++) {\n this.layerTransform = layers[i].worldTransform;\n break;\n }\n }\n\n renderCanvas(renderer: any) {\n this.cacheIfDirty();\n let wt = this.layerTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n let tilemap = this.tilemap;\n renderer.context.drawImage(this.canvasBuffer, 0, 0);\n }\n}\n","import { CanvasTileRenderer } from './CanvasTileRenderer';\nimport { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport { Constant } from './Constant';\nimport { GraphicsLayer } from './GraphicsLayer';\nimport { MultiTextureResource } from './MultiTextureResource';\nimport { RectTileLayer } from './RectTileLayer';\nimport { TilemapShader, RectTileShader, RectTileGeom } from './RectTileShader';\nimport { TileRenderer } from './TileRenderer';\nimport { ZLayer } from './ZLayer';\n\nexport const pixi_tilemap = {\n CanvasTileRenderer,\n CompositeRectTileLayer,\n Constant,\n GraphicsLayer,\n MultiTextureResource,\n RectTileLayer,\n TilemapShader,\n RectTileShader,\n RectTileGeom,\n TileRenderer,\n ZLayer,\n};\n\nexport * from './CanvasTileRenderer';\nexport * from './CompositeRectTileLayer';\nexport * from './Constant';\nexport * from './exporter';\nexport * from './GraphicsLayer';\nexport * from './MultiTextureResource';\nexport * from './RectTileLayer';\nexport * from './RectTileShader';\nexport * from './shaderGenerator';\nexport * from './TileRenderer';\nexport * from './ZLayer';"],"names":["renderer","this","tileAnim","cr","PIXI","CanvasRenderer","registerPlugin","CanvasTileRenderer","extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","__extends","__","constructor","prototype","create","Constant","maxTextures","bufferSize","boundSize","boundCountPerBuffer","use32bitIndex","SCALE_MODE","SCALE_MODES","LINEAR","DO_CLEAR","zIndex","texture","_super","_this","Float32Array","initialize","RectTileLayer","textures","baseTexture","pointsBuf","length","modificationMarker","hasAnim","texture_","x","y","animX","animY","textureIndex","Texture","from","found","textureList","i","addRect","frame","orig","width","height","rotate","u","v","tileWidth","tileHeight","animCountX","animCountY","pb","push","offset","count","plugins","tilemap","dontUseTransform","wt","worldTransform","context","setTransform","a","c","tx","resolution","ty","renderCanvasCore","points","fillStyle","n","x1","y1","x2","y2","w","h","drawImage","getDrawableSource","globalAlpha","fillRect","vb","destroy","plugin","shader","getShader","batch","setObjectRenderer","_globalMat","uniforms","projTransMatrix","globalUniforms","projectionMatrix","copyTo","append","shadowColor","animationFrame","renderWebGLCore","rectsCount","bindTextures","bind","createVb","vbId","id","vbBuffer","checkIndexBuffer","vertexBuf","getBuffer","vertices","vertPerQuad","vs","stride","byteLength","bk","ArrayBuffer","vbArray","vbInts","Uint32Array","update","arr","sz","textureId","shiftU","offsetX","shiftV","offsetY","compositeParent","animXEncoded","animYEncoded","u0","v0","u1","v1","u2","v2","u3","v3","w2","h2","cX","cY","groupD8","add","NW","uX","uY","geometry","draw","DRAW_MODES","TRIANGLES","anim","options","destroyVb","Container","bitmaps","texPerChild","apply","arguments","CompositeRectTileLayer","displayObjectUpdateTransform","z","setBitmaps","i_1","Error","len1","children","len2","Math","ceil","slice","layer","addChild","clear","animWidth","animHeight","childIndex","_lastLayer","tileRotate","tileAnimX","tileAnimY","ind","tex","child","j","visible","worldAlpha","renderable","layers","isModified","clearModify","GraphicsLayer","transform","Matrix","IDENTITY","graphics","render","Graphics","bounds","boundSprites","dirties","spr","Sprite","position","MultiTextureResource","baseTex","dirtyId","glTexture","gl","pixelStorei","UNPACK_PREMULTIPLY_ALPHA_WEBGL","undefined","alphaMode","ALPHA_MODES","UNPACK","texImage2D","target","format","type","doClear","_clearBuffer","Uint8Array","res","resource","valid","source","texSubImage2D","resources","Resource","fillSamplers","sampleValues","uSamplers","samplerSize","uSamplerSize","generateFragmentSrc","fragmentSrc","replace","generateSampleSrc","shaderVert","shaderFrag","Program","shaderGenerator.fillSamplers","Shader","shaderGenerator.generateFragmentSrc","TilemapShader","vertSize","buf","Buffer","addAttribute","Geometry","rectShader","RectTileShader","indexBuffer","initBounds","TileRenderer","BaseTexture","scaleMode","wrapMode","WRAP_MODES","CLAMP","texResources","texLoc","len","bindTexturesWithoutRT","setTexture","gltsUsed","geom","RectTileGeom","addIndex","lastTimeAccess","Date","now","size","totalIndices","ibLen","utils","createIndicesForQuads","ObjectRenderer","pixi_tilemap","ZLayer","_previousLayers","modified","canvasBuffer","tempRender","_tempRender","document","createElement","view","rootContext","_layerWidth","_layerHeight","_lastAnimationFrame","_hackRenderer","clearRect","renderCanvas","layerTransform","cacheIfDirty","src"],"mappings":";;;;;;;;;4DASI,SAAYA,GAHZC,cAAW,CAAC,EAAG,GACfA,uBAAmB,EAGfA,KAAKD,SAAWA,EAChBC,KAAKC,SAAW,CAAC,EAAG,IAItBC,EAAMC,KAAaC,eAErBF,GACAA,EAAGG,eAAe,UAAWC;;;;;;;;;;;;;;qFCFjC,IAAIC,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,IACvE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOA,EAAEM,eAAeD,KAAIN,EAA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GAAO,2BACPA,GAAO,2BACPA,GAAO,MAEP,IAAK,IAAIlQ,EAAI,EAAGA,EAAIhC,EAAagC,IAE7BkQ,GAAO,UAEJlQ,EAAIhC,EAAY,IAEfkS,GAAO,mBAAqBlQ,EAAI,OAGpCkQ,GAAO,MACPA,GAAO,mCAAmClQ,EAAE,kCAAkCA,EAAE,MAChFkQ,GAAO,MAMX,OAHAA,GAAO,KACPA,GAAO"} \ No newline at end of file diff --git a/lib/pixi-tilemap.es.js b/lib/pixi-tilemap.es.js index ab14d3f7..0a9ff8a4 100644 --- a/lib/pixi-tilemap.es.js +++ b/lib/pixi-tilemap.es.js @@ -1,6 +1,8 @@ +/* eslint-disable */ + /*! * pixi-tilemap - v2.0.6 - * Compiled Fri, 14 Aug 2020 02:19:53 UTC + * Compiled Fri, 14 Aug 2020 02:36:52 UTC * * pixi-tilemap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license diff --git a/lib/pixi-tilemap.es.js.map b/lib/pixi-tilemap.es.js.map index 3756e52b..459c5881 100644 --- a/lib/pixi-tilemap.es.js.map +++ b/lib/pixi-tilemap.es.js.map @@ -1 +1 @@ -{"version":3,"file":"pixi-tilemap.es.js","sources":["../src/CanvasTileRenderer.ts","../node_modules/tslib/tslib.es6.js","../src/Constant.ts","../src/RectTileLayer.ts","../src/CompositeRectTileLayer.ts","../src/GraphicsLayer.ts","../src/MultiTextureResource.ts","../src/shaderGenerator.ts","../src/RectTileShader.ts","../src/TileRenderer.ts","../src/ZLayer.ts","../src/exporter.ts","../src/index.ts"],"sourcesContent":["/// \n\nimport { Renderer } from '@pixi/core';\n\nexport class CanvasTileRenderer {\n renderer: Renderer;\n tileAnim = [0, 0];\n dontUseTransform = false;\n\n constructor(renderer: Renderer) {\n this.renderer = renderer;\n this.tileAnim = [0, 0];\n }\n}\n\nconst cr = (PIXI as any).CanvasRenderer;\n\nif (cr) {\n cr.registerPlugin('tilemap', CanvasTileRenderer);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","export const Constant = {\n maxTextures: 16,\n bufferSize: 2048,\n boundSize: 1024,\n boundCountPerBuffer: 1,\n use32bitIndex: false,\n SCALE_MODE: PIXI.SCALE_MODES.LINEAR,\n DO_CLEAR: true\n};","/// \n\nimport { Container } from '@pixi/display';\nimport { Constant } from './Constant';\nimport { DRAW_MODES } from '@pixi/constants';\nimport { Texture, Renderer } from '@pixi/core';\nimport { TileRenderer } from './TileRenderer';\nimport { Matrix, groupD8 } from '@pixi/math';\n\nimport type { RectTileGeom } from './RectTileShader';\n\nexport const POINT_STRUCT_SIZE = 12;\n\nexport class RectTileLayer extends Container {\n constructor(zIndex: number, texture: Texture | Array) {\n super();\n this.initialize(zIndex, texture);\n }\n\n zIndex = 0;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n\n pointsBuf: Array = [];\n hasAnim = false;\n textures: Array;\n\n offsetX = 0;\n offsetY = 0;\n compositeParent = false;\n\n initialize(zIndex: number, textures: Texture | Array) {\n if (!textures) {\n textures = [];\n } else if (!(textures instanceof Array) && (textures as Texture).baseTexture) {\n textures = [textures as Texture];\n }\n this.textures = textures as Array;\n this.zIndex = zIndex;\n // this.visible = false;\n }\n\n clear() {\n this.pointsBuf.length = 0;\n this.modificationMarker = 0;\n this.hasAnim = false;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX: number, animY: number) {\n let texture: Texture;\n let textureIndex = 0;\n\n if (typeof texture_ === \"number\") {\n textureIndex = texture_;\n texture = this.textures[textureIndex];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n let found = false;\n let textureList = this.textures;\n for (let i = 0; i < textureList.length; i++) {\n if (textureList[i].baseTexture === texture.baseTexture) {\n textureIndex = i;\n found = true;\n break;\n }\n }\n\n if (!found) {\n // textureIndex = this.textures.length;\n // this.textures.push(texture);\n return false;\n }\n }\n\n this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate);\n return true;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number,\n animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this {\n let pb = this.pointsBuf;\n this.hasAnim = this.hasAnim || animX > 0 || animY > 0;\n pb.push(u);\n pb.push(v);\n pb.push(x);\n pb.push(y);\n pb.push(tileWidth);\n pb.push(tileHeight);\n pb.push(rotate);\n pb.push(animX | 0);\n pb.push(animY | 0);\n pb.push(textureIndex);\n pb.push(animCountX);\n pb.push(animCountY);\n\n return this;\n }\n\n tileRotate(rotate: number) {\n const pb = this.pointsBuf;\n pb[pb.length - 3] = rotate;\n }\n\n tileAnimX(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 5] = offset;\n pb[pb.length - 2] = count;\n }\n\n tileAnimY(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 4] = offset;\n pb[pb.length - 1] = count;\n }\n\n renderCanvas(renderer: any) {\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n this.renderCanvasCore(renderer);\n }\n\n renderCanvasCore(renderer: any) {\n if (this.textures.length === 0) return;\n let points = this.pointsBuf;\n renderer.context.fillStyle = '#000000';\n for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) {\n let x1 = points[i], y1 = points[i + 1];\n let x2 = points[i + 2], y2 = points[i + 3];\n let w = points[i + 4];\n let h = points[i + 5];\n var rotate = points[i + 6];\n x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0];\n y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1];\n let textureIndex = points[i + 9];\n // canvas does not work with rotate yet\n if (textureIndex >= 0) {\n renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h);\n } else {\n renderer.context.globalAlpha = 0.5;\n renderer.context.fillRect(x2, y2, w, h);\n renderer.context.globalAlpha = 1;\n }\n }\n }\n\n vbId = 0;\n vb: RectTileGeom = null;\n vbBuffer: ArrayBuffer = null;\n vbArray: Float32Array = null;\n vbInts: Uint32Array = null;\n\n destroyVb() {\n if (this.vb) {\n this.vb.destroy();\n this.vb = null;\n }\n }\n\n render(renderer: Renderer) {\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n this.renderWebGLCore(renderer, plugin);\n }\n\n renderWebGLCore(renderer: Renderer, plugin: TileRenderer) {\n let points = this.pointsBuf;\n if (points.length === 0) return;\n let rectsCount = points.length / POINT_STRUCT_SIZE;\n\n let shader = plugin.getShader();\n let textures = this.textures;\n if (textures.length === 0) return;\n\n plugin.bindTextures(renderer, shader, textures);\n renderer.shader.bind(shader, false);\n\n //lost context! recover!\n let vb = this.vb;\n if (!vb) {\n vb = plugin.createVb();\n this.vb = vb;\n this.vbId = (vb as any).id;\n this.vbBuffer = null;\n this.modificationMarker = 0;\n }\n\n plugin.checkIndexBuffer(rectsCount, vb);\n const boundCountPerBuffer = Constant.boundCountPerBuffer;\n\n let vertexBuf = vb.getBuffer('aVertexPosition');\n //if layer was changed, re-upload vertices\n let vertices = rectsCount * vb.vertPerQuad;\n if (vertices === 0) return;\n if (this.modificationMarker !== vertices) {\n this.modificationMarker = vertices;\n let vs = vb.stride * vertices;\n if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {\n //!@#$ happens, need resize\n let bk = vb.stride;\n while (bk < vs) {\n bk *= 2;\n }\n this.vbBuffer = new ArrayBuffer(bk);\n this.vbArray = new Float32Array(this.vbBuffer);\n this.vbInts = new Uint32Array(this.vbBuffer);\n vertexBuf.update(this.vbBuffer);\n }\n\n let arr = this.vbArray, ints = this.vbInts;\n //upload vertices!\n let sz = 0;\n //let tint = 0xffffffff;\n let textureId: number = 0;\n let shiftU: number = this.offsetX;\n let shiftV: number = this.offsetY;\n\n //let tint = 0xffffffff;\n let tint = -1;\n for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) {\n let eps = 0.5;\n if (this.compositeParent) {\n if (boundCountPerBuffer > 1) {\n //TODO: what if its more than 4?\n textureId = (points[i + 9] >> 2);\n shiftU = this.offsetX * (points[i + 9] & 1);\n shiftV = this.offsetY * ((points[i + 9] >> 1) & 1);\n } else {\n textureId = points[i + 9];\n shiftU = 0;\n shiftV = 0;\n }\n }\n let x = points[i + 2], y = points[i + 3];\n let w = points[i + 4], h = points[i + 5];\n let u = points[i] + shiftU, v = points[i + 1] + shiftV;\n let rotate = points[i + 6];\n\n const animX = points[i + 7], animY = points[i + 8];\n const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024;\n const animXEncoded = animX + (animWidth * 2048);\n const animYEncoded = animY + (animHeight * 2048);\n\n let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number;\n if (rotate === 0) {\n u0 = u;\n v0 = v;\n u1 = u + w;\n v1 = v;\n u2 = u + w;\n v2 = v + h;\n u3 = u;\n v3 = v + h;\n } else {\n let w2 = w / 2;\n let h2 = h / 2;\n if (rotate % 4 !== 0) {\n w2 = h / 2;\n h2 = w / 2;\n }\n const cX = u + w2;\n const cY = v + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW);\n u0 = cX + (w2 * groupD8.uX(rotate));\n v0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n u1 = cX + (w2 * groupD8.uX(rotate));\n v1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u2 = cX + (w2 * groupD8.uX(rotate));\n v2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u3 = cX + (w2 * groupD8.uX(rotate));\n v3 = cY + (h2 * groupD8.uY(rotate));\n }\n\n arr[sz++] = x;\n arr[sz++] = y;\n arr[sz++] = u0;\n arr[sz++] = v0;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y;\n arr[sz++] = u1;\n arr[sz++] = v1;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y + h;\n arr[sz++] = u2;\n arr[sz++] = v2;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x;\n arr[sz++] = y + h;\n arr[sz++] = u3;\n arr[sz++] = v3;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n }\n\n vertexBuf.update(arr);\n }\n\n (renderer.geometry as any).bind(vb, shader);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES, rectsCount * 6, 0);\n }\n\n isModified(anim: boolean) {\n if (this.modificationMarker !== this.pointsBuf.length ||\n anim && this.hasAnim) {\n return true;\n }\n return false;\n }\n\n clearModify() {\n this.modificationMarker = this.pointsBuf.length;\n }\n\n destroy(options?: any) {\n super.destroy(options);\n this.destroyVb();\n }\n}\n","/// \n\nimport { Container } from '@pixi/display';\nimport { Texture, Renderer } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { Constant } from './Constant';\nimport { RectTileLayer } from './RectTileLayer';\n\nexport class CompositeRectTileLayer extends Container {\n constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n super();\n this.initialize.apply(this, arguments);\n }\n\n updateTransform() {\n (this as any).displayObjectUpdateTransform();\n }\n\n z: number;\n zIndex: number;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n _lastLayer: RectTileLayer = null;\n\n texPerChild: number;\n\n initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n if (texPerChild as any === true) {\n //old format, ignore it!\n texPerChild = 0;\n }\n this.z = this.zIndex = zIndex;\n this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures;\n if (bitmaps) {\n this.setBitmaps(bitmaps);\n }\n }\n\n setBitmaps(bitmaps: Array) {\n for (let i=0;i 5.2.1, it does not exist there.`);\n }\n }\n let texPerChild = this.texPerChild;\n let len1 = this.children.length;\n let len2 = Math.ceil(bitmaps.length / texPerChild);\n let i: number;\n for (i = 0; i < len1; i++) {\n (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);\n }\n for (i = len1; i < len2; i++) {\n let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild));\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n this.addChild(layer);\n }\n }\n\n clear() {\n for (let i = 0; i < this.children.length; i++) {\n (this.children[i] as RectTileLayer).clear();\n }\n this.modificationMarker = 0;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this {\n const childIndex: number = textureIndex / this.texPerChild >> 0;\n const textureId: number = textureIndex % this.texPerChild;\n\n if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) {\n this._lastLayer = (this.children[childIndex] as RectTileLayer);\n this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight);\n } else {\n this._lastLayer = null;\n }\n\n return this;\n }\n\n tileRotate(rotate: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileRotate(rotate);\n }\n return this;\n }\n\n tileAnimX(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimX(offset, count);\n }\n return this;\n }\n\n tileAnimY(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimY(offset, count);\n }\n return this;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this {\n let texture: Texture;\n let layer: RectTileLayer = null;\n let ind: number = 0;\n let children = this.children;\n\n this._lastLayer = null;\n if (typeof texture_ === \"number\") {\n let childIndex = texture_ / this.texPerChild >> 0;\n layer = children[childIndex] as RectTileLayer;\n\n if (!layer) {\n layer = children[0] as RectTileLayer;\n if (!layer) {\n return this;\n }\n ind = 0;\n } else {\n ind = texture_ % this.texPerChild;\n }\n\n texture = layer.textures[ind];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n let tex = child.textures;\n for (let j = 0; j < tex.length; j++) {\n if (tex[j].baseTexture === texture.baseTexture) {\n layer = child;\n ind = j;\n break;\n }\n }\n if (layer) {\n break;\n }\n }\n\n if (!layer) {\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n if (child.textures.length < this.texPerChild) {\n layer = child;\n ind = child.textures.length;\n child.textures.push(texture);\n break;\n }\n }\n if (!layer) {\n layer = new RectTileLayer(this.zIndex, texture);\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n children.push(layer);\n ind = 0;\n }\n }\n }\n\n this._lastLayer = layer;\n layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight);\n return this;\n }\n\n renderCanvas(renderer: any) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderCanvasCore(renderer);\n }\n }\n\n render(renderer: Renderer) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n //TODO: dont create new array, please\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n renderer.shader.bind(shader, false);\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin);\n }\n }\n\n isModified(anim: boolean) {\n let layers = this.children;\n if (this.modificationMarker !== layers.length) {\n return true;\n }\n for (let i = 0; i < layers.length; i++) {\n if ((layers[i] as RectTileLayer).isModified(anim)) {\n return true;\n }\n }\n return false;\n }\n\n clearModify() {\n let layers = this.children;\n this.modificationMarker = layers.length;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).clearModify();\n }\n }\n}","/// \n\nimport { Matrix } from '@pixi/math';\nimport { Graphics } from '@pixi/graphics';\n\nexport class GraphicsLayer extends Graphics {\n constructor(zIndex: number) {\n super();\n this.zIndex = zIndex;\n }\n\n renderCanvas(renderer: any) {\n let wt: Matrix = null;\n if (renderer.plugins.tilemap.dontUseTransform) {\n wt = this.transform.worldTransform;\n this.transform.worldTransform = Matrix.IDENTITY;\n }\n renderer.plugins.graphics.render(this);\n if (renderer.plugins.tilemap.dontUseTransform) {\n this.transform.worldTransform = wt;\n }\n renderer.context.globalAlpha = 1.0;\n }\n\n // renderWebGL(renderer: PIXI.Renderer) {\n // if (!this._webGL[renderer.CONTEXT_UID])\n // this.dirty++;\n // super.renderWebGL(renderer)\n // }\n\n isModified(anim: boolean): boolean {\n return false;\n }\n\n clearModify() {\n }\n}\n","/// \n\nimport { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, Renderer, Texture, GLTexture, resources } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Constant } from './Constant';\n\nexport interface IMultiTextureOptions {\n\tboundCountPerBuffer: number;\n\tboundSize: number;\n\tbufferSize: number;\n\tDO_CLEAR?: boolean;\n}\n\nexport class MultiTextureResource extends resources.Resource {\n\tconstructor(options: IMultiTextureOptions) {\n\t\tsuper(options.bufferSize, options.bufferSize);\n\n\t\tconst bounds = this.boundSprites;\n\t\tconst dirties = this.dirties;\n\t\tthis.boundSize = options.boundSize;\n\t\tfor (let j = 0; j < options.boundCountPerBuffer; j++) {\n\t\t\tconst spr = new Sprite();\n\t\t\tspr.position.x = options.boundSize * (j & 1);\n\t\t\tspr.position.y = options.boundSize * (j >> 1);\n\t\t\tbounds.push(spr);\n\t\t\tdirties.push(0);\n\t\t}\n\t\tthis.DO_CLEAR = !!options.DO_CLEAR;\n\t}\n\n\tDO_CLEAR = false;\n\tboundSize: number = 0;\n\t_clearBuffer: Uint8Array = null;\n\n\tbind(baseTexture: BaseTexture) {\n\t\tif (this.baseTex) {\n\t\t\tthrow new Error('Only one baseTexture is allowed for this resource!')\n\t\t}\n\t\tthis.baseTex = baseTexture;\n\t\tsuper.bind(baseTexture);\n\t}\n\n\tbaseTex: BaseTexture = null;\n\tboundSprites: Array = [];\n\tdirties: Array = [];\n\n\tsetTexture(ind: number, texture: Texture) {\n\t\tconst spr = this.boundSprites[ind];\n\t\tif (spr.texture.baseTexture === texture.baseTexture) {\n\t\t\treturn;\n\t\t}\n\t\tspr.texture = texture;\n\t\tthis.baseTex.update();\n\t\tthis.dirties[ind] = (this.baseTex as any).dirtyId;\n\t}\n\n\tupload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture) {\n\t\tconst { gl } = renderer as any;\n\n\t\tconst {width, height} = this;\n\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined ||\n\t\t\ttexture.alphaMode === ALPHA_MODES.UNPACK);\n\n\t\tif (glTexture.dirtyId < 0) {\n\t\t\t(glTexture as any).width = width;\n\t\t\t(glTexture as any).height = height;\n\n\t\t\tgl.texImage2D(texture.target, 0,\n\t\t\t\ttexture.format,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\t0,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tnull);\n\t\t}\n\n\t\tconst doClear = this.DO_CLEAR;\n\t\tif (doClear && !this._clearBuffer) {\n\t\t\tthis._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4);\n\t\t}\n\n\t\tconst bounds = this.boundSprites;\n\t\tfor (let i = 0; i < bounds.length; i++) {\n\t\t\tconst spr = bounds[i];\n\t\t\tconst tex = spr.texture.baseTexture;\n\t\t\tif (glTexture.dirtyId >= this.dirties[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst res = tex.resource as any;\n\t\t\tif (!tex.valid || !res || !res.source) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (doClear && (tex.width < this.boundSize || tex.height < this.boundSize))\n\t\t\t{\n\t\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\t\tspr.position.x,\n\t\t\t\t\tspr.position.y,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\ttexture.format,\n\t\t\t\t\ttexture.type,\n\t\t\t\t\tthis._clearBuffer);\n\t\t\t}\n\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\tspr.position.x,\n\t\t\t\tspr.position.y,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tres.source);\n\t\t}\n\n\t\treturn true;\n\t}\n}\n","import { Constant } from './Constant';\n\nimport type { TilemapShader } from './RectTileShader';\n\n\nexport function fillSamplers(shader: TilemapShader, maxTextures: number) {\n let sampleValues: Array = [];\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n shader.uniforms.uSamplers = sampleValues;\n\n let samplerSize: Array = [];\n for (let i = 0; i < maxTextures; i++) {\n samplerSize.push(1.0 / Constant.bufferSize);\n samplerSize.push(1.0 / Constant.bufferSize);\n }\n shader.uniforms.uSamplerSize = samplerSize;\n}\n\nexport function generateFragmentSrc(maxTextures: number, fragmentSrc: string) {\n return fragmentSrc.replace(/%count%/gi, maxTextures + \"\")\n .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n}\n\nexport function generateSampleSrc(maxTextures: number) {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n src += 'if(vTextureId <= -1.0) {';\n src += '\\n\\tcolor = shadowColor;';\n src += '\\n}';\n\n for (let i = 0; i < maxTextures; i++)\n {\n src += '\\nelse ';\n\n if(i < maxTextures-1)\n {\n src += 'if(textureId == ' + i + '.0)';\n }\n\n src += '\\n{';\n src += '\\n\\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);';\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n}\n","/// \n\nimport * as shaderGenerator from './shaderGenerator';\n\nimport { Buffer, Geometry, Shader } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nlet rectShaderFrag = `\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n`;\nlet rectShaderVert = `\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n`;\n\nexport abstract class TilemapShader extends Shader {\n\tmaxTextures = 0;\n\n\tconstructor(maxTextures: number, shaderVert: string, shaderFrag: string) {\n\t\tsuper(\n\t\t\tnew PIXI.Program(\n\t\t\t\tshaderVert,\n\t\t\t\tshaderFrag),\n\t\t\t{\n\t\t\t\tanimationFrame: new Float32Array(2),\n\t\t\t\tuSamplers: [],\n\t\t\t\tuSamplerSize: [],\n\t\t\t\tprojTransMatrix: new Matrix()\n\t\t\t}\n\t\t);\n\t\tthis.maxTextures = maxTextures;\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileShader extends TilemapShader {\n\tconstructor(maxTextures: number) {\n\t\tsuper(\n\t\t\tmaxTextures,\n\t\t\trectShaderVert,\n\t\t\tshaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)\n\t\t);\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileGeom extends Geometry {\n\tvertSize = 11;\n\tvertPerQuad = 4;\n\tstride = this.vertSize * 4;\n\tlastTimeAccess = 0;\n\n\tconstructor() {\n\t\tsuper();\n\t\tconst buf = this.buf = new Buffer(new Float32Array(2), true, false);\n\t\tthis.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0)\n\t\t\t.addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4)\n\t\t\t.addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4)\n\t\t\t.addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4)\n\t\t\t.addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4);\n\t}\n\n\tbuf: PIXI.Buffer;\n}","import { WRAP_MODES } from '@pixi/constants';\nimport { BaseTexture, Buffer, resources, ObjectRenderer, Texture, Renderer } from '@pixi/core';\nimport { Constant } from './Constant';\nimport { RectTileGeom, RectTileShader } from './RectTileShader';\nimport { MultiTextureResource } from './MultiTextureResource';\n\nimport type { TilemapShader } from './RectTileShader';\n\n/**\n * Renderer for rectangle tiles.\n */\nexport class TileRenderer extends ObjectRenderer {\n\trenderer: Renderer;\n\tgl: WebGLRenderingContext;\n\tsn: number = -1;\n\tindexBuffer: PIXI.Buffer = null;\n\tibLen: number = 0;\n\ttileAnim = [0, 0];\n\ttexLoc: Array = [];\n\n\trectShader: RectTileShader;\n\ttexResources: Array = [];\n\n\tconstructor(renderer: Renderer) {\n\t\tsuper(renderer);\n\t\tthis.rectShader = new RectTileShader(Constant.maxTextures);\n\t\tthis.indexBuffer = new Buffer(undefined, true, true);\n\t\tthis.checkIndexBuffer(2000);\n\t\tthis.initBounds();\n\t}\n\n\tinitBounds() {\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tfor (let i = 0; i < maxTextures; i++) {\n\t\t\tconst resource = new MultiTextureResource(Constant);\n\t\t\tconst baseTex = new BaseTexture(resource);\n\t\t\tbaseTex.scaleMode = Constant.SCALE_MODE;\n\t\t\tbaseTex.wrapMode = WRAP_MODES.CLAMP;\n\t\t\tthis.texResources.push(resource);\n\t\t}\n\t}\n\n\tbindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tlet samplerSize: Array = (shader as any).uniforms.uSamplerSize;\n\t\tthis.texLoc.length = 0;\n\t\tfor (let i = 0; i < textures.length; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trenderer.texture.bind(textures[i], i);\n\t\t\t//TODO: add resolution here\n\t\t\tsamplerSize[i * 2] = 1.0 / textures[i].baseTexture.width;\n\t\t\tsamplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height;\n\t\t}\n\t\t(shader as any).uniforms.uSamplerSize = samplerSize;\n\t}\n\n\tbindTextures(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tconst len = textures.length;\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tif (len > Constant.boundCountPerBuffer * maxTextures) {\n\t\t\treturn;\n\t\t}\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\tthis.bindTexturesWithoutRT(renderer, shader, textures);\n\t\t\treturn;\n\t\t}\n\n\t\tlet i = 0;\n\t\tfor (; i < len; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) continue;\n\t\t\tconst multi = this.texResources[i >> 2];\n\t\t\tmulti.setTexture(i & 3, texture);\n\t\t}\n\n\t\tlet gltsUsed = (i + 3) >> 2;\n\t\tfor (i = 0; i < gltsUsed; i++) {\n\t\t\t//remove \"i, true\" after resolving a bug\n\t\t\trenderer.texture.bind(this.texResources[i].baseTex, i);\n\t\t}\n\t}\n\n\tstart() {\n\t\t//sorry, nothing\n\t}\n\n\tcreateVb() {\n\t\tconst geom = new RectTileGeom();\n\t\tgeom.addIndex(this.indexBuffer);\n\t\tgeom.lastTimeAccess = Date.now();\n\t\treturn geom;\n\t}\n\n\tcheckIndexBuffer(size: number, vb: RectTileGeom = null) {\n\t\tconst totalIndices = size * 6;\n\n\t\tif (totalIndices <= this.ibLen) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet len = totalIndices;\n\t\twhile (len < totalIndices) {\n\t\t\tlen <<= 1;\n\t\t}\n\n\t\tthis.ibLen = totalIndices;\n\t\tthis.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size,\n\t\t\tConstant.use32bitIndex ? new Uint32Array(size * 6) : undefined));\n\n\t\t// \tTODO: create new index buffer instead?\n\t\t// if (vb) {\n\t\t// \tconst curIndex = vb.getIndex();\n\t\t// \tif (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) {\n\t\t// \t\tthis.swapIndex(vb, this.indexBuffer);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t// swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) {\n\t\t// let buffers = (geom as any).buffers;\n\t\t// const oldIndex = geom.getIndex();\n\t\t// let ind = buffers.indexOf(oldIndex);\n\t\t// if (ind >= 0) {\n\t\t// \tbuffers.splice(ind, 1);\n\t\t// }\n\t\t// geom.addIndex(indexBuf);\n\t// }\n\n\tgetShader(): TilemapShader {\n\t\treturn this.rectShader;\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\t// this.rectShader.destroy();\n\t\tthis.rectShader = null;\n\t}\n}\n\nRenderer.registerPlugin('tilemap', TileRenderer as any);\n","/// \n\nimport { Container } from '@pixi/display';\n\nimport type { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport type { Matrix } from '@pixi/math';\n\nexport class ZLayer extends Container {\n\n constructor(tilemap: Container, zIndex: number) {\n super();\n this.tilemap = tilemap;\n this.z = zIndex;\n }\n\n tilemap: any;\n z: number;\n zIndex: number;\n _previousLayers: number;\n canvasBuffer: HTMLCanvasElement;\n _tempRender: any;\n _lastAnimationFrame: number = -1;\n layerTransform: Matrix;\n\n clear() {\n let layers = this.children as Array;\n for (let i = 0; i < layers.length; i++)\n layers[i].clear();\n this._previousLayers = 0;\n }\n\n cacheIfDirty() {\n let tilemap: any = this.tilemap;\n let layers = this.children as Array;\n let modified = this._previousLayers !== layers.length;\n this._previousLayers = layers.length;\n let buf = this.canvasBuffer;\n let tempRender = this._tempRender;\n if (!buf) {\n buf = this.canvasBuffer = document.createElement('canvas');\n tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf});\n tempRender.context = tempRender.rootContext;\n tempRender.plugins.tilemap.dontUseTransform = true;\n }\n if (buf.width !== tilemap._layerWidth ||\n buf.height !== tilemap._layerHeight) {\n buf.width = tilemap._layerWidth;\n buf.height = tilemap._layerHeight;\n modified = true;\n }\n let i: number;\n if (!modified) {\n for (i = 0; i < layers.length; i++) {\n if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) {\n modified = true;\n break;\n }\n }\n }\n this._lastAnimationFrame = tilemap.animationFrame;\n if (modified) {\n if (tilemap._hackRenderer) {\n tilemap._hackRenderer(tempRender);\n }\n tempRender.context.clearRect(0, 0, buf.width, buf.height);\n for (i = 0; i < layers.length; i++) {\n layers[i].clearModify();\n layers[i].renderCanvas(tempRender);\n }\n }\n this.layerTransform = this.worldTransform;\n for (i = 0; i < layers.length; i++) {\n this.layerTransform = layers[i].worldTransform;\n break;\n }\n }\n\n renderCanvas(renderer: any) {\n this.cacheIfDirty();\n let wt = this.layerTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n let tilemap = this.tilemap;\n renderer.context.drawImage(this.canvasBuffer, 0, 0);\n }\n}\n","/// \n\nnamespace pixi_tilemap {\n (PIXI as any).tilemap = pixi_tilemap;\n}\n\n// This makes exporter.ts a module!\nexport default {}\n","import { CanvasTileRenderer } from './CanvasTileRenderer';\nimport { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport { Constant } from './Constant';\nimport { GraphicsLayer } from './GraphicsLayer';\nimport { MultiTextureResource } from './MultiTextureResource';\nimport { RectTileLayer } from './RectTileLayer';\nimport { TilemapShader, RectTileShader, RectTileGeom } from './RectTileShader';\nimport { TileRenderer } from './TileRenderer';\nimport { ZLayer } from './ZLayer';\n\nexport const pixi_tilemap = {\n CanvasTileRenderer,\n CompositeRectTileLayer,\n Constant,\n GraphicsLayer,\n MultiTextureResource,\n RectTileLayer,\n TilemapShader,\n RectTileShader,\n RectTileGeom,\n TileRenderer,\n ZLayer,\n};\n\nexport * from './CanvasTileRenderer';\nexport * from './CompositeRectTileLayer';\nexport * from './Constant';\nexport * from './exporter';\nexport * from './GraphicsLayer';\nexport * from './MultiTextureResource';\nexport * from './RectTileLayer';\nexport * from './RectTileShader';\nexport * from './shaderGenerator';\nexport * from './TileRenderer';\nexport * from './ZLayer';"],"names":["shaderGenerator.fillSamplers","shaderGenerator.generateFragmentSrc","pixi_tilemap"],"mappings":";;;;;;;;;;;;;;;;;IASI,4BAAY,QAAkB;QAH9B,aAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAClB,qBAAgB,GAAG,KAAK,CAAC;QAGrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KAC1B;IACL,yBAAC;AAAD,CAAC,IAAA;AAED,IAAM,EAAE,GAAI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AAC;AACzC,CAAC,EAFS,YAAY,KAAZ,YAAY;;ICQTE,cAAY,GAAG;IACxB,kBAAkB,oBAAA;IAClB,sBAAsB,wBAAA;IACtB,QAAQ,UAAA;IACR,aAAa,eAAA;IACb,oBAAoB,sBAAA;IACpB,aAAa,eAAA;IACb,aAAa,eAAA;IACb,cAAc,gBAAA;IACd,YAAY,cAAA;IACZ,YAAY,cAAA;IACZ,MAAM,QAAA;;;;;"} \ No newline at end of file +{"version":3,"file":"pixi-tilemap.es.js","sources":["../src/CanvasTileRenderer.ts","../node_modules/tslib/tslib.es6.js","../src/Constant.ts","../src/RectTileLayer.ts","../src/CompositeRectTileLayer.ts","../src/GraphicsLayer.ts","../src/MultiTextureResource.ts","../src/shaderGenerator.ts","../src/RectTileShader.ts","../src/TileRenderer.ts","../src/ZLayer.ts","../src/exporter.ts","../src/index.ts"],"sourcesContent":["/// \n\nimport { Renderer } from '@pixi/core';\n\nexport class CanvasTileRenderer {\n renderer: Renderer;\n tileAnim = [0, 0];\n dontUseTransform = false;\n\n constructor(renderer: Renderer) {\n this.renderer = renderer;\n this.tileAnim = [0, 0];\n }\n}\n\nconst cr = (PIXI as any).CanvasRenderer;\n\nif (cr) {\n cr.registerPlugin('tilemap', CanvasTileRenderer);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","export const Constant = {\n maxTextures: 16,\n bufferSize: 2048,\n boundSize: 1024,\n boundCountPerBuffer: 1,\n use32bitIndex: false,\n SCALE_MODE: PIXI.SCALE_MODES.LINEAR,\n DO_CLEAR: true\n};","/// \n\nimport { Container } from '@pixi/display';\nimport { Constant } from './Constant';\nimport { DRAW_MODES } from '@pixi/constants';\nimport { Texture, Renderer } from '@pixi/core';\nimport { TileRenderer } from './TileRenderer';\nimport { Matrix, groupD8 } from '@pixi/math';\n\nimport type { RectTileGeom } from './RectTileShader';\n\nexport const POINT_STRUCT_SIZE = 12;\n\nexport class RectTileLayer extends Container {\n constructor(zIndex: number, texture: Texture | Array) {\n super();\n this.initialize(zIndex, texture);\n }\n\n zIndex = 0;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n\n pointsBuf: Array = [];\n hasAnim = false;\n textures: Array;\n\n offsetX = 0;\n offsetY = 0;\n compositeParent = false;\n\n initialize(zIndex: number, textures: Texture | Array) {\n if (!textures) {\n textures = [];\n } else if (!(textures instanceof Array) && (textures as Texture).baseTexture) {\n textures = [textures as Texture];\n }\n this.textures = textures as Array;\n this.zIndex = zIndex;\n // this.visible = false;\n }\n\n clear() {\n this.pointsBuf.length = 0;\n this.modificationMarker = 0;\n this.hasAnim = false;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX: number, animY: number) {\n let texture: Texture;\n let textureIndex = 0;\n\n if (typeof texture_ === \"number\") {\n textureIndex = texture_;\n texture = this.textures[textureIndex];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n let found = false;\n let textureList = this.textures;\n for (let i = 0; i < textureList.length; i++) {\n if (textureList[i].baseTexture === texture.baseTexture) {\n textureIndex = i;\n found = true;\n break;\n }\n }\n\n if (!found) {\n // textureIndex = this.textures.length;\n // this.textures.push(texture);\n return false;\n }\n }\n\n this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate);\n return true;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number,\n animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this {\n let pb = this.pointsBuf;\n this.hasAnim = this.hasAnim || animX > 0 || animY > 0;\n pb.push(u);\n pb.push(v);\n pb.push(x);\n pb.push(y);\n pb.push(tileWidth);\n pb.push(tileHeight);\n pb.push(rotate);\n pb.push(animX | 0);\n pb.push(animY | 0);\n pb.push(textureIndex);\n pb.push(animCountX);\n pb.push(animCountY);\n\n return this;\n }\n\n tileRotate(rotate: number) {\n const pb = this.pointsBuf;\n pb[pb.length - 3] = rotate;\n }\n\n tileAnimX(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 5] = offset;\n pb[pb.length - 2] = count;\n }\n\n tileAnimY(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 4] = offset;\n pb[pb.length - 1] = count;\n }\n\n renderCanvas(renderer: any) {\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n this.renderCanvasCore(renderer);\n }\n\n renderCanvasCore(renderer: any) {\n if (this.textures.length === 0) return;\n let points = this.pointsBuf;\n renderer.context.fillStyle = '#000000';\n for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) {\n let x1 = points[i], y1 = points[i + 1];\n let x2 = points[i + 2], y2 = points[i + 3];\n let w = points[i + 4];\n let h = points[i + 5];\n var rotate = points[i + 6];\n x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0];\n y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1];\n let textureIndex = points[i + 9];\n // canvas does not work with rotate yet\n if (textureIndex >= 0) {\n renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h);\n } else {\n renderer.context.globalAlpha = 0.5;\n renderer.context.fillRect(x2, y2, w, h);\n renderer.context.globalAlpha = 1;\n }\n }\n }\n\n vbId = 0;\n vb: RectTileGeom = null;\n vbBuffer: ArrayBuffer = null;\n vbArray: Float32Array = null;\n vbInts: Uint32Array = null;\n\n destroyVb() {\n if (this.vb) {\n this.vb.destroy();\n this.vb = null;\n }\n }\n\n render(renderer: Renderer) {\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n this.renderWebGLCore(renderer, plugin);\n }\n\n renderWebGLCore(renderer: Renderer, plugin: TileRenderer) {\n let points = this.pointsBuf;\n if (points.length === 0) return;\n let rectsCount = points.length / POINT_STRUCT_SIZE;\n\n let shader = plugin.getShader();\n let textures = this.textures;\n if (textures.length === 0) return;\n\n plugin.bindTextures(renderer, shader, textures);\n renderer.shader.bind(shader, false);\n\n //lost context! recover!\n let vb = this.vb;\n if (!vb) {\n vb = plugin.createVb();\n this.vb = vb;\n this.vbId = (vb as any).id;\n this.vbBuffer = null;\n this.modificationMarker = 0;\n }\n\n plugin.checkIndexBuffer(rectsCount, vb);\n const boundCountPerBuffer = Constant.boundCountPerBuffer;\n\n let vertexBuf = vb.getBuffer('aVertexPosition');\n //if layer was changed, re-upload vertices\n let vertices = rectsCount * vb.vertPerQuad;\n if (vertices === 0) return;\n if (this.modificationMarker !== vertices) {\n this.modificationMarker = vertices;\n let vs = vb.stride * vertices;\n if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {\n //!@#$ happens, need resize\n let bk = vb.stride;\n while (bk < vs) {\n bk *= 2;\n }\n this.vbBuffer = new ArrayBuffer(bk);\n this.vbArray = new Float32Array(this.vbBuffer);\n this.vbInts = new Uint32Array(this.vbBuffer);\n vertexBuf.update(this.vbBuffer);\n }\n\n let arr = this.vbArray, ints = this.vbInts;\n //upload vertices!\n let sz = 0;\n //let tint = 0xffffffff;\n let textureId: number = 0;\n let shiftU: number = this.offsetX;\n let shiftV: number = this.offsetY;\n\n //let tint = 0xffffffff;\n let tint = -1;\n for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) {\n let eps = 0.5;\n if (this.compositeParent) {\n if (boundCountPerBuffer > 1) {\n //TODO: what if its more than 4?\n textureId = (points[i + 9] >> 2);\n shiftU = this.offsetX * (points[i + 9] & 1);\n shiftV = this.offsetY * ((points[i + 9] >> 1) & 1);\n } else {\n textureId = points[i + 9];\n shiftU = 0;\n shiftV = 0;\n }\n }\n let x = points[i + 2], y = points[i + 3];\n let w = points[i + 4], h = points[i + 5];\n let u = points[i] + shiftU, v = points[i + 1] + shiftV;\n let rotate = points[i + 6];\n\n const animX = points[i + 7], animY = points[i + 8];\n const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024;\n const animXEncoded = animX + (animWidth * 2048);\n const animYEncoded = animY + (animHeight * 2048);\n\n let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number;\n if (rotate === 0) {\n u0 = u;\n v0 = v;\n u1 = u + w;\n v1 = v;\n u2 = u + w;\n v2 = v + h;\n u3 = u;\n v3 = v + h;\n } else {\n let w2 = w / 2;\n let h2 = h / 2;\n if (rotate % 4 !== 0) {\n w2 = h / 2;\n h2 = w / 2;\n }\n const cX = u + w2;\n const cY = v + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW);\n u0 = cX + (w2 * groupD8.uX(rotate));\n v0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n u1 = cX + (w2 * groupD8.uX(rotate));\n v1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u2 = cX + (w2 * groupD8.uX(rotate));\n v2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u3 = cX + (w2 * groupD8.uX(rotate));\n v3 = cY + (h2 * groupD8.uY(rotate));\n }\n\n arr[sz++] = x;\n arr[sz++] = y;\n arr[sz++] = u0;\n arr[sz++] = v0;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y;\n arr[sz++] = u1;\n arr[sz++] = v1;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y + h;\n arr[sz++] = u2;\n arr[sz++] = v2;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x;\n arr[sz++] = y + h;\n arr[sz++] = u3;\n arr[sz++] = v3;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n }\n\n vertexBuf.update(arr);\n }\n\n (renderer.geometry as any).bind(vb, shader);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES, rectsCount * 6, 0);\n }\n\n isModified(anim: boolean) {\n if (this.modificationMarker !== this.pointsBuf.length ||\n anim && this.hasAnim) {\n return true;\n }\n return false;\n }\n\n clearModify() {\n this.modificationMarker = this.pointsBuf.length;\n }\n\n destroy(options?: any) {\n super.destroy(options);\n this.destroyVb();\n }\n}\n","/// \n\nimport { Container } from '@pixi/display';\nimport { Texture, Renderer } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { Constant } from './Constant';\nimport { RectTileLayer } from './RectTileLayer';\n\nexport class CompositeRectTileLayer extends Container {\n constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n super();\n this.initialize.apply(this, arguments);\n }\n\n updateTransform() {\n (this as any).displayObjectUpdateTransform();\n }\n\n z: number;\n zIndex: number;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n _lastLayer: RectTileLayer = null;\n\n texPerChild: number;\n\n initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n if (texPerChild as any === true) {\n //old format, ignore it!\n texPerChild = 0;\n }\n this.z = this.zIndex = zIndex;\n this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures;\n if (bitmaps) {\n this.setBitmaps(bitmaps);\n }\n }\n\n setBitmaps(bitmaps: Array) {\n for (let i=0;i 5.2.1, it does not exist there.`);\n }\n }\n let texPerChild = this.texPerChild;\n let len1 = this.children.length;\n let len2 = Math.ceil(bitmaps.length / texPerChild);\n let i: number;\n for (i = 0; i < len1; i++) {\n (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);\n }\n for (i = len1; i < len2; i++) {\n let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild));\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n this.addChild(layer);\n }\n }\n\n clear() {\n for (let i = 0; i < this.children.length; i++) {\n (this.children[i] as RectTileLayer).clear();\n }\n this.modificationMarker = 0;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this {\n const childIndex: number = textureIndex / this.texPerChild >> 0;\n const textureId: number = textureIndex % this.texPerChild;\n\n if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) {\n this._lastLayer = (this.children[childIndex] as RectTileLayer);\n this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight);\n } else {\n this._lastLayer = null;\n }\n\n return this;\n }\n\n tileRotate(rotate: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileRotate(rotate);\n }\n return this;\n }\n\n tileAnimX(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimX(offset, count);\n }\n return this;\n }\n\n tileAnimY(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimY(offset, count);\n }\n return this;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this {\n let texture: Texture;\n let layer: RectTileLayer = null;\n let ind: number = 0;\n let children = this.children;\n\n this._lastLayer = null;\n if (typeof texture_ === \"number\") {\n let childIndex = texture_ / this.texPerChild >> 0;\n layer = children[childIndex] as RectTileLayer;\n\n if (!layer) {\n layer = children[0] as RectTileLayer;\n if (!layer) {\n return this;\n }\n ind = 0;\n } else {\n ind = texture_ % this.texPerChild;\n }\n\n texture = layer.textures[ind];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n let tex = child.textures;\n for (let j = 0; j < tex.length; j++) {\n if (tex[j].baseTexture === texture.baseTexture) {\n layer = child;\n ind = j;\n break;\n }\n }\n if (layer) {\n break;\n }\n }\n\n if (!layer) {\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n if (child.textures.length < this.texPerChild) {\n layer = child;\n ind = child.textures.length;\n child.textures.push(texture);\n break;\n }\n }\n if (!layer) {\n layer = new RectTileLayer(this.zIndex, texture);\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n children.push(layer);\n ind = 0;\n }\n }\n }\n\n this._lastLayer = layer;\n layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight);\n return this;\n }\n\n renderCanvas(renderer: any) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderCanvasCore(renderer);\n }\n }\n\n render(renderer: Renderer) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n //TODO: dont create new array, please\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n renderer.shader.bind(shader, false);\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin);\n }\n }\n\n isModified(anim: boolean) {\n let layers = this.children;\n if (this.modificationMarker !== layers.length) {\n return true;\n }\n for (let i = 0; i < layers.length; i++) {\n if ((layers[i] as RectTileLayer).isModified(anim)) {\n return true;\n }\n }\n return false;\n }\n\n clearModify() {\n let layers = this.children;\n this.modificationMarker = layers.length;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).clearModify();\n }\n }\n}","/// \n\nimport { Matrix } from '@pixi/math';\nimport { Graphics } from '@pixi/graphics';\n\nexport class GraphicsLayer extends Graphics {\n constructor(zIndex: number) {\n super();\n this.zIndex = zIndex;\n }\n\n renderCanvas(renderer: any) {\n let wt: Matrix = null;\n if (renderer.plugins.tilemap.dontUseTransform) {\n wt = this.transform.worldTransform;\n this.transform.worldTransform = Matrix.IDENTITY;\n }\n renderer.plugins.graphics.render(this);\n if (renderer.plugins.tilemap.dontUseTransform) {\n this.transform.worldTransform = wt;\n }\n renderer.context.globalAlpha = 1.0;\n }\n\n // renderWebGL(renderer: PIXI.Renderer) {\n // if (!this._webGL[renderer.CONTEXT_UID])\n // this.dirty++;\n // super.renderWebGL(renderer)\n // }\n\n isModified(anim: boolean): boolean {\n return false;\n }\n\n clearModify() {\n }\n}\n","/// \n\nimport { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, Renderer, Texture, GLTexture, resources } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Constant } from './Constant';\n\nexport interface IMultiTextureOptions {\n\tboundCountPerBuffer: number;\n\tboundSize: number;\n\tbufferSize: number;\n\tDO_CLEAR?: boolean;\n}\n\nexport class MultiTextureResource extends resources.Resource {\n\tconstructor(options: IMultiTextureOptions) {\n\t\tsuper(options.bufferSize, options.bufferSize);\n\n\t\tconst bounds = this.boundSprites;\n\t\tconst dirties = this.dirties;\n\t\tthis.boundSize = options.boundSize;\n\t\tfor (let j = 0; j < options.boundCountPerBuffer; j++) {\n\t\t\tconst spr = new Sprite();\n\t\t\tspr.position.x = options.boundSize * (j & 1);\n\t\t\tspr.position.y = options.boundSize * (j >> 1);\n\t\t\tbounds.push(spr);\n\t\t\tdirties.push(0);\n\t\t}\n\t\tthis.DO_CLEAR = !!options.DO_CLEAR;\n\t}\n\n\tDO_CLEAR = false;\n\tboundSize: number = 0;\n\t_clearBuffer: Uint8Array = null;\n\n\tbind(baseTexture: BaseTexture) {\n\t\tif (this.baseTex) {\n\t\t\tthrow new Error('Only one baseTexture is allowed for this resource!')\n\t\t}\n\t\tthis.baseTex = baseTexture;\n\t\tsuper.bind(baseTexture);\n\t}\n\n\tbaseTex: BaseTexture = null;\n\tboundSprites: Array = [];\n\tdirties: Array = [];\n\n\tsetTexture(ind: number, texture: Texture) {\n\t\tconst spr = this.boundSprites[ind];\n\t\tif (spr.texture.baseTexture === texture.baseTexture) {\n\t\t\treturn;\n\t\t}\n\t\tspr.texture = texture;\n\t\tthis.baseTex.update();\n\t\tthis.dirties[ind] = (this.baseTex as any).dirtyId;\n\t}\n\n\tupload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture) {\n\t\tconst { gl } = renderer as any;\n\n\t\tconst {width, height} = this;\n\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined ||\n\t\t\ttexture.alphaMode === ALPHA_MODES.UNPACK);\n\n\t\tif (glTexture.dirtyId < 0) {\n\t\t\t(glTexture as any).width = width;\n\t\t\t(glTexture as any).height = height;\n\n\t\t\tgl.texImage2D(texture.target, 0,\n\t\t\t\ttexture.format,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\t0,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tnull);\n\t\t}\n\n\t\tconst doClear = this.DO_CLEAR;\n\t\tif (doClear && !this._clearBuffer) {\n\t\t\tthis._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4);\n\t\t}\n\n\t\tconst bounds = this.boundSprites;\n\t\tfor (let i = 0; i < bounds.length; i++) {\n\t\t\tconst spr = bounds[i];\n\t\t\tconst tex = spr.texture.baseTexture;\n\t\t\tif (glTexture.dirtyId >= this.dirties[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst res = tex.resource as any;\n\t\t\tif (!tex.valid || !res || !res.source) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (doClear && (tex.width < this.boundSize || tex.height < this.boundSize))\n\t\t\t{\n\t\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\t\tspr.position.x,\n\t\t\t\t\tspr.position.y,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\ttexture.format,\n\t\t\t\t\ttexture.type,\n\t\t\t\t\tthis._clearBuffer);\n\t\t\t}\n\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\tspr.position.x,\n\t\t\t\tspr.position.y,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tres.source);\n\t\t}\n\n\t\treturn true;\n\t}\n}\n","import { Constant } from './Constant';\n\nimport type { TilemapShader } from './RectTileShader';\n\n\nexport function fillSamplers(shader: TilemapShader, maxTextures: number) {\n let sampleValues: Array = [];\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n shader.uniforms.uSamplers = sampleValues;\n\n let samplerSize: Array = [];\n for (let i = 0; i < maxTextures; i++) {\n samplerSize.push(1.0 / Constant.bufferSize);\n samplerSize.push(1.0 / Constant.bufferSize);\n }\n shader.uniforms.uSamplerSize = samplerSize;\n}\n\nexport function generateFragmentSrc(maxTextures: number, fragmentSrc: string) {\n return fragmentSrc.replace(/%count%/gi, maxTextures + \"\")\n .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n}\n\nexport function generateSampleSrc(maxTextures: number) {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n src += 'if(vTextureId <= -1.0) {';\n src += '\\n\\tcolor = shadowColor;';\n src += '\\n}';\n\n for (let i = 0; i < maxTextures; i++)\n {\n src += '\\nelse ';\n\n if(i < maxTextures-1)\n {\n src += 'if(textureId == ' + i + '.0)';\n }\n\n src += '\\n{';\n src += '\\n\\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);';\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n}\n","/// \n\nimport * as shaderGenerator from './shaderGenerator';\n\nimport { Buffer, Geometry, Shader } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nlet rectShaderFrag = `\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n`;\nlet rectShaderVert = `\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n`;\n\nexport abstract class TilemapShader extends Shader {\n\tmaxTextures = 0;\n\n\tconstructor(maxTextures: number, shaderVert: string, shaderFrag: string) {\n\t\tsuper(\n\t\t\tnew PIXI.Program(\n\t\t\t\tshaderVert,\n\t\t\t\tshaderFrag),\n\t\t\t{\n\t\t\t\tanimationFrame: new Float32Array(2),\n\t\t\t\tuSamplers: [],\n\t\t\t\tuSamplerSize: [],\n\t\t\t\tprojTransMatrix: new Matrix()\n\t\t\t}\n\t\t);\n\t\tthis.maxTextures = maxTextures;\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileShader extends TilemapShader {\n\tconstructor(maxTextures: number) {\n\t\tsuper(\n\t\t\tmaxTextures,\n\t\t\trectShaderVert,\n\t\t\tshaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)\n\t\t);\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileGeom extends Geometry {\n\tvertSize = 11;\n\tvertPerQuad = 4;\n\tstride = this.vertSize * 4;\n\tlastTimeAccess = 0;\n\n\tconstructor() {\n\t\tsuper();\n\t\tconst buf = this.buf = new Buffer(new Float32Array(2), true, false);\n\t\tthis.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0)\n\t\t\t.addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4)\n\t\t\t.addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4)\n\t\t\t.addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4)\n\t\t\t.addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4);\n\t}\n\n\tbuf: PIXI.Buffer;\n}","import { WRAP_MODES } from '@pixi/constants';\nimport { BaseTexture, Buffer, resources, ObjectRenderer, Texture, Renderer } from '@pixi/core';\nimport { Constant } from './Constant';\nimport { RectTileGeom, RectTileShader } from './RectTileShader';\nimport { MultiTextureResource } from './MultiTextureResource';\n\nimport type { TilemapShader } from './RectTileShader';\n\n/**\n * Renderer for rectangle tiles.\n */\nexport class TileRenderer extends ObjectRenderer {\n\trenderer: Renderer;\n\tgl: WebGLRenderingContext;\n\tsn: number = -1;\n\tindexBuffer: PIXI.Buffer = null;\n\tibLen: number = 0;\n\ttileAnim = [0, 0];\n\ttexLoc: Array = [];\n\n\trectShader: RectTileShader;\n\ttexResources: Array = [];\n\n\tconstructor(renderer: Renderer) {\n\t\tsuper(renderer);\n\t\tthis.rectShader = new RectTileShader(Constant.maxTextures);\n\t\tthis.indexBuffer = new Buffer(undefined, true, true);\n\t\tthis.checkIndexBuffer(2000);\n\t\tthis.initBounds();\n\t}\n\n\tinitBounds() {\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tfor (let i = 0; i < maxTextures; i++) {\n\t\t\tconst resource = new MultiTextureResource(Constant);\n\t\t\tconst baseTex = new BaseTexture(resource);\n\t\t\tbaseTex.scaleMode = Constant.SCALE_MODE;\n\t\t\tbaseTex.wrapMode = WRAP_MODES.CLAMP;\n\t\t\tthis.texResources.push(resource);\n\t\t}\n\t}\n\n\tbindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tlet samplerSize: Array = (shader as any).uniforms.uSamplerSize;\n\t\tthis.texLoc.length = 0;\n\t\tfor (let i = 0; i < textures.length; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trenderer.texture.bind(textures[i], i);\n\t\t\t//TODO: add resolution here\n\t\t\tsamplerSize[i * 2] = 1.0 / textures[i].baseTexture.width;\n\t\t\tsamplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height;\n\t\t}\n\t\t(shader as any).uniforms.uSamplerSize = samplerSize;\n\t}\n\n\tbindTextures(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tconst len = textures.length;\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tif (len > Constant.boundCountPerBuffer * maxTextures) {\n\t\t\treturn;\n\t\t}\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\tthis.bindTexturesWithoutRT(renderer, shader, textures);\n\t\t\treturn;\n\t\t}\n\n\t\tlet i = 0;\n\t\tfor (; i < len; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) continue;\n\t\t\tconst multi = this.texResources[i >> 2];\n\t\t\tmulti.setTexture(i & 3, texture);\n\t\t}\n\n\t\tlet gltsUsed = (i + 3) >> 2;\n\t\tfor (i = 0; i < gltsUsed; i++) {\n\t\t\t//remove \"i, true\" after resolving a bug\n\t\t\trenderer.texture.bind(this.texResources[i].baseTex, i);\n\t\t}\n\t}\n\n\tstart() {\n\t\t//sorry, nothing\n\t}\n\n\tcreateVb() {\n\t\tconst geom = new RectTileGeom();\n\t\tgeom.addIndex(this.indexBuffer);\n\t\tgeom.lastTimeAccess = Date.now();\n\t\treturn geom;\n\t}\n\n\tcheckIndexBuffer(size: number, vb: RectTileGeom = null) {\n\t\tconst totalIndices = size * 6;\n\n\t\tif (totalIndices <= this.ibLen) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet len = totalIndices;\n\t\twhile (len < totalIndices) {\n\t\t\tlen <<= 1;\n\t\t}\n\n\t\tthis.ibLen = totalIndices;\n\t\tthis.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size,\n\t\t\tConstant.use32bitIndex ? new Uint32Array(size * 6) : undefined));\n\n\t\t// \tTODO: create new index buffer instead?\n\t\t// if (vb) {\n\t\t// \tconst curIndex = vb.getIndex();\n\t\t// \tif (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) {\n\t\t// \t\tthis.swapIndex(vb, this.indexBuffer);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t// swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) {\n\t\t// let buffers = (geom as any).buffers;\n\t\t// const oldIndex = geom.getIndex();\n\t\t// let ind = buffers.indexOf(oldIndex);\n\t\t// if (ind >= 0) {\n\t\t// \tbuffers.splice(ind, 1);\n\t\t// }\n\t\t// geom.addIndex(indexBuf);\n\t// }\n\n\tgetShader(): TilemapShader {\n\t\treturn this.rectShader;\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\t// this.rectShader.destroy();\n\t\tthis.rectShader = null;\n\t}\n}\n\nRenderer.registerPlugin('tilemap', TileRenderer as any);\n","/// \n\nimport { Container } from '@pixi/display';\n\nimport type { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport type { Matrix } from '@pixi/math';\n\nexport class ZLayer extends Container {\n\n constructor(tilemap: Container, zIndex: number) {\n super();\n this.tilemap = tilemap;\n this.z = zIndex;\n }\n\n tilemap: any;\n z: number;\n zIndex: number;\n _previousLayers: number;\n canvasBuffer: HTMLCanvasElement;\n _tempRender: any;\n _lastAnimationFrame: number = -1;\n layerTransform: Matrix;\n\n clear() {\n let layers = this.children as Array;\n for (let i = 0; i < layers.length; i++)\n layers[i].clear();\n this._previousLayers = 0;\n }\n\n cacheIfDirty() {\n let tilemap: any = this.tilemap;\n let layers = this.children as Array;\n let modified = this._previousLayers !== layers.length;\n this._previousLayers = layers.length;\n let buf = this.canvasBuffer;\n let tempRender = this._tempRender;\n if (!buf) {\n buf = this.canvasBuffer = document.createElement('canvas');\n tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf});\n tempRender.context = tempRender.rootContext;\n tempRender.plugins.tilemap.dontUseTransform = true;\n }\n if (buf.width !== tilemap._layerWidth ||\n buf.height !== tilemap._layerHeight) {\n buf.width = tilemap._layerWidth;\n buf.height = tilemap._layerHeight;\n modified = true;\n }\n let i: number;\n if (!modified) {\n for (i = 0; i < layers.length; i++) {\n if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) {\n modified = true;\n break;\n }\n }\n }\n this._lastAnimationFrame = tilemap.animationFrame;\n if (modified) {\n if (tilemap._hackRenderer) {\n tilemap._hackRenderer(tempRender);\n }\n tempRender.context.clearRect(0, 0, buf.width, buf.height);\n for (i = 0; i < layers.length; i++) {\n layers[i].clearModify();\n layers[i].renderCanvas(tempRender);\n }\n }\n this.layerTransform = this.worldTransform;\n for (i = 0; i < layers.length; i++) {\n this.layerTransform = layers[i].worldTransform;\n break;\n }\n }\n\n renderCanvas(renderer: any) {\n this.cacheIfDirty();\n let wt = this.layerTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n let tilemap = this.tilemap;\n renderer.context.drawImage(this.canvasBuffer, 0, 0);\n }\n}\n","/// \n\nnamespace pixi_tilemap {\n (PIXI as any).tilemap = pixi_tilemap;\n}\n\n// This makes exporter.ts a module!\nexport default {}\n","import { CanvasTileRenderer } from './CanvasTileRenderer';\nimport { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport { Constant } from './Constant';\nimport { GraphicsLayer } from './GraphicsLayer';\nimport { MultiTextureResource } from './MultiTextureResource';\nimport { RectTileLayer } from './RectTileLayer';\nimport { TilemapShader, RectTileShader, RectTileGeom } from './RectTileShader';\nimport { TileRenderer } from './TileRenderer';\nimport { ZLayer } from './ZLayer';\n\nexport const pixi_tilemap = {\n CanvasTileRenderer,\n CompositeRectTileLayer,\n Constant,\n GraphicsLayer,\n MultiTextureResource,\n RectTileLayer,\n TilemapShader,\n RectTileShader,\n RectTileGeom,\n TileRenderer,\n ZLayer,\n};\n\nexport * from './CanvasTileRenderer';\nexport * from './CompositeRectTileLayer';\nexport * from './Constant';\nexport * from './exporter';\nexport * from './GraphicsLayer';\nexport * from './MultiTextureResource';\nexport * from './RectTileLayer';\nexport * from './RectTileShader';\nexport * from './shaderGenerator';\nexport * from './TileRenderer';\nexport * from './ZLayer';"],"names":["shaderGenerator.fillSamplers","shaderGenerator.generateFragmentSrc","pixi_tilemap"],"mappings":";;;;;;;;;;;;;;;;;;;IASI,4BAAY,QAAkB;QAH9B,aAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAClB,qBAAgB,GAAG,KAAK,CAAC;QAGrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KAC1B;IACL,yBAAC;AAAD,CAAC,IAAA;AAED,IAAM,EAAE,GAAI,IAAY,CAAC,cAAc,CAAC;AAExC,IAAI,EAAE,EAAE;IACJ,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;;;AClBrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,aAAa,eAAA;IACb,cAAc,gBAAA;IACd,YAAY,cAAA;IACZ,YAAY,cAAA;IACZ,MAAM,QAAA;;;;;"} \ No newline at end of file diff --git a/package.json b/package.json index db7d7a40..41a54af2 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "watch": "tsc -w", "prebuild": "yarn cleanup", "make:dts": "node scripts/make_dts.js", - "build": "tsc && yarn make:dts", + "build": "rollup -c && yarn build:types", "build:types": "rm -rf ./compile && tsc -p ./tsconfig.compile.json && api-extractor run", "docs": "typedoc --out ./docs/ --readme README.md ./src/", "check:browserify": "yarn checkpack browserify -e test/checkpack.ts", diff --git a/rollup.config.js b/rollup.config.js index de2c41fc..19b8a6bc 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -15,6 +15,8 @@ const plugins = [ ]; const compiled = (new Date()).toUTCString().replace(/GMT/g, 'UTC'); const banner = [ + `/* eslint-disable */`, + ` `, `/*!`, ` * ${pkg.name} - v${pkg.version}`, ` * Compiled ${compiled}`, From 74e19e538982ec0a549242d9e22629ea24e2456e Mon Sep 17 00:00:00 2001 From: Shukant Pal Date: Thu, 13 Aug 2020 22:42:01 -0400 Subject: [PATCH 4/8] Turn off non-fatal warnings in api-extractor --- api-extractor.json | 6 +++--- dist/pixi-tilemap.js | 2 +- dist/pixi-tilemap.umd.js | 2 +- dist/pixi-tilemap.umd.min.js | 2 +- lib/pixi-tilemap.es.js | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api-extractor.json b/api-extractor.json index 86c3cdda..aafb5327 100644 --- a/api-extractor.json +++ b/api-extractor.json @@ -27,17 +27,17 @@ "messages": { "compilerMessageReporting": { "default": { - "logLevel": "warning" + "logLevel": "none" } }, "extractorMessageReporting": { "default": { - "logLevel": "warning" + "logLevel": "none" } }, "tsdocMessageReporting": { "default": { - "logLevel": "warning" + "logLevel": "none" } } } diff --git a/dist/pixi-tilemap.js b/dist/pixi-tilemap.js index 8aae79bf..61319ad0 100644 --- a/dist/pixi-tilemap.js +++ b/dist/pixi-tilemap.js @@ -2,7 +2,7 @@ /*! * pixi-tilemap - v2.0.6 - * Compiled Fri, 14 Aug 2020 02:36:52 UTC + * Compiled Fri, 14 Aug 2020 02:41:40 UTC * * pixi-tilemap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license diff --git a/dist/pixi-tilemap.umd.js b/dist/pixi-tilemap.umd.js index aa4027bc..2a6e8341 100644 --- a/dist/pixi-tilemap.umd.js +++ b/dist/pixi-tilemap.umd.js @@ -2,7 +2,7 @@ /*! * pixi-tilemap - v2.0.6 - * Compiled Fri, 14 Aug 2020 02:36:52 UTC + * Compiled Fri, 14 Aug 2020 02:41:40 UTC * * pixi-tilemap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license diff --git a/dist/pixi-tilemap.umd.min.js b/dist/pixi-tilemap.umd.min.js index 2b5932e8..0a2575fe 100644 --- a/dist/pixi-tilemap.umd.min.js +++ b/dist/pixi-tilemap.umd.min.js @@ -1,6 +1,6 @@ /*! * pixi-tilemap - v2.0.6 - * Compiled Fri, 14 Aug 2020 02:36:52 UTC + * Compiled Fri, 14 Aug 2020 02:41:40 UTC * * pixi-tilemap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license diff --git a/lib/pixi-tilemap.es.js b/lib/pixi-tilemap.es.js index 0a9ff8a4..0272e6af 100644 --- a/lib/pixi-tilemap.es.js +++ b/lib/pixi-tilemap.es.js @@ -2,7 +2,7 @@ /*! * pixi-tilemap - v2.0.6 - * Compiled Fri, 14 Aug 2020 02:36:52 UTC + * Compiled Fri, 14 Aug 2020 02:41:40 UTC * * pixi-tilemap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license From 7e2b62e4e0fa368e11e40965e4475c80261b7d57 Mon Sep 17 00:00:00 2001 From: Shukant Pal Date: Fri, 14 Aug 2020 14:22:24 -0400 Subject: [PATCH 5/8] Fix UMD build dependencies --- dist/pixi-tilemap.js | 2 +- dist/pixi-tilemap.umd.js | 4 ++-- dist/pixi-tilemap.umd.min.js | 4 ++-- lib/pixi-tilemap.es.js | 2 +- rollup.config.js | 14 +++++++------- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/dist/pixi-tilemap.js b/dist/pixi-tilemap.js index 61319ad0..777bf3f1 100644 --- a/dist/pixi-tilemap.js +++ b/dist/pixi-tilemap.js @@ -2,7 +2,7 @@ /*! * pixi-tilemap - v2.0.6 - * Compiled Fri, 14 Aug 2020 02:41:40 UTC + * Compiled Fri, 14 Aug 2020 18:21:51 UTC * * pixi-tilemap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license diff --git a/dist/pixi-tilemap.umd.js b/dist/pixi-tilemap.umd.js index 2a6e8341..13fca8ca 100644 --- a/dist/pixi-tilemap.umd.js +++ b/dist/pixi-tilemap.umd.js @@ -2,7 +2,7 @@ /*! * pixi-tilemap - v2.0.6 - * Compiled Fri, 14 Aug 2020 02:41:40 UTC + * Compiled Fri, 14 Aug 2020 18:21:51 UTC * * pixi-tilemap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -968,5 +968,5 @@ var pixi_tilemap = (function (exports, display, core, constants, math, graphics, return exports; -}({}, _pixi_display, _pixi_core, _pixi_constants, _pixi_math, _pixi_graphics, _pixi_sprite)); +}({}, PIXI, PIXI, PIXI, PIXI, PIXI, PIXI)); //# sourceMappingURL=pixi-tilemap.umd.js.map diff --git a/dist/pixi-tilemap.umd.min.js b/dist/pixi-tilemap.umd.min.js index 0a2575fe..21ddae70 100644 --- a/dist/pixi-tilemap.umd.min.js +++ b/dist/pixi-tilemap.umd.min.js @@ -1,6 +1,6 @@ /*! * pixi-tilemap - v2.0.6 - * Compiled Fri, 14 Aug 2020 02:41:40 UTC + * Compiled Fri, 14 Aug 2020 18:21:51 UTC * * pixi-tilemap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -21,5 +21,5 @@ var pixi_tilemap=function(e,t,r,i,n,o,a){"use strict";var s=function(e){this.til See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. - ***************************************************************************** */;var h=function(e,t){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function l(e,t){function r(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var f={maxTextures:16,bufferSize:2048,boundSize:1024,boundCountPerBuffer:1,use32bitIndex:!1,SCALE_MODE:PIXI.SCALE_MODES.LINEAR,DO_CLEAR:!0},d=function(e){function t(t,r){var i=e.call(this)||this;return i.zIndex=0,i.modificationMarker=0,i.shadowColor=new Float32Array([0,0,0,.5]),i._globalMat=null,i.pointsBuf=[],i.hasAnim=!1,i.offsetX=0,i.offsetY=0,i.compositeParent=!1,i.vbId=0,i.vb=null,i.vbBuffer=null,i.vbArray=null,i.vbInts=null,i.initialize(t,r),i}return l(t,e),t.prototype.initialize=function(e,t){t?t instanceof Array||!t.baseTexture||(t=[t]):t=[],this.textures=t,this.zIndex=e},t.prototype.clear=function(){this.pointsBuf.length=0,this.modificationMarker=0,this.hasAnim=!1},t.prototype.addFrame=function(e,t,i,n,o){var a,s=0;if("number"==typeof e)s=e,a=this.textures[s];else{a="string"==typeof e?r.Texture.from(e):e;for(var u=!1,h=this.textures,l=0;l0||u>0,d.push(t),d.push(r),d.push(i),d.push(n),d.push(o),d.push(a),d.push(h),d.push(0|s),d.push(0|u),d.push(e),d.push(l),d.push(f),this},t.prototype.tileRotate=function(e){var t=this.pointsBuf;t[t.length-3]=e},t.prototype.tileAnimX=function(e,t){var r=this.pointsBuf;r[r.length-5]=e,r[r.length-2]=t},t.prototype.tileAnimY=function(e,t){var r=this.pointsBuf;r[r.length-4]=e,r[r.length-1]=t},t.prototype.renderCanvas=function(e){if(!e.plugins.tilemap.dontUseTransform){var t=this.worldTransform;e.context.setTransform(t.a,t.b,t.c,t.d,t.tx*e.resolution,t.ty*e.resolution)}this.renderCanvasCore(e)},t.prototype.renderCanvasCore=function(e){if(0!==this.textures.length){var t=this.pointsBuf;e.context.fillStyle="#000000";for(var r=0,i=t.length;r=0?e.context.drawImage(this.textures[l].baseTexture.getDrawableSource(),n,o,u,h,a,s,u,h):(e.context.globalAlpha=.5,e.context.fillRect(a,s,u,h),e.context.globalAlpha=1)}}},t.prototype.destroyVb=function(){this.vb&&(this.vb.destroy(),this.vb=null)},t.prototype.render=function(e){var t=e.plugins.tilemap,r=t.getShader();e.batch.setObjectRenderer(t),this._globalMat=r.uniforms.projTransMatrix,e.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform),r.uniforms.shadowColor=this.shadowColor,r.uniforms.animationFrame=t.tileAnim,this.renderWebGLCore(e,t)},t.prototype.renderWebGLCore=function(e,t){var r=this.pointsBuf;if(0!==r.length){var o=r.length/12,a=t.getShader(),s=this.textures;if(0!==s.length){t.bindTextures(e,a,s),e.shader.bind(a,!1);var u=this.vb;u||(u=t.createVb(),this.vb=u,this.vbId=u.id,this.vbBuffer=null,this.modificationMarker=0),t.checkIndexBuffer(o,u);var h=f.boundCountPerBuffer,l=u.getBuffer("aVertexPosition"),d=o*u.vertPerQuad;if(0!==d){if(this.modificationMarker!==d){this.modificationMarker=d;var p=u.stride*d;if(!this.vbBuffer||this.vbBuffer.byteLength1?(x=r[g+9]>>2,y=this.offsetX*(1&r[g+9]),b=this.offsetY*(r[g+9]>>1&1)):(x=r[g+9],y=0,b=0));var T=r[g+2],S=r[g+3],_=r[g+4],C=r[g+5],A=r[g]+y,w=r[g+1]+b,I=r[g+6],R=r[g+7],M=r[g+8],B=R+2048*(r[g+10]||1024),L=M+2048*(r[g+11]||1024),P=void 0,z=void 0,D=void 0,F=void 0,O=void 0,E=void 0,k=void 0,X=void 0;if(0===I)P=A,z=w,D=A+_,F=w,O=A+_,E=w+C,k=A,X=w+C;else{var U=_/2,Y=C/2;I%4!=0&&(U=C/2,Y=_/2);var j=A+U,G=w+Y;I=n.groupD8.add(I,n.groupD8.NW),P=j+U*n.groupD8.uX(I),z=G+Y*n.groupD8.uY(I),I=n.groupD8.add(I,2),D=j+U*n.groupD8.uX(I),F=G+Y*n.groupD8.uY(I),I=n.groupD8.add(I,2),O=j+U*n.groupD8.uX(I),E=G+Y*n.groupD8.uY(I),I=n.groupD8.add(I,2),k=j+U*n.groupD8.uX(I),X=G+Y*n.groupD8.uY(I)}m[v++]=T,m[v++]=S,m[v++]=P,m[v++]=z,m[v++]=A+.5,m[v++]=w+.5,m[v++]=A+_-.5,m[v++]=w+C-.5,m[v++]=B,m[v++]=L,m[v++]=x,m[v++]=T+_,m[v++]=S,m[v++]=D,m[v++]=F,m[v++]=A+.5,m[v++]=w+.5,m[v++]=A+_-.5,m[v++]=w+C-.5,m[v++]=B,m[v++]=L,m[v++]=x,m[v++]=T+_,m[v++]=S+C,m[v++]=O,m[v++]=E,m[v++]=A+.5,m[v++]=w+.5,m[v++]=A+_-.5,m[v++]=w+C-.5,m[v++]=B,m[v++]=L,m[v++]=x,m[v++]=T,m[v++]=S+C,m[v++]=k,m[v++]=X,m[v++]=A+.5,m[v++]=w+.5,m[v++]=A+_-.5,m[v++]=w+C-.5,m[v++]=B,m[v++]=L,m[v++]=x}l.update(m)}e.geometry.bind(u,a),e.geometry.draw(i.DRAW_MODES.TRIANGLES,6*o,0)}}}},t.prototype.isModified=function(e){return!!(this.modificationMarker!==this.pointsBuf.length||e&&this.hasAnim)},t.prototype.clearModify=function(){this.modificationMarker=this.pointsBuf.length},t.prototype.destroy=function(t){e.prototype.destroy.call(this,t),this.destroyVb()},t}(t.Container),p=function(e){function t(t,r,i){var n=e.call(this)||this;return n.modificationMarker=0,n.shadowColor=new Float32Array([0,0,0,.5]),n._globalMat=null,n._lastLayer=null,n.initialize.apply(n,arguments),n}return l(t,e),t.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},t.prototype.initialize=function(e,t,r){!0===r&&(r=0),this.z=this.zIndex=e,this.texPerChild=r||f.boundCountPerBuffer*f.maxTextures,t&&this.setBitmaps(t)},t.prototype.setBitmaps=function(e){for(var t=0;t 5.2.1, it does not exist there.");var r,i=this.texPerChild,n=this.children.length,o=Math.ceil(e.length/i);for(r=0;r>0,p=e%this.texPerChild;return this.children[d]&&this.children[d].textures?(this._lastLayer=this.children[d],this._lastLayer.addRect(p,t,r,i,n,o,a,s,u,h,l,f)):this._lastLayer=null,this},t.prototype.tileRotate=function(e){return this._lastLayer&&this._lastLayer.tileRotate(e),this},t.prototype.tileAnimX=function(e,t){return this._lastLayer&&this._lastLayer.tileAnimX(e,t),this},t.prototype.tileAnimY=function(e,t){return this._lastLayer&&this._lastLayer.tileAnimY(e,t),this},t.prototype.addFrame=function(e,t,i,n,o,a,s){var u,h=null,l=0,p=this.children;if(this._lastLayer=null,"number"==typeof e){if(h=p[e/this.texPerChild>>0])l=e%this.texPerChild;else{if(!(h=p[0]))return this;l=0}u=h.textures[l]}else{u="string"==typeof e?r.Texture.from(e):e;for(var c=0;c>1),i.push(s),n.push(0)}return r.DO_CLEAR=!!t.DO_CLEAR,r}return l(t,e),t.prototype.bind=function(t){if(this.baseTex)throw new Error("Only one baseTexture is allowed for this resource!");this.baseTex=t,e.prototype.bind.call(this,t)},t.prototype.setTexture=function(e,t){var r=this.boundSprites[e];r.texture.baseTexture!==t.baseTexture&&(r.texture=t,this.baseTex.update(),this.dirties[e]=this.baseTex.dirtyId)},t.prototype.upload=function(e,t,r){var n=e.gl,o=this.width,a=this.height;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,void 0===t.alphaMode||t.alphaMode===i.ALPHA_MODES.UNPACK),r.dirtyId<0&&(r.width=o,r.height=a,n.texImage2D(t.target,0,t.format,o,a,0,t.format,t.type,null));var s=this.DO_CLEAR;s&&!this._clearBuffer&&(this._clearBuffer=new Uint8Array(f.boundSize*f.boundSize*4));for(var u=this.boundSprites,h=0;h=this.dirties[h])){var p=d.resource;d.valid&&p&&p.source&&(s&&(d.widthf.boundCountPerBuffer*f.maxTextures))if(f.boundCountPerBuffer<=1)this.bindTexturesWithoutRT(e,t,r);else{for(var n=0;n>2].setTexture(3&n,o)}var a=n+3>>2;for(n=0;n0||u>0,d.push(t),d.push(r),d.push(i),d.push(n),d.push(o),d.push(a),d.push(h),d.push(0|s),d.push(0|u),d.push(e),d.push(l),d.push(f),this},t.prototype.tileRotate=function(e){var t=this.pointsBuf;t[t.length-3]=e},t.prototype.tileAnimX=function(e,t){var r=this.pointsBuf;r[r.length-5]=e,r[r.length-2]=t},t.prototype.tileAnimY=function(e,t){var r=this.pointsBuf;r[r.length-4]=e,r[r.length-1]=t},t.prototype.renderCanvas=function(e){if(!e.plugins.tilemap.dontUseTransform){var t=this.worldTransform;e.context.setTransform(t.a,t.b,t.c,t.d,t.tx*e.resolution,t.ty*e.resolution)}this.renderCanvasCore(e)},t.prototype.renderCanvasCore=function(e){if(0!==this.textures.length){var t=this.pointsBuf;e.context.fillStyle="#000000";for(var r=0,i=t.length;r=0?e.context.drawImage(this.textures[l].baseTexture.getDrawableSource(),n,o,u,h,a,s,u,h):(e.context.globalAlpha=.5,e.context.fillRect(a,s,u,h),e.context.globalAlpha=1)}}},t.prototype.destroyVb=function(){this.vb&&(this.vb.destroy(),this.vb=null)},t.prototype.render=function(e){var t=e.plugins.tilemap,r=t.getShader();e.batch.setObjectRenderer(t),this._globalMat=r.uniforms.projTransMatrix,e.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform),r.uniforms.shadowColor=this.shadowColor,r.uniforms.animationFrame=t.tileAnim,this.renderWebGLCore(e,t)},t.prototype.renderWebGLCore=function(e,t){var r=this.pointsBuf;if(0!==r.length){var o=r.length/12,a=t.getShader(),s=this.textures;if(0!==s.length){t.bindTextures(e,a,s),e.shader.bind(a,!1);var u=this.vb;u||(u=t.createVb(),this.vb=u,this.vbId=u.id,this.vbBuffer=null,this.modificationMarker=0),t.checkIndexBuffer(o,u);var h=f.boundCountPerBuffer,l=u.getBuffer("aVertexPosition"),d=o*u.vertPerQuad;if(0!==d){if(this.modificationMarker!==d){this.modificationMarker=d;var p=u.stride*d;if(!this.vbBuffer||this.vbBuffer.byteLength1?(x=r[g+9]>>2,y=this.offsetX*(1&r[g+9]),b=this.offsetY*(r[g+9]>>1&1)):(x=r[g+9],y=0,b=0));var T=r[g+2],S=r[g+3],C=r[g+4],A=r[g+5],I=r[g]+y,w=r[g+1]+b,_=r[g+6],P=r[g+7],R=r[g+8],M=P+2048*(r[g+10]||1024),B=R+2048*(r[g+11]||1024),L=void 0,z=void 0,D=void 0,F=void 0,O=void 0,X=void 0,E=void 0,k=void 0;if(0===_)L=I,z=w,D=I+C,F=w,O=I+C,X=w+A,E=I,k=w+A;else{var U=C/2,Y=A/2;_%4!=0&&(U=A/2,Y=C/2);var j=I+U,G=w+Y;_=n.groupD8.add(_,n.groupD8.NW),L=j+U*n.groupD8.uX(_),z=G+Y*n.groupD8.uY(_),_=n.groupD8.add(_,2),D=j+U*n.groupD8.uX(_),F=G+Y*n.groupD8.uY(_),_=n.groupD8.add(_,2),O=j+U*n.groupD8.uX(_),X=G+Y*n.groupD8.uY(_),_=n.groupD8.add(_,2),E=j+U*n.groupD8.uX(_),k=G+Y*n.groupD8.uY(_)}m[v++]=T,m[v++]=S,m[v++]=L,m[v++]=z,m[v++]=I+.5,m[v++]=w+.5,m[v++]=I+C-.5,m[v++]=w+A-.5,m[v++]=M,m[v++]=B,m[v++]=x,m[v++]=T+C,m[v++]=S,m[v++]=D,m[v++]=F,m[v++]=I+.5,m[v++]=w+.5,m[v++]=I+C-.5,m[v++]=w+A-.5,m[v++]=M,m[v++]=B,m[v++]=x,m[v++]=T+C,m[v++]=S+A,m[v++]=O,m[v++]=X,m[v++]=I+.5,m[v++]=w+.5,m[v++]=I+C-.5,m[v++]=w+A-.5,m[v++]=M,m[v++]=B,m[v++]=x,m[v++]=T,m[v++]=S+A,m[v++]=E,m[v++]=k,m[v++]=I+.5,m[v++]=w+.5,m[v++]=I+C-.5,m[v++]=w+A-.5,m[v++]=M,m[v++]=B,m[v++]=x}l.update(m)}e.geometry.bind(u,a),e.geometry.draw(i.DRAW_MODES.TRIANGLES,6*o,0)}}}},t.prototype.isModified=function(e){return!!(this.modificationMarker!==this.pointsBuf.length||e&&this.hasAnim)},t.prototype.clearModify=function(){this.modificationMarker=this.pointsBuf.length},t.prototype.destroy=function(t){e.prototype.destroy.call(this,t),this.destroyVb()},t}(t.Container),p=function(e){function t(t,r,i){var n=e.call(this)||this;return n.modificationMarker=0,n.shadowColor=new Float32Array([0,0,0,.5]),n._globalMat=null,n._lastLayer=null,n.initialize.apply(n,arguments),n}return l(t,e),t.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},t.prototype.initialize=function(e,t,r){!0===r&&(r=0),this.z=this.zIndex=e,this.texPerChild=r||f.boundCountPerBuffer*f.maxTextures,t&&this.setBitmaps(t)},t.prototype.setBitmaps=function(e){for(var t=0;t 5.2.1, it does not exist there.");var r,i=this.texPerChild,n=this.children.length,o=Math.ceil(e.length/i);for(r=0;r>0,p=e%this.texPerChild;return this.children[d]&&this.children[d].textures?(this._lastLayer=this.children[d],this._lastLayer.addRect(p,t,r,i,n,o,a,s,u,h,l,f)):this._lastLayer=null,this},t.prototype.tileRotate=function(e){return this._lastLayer&&this._lastLayer.tileRotate(e),this},t.prototype.tileAnimX=function(e,t){return this._lastLayer&&this._lastLayer.tileAnimX(e,t),this},t.prototype.tileAnimY=function(e,t){return this._lastLayer&&this._lastLayer.tileAnimY(e,t),this},t.prototype.addFrame=function(e,t,i,n,o,a,s){var u,h=null,l=0,p=this.children;if(this._lastLayer=null,"number"==typeof e){if(h=p[e/this.texPerChild>>0])l=e%this.texPerChild;else{if(!(h=p[0]))return this;l=0}u=h.textures[l]}else{u="string"==typeof e?r.Texture.from(e):e;for(var c=0;c>1),i.push(s),n.push(0)}return r.DO_CLEAR=!!t.DO_CLEAR,r}return l(t,e),t.prototype.bind=function(t){if(this.baseTex)throw new Error("Only one baseTexture is allowed for this resource!");this.baseTex=t,e.prototype.bind.call(this,t)},t.prototype.setTexture=function(e,t){var r=this.boundSprites[e];r.texture.baseTexture!==t.baseTexture&&(r.texture=t,this.baseTex.update(),this.dirties[e]=this.baseTex.dirtyId)},t.prototype.upload=function(e,t,r){var n=e.gl,o=this.width,a=this.height;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,void 0===t.alphaMode||t.alphaMode===i.ALPHA_MODES.UNPACK),r.dirtyId<0&&(r.width=o,r.height=a,n.texImage2D(t.target,0,t.format,o,a,0,t.format,t.type,null));var s=this.DO_CLEAR;s&&!this._clearBuffer&&(this._clearBuffer=new Uint8Array(f.boundSize*f.boundSize*4));for(var u=this.boundSprites,h=0;h=this.dirties[h])){var p=d.resource;d.valid&&p&&p.source&&(s&&(d.widthf.boundCountPerBuffer*f.maxTextures))if(f.boundCountPerBuffer<=1)this.bindTexturesWithoutRT(e,t,r);else{for(var n=0;n>2].setTexture(3&n,o)}var a=n+3>>2;for(n=0;n Date: Fri, 14 Aug 2020 14:27:22 -0400 Subject: [PATCH 6/8] PIXI.tilemap --- dist/pixi-tilemap.js | 2 +- dist/pixi-tilemap.umd.js | 5 ++++- dist/pixi-tilemap.umd.js.map | 2 +- dist/pixi-tilemap.umd.min.js | 4 ++-- lib/pixi-tilemap.es.js | 2 +- rollup.config.js | 10 ++++++++-- 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/dist/pixi-tilemap.js b/dist/pixi-tilemap.js index 777bf3f1..fe77e253 100644 --- a/dist/pixi-tilemap.js +++ b/dist/pixi-tilemap.js @@ -2,7 +2,7 @@ /*! * pixi-tilemap - v2.0.6 - * Compiled Fri, 14 Aug 2020 18:21:51 UTC + * Compiled Fri, 14 Aug 2020 18:27:09 UTC * * pixi-tilemap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license diff --git a/dist/pixi-tilemap.umd.js b/dist/pixi-tilemap.umd.js index 13fca8ca..aa469c8d 100644 --- a/dist/pixi-tilemap.umd.js +++ b/dist/pixi-tilemap.umd.js @@ -2,7 +2,7 @@ /*! * pixi-tilemap - v2.0.6 - * Compiled Fri, 14 Aug 2020 18:21:51 UTC + * Compiled Fri, 14 Aug 2020 18:27:09 UTC * * pixi-tilemap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -969,4 +969,7 @@ var pixi_tilemap = (function (exports, display, core, constants, math, graphics, return exports; }({}, PIXI, PIXI, PIXI, PIXI, PIXI, PIXI)); + +PIXI.tilemap = PIXI.tilemap || {}; +Object.assign(PIXI.tilemap, _pixi_tilemap) //# sourceMappingURL=pixi-tilemap.umd.js.map diff --git a/dist/pixi-tilemap.umd.js.map b/dist/pixi-tilemap.umd.js.map index a8eeca56..ab11509b 100644 --- a/dist/pixi-tilemap.umd.js.map +++ b/dist/pixi-tilemap.umd.js.map @@ -1 +1 @@ -{"version":3,"file":"pixi-tilemap.umd.js","sources":["../src/CanvasTileRenderer.ts","../node_modules/tslib/tslib.es6.js","../src/Constant.ts","../src/RectTileLayer.ts","../src/CompositeRectTileLayer.ts","../src/GraphicsLayer.ts","../src/MultiTextureResource.ts","../src/shaderGenerator.ts","../src/RectTileShader.ts","../src/TileRenderer.ts","../src/ZLayer.ts","../src/exporter.ts","../src/index.ts"],"sourcesContent":["/// \n\nimport { Renderer } from '@pixi/core';\n\nexport class CanvasTileRenderer {\n renderer: Renderer;\n tileAnim = [0, 0];\n dontUseTransform = false;\n\n constructor(renderer: Renderer) {\n this.renderer = renderer;\n this.tileAnim = [0, 0];\n }\n}\n\nconst cr = (PIXI as any).CanvasRenderer;\n\nif (cr) {\n cr.registerPlugin('tilemap', CanvasTileRenderer);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","export const Constant = {\n maxTextures: 16,\n bufferSize: 2048,\n boundSize: 1024,\n boundCountPerBuffer: 1,\n use32bitIndex: false,\n SCALE_MODE: PIXI.SCALE_MODES.LINEAR,\n DO_CLEAR: true\n};","/// \n\nimport { Container } from '@pixi/display';\nimport { Constant } from './Constant';\nimport { DRAW_MODES } from '@pixi/constants';\nimport { Texture, Renderer } from '@pixi/core';\nimport { TileRenderer } from './TileRenderer';\nimport { Matrix, groupD8 } from '@pixi/math';\n\nimport type { RectTileGeom } from './RectTileShader';\n\nexport const POINT_STRUCT_SIZE = 12;\n\nexport class RectTileLayer extends Container {\n constructor(zIndex: number, texture: Texture | Array) {\n super();\n this.initialize(zIndex, texture);\n }\n\n zIndex = 0;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n\n pointsBuf: Array = [];\n hasAnim = false;\n textures: Array;\n\n offsetX = 0;\n offsetY = 0;\n compositeParent = false;\n\n initialize(zIndex: number, textures: Texture | Array) {\n if (!textures) {\n textures = [];\n } else if (!(textures instanceof Array) && (textures as Texture).baseTexture) {\n textures = [textures as Texture];\n }\n this.textures = textures as Array;\n this.zIndex = zIndex;\n // this.visible = false;\n }\n\n clear() {\n this.pointsBuf.length = 0;\n this.modificationMarker = 0;\n this.hasAnim = false;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX: number, animY: number) {\n let texture: Texture;\n let textureIndex = 0;\n\n if (typeof texture_ === \"number\") {\n textureIndex = texture_;\n texture = this.textures[textureIndex];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n let found = false;\n let textureList = this.textures;\n for (let i = 0; i < textureList.length; i++) {\n if (textureList[i].baseTexture === texture.baseTexture) {\n textureIndex = i;\n found = true;\n break;\n }\n }\n\n if (!found) {\n // textureIndex = this.textures.length;\n // this.textures.push(texture);\n return false;\n }\n }\n\n this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate);\n return true;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number,\n animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this {\n let pb = this.pointsBuf;\n this.hasAnim = this.hasAnim || animX > 0 || animY > 0;\n pb.push(u);\n pb.push(v);\n pb.push(x);\n pb.push(y);\n pb.push(tileWidth);\n pb.push(tileHeight);\n pb.push(rotate);\n pb.push(animX | 0);\n pb.push(animY | 0);\n pb.push(textureIndex);\n pb.push(animCountX);\n pb.push(animCountY);\n\n return this;\n }\n\n tileRotate(rotate: number) {\n const pb = this.pointsBuf;\n pb[pb.length - 3] = rotate;\n }\n\n tileAnimX(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 5] = offset;\n pb[pb.length - 2] = count;\n }\n\n tileAnimY(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 4] = offset;\n pb[pb.length - 1] = count;\n }\n\n renderCanvas(renderer: any) {\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n this.renderCanvasCore(renderer);\n }\n\n renderCanvasCore(renderer: any) {\n if (this.textures.length === 0) return;\n let points = this.pointsBuf;\n renderer.context.fillStyle = '#000000';\n for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) {\n let x1 = points[i], y1 = points[i + 1];\n let x2 = points[i + 2], y2 = points[i + 3];\n let w = points[i + 4];\n let h = points[i + 5];\n var rotate = points[i + 6];\n x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0];\n y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1];\n let textureIndex = points[i + 9];\n // canvas does not work with rotate yet\n if (textureIndex >= 0) {\n renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h);\n } else {\n renderer.context.globalAlpha = 0.5;\n renderer.context.fillRect(x2, y2, w, h);\n renderer.context.globalAlpha = 1;\n }\n }\n }\n\n vbId = 0;\n vb: RectTileGeom = null;\n vbBuffer: ArrayBuffer = null;\n vbArray: Float32Array = null;\n vbInts: Uint32Array = null;\n\n destroyVb() {\n if (this.vb) {\n this.vb.destroy();\n this.vb = null;\n }\n }\n\n render(renderer: Renderer) {\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n this.renderWebGLCore(renderer, plugin);\n }\n\n renderWebGLCore(renderer: Renderer, plugin: TileRenderer) {\n let points = this.pointsBuf;\n if (points.length === 0) return;\n let rectsCount = points.length / POINT_STRUCT_SIZE;\n\n let shader = plugin.getShader();\n let textures = this.textures;\n if (textures.length === 0) return;\n\n plugin.bindTextures(renderer, shader, textures);\n renderer.shader.bind(shader, false);\n\n //lost context! recover!\n let vb = this.vb;\n if (!vb) {\n vb = plugin.createVb();\n this.vb = vb;\n this.vbId = (vb as any).id;\n this.vbBuffer = null;\n this.modificationMarker = 0;\n }\n\n plugin.checkIndexBuffer(rectsCount, vb);\n const boundCountPerBuffer = Constant.boundCountPerBuffer;\n\n let vertexBuf = vb.getBuffer('aVertexPosition');\n //if layer was changed, re-upload vertices\n let vertices = rectsCount * vb.vertPerQuad;\n if (vertices === 0) return;\n if (this.modificationMarker !== vertices) {\n this.modificationMarker = vertices;\n let vs = vb.stride * vertices;\n if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {\n //!@#$ happens, need resize\n let bk = vb.stride;\n while (bk < vs) {\n bk *= 2;\n }\n this.vbBuffer = new ArrayBuffer(bk);\n this.vbArray = new Float32Array(this.vbBuffer);\n this.vbInts = new Uint32Array(this.vbBuffer);\n vertexBuf.update(this.vbBuffer);\n }\n\n let arr = this.vbArray, ints = this.vbInts;\n //upload vertices!\n let sz = 0;\n //let tint = 0xffffffff;\n let textureId: number = 0;\n let shiftU: number = this.offsetX;\n let shiftV: number = this.offsetY;\n\n //let tint = 0xffffffff;\n let tint = -1;\n for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) {\n let eps = 0.5;\n if (this.compositeParent) {\n if (boundCountPerBuffer > 1) {\n //TODO: what if its more than 4?\n textureId = (points[i + 9] >> 2);\n shiftU = this.offsetX * (points[i + 9] & 1);\n shiftV = this.offsetY * ((points[i + 9] >> 1) & 1);\n } else {\n textureId = points[i + 9];\n shiftU = 0;\n shiftV = 0;\n }\n }\n let x = points[i + 2], y = points[i + 3];\n let w = points[i + 4], h = points[i + 5];\n let u = points[i] + shiftU, v = points[i + 1] + shiftV;\n let rotate = points[i + 6];\n\n const animX = points[i + 7], animY = points[i + 8];\n const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024;\n const animXEncoded = animX + (animWidth * 2048);\n const animYEncoded = animY + (animHeight * 2048);\n\n let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number;\n if (rotate === 0) {\n u0 = u;\n v0 = v;\n u1 = u + w;\n v1 = v;\n u2 = u + w;\n v2 = v + h;\n u3 = u;\n v3 = v + h;\n } else {\n let w2 = w / 2;\n let h2 = h / 2;\n if (rotate % 4 !== 0) {\n w2 = h / 2;\n h2 = w / 2;\n }\n const cX = u + w2;\n const cY = v + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW);\n u0 = cX + (w2 * groupD8.uX(rotate));\n v0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n u1 = cX + (w2 * groupD8.uX(rotate));\n v1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u2 = cX + (w2 * groupD8.uX(rotate));\n v2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u3 = cX + (w2 * groupD8.uX(rotate));\n v3 = cY + (h2 * groupD8.uY(rotate));\n }\n\n arr[sz++] = x;\n arr[sz++] = y;\n arr[sz++] = u0;\n arr[sz++] = v0;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y;\n arr[sz++] = u1;\n arr[sz++] = v1;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y + h;\n arr[sz++] = u2;\n arr[sz++] = v2;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x;\n arr[sz++] = y + h;\n arr[sz++] = u3;\n arr[sz++] = v3;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n }\n\n vertexBuf.update(arr);\n }\n\n (renderer.geometry as any).bind(vb, shader);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES, rectsCount * 6, 0);\n }\n\n isModified(anim: boolean) {\n if (this.modificationMarker !== this.pointsBuf.length ||\n anim && this.hasAnim) {\n return true;\n }\n return false;\n }\n\n clearModify() {\n this.modificationMarker = this.pointsBuf.length;\n }\n\n destroy(options?: any) {\n super.destroy(options);\n this.destroyVb();\n }\n}\n","/// \n\nimport { Container } from '@pixi/display';\nimport { Texture, Renderer } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { Constant } from './Constant';\nimport { RectTileLayer } from './RectTileLayer';\n\nexport class CompositeRectTileLayer extends Container {\n constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n super();\n this.initialize.apply(this, arguments);\n }\n\n updateTransform() {\n (this as any).displayObjectUpdateTransform();\n }\n\n z: number;\n zIndex: number;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n _lastLayer: RectTileLayer = null;\n\n texPerChild: number;\n\n initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n if (texPerChild as any === true) {\n //old format, ignore it!\n texPerChild = 0;\n }\n this.z = this.zIndex = zIndex;\n this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures;\n if (bitmaps) {\n this.setBitmaps(bitmaps);\n }\n }\n\n setBitmaps(bitmaps: Array) {\n for (let i=0;i 5.2.1, it does not exist there.`);\n }\n }\n let texPerChild = this.texPerChild;\n let len1 = this.children.length;\n let len2 = Math.ceil(bitmaps.length / texPerChild);\n let i: number;\n for (i = 0; i < len1; i++) {\n (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);\n }\n for (i = len1; i < len2; i++) {\n let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild));\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n this.addChild(layer);\n }\n }\n\n clear() {\n for (let i = 0; i < this.children.length; i++) {\n (this.children[i] as RectTileLayer).clear();\n }\n this.modificationMarker = 0;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this {\n const childIndex: number = textureIndex / this.texPerChild >> 0;\n const textureId: number = textureIndex % this.texPerChild;\n\n if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) {\n this._lastLayer = (this.children[childIndex] as RectTileLayer);\n this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight);\n } else {\n this._lastLayer = null;\n }\n\n return this;\n }\n\n tileRotate(rotate: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileRotate(rotate);\n }\n return this;\n }\n\n tileAnimX(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimX(offset, count);\n }\n return this;\n }\n\n tileAnimY(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimY(offset, count);\n }\n return this;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this {\n let texture: Texture;\n let layer: RectTileLayer = null;\n let ind: number = 0;\n let children = this.children;\n\n this._lastLayer = null;\n if (typeof texture_ === \"number\") {\n let childIndex = texture_ / this.texPerChild >> 0;\n layer = children[childIndex] as RectTileLayer;\n\n if (!layer) {\n layer = children[0] as RectTileLayer;\n if (!layer) {\n return this;\n }\n ind = 0;\n } else {\n ind = texture_ % this.texPerChild;\n }\n\n texture = layer.textures[ind];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n let tex = child.textures;\n for (let j = 0; j < tex.length; j++) {\n if (tex[j].baseTexture === texture.baseTexture) {\n layer = child;\n ind = j;\n break;\n }\n }\n if (layer) {\n break;\n }\n }\n\n if (!layer) {\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n if (child.textures.length < this.texPerChild) {\n layer = child;\n ind = child.textures.length;\n child.textures.push(texture);\n break;\n }\n }\n if (!layer) {\n layer = new RectTileLayer(this.zIndex, texture);\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n children.push(layer);\n ind = 0;\n }\n }\n }\n\n this._lastLayer = layer;\n layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight);\n return this;\n }\n\n renderCanvas(renderer: any) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderCanvasCore(renderer);\n }\n }\n\n render(renderer: Renderer) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n //TODO: dont create new array, please\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n renderer.shader.bind(shader, false);\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin);\n }\n }\n\n isModified(anim: boolean) {\n let layers = this.children;\n if (this.modificationMarker !== layers.length) {\n return true;\n }\n for (let i = 0; i < layers.length; i++) {\n if ((layers[i] as RectTileLayer).isModified(anim)) {\n return true;\n }\n }\n return false;\n }\n\n clearModify() {\n let layers = this.children;\n this.modificationMarker = layers.length;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).clearModify();\n }\n }\n}","/// \n\nimport { Matrix } from '@pixi/math';\nimport { Graphics } from '@pixi/graphics';\n\nexport class GraphicsLayer extends Graphics {\n constructor(zIndex: number) {\n super();\n this.zIndex = zIndex;\n }\n\n renderCanvas(renderer: any) {\n let wt: Matrix = null;\n if (renderer.plugins.tilemap.dontUseTransform) {\n wt = this.transform.worldTransform;\n this.transform.worldTransform = Matrix.IDENTITY;\n }\n renderer.plugins.graphics.render(this);\n if (renderer.plugins.tilemap.dontUseTransform) {\n this.transform.worldTransform = wt;\n }\n renderer.context.globalAlpha = 1.0;\n }\n\n // renderWebGL(renderer: PIXI.Renderer) {\n // if (!this._webGL[renderer.CONTEXT_UID])\n // this.dirty++;\n // super.renderWebGL(renderer)\n // }\n\n isModified(anim: boolean): boolean {\n return false;\n }\n\n clearModify() {\n }\n}\n","/// \n\nimport { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, Renderer, Texture, GLTexture, resources } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Constant } from './Constant';\n\nexport interface IMultiTextureOptions {\n\tboundCountPerBuffer: number;\n\tboundSize: number;\n\tbufferSize: number;\n\tDO_CLEAR?: boolean;\n}\n\nexport class MultiTextureResource extends resources.Resource {\n\tconstructor(options: IMultiTextureOptions) {\n\t\tsuper(options.bufferSize, options.bufferSize);\n\n\t\tconst bounds = this.boundSprites;\n\t\tconst dirties = this.dirties;\n\t\tthis.boundSize = options.boundSize;\n\t\tfor (let j = 0; j < options.boundCountPerBuffer; j++) {\n\t\t\tconst spr = new Sprite();\n\t\t\tspr.position.x = options.boundSize * (j & 1);\n\t\t\tspr.position.y = options.boundSize * (j >> 1);\n\t\t\tbounds.push(spr);\n\t\t\tdirties.push(0);\n\t\t}\n\t\tthis.DO_CLEAR = !!options.DO_CLEAR;\n\t}\n\n\tDO_CLEAR = false;\n\tboundSize: number = 0;\n\t_clearBuffer: Uint8Array = null;\n\n\tbind(baseTexture: BaseTexture) {\n\t\tif (this.baseTex) {\n\t\t\tthrow new Error('Only one baseTexture is allowed for this resource!')\n\t\t}\n\t\tthis.baseTex = baseTexture;\n\t\tsuper.bind(baseTexture);\n\t}\n\n\tbaseTex: BaseTexture = null;\n\tboundSprites: Array = [];\n\tdirties: Array = [];\n\n\tsetTexture(ind: number, texture: Texture) {\n\t\tconst spr = this.boundSprites[ind];\n\t\tif (spr.texture.baseTexture === texture.baseTexture) {\n\t\t\treturn;\n\t\t}\n\t\tspr.texture = texture;\n\t\tthis.baseTex.update();\n\t\tthis.dirties[ind] = (this.baseTex as any).dirtyId;\n\t}\n\n\tupload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture) {\n\t\tconst { gl } = renderer as any;\n\n\t\tconst {width, height} = this;\n\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined ||\n\t\t\ttexture.alphaMode === ALPHA_MODES.UNPACK);\n\n\t\tif (glTexture.dirtyId < 0) {\n\t\t\t(glTexture as any).width = width;\n\t\t\t(glTexture as any).height = height;\n\n\t\t\tgl.texImage2D(texture.target, 0,\n\t\t\t\ttexture.format,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\t0,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tnull);\n\t\t}\n\n\t\tconst doClear = this.DO_CLEAR;\n\t\tif (doClear && !this._clearBuffer) {\n\t\t\tthis._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4);\n\t\t}\n\n\t\tconst bounds = this.boundSprites;\n\t\tfor (let i = 0; i < bounds.length; i++) {\n\t\t\tconst spr = bounds[i];\n\t\t\tconst tex = spr.texture.baseTexture;\n\t\t\tif (glTexture.dirtyId >= this.dirties[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst res = tex.resource as any;\n\t\t\tif (!tex.valid || !res || !res.source) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (doClear && (tex.width < this.boundSize || tex.height < this.boundSize))\n\t\t\t{\n\t\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\t\tspr.position.x,\n\t\t\t\t\tspr.position.y,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\ttexture.format,\n\t\t\t\t\ttexture.type,\n\t\t\t\t\tthis._clearBuffer);\n\t\t\t}\n\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\tspr.position.x,\n\t\t\t\tspr.position.y,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tres.source);\n\t\t}\n\n\t\treturn true;\n\t}\n}\n","import { Constant } from './Constant';\n\nimport type { TilemapShader } from './RectTileShader';\n\n\nexport function fillSamplers(shader: TilemapShader, maxTextures: number) {\n let sampleValues: Array = [];\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n shader.uniforms.uSamplers = sampleValues;\n\n let samplerSize: Array = [];\n for (let i = 0; i < maxTextures; i++) {\n samplerSize.push(1.0 / Constant.bufferSize);\n samplerSize.push(1.0 / Constant.bufferSize);\n }\n shader.uniforms.uSamplerSize = samplerSize;\n}\n\nexport function generateFragmentSrc(maxTextures: number, fragmentSrc: string) {\n return fragmentSrc.replace(/%count%/gi, maxTextures + \"\")\n .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n}\n\nexport function generateSampleSrc(maxTextures: number) {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n src += 'if(vTextureId <= -1.0) {';\n src += '\\n\\tcolor = shadowColor;';\n src += '\\n}';\n\n for (let i = 0; i < maxTextures; i++)\n {\n src += '\\nelse ';\n\n if(i < maxTextures-1)\n {\n src += 'if(textureId == ' + i + '.0)';\n }\n\n src += '\\n{';\n src += '\\n\\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);';\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n}\n","/// \n\nimport * as shaderGenerator from './shaderGenerator';\n\nimport { Buffer, Geometry, Shader } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nlet rectShaderFrag = `\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n`;\nlet rectShaderVert = `\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n`;\n\nexport abstract class TilemapShader extends Shader {\n\tmaxTextures = 0;\n\n\tconstructor(maxTextures: number, shaderVert: string, shaderFrag: string) {\n\t\tsuper(\n\t\t\tnew PIXI.Program(\n\t\t\t\tshaderVert,\n\t\t\t\tshaderFrag),\n\t\t\t{\n\t\t\t\tanimationFrame: new Float32Array(2),\n\t\t\t\tuSamplers: [],\n\t\t\t\tuSamplerSize: [],\n\t\t\t\tprojTransMatrix: new Matrix()\n\t\t\t}\n\t\t);\n\t\tthis.maxTextures = maxTextures;\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileShader extends TilemapShader {\n\tconstructor(maxTextures: number) {\n\t\tsuper(\n\t\t\tmaxTextures,\n\t\t\trectShaderVert,\n\t\t\tshaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)\n\t\t);\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileGeom extends Geometry {\n\tvertSize = 11;\n\tvertPerQuad = 4;\n\tstride = this.vertSize * 4;\n\tlastTimeAccess = 0;\n\n\tconstructor() {\n\t\tsuper();\n\t\tconst buf = this.buf = new Buffer(new Float32Array(2), true, false);\n\t\tthis.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0)\n\t\t\t.addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4)\n\t\t\t.addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4)\n\t\t\t.addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4)\n\t\t\t.addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4);\n\t}\n\n\tbuf: PIXI.Buffer;\n}","import { WRAP_MODES } from '@pixi/constants';\nimport { BaseTexture, Buffer, resources, ObjectRenderer, Texture, Renderer } from '@pixi/core';\nimport { Constant } from './Constant';\nimport { RectTileGeom, RectTileShader } from './RectTileShader';\nimport { MultiTextureResource } from './MultiTextureResource';\n\nimport type { TilemapShader } from './RectTileShader';\n\n/**\n * Renderer for rectangle tiles.\n */\nexport class TileRenderer extends ObjectRenderer {\n\trenderer: Renderer;\n\tgl: WebGLRenderingContext;\n\tsn: number = -1;\n\tindexBuffer: PIXI.Buffer = null;\n\tibLen: number = 0;\n\ttileAnim = [0, 0];\n\ttexLoc: Array = [];\n\n\trectShader: RectTileShader;\n\ttexResources: Array = [];\n\n\tconstructor(renderer: Renderer) {\n\t\tsuper(renderer);\n\t\tthis.rectShader = new RectTileShader(Constant.maxTextures);\n\t\tthis.indexBuffer = new Buffer(undefined, true, true);\n\t\tthis.checkIndexBuffer(2000);\n\t\tthis.initBounds();\n\t}\n\n\tinitBounds() {\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tfor (let i = 0; i < maxTextures; i++) {\n\t\t\tconst resource = new MultiTextureResource(Constant);\n\t\t\tconst baseTex = new BaseTexture(resource);\n\t\t\tbaseTex.scaleMode = Constant.SCALE_MODE;\n\t\t\tbaseTex.wrapMode = WRAP_MODES.CLAMP;\n\t\t\tthis.texResources.push(resource);\n\t\t}\n\t}\n\n\tbindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tlet samplerSize: Array = (shader as any).uniforms.uSamplerSize;\n\t\tthis.texLoc.length = 0;\n\t\tfor (let i = 0; i < textures.length; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trenderer.texture.bind(textures[i], i);\n\t\t\t//TODO: add resolution here\n\t\t\tsamplerSize[i * 2] = 1.0 / textures[i].baseTexture.width;\n\t\t\tsamplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height;\n\t\t}\n\t\t(shader as any).uniforms.uSamplerSize = samplerSize;\n\t}\n\n\tbindTextures(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tconst len = textures.length;\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tif (len > Constant.boundCountPerBuffer * maxTextures) {\n\t\t\treturn;\n\t\t}\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\tthis.bindTexturesWithoutRT(renderer, shader, textures);\n\t\t\treturn;\n\t\t}\n\n\t\tlet i = 0;\n\t\tfor (; i < len; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) continue;\n\t\t\tconst multi = this.texResources[i >> 2];\n\t\t\tmulti.setTexture(i & 3, texture);\n\t\t}\n\n\t\tlet gltsUsed = (i + 3) >> 2;\n\t\tfor (i = 0; i < gltsUsed; i++) {\n\t\t\t//remove \"i, true\" after resolving a bug\n\t\t\trenderer.texture.bind(this.texResources[i].baseTex, i);\n\t\t}\n\t}\n\n\tstart() {\n\t\t//sorry, nothing\n\t}\n\n\tcreateVb() {\n\t\tconst geom = new RectTileGeom();\n\t\tgeom.addIndex(this.indexBuffer);\n\t\tgeom.lastTimeAccess = Date.now();\n\t\treturn geom;\n\t}\n\n\tcheckIndexBuffer(size: number, vb: RectTileGeom = null) {\n\t\tconst totalIndices = size * 6;\n\n\t\tif (totalIndices <= this.ibLen) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet len = totalIndices;\n\t\twhile (len < totalIndices) {\n\t\t\tlen <<= 1;\n\t\t}\n\n\t\tthis.ibLen = totalIndices;\n\t\tthis.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size,\n\t\t\tConstant.use32bitIndex ? new Uint32Array(size * 6) : undefined));\n\n\t\t// \tTODO: create new index buffer instead?\n\t\t// if (vb) {\n\t\t// \tconst curIndex = vb.getIndex();\n\t\t// \tif (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) {\n\t\t// \t\tthis.swapIndex(vb, this.indexBuffer);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t// swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) {\n\t\t// let buffers = (geom as any).buffers;\n\t\t// const oldIndex = geom.getIndex();\n\t\t// let ind = buffers.indexOf(oldIndex);\n\t\t// if (ind >= 0) {\n\t\t// \tbuffers.splice(ind, 1);\n\t\t// }\n\t\t// geom.addIndex(indexBuf);\n\t// }\n\n\tgetShader(): TilemapShader {\n\t\treturn this.rectShader;\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\t// this.rectShader.destroy();\n\t\tthis.rectShader = null;\n\t}\n}\n\nRenderer.registerPlugin('tilemap', TileRenderer as any);\n","/// \n\nimport { Container } from '@pixi/display';\n\nimport type { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport type { Matrix } from '@pixi/math';\n\nexport class ZLayer extends Container {\n\n constructor(tilemap: Container, zIndex: number) {\n super();\n this.tilemap = tilemap;\n this.z = zIndex;\n }\n\n tilemap: any;\n z: number;\n zIndex: number;\n _previousLayers: number;\n canvasBuffer: HTMLCanvasElement;\n _tempRender: any;\n _lastAnimationFrame: number = -1;\n layerTransform: Matrix;\n\n clear() {\n let layers = this.children as Array;\n for (let i = 0; i < layers.length; i++)\n layers[i].clear();\n this._previousLayers = 0;\n }\n\n cacheIfDirty() {\n let tilemap: any = this.tilemap;\n let layers = this.children as Array;\n let modified = this._previousLayers !== layers.length;\n this._previousLayers = layers.length;\n let buf = this.canvasBuffer;\n let tempRender = this._tempRender;\n if (!buf) {\n buf = this.canvasBuffer = document.createElement('canvas');\n tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf});\n tempRender.context = tempRender.rootContext;\n tempRender.plugins.tilemap.dontUseTransform = true;\n }\n if (buf.width !== tilemap._layerWidth ||\n buf.height !== tilemap._layerHeight) {\n buf.width = tilemap._layerWidth;\n buf.height = tilemap._layerHeight;\n modified = true;\n }\n let i: number;\n if (!modified) {\n for (i = 0; i < layers.length; i++) {\n if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) {\n modified = true;\n break;\n }\n }\n }\n this._lastAnimationFrame = tilemap.animationFrame;\n if (modified) {\n if (tilemap._hackRenderer) {\n tilemap._hackRenderer(tempRender);\n }\n tempRender.context.clearRect(0, 0, buf.width, buf.height);\n for (i = 0; i < layers.length; i++) {\n layers[i].clearModify();\n layers[i].renderCanvas(tempRender);\n }\n }\n this.layerTransform = this.worldTransform;\n for (i = 0; i < layers.length; i++) {\n this.layerTransform = layers[i].worldTransform;\n break;\n }\n }\n\n renderCanvas(renderer: any) {\n this.cacheIfDirty();\n let wt = this.layerTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n let tilemap = this.tilemap;\n renderer.context.drawImage(this.canvasBuffer, 0, 0);\n }\n}\n","/// \n\nnamespace pixi_tilemap {\n (PIXI as any).tilemap = pixi_tilemap;\n}\n\n// This makes exporter.ts a module!\nexport default {}\n","import { CanvasTileRenderer } from './CanvasTileRenderer';\nimport { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport { Constant } from './Constant';\nimport { GraphicsLayer } from './GraphicsLayer';\nimport { MultiTextureResource } from './MultiTextureResource';\nimport { RectTileLayer } from './RectTileLayer';\nimport { TilemapShader, RectTileShader, RectTileGeom } from './RectTileShader';\nimport { TileRenderer } from './TileRenderer';\nimport { ZLayer } from './ZLayer';\n\nexport const pixi_tilemap = {\n CanvasTileRenderer,\n CompositeRectTileLayer,\n Constant,\n GraphicsLayer,\n MultiTextureResource,\n RectTileLayer,\n TilemapShader,\n RectTileShader,\n RectTileGeom,\n TileRenderer,\n ZLayer,\n};\n\nexport * from './CanvasTileRenderer';\nexport * from './CompositeRectTileLayer';\nexport * from './Constant';\nexport * from './exporter';\nexport * from './GraphicsLayer';\nexport * from './MultiTextureResource';\nexport * from './RectTileLayer';\nexport * from './RectTileShader';\nexport * from './shaderGenerator';\nexport * from './TileRenderer';\nexport * from './ZLayer';"],"names":["Texture","groupD8","DRAW_MODES","Container","Matrix","Graphics","Sprite","ALPHA_MODES","resources","shaderGenerator.fillSamplers","Shader","shaderGenerator.generateFragmentSrc","Buffer","Geometry","BaseTexture","WRAP_MODES","ObjectRenderer","Renderer","pixi_tilemap"],"mappings":";;;;;;;;;;;;;;;QASI,4BAAY,QAAkB;YAH9B,aAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAClB,qBAAgB,GAAG,KAAK,CAAC;YAGrB,IAAI,CAAC,QAAQ,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E,CAAC,CAAC,EACJ,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,UAAU,EAC3B,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,UAAU,CAC9B,CAAC;YACF,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;YAC3B,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;SACvD;QACL,aAAC;IAAD,CApFA,CAA4Bd,iBAAS;;ICLrC,IAAU,YAAY,CAErB;IAFD,WAAU,YAAY;QACjB,IAAY,CAAC,OAAO,GAAG,YAAY,CAAC;IACzC,CAAC,EAFS,YAAY,KAAZ,YAAY;;QCQTe,cAAY,GAAG;QACxB,kBAAkB,oBAAA;QAClB,sBAAsB,wBAAA;QACtB,QAAQ,UAAA;QACR,aAAa,eAAA;QACb,oBAAoB,sBAAA;QACpB,aAAa,eAAA;QACb,aAAa,eAAA;QACb,cAAc,gBAAA;QACd,YAAY,cAAA;QACZ,YAAY,cAAA;QACZ,MAAM,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"pixi-tilemap.umd.js","sources":["../src/CanvasTileRenderer.ts","../node_modules/tslib/tslib.es6.js","../src/Constant.ts","../src/RectTileLayer.ts","../src/CompositeRectTileLayer.ts","../src/GraphicsLayer.ts","../src/MultiTextureResource.ts","../src/shaderGenerator.ts","../src/RectTileShader.ts","../src/TileRenderer.ts","../src/ZLayer.ts","../src/exporter.ts","../src/index.ts"],"sourcesContent":["/// \n\nimport { Renderer } from '@pixi/core';\n\nexport class CanvasTileRenderer {\n renderer: Renderer;\n tileAnim = [0, 0];\n dontUseTransform = false;\n\n constructor(renderer: Renderer) {\n this.renderer = renderer;\n this.tileAnim = [0, 0];\n }\n}\n\nconst cr = (PIXI as any).CanvasRenderer;\n\nif (cr) {\n cr.registerPlugin('tilemap', CanvasTileRenderer);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","export const Constant = {\n maxTextures: 16,\n bufferSize: 2048,\n boundSize: 1024,\n boundCountPerBuffer: 1,\n use32bitIndex: false,\n SCALE_MODE: PIXI.SCALE_MODES.LINEAR,\n DO_CLEAR: true\n};","/// \n\nimport { Container } from '@pixi/display';\nimport { Constant } from './Constant';\nimport { DRAW_MODES } from '@pixi/constants';\nimport { Texture, Renderer } from '@pixi/core';\nimport { TileRenderer } from './TileRenderer';\nimport { Matrix, groupD8 } from '@pixi/math';\n\nimport type { RectTileGeom } from './RectTileShader';\n\nexport const POINT_STRUCT_SIZE = 12;\n\nexport class RectTileLayer extends Container {\n constructor(zIndex: number, texture: Texture | Array) {\n super();\n this.initialize(zIndex, texture);\n }\n\n zIndex = 0;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n\n pointsBuf: Array = [];\n hasAnim = false;\n textures: Array;\n\n offsetX = 0;\n offsetY = 0;\n compositeParent = false;\n\n initialize(zIndex: number, textures: Texture | Array) {\n if (!textures) {\n textures = [];\n } else if (!(textures instanceof Array) && (textures as Texture).baseTexture) {\n textures = [textures as Texture];\n }\n this.textures = textures as Array;\n this.zIndex = zIndex;\n // this.visible = false;\n }\n\n clear() {\n this.pointsBuf.length = 0;\n this.modificationMarker = 0;\n this.hasAnim = false;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX: number, animY: number) {\n let texture: Texture;\n let textureIndex = 0;\n\n if (typeof texture_ === \"number\") {\n textureIndex = texture_;\n texture = this.textures[textureIndex];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n let found = false;\n let textureList = this.textures;\n for (let i = 0; i < textureList.length; i++) {\n if (textureList[i].baseTexture === texture.baseTexture) {\n textureIndex = i;\n found = true;\n break;\n }\n }\n\n if (!found) {\n // textureIndex = this.textures.length;\n // this.textures.push(texture);\n return false;\n }\n }\n\n this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate);\n return true;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number,\n animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this {\n let pb = this.pointsBuf;\n this.hasAnim = this.hasAnim || animX > 0 || animY > 0;\n pb.push(u);\n pb.push(v);\n pb.push(x);\n pb.push(y);\n pb.push(tileWidth);\n pb.push(tileHeight);\n pb.push(rotate);\n pb.push(animX | 0);\n pb.push(animY | 0);\n pb.push(textureIndex);\n pb.push(animCountX);\n pb.push(animCountY);\n\n return this;\n }\n\n tileRotate(rotate: number) {\n const pb = this.pointsBuf;\n pb[pb.length - 3] = rotate;\n }\n\n tileAnimX(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 5] = offset;\n pb[pb.length - 2] = count;\n }\n\n tileAnimY(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 4] = offset;\n pb[pb.length - 1] = count;\n }\n\n renderCanvas(renderer: any) {\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n this.renderCanvasCore(renderer);\n }\n\n renderCanvasCore(renderer: any) {\n if (this.textures.length === 0) return;\n let points = this.pointsBuf;\n renderer.context.fillStyle = '#000000';\n for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) {\n let x1 = points[i], y1 = points[i + 1];\n let x2 = points[i + 2], y2 = points[i + 3];\n let w = points[i + 4];\n let h = points[i + 5];\n var rotate = points[i + 6];\n x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0];\n y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1];\n let textureIndex = points[i + 9];\n // canvas does not work with rotate yet\n if (textureIndex >= 0) {\n renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h);\n } else {\n renderer.context.globalAlpha = 0.5;\n renderer.context.fillRect(x2, y2, w, h);\n renderer.context.globalAlpha = 1;\n }\n }\n }\n\n vbId = 0;\n vb: RectTileGeom = null;\n vbBuffer: ArrayBuffer = null;\n vbArray: Float32Array = null;\n vbInts: Uint32Array = null;\n\n destroyVb() {\n if (this.vb) {\n this.vb.destroy();\n this.vb = null;\n }\n }\n\n render(renderer: Renderer) {\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n this.renderWebGLCore(renderer, plugin);\n }\n\n renderWebGLCore(renderer: Renderer, plugin: TileRenderer) {\n let points = this.pointsBuf;\n if (points.length === 0) return;\n let rectsCount = points.length / POINT_STRUCT_SIZE;\n\n let shader = plugin.getShader();\n let textures = this.textures;\n if (textures.length === 0) return;\n\n plugin.bindTextures(renderer, shader, textures);\n renderer.shader.bind(shader, false);\n\n //lost context! recover!\n let vb = this.vb;\n if (!vb) {\n vb = plugin.createVb();\n this.vb = vb;\n this.vbId = (vb as any).id;\n this.vbBuffer = null;\n this.modificationMarker = 0;\n }\n\n plugin.checkIndexBuffer(rectsCount, vb);\n const boundCountPerBuffer = Constant.boundCountPerBuffer;\n\n let vertexBuf = vb.getBuffer('aVertexPosition');\n //if layer was changed, re-upload vertices\n let vertices = rectsCount * vb.vertPerQuad;\n if (vertices === 0) return;\n if (this.modificationMarker !== vertices) {\n this.modificationMarker = vertices;\n let vs = vb.stride * vertices;\n if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {\n //!@#$ happens, need resize\n let bk = vb.stride;\n while (bk < vs) {\n bk *= 2;\n }\n this.vbBuffer = new ArrayBuffer(bk);\n this.vbArray = new Float32Array(this.vbBuffer);\n this.vbInts = new Uint32Array(this.vbBuffer);\n vertexBuf.update(this.vbBuffer);\n }\n\n let arr = this.vbArray, ints = this.vbInts;\n //upload vertices!\n let sz = 0;\n //let tint = 0xffffffff;\n let textureId: number = 0;\n let shiftU: number = this.offsetX;\n let shiftV: number = this.offsetY;\n\n //let tint = 0xffffffff;\n let tint = -1;\n for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) {\n let eps = 0.5;\n if (this.compositeParent) {\n if (boundCountPerBuffer > 1) {\n //TODO: what if its more than 4?\n textureId = (points[i + 9] >> 2);\n shiftU = this.offsetX * (points[i + 9] & 1);\n shiftV = this.offsetY * ((points[i + 9] >> 1) & 1);\n } else {\n textureId = points[i + 9];\n shiftU = 0;\n shiftV = 0;\n }\n }\n let x = points[i + 2], y = points[i + 3];\n let w = points[i + 4], h = points[i + 5];\n let u = points[i] + shiftU, v = points[i + 1] + shiftV;\n let rotate = points[i + 6];\n\n const animX = points[i + 7], animY = points[i + 8];\n const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024;\n const animXEncoded = animX + (animWidth * 2048);\n const animYEncoded = animY + (animHeight * 2048);\n\n let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number;\n if (rotate === 0) {\n u0 = u;\n v0 = v;\n u1 = u + w;\n v1 = v;\n u2 = u + w;\n v2 = v + h;\n u3 = u;\n v3 = v + h;\n } else {\n let w2 = w / 2;\n let h2 = h / 2;\n if (rotate % 4 !== 0) {\n w2 = h / 2;\n h2 = w / 2;\n }\n const cX = u + w2;\n const cY = v + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW);\n u0 = cX + (w2 * groupD8.uX(rotate));\n v0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n u1 = cX + (w2 * groupD8.uX(rotate));\n v1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u2 = cX + (w2 * groupD8.uX(rotate));\n v2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u3 = cX + (w2 * groupD8.uX(rotate));\n v3 = cY + (h2 * groupD8.uY(rotate));\n }\n\n arr[sz++] = x;\n arr[sz++] = y;\n arr[sz++] = u0;\n arr[sz++] = v0;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y;\n arr[sz++] = u1;\n arr[sz++] = v1;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y + h;\n arr[sz++] = u2;\n arr[sz++] = v2;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x;\n arr[sz++] = y + h;\n arr[sz++] = u3;\n arr[sz++] = v3;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n }\n\n vertexBuf.update(arr);\n }\n\n (renderer.geometry as any).bind(vb, shader);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES, rectsCount * 6, 0);\n }\n\n isModified(anim: boolean) {\n if (this.modificationMarker !== this.pointsBuf.length ||\n anim && this.hasAnim) {\n return true;\n }\n return false;\n }\n\n clearModify() {\n this.modificationMarker = this.pointsBuf.length;\n }\n\n destroy(options?: any) {\n super.destroy(options);\n this.destroyVb();\n }\n}\n","/// \n\nimport { Container } from '@pixi/display';\nimport { Texture, Renderer } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { Constant } from './Constant';\nimport { RectTileLayer } from './RectTileLayer';\n\nexport class CompositeRectTileLayer extends Container {\n constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n super();\n this.initialize.apply(this, arguments);\n }\n\n updateTransform() {\n (this as any).displayObjectUpdateTransform();\n }\n\n z: number;\n zIndex: number;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n _lastLayer: RectTileLayer = null;\n\n texPerChild: number;\n\n initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n if (texPerChild as any === true) {\n //old format, ignore it!\n texPerChild = 0;\n }\n this.z = this.zIndex = zIndex;\n this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures;\n if (bitmaps) {\n this.setBitmaps(bitmaps);\n }\n }\n\n setBitmaps(bitmaps: Array) {\n for (let i=0;i 5.2.1, it does not exist there.`);\n }\n }\n let texPerChild = this.texPerChild;\n let len1 = this.children.length;\n let len2 = Math.ceil(bitmaps.length / texPerChild);\n let i: number;\n for (i = 0; i < len1; i++) {\n (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);\n }\n for (i = len1; i < len2; i++) {\n let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild));\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n this.addChild(layer);\n }\n }\n\n clear() {\n for (let i = 0; i < this.children.length; i++) {\n (this.children[i] as RectTileLayer).clear();\n }\n this.modificationMarker = 0;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this {\n const childIndex: number = textureIndex / this.texPerChild >> 0;\n const textureId: number = textureIndex % this.texPerChild;\n\n if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) {\n this._lastLayer = (this.children[childIndex] as RectTileLayer);\n this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight);\n } else {\n this._lastLayer = null;\n }\n\n return this;\n }\n\n tileRotate(rotate: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileRotate(rotate);\n }\n return this;\n }\n\n tileAnimX(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimX(offset, count);\n }\n return this;\n }\n\n tileAnimY(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimY(offset, count);\n }\n return this;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this {\n let texture: Texture;\n let layer: RectTileLayer = null;\n let ind: number = 0;\n let children = this.children;\n\n this._lastLayer = null;\n if (typeof texture_ === \"number\") {\n let childIndex = texture_ / this.texPerChild >> 0;\n layer = children[childIndex] as RectTileLayer;\n\n if (!layer) {\n layer = children[0] as RectTileLayer;\n if (!layer) {\n return this;\n }\n ind = 0;\n } else {\n ind = texture_ % this.texPerChild;\n }\n\n texture = layer.textures[ind];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n let tex = child.textures;\n for (let j = 0; j < tex.length; j++) {\n if (tex[j].baseTexture === texture.baseTexture) {\n layer = child;\n ind = j;\n break;\n }\n }\n if (layer) {\n break;\n }\n }\n\n if (!layer) {\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n if (child.textures.length < this.texPerChild) {\n layer = child;\n ind = child.textures.length;\n child.textures.push(texture);\n break;\n }\n }\n if (!layer) {\n layer = new RectTileLayer(this.zIndex, texture);\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n children.push(layer);\n ind = 0;\n }\n }\n }\n\n this._lastLayer = layer;\n layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight);\n return this;\n }\n\n renderCanvas(renderer: any) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderCanvasCore(renderer);\n }\n }\n\n render(renderer: Renderer) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n //TODO: dont create new array, please\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n renderer.shader.bind(shader, false);\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin);\n }\n }\n\n isModified(anim: boolean) {\n let layers = this.children;\n if (this.modificationMarker !== layers.length) {\n return true;\n }\n for (let i = 0; i < layers.length; i++) {\n if ((layers[i] as RectTileLayer).isModified(anim)) {\n return true;\n }\n }\n return false;\n }\n\n clearModify() {\n let layers = this.children;\n this.modificationMarker = layers.length;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).clearModify();\n }\n }\n}","/// \n\nimport { Matrix } from '@pixi/math';\nimport { Graphics } from '@pixi/graphics';\n\nexport class GraphicsLayer extends Graphics {\n constructor(zIndex: number) {\n super();\n this.zIndex = zIndex;\n }\n\n renderCanvas(renderer: any) {\n let wt: Matrix = null;\n if (renderer.plugins.tilemap.dontUseTransform) {\n wt = this.transform.worldTransform;\n this.transform.worldTransform = Matrix.IDENTITY;\n }\n renderer.plugins.graphics.render(this);\n if (renderer.plugins.tilemap.dontUseTransform) {\n this.transform.worldTransform = wt;\n }\n renderer.context.globalAlpha = 1.0;\n }\n\n // renderWebGL(renderer: PIXI.Renderer) {\n // if (!this._webGL[renderer.CONTEXT_UID])\n // this.dirty++;\n // super.renderWebGL(renderer)\n // }\n\n isModified(anim: boolean): boolean {\n return false;\n }\n\n clearModify() {\n }\n}\n","/// \n\nimport { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, Renderer, Texture, GLTexture, resources } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Constant } from './Constant';\n\nexport interface IMultiTextureOptions {\n\tboundCountPerBuffer: number;\n\tboundSize: number;\n\tbufferSize: number;\n\tDO_CLEAR?: boolean;\n}\n\nexport class MultiTextureResource extends resources.Resource {\n\tconstructor(options: IMultiTextureOptions) {\n\t\tsuper(options.bufferSize, options.bufferSize);\n\n\t\tconst bounds = this.boundSprites;\n\t\tconst dirties = this.dirties;\n\t\tthis.boundSize = options.boundSize;\n\t\tfor (let j = 0; j < options.boundCountPerBuffer; j++) {\n\t\t\tconst spr = new Sprite();\n\t\t\tspr.position.x = options.boundSize * (j & 1);\n\t\t\tspr.position.y = options.boundSize * (j >> 1);\n\t\t\tbounds.push(spr);\n\t\t\tdirties.push(0);\n\t\t}\n\t\tthis.DO_CLEAR = !!options.DO_CLEAR;\n\t}\n\n\tDO_CLEAR = false;\n\tboundSize: number = 0;\n\t_clearBuffer: Uint8Array = null;\n\n\tbind(baseTexture: BaseTexture) {\n\t\tif (this.baseTex) {\n\t\t\tthrow new Error('Only one baseTexture is allowed for this resource!')\n\t\t}\n\t\tthis.baseTex = baseTexture;\n\t\tsuper.bind(baseTexture);\n\t}\n\n\tbaseTex: BaseTexture = null;\n\tboundSprites: Array = [];\n\tdirties: Array = [];\n\n\tsetTexture(ind: number, texture: Texture) {\n\t\tconst spr = this.boundSprites[ind];\n\t\tif (spr.texture.baseTexture === texture.baseTexture) {\n\t\t\treturn;\n\t\t}\n\t\tspr.texture = texture;\n\t\tthis.baseTex.update();\n\t\tthis.dirties[ind] = (this.baseTex as any).dirtyId;\n\t}\n\n\tupload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture) {\n\t\tconst { gl } = renderer as any;\n\n\t\tconst {width, height} = this;\n\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined ||\n\t\t\ttexture.alphaMode === ALPHA_MODES.UNPACK);\n\n\t\tif (glTexture.dirtyId < 0) {\n\t\t\t(glTexture as any).width = width;\n\t\t\t(glTexture as any).height = height;\n\n\t\t\tgl.texImage2D(texture.target, 0,\n\t\t\t\ttexture.format,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\t0,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tnull);\n\t\t}\n\n\t\tconst doClear = this.DO_CLEAR;\n\t\tif (doClear && !this._clearBuffer) {\n\t\t\tthis._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4);\n\t\t}\n\n\t\tconst bounds = this.boundSprites;\n\t\tfor (let i = 0; i < bounds.length; i++) {\n\t\t\tconst spr = bounds[i];\n\t\t\tconst tex = spr.texture.baseTexture;\n\t\t\tif (glTexture.dirtyId >= this.dirties[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst res = tex.resource as any;\n\t\t\tif (!tex.valid || !res || !res.source) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (doClear && (tex.width < this.boundSize || tex.height < this.boundSize))\n\t\t\t{\n\t\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\t\tspr.position.x,\n\t\t\t\t\tspr.position.y,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\ttexture.format,\n\t\t\t\t\ttexture.type,\n\t\t\t\t\tthis._clearBuffer);\n\t\t\t}\n\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\tspr.position.x,\n\t\t\t\tspr.position.y,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tres.source);\n\t\t}\n\n\t\treturn true;\n\t}\n}\n","import { Constant } from './Constant';\n\nimport type { TilemapShader } from './RectTileShader';\n\n\nexport function fillSamplers(shader: TilemapShader, maxTextures: number) {\n let sampleValues: Array = [];\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n shader.uniforms.uSamplers = sampleValues;\n\n let samplerSize: Array = [];\n for (let i = 0; i < maxTextures; i++) {\n samplerSize.push(1.0 / Constant.bufferSize);\n samplerSize.push(1.0 / Constant.bufferSize);\n }\n shader.uniforms.uSamplerSize = samplerSize;\n}\n\nexport function generateFragmentSrc(maxTextures: number, fragmentSrc: string) {\n return fragmentSrc.replace(/%count%/gi, maxTextures + \"\")\n .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n}\n\nexport function generateSampleSrc(maxTextures: number) {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n src += 'if(vTextureId <= -1.0) {';\n src += '\\n\\tcolor = shadowColor;';\n src += '\\n}';\n\n for (let i = 0; i < maxTextures; i++)\n {\n src += '\\nelse ';\n\n if(i < maxTextures-1)\n {\n src += 'if(textureId == ' + i + '.0)';\n }\n\n src += '\\n{';\n src += '\\n\\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);';\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n}\n","/// \n\nimport * as shaderGenerator from './shaderGenerator';\n\nimport { Buffer, Geometry, Shader } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nlet rectShaderFrag = `\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n`;\nlet rectShaderVert = `\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n`;\n\nexport abstract class TilemapShader extends Shader {\n\tmaxTextures = 0;\n\n\tconstructor(maxTextures: number, shaderVert: string, shaderFrag: string) {\n\t\tsuper(\n\t\t\tnew PIXI.Program(\n\t\t\t\tshaderVert,\n\t\t\t\tshaderFrag),\n\t\t\t{\n\t\t\t\tanimationFrame: new Float32Array(2),\n\t\t\t\tuSamplers: [],\n\t\t\t\tuSamplerSize: [],\n\t\t\t\tprojTransMatrix: new Matrix()\n\t\t\t}\n\t\t);\n\t\tthis.maxTextures = maxTextures;\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileShader extends TilemapShader {\n\tconstructor(maxTextures: number) {\n\t\tsuper(\n\t\t\tmaxTextures,\n\t\t\trectShaderVert,\n\t\t\tshaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)\n\t\t);\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileGeom extends Geometry {\n\tvertSize = 11;\n\tvertPerQuad = 4;\n\tstride = this.vertSize * 4;\n\tlastTimeAccess = 0;\n\n\tconstructor() {\n\t\tsuper();\n\t\tconst buf = this.buf = new Buffer(new Float32Array(2), true, false);\n\t\tthis.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0)\n\t\t\t.addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4)\n\t\t\t.addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4)\n\t\t\t.addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4)\n\t\t\t.addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4);\n\t}\n\n\tbuf: PIXI.Buffer;\n}","import { WRAP_MODES } from '@pixi/constants';\nimport { BaseTexture, Buffer, resources, ObjectRenderer, Texture, Renderer } from '@pixi/core';\nimport { Constant } from './Constant';\nimport { RectTileGeom, RectTileShader } from './RectTileShader';\nimport { MultiTextureResource } from './MultiTextureResource';\n\nimport type { TilemapShader } from './RectTileShader';\n\n/**\n * Renderer for rectangle tiles.\n */\nexport class TileRenderer extends ObjectRenderer {\n\trenderer: Renderer;\n\tgl: WebGLRenderingContext;\n\tsn: number = -1;\n\tindexBuffer: PIXI.Buffer = null;\n\tibLen: number = 0;\n\ttileAnim = [0, 0];\n\ttexLoc: Array = [];\n\n\trectShader: RectTileShader;\n\ttexResources: Array = [];\n\n\tconstructor(renderer: Renderer) {\n\t\tsuper(renderer);\n\t\tthis.rectShader = new RectTileShader(Constant.maxTextures);\n\t\tthis.indexBuffer = new Buffer(undefined, true, true);\n\t\tthis.checkIndexBuffer(2000);\n\t\tthis.initBounds();\n\t}\n\n\tinitBounds() {\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tfor (let i = 0; i < maxTextures; i++) {\n\t\t\tconst resource = new MultiTextureResource(Constant);\n\t\t\tconst baseTex = new BaseTexture(resource);\n\t\t\tbaseTex.scaleMode = Constant.SCALE_MODE;\n\t\t\tbaseTex.wrapMode = WRAP_MODES.CLAMP;\n\t\t\tthis.texResources.push(resource);\n\t\t}\n\t}\n\n\tbindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tlet samplerSize: Array = (shader as any).uniforms.uSamplerSize;\n\t\tthis.texLoc.length = 0;\n\t\tfor (let i = 0; i < textures.length; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trenderer.texture.bind(textures[i], i);\n\t\t\t//TODO: add resolution here\n\t\t\tsamplerSize[i * 2] = 1.0 / textures[i].baseTexture.width;\n\t\t\tsamplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height;\n\t\t}\n\t\t(shader as any).uniforms.uSamplerSize = samplerSize;\n\t}\n\n\tbindTextures(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tconst len = textures.length;\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tif (len > Constant.boundCountPerBuffer * maxTextures) {\n\t\t\treturn;\n\t\t}\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\tthis.bindTexturesWithoutRT(renderer, shader, textures);\n\t\t\treturn;\n\t\t}\n\n\t\tlet i = 0;\n\t\tfor (; i < len; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) continue;\n\t\t\tconst multi = this.texResources[i >> 2];\n\t\t\tmulti.setTexture(i & 3, texture);\n\t\t}\n\n\t\tlet gltsUsed = (i + 3) >> 2;\n\t\tfor (i = 0; i < gltsUsed; i++) {\n\t\t\t//remove \"i, true\" after resolving a bug\n\t\t\trenderer.texture.bind(this.texResources[i].baseTex, i);\n\t\t}\n\t}\n\n\tstart() {\n\t\t//sorry, nothing\n\t}\n\n\tcreateVb() {\n\t\tconst geom = new RectTileGeom();\n\t\tgeom.addIndex(this.indexBuffer);\n\t\tgeom.lastTimeAccess = Date.now();\n\t\treturn geom;\n\t}\n\n\tcheckIndexBuffer(size: number, vb: RectTileGeom = null) {\n\t\tconst totalIndices = size * 6;\n\n\t\tif (totalIndices <= this.ibLen) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet len = totalIndices;\n\t\twhile (len < totalIndices) {\n\t\t\tlen <<= 1;\n\t\t}\n\n\t\tthis.ibLen = totalIndices;\n\t\tthis.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size,\n\t\t\tConstant.use32bitIndex ? new Uint32Array(size * 6) : undefined));\n\n\t\t// \tTODO: create new index buffer instead?\n\t\t// if (vb) {\n\t\t// \tconst curIndex = vb.getIndex();\n\t\t// \tif (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) {\n\t\t// \t\tthis.swapIndex(vb, this.indexBuffer);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t// swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) {\n\t\t// let buffers = (geom as any).buffers;\n\t\t// const oldIndex = geom.getIndex();\n\t\t// let ind = buffers.indexOf(oldIndex);\n\t\t// if (ind >= 0) {\n\t\t// \tbuffers.splice(ind, 1);\n\t\t// }\n\t\t// geom.addIndex(indexBuf);\n\t// }\n\n\tgetShader(): TilemapShader {\n\t\treturn this.rectShader;\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\t// this.rectShader.destroy();\n\t\tthis.rectShader = null;\n\t}\n}\n\nRenderer.registerPlugin('tilemap', TileRenderer as any);\n","/// \n\nimport { Container } from '@pixi/display';\n\nimport type { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport type { Matrix } from '@pixi/math';\n\nexport class ZLayer extends Container {\n\n constructor(tilemap: Container, zIndex: number) {\n super();\n this.tilemap = tilemap;\n this.z = zIndex;\n }\n\n tilemap: any;\n z: number;\n zIndex: number;\n _previousLayers: number;\n canvasBuffer: HTMLCanvasElement;\n _tempRender: any;\n _lastAnimationFrame: number = -1;\n layerTransform: Matrix;\n\n clear() {\n let layers = this.children as Array;\n for (let i = 0; i < layers.length; i++)\n layers[i].clear();\n this._previousLayers = 0;\n }\n\n cacheIfDirty() {\n let tilemap: any = this.tilemap;\n let layers = this.children as Array;\n let modified = this._previousLayers !== layers.length;\n this._previousLayers = layers.length;\n let buf = this.canvasBuffer;\n let tempRender = this._tempRender;\n if (!buf) {\n buf = this.canvasBuffer = document.createElement('canvas');\n tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf});\n tempRender.context = tempRender.rootContext;\n tempRender.plugins.tilemap.dontUseTransform = true;\n }\n if (buf.width !== tilemap._layerWidth ||\n buf.height !== tilemap._layerHeight) {\n buf.width = tilemap._layerWidth;\n buf.height = tilemap._layerHeight;\n modified = true;\n }\n let i: number;\n if (!modified) {\n for (i = 0; i < layers.length; i++) {\n if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) {\n modified = true;\n break;\n }\n }\n }\n this._lastAnimationFrame = tilemap.animationFrame;\n if (modified) {\n if (tilemap._hackRenderer) {\n tilemap._hackRenderer(tempRender);\n }\n tempRender.context.clearRect(0, 0, buf.width, buf.height);\n for (i = 0; i < layers.length; i++) {\n layers[i].clearModify();\n layers[i].renderCanvas(tempRender);\n }\n }\n this.layerTransform = this.worldTransform;\n for (i = 0; i < layers.length; i++) {\n this.layerTransform = layers[i].worldTransform;\n break;\n }\n }\n\n renderCanvas(renderer: any) {\n this.cacheIfDirty();\n let wt = this.layerTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n let tilemap = this.tilemap;\n renderer.context.drawImage(this.canvasBuffer, 0, 0);\n }\n}\n","/// \n\nnamespace pixi_tilemap {\n (PIXI as any).tilemap = pixi_tilemap;\n}\n\n// This makes exporter.ts a module!\nexport default {}\n","import { CanvasTileRenderer } from './CanvasTileRenderer';\nimport { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport { Constant } from './Constant';\nimport { GraphicsLayer } from './GraphicsLayer';\nimport { MultiTextureResource } from './MultiTextureResource';\nimport { RectTileLayer } from './RectTileLayer';\nimport { TilemapShader, RectTileShader, RectTileGeom } from './RectTileShader';\nimport { TileRenderer } from './TileRenderer';\nimport { ZLayer } from './ZLayer';\n\nexport const pixi_tilemap = {\n CanvasTileRenderer,\n CompositeRectTileLayer,\n Constant,\n GraphicsLayer,\n MultiTextureResource,\n RectTileLayer,\n TilemapShader,\n RectTileShader,\n RectTileGeom,\n TileRenderer,\n ZLayer,\n};\n\nexport * from './CanvasTileRenderer';\nexport * from './CompositeRectTileLayer';\nexport * from './Constant';\nexport * from './exporter';\nexport * from './GraphicsLayer';\nexport * from './MultiTextureResource';\nexport * from './RectTileLayer';\nexport * from './RectTileShader';\nexport * from './shaderGenerator';\nexport * from './TileRenderer';\nexport * from './ZLayer';"],"names":["Texture","groupD8","DRAW_MODES","Container","Matrix","Graphics","Sprite","ALPHA_MODES","resources","shaderGenerator.fillSamplers","Shader","shaderGenerator.generateFragmentSrc","Buffer","Geometry","Ba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YACtB,IAAI,CAAC,YAAY,EAAE,CAAC;YACpB,IAAI,EAAE,GAAG,IAAI,CAAC,cAAc,CAAC;YAC7B,QAAQ,CAAC,OAAO,CAAC,YAAY,CACzB,EAAE,CAAC,CAAC,EACJ,EAAE,CAAC,CAAC,EACJ,EAAE,CAAC,CAAC,EACJ,EAAE,CAAC,CAAC,EACJ,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,UAAU,EAC3B,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,UAAU,CAC9B,CAAC;YACF,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;YAC3B,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;SACvD;QACL,aAAC;IAAD,CApFA,CAA4Bd,iBAAS;;ICLrC,IAAU,YAAY,CAErB;IAFD,WAAU,YAAY;QACjB,IAAY,CAAC,OAAO,GAAG,YAAY,CAAC;IACzC,CAAC,EAFS,YAAY,KAAZ,YAAY;;QCQTe,cAAY,GAAG;QACxB,kBAAkB,oBAAA;QAClB,sBAAsB,wBAAA;QACtB,QAAQ,UAAA;QACR,aAAa,eAAA;QACb,oBAAoB,sBAAA;QACpB,aAAa,eAAA;QACb,aAAa,eAAA;QACb,cAAc,gBAAA;QACd,YAAY,cAAA;QACZ,YAAY,cAAA;QACZ,MAAM,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/pixi-tilemap.umd.min.js b/dist/pixi-tilemap.umd.min.js index 21ddae70..d0a069fb 100644 --- a/dist/pixi-tilemap.umd.min.js +++ b/dist/pixi-tilemap.umd.min.js @@ -1,6 +1,6 @@ /*! * pixi-tilemap - v2.0.6 - * Compiled Fri, 14 Aug 2020 18:21:51 UTC + * Compiled Fri, 14 Aug 2020 18:27:09 UTC * * pixi-tilemap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -21,5 +21,5 @@ var pixi_tilemap=function(e,t,r,i,n,o,a){"use strict";var s=function(e){this.til See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. - ***************************************************************************** */;var h=function(e,t){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function l(e,t){function r(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var f={maxTextures:16,bufferSize:2048,boundSize:1024,boundCountPerBuffer:1,use32bitIndex:!1,SCALE_MODE:PIXI.SCALE_MODES.LINEAR,DO_CLEAR:!0},d=function(e){function t(t,r){var i=e.call(this)||this;return i.zIndex=0,i.modificationMarker=0,i.shadowColor=new Float32Array([0,0,0,.5]),i._globalMat=null,i.pointsBuf=[],i.hasAnim=!1,i.offsetX=0,i.offsetY=0,i.compositeParent=!1,i.vbId=0,i.vb=null,i.vbBuffer=null,i.vbArray=null,i.vbInts=null,i.initialize(t,r),i}return l(t,e),t.prototype.initialize=function(e,t){t?t instanceof Array||!t.baseTexture||(t=[t]):t=[],this.textures=t,this.zIndex=e},t.prototype.clear=function(){this.pointsBuf.length=0,this.modificationMarker=0,this.hasAnim=!1},t.prototype.addFrame=function(e,t,i,n,o){var a,s=0;if("number"==typeof e)s=e,a=this.textures[s];else{a="string"==typeof e?r.Texture.from(e):e;for(var u=!1,h=this.textures,l=0;l0||u>0,d.push(t),d.push(r),d.push(i),d.push(n),d.push(o),d.push(a),d.push(h),d.push(0|s),d.push(0|u),d.push(e),d.push(l),d.push(f),this},t.prototype.tileRotate=function(e){var t=this.pointsBuf;t[t.length-3]=e},t.prototype.tileAnimX=function(e,t){var r=this.pointsBuf;r[r.length-5]=e,r[r.length-2]=t},t.prototype.tileAnimY=function(e,t){var r=this.pointsBuf;r[r.length-4]=e,r[r.length-1]=t},t.prototype.renderCanvas=function(e){if(!e.plugins.tilemap.dontUseTransform){var t=this.worldTransform;e.context.setTransform(t.a,t.b,t.c,t.d,t.tx*e.resolution,t.ty*e.resolution)}this.renderCanvasCore(e)},t.prototype.renderCanvasCore=function(e){if(0!==this.textures.length){var t=this.pointsBuf;e.context.fillStyle="#000000";for(var r=0,i=t.length;r=0?e.context.drawImage(this.textures[l].baseTexture.getDrawableSource(),n,o,u,h,a,s,u,h):(e.context.globalAlpha=.5,e.context.fillRect(a,s,u,h),e.context.globalAlpha=1)}}},t.prototype.destroyVb=function(){this.vb&&(this.vb.destroy(),this.vb=null)},t.prototype.render=function(e){var t=e.plugins.tilemap,r=t.getShader();e.batch.setObjectRenderer(t),this._globalMat=r.uniforms.projTransMatrix,e.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform),r.uniforms.shadowColor=this.shadowColor,r.uniforms.animationFrame=t.tileAnim,this.renderWebGLCore(e,t)},t.prototype.renderWebGLCore=function(e,t){var r=this.pointsBuf;if(0!==r.length){var o=r.length/12,a=t.getShader(),s=this.textures;if(0!==s.length){t.bindTextures(e,a,s),e.shader.bind(a,!1);var u=this.vb;u||(u=t.createVb(),this.vb=u,this.vbId=u.id,this.vbBuffer=null,this.modificationMarker=0),t.checkIndexBuffer(o,u);var h=f.boundCountPerBuffer,l=u.getBuffer("aVertexPosition"),d=o*u.vertPerQuad;if(0!==d){if(this.modificationMarker!==d){this.modificationMarker=d;var p=u.stride*d;if(!this.vbBuffer||this.vbBuffer.byteLength1?(x=r[g+9]>>2,y=this.offsetX*(1&r[g+9]),b=this.offsetY*(r[g+9]>>1&1)):(x=r[g+9],y=0,b=0));var T=r[g+2],S=r[g+3],C=r[g+4],A=r[g+5],I=r[g]+y,w=r[g+1]+b,_=r[g+6],P=r[g+7],R=r[g+8],M=P+2048*(r[g+10]||1024),B=R+2048*(r[g+11]||1024),L=void 0,z=void 0,D=void 0,F=void 0,O=void 0,X=void 0,E=void 0,k=void 0;if(0===_)L=I,z=w,D=I+C,F=w,O=I+C,X=w+A,E=I,k=w+A;else{var U=C/2,Y=A/2;_%4!=0&&(U=A/2,Y=C/2);var j=I+U,G=w+Y;_=n.groupD8.add(_,n.groupD8.NW),L=j+U*n.groupD8.uX(_),z=G+Y*n.groupD8.uY(_),_=n.groupD8.add(_,2),D=j+U*n.groupD8.uX(_),F=G+Y*n.groupD8.uY(_),_=n.groupD8.add(_,2),O=j+U*n.groupD8.uX(_),X=G+Y*n.groupD8.uY(_),_=n.groupD8.add(_,2),E=j+U*n.groupD8.uX(_),k=G+Y*n.groupD8.uY(_)}m[v++]=T,m[v++]=S,m[v++]=L,m[v++]=z,m[v++]=I+.5,m[v++]=w+.5,m[v++]=I+C-.5,m[v++]=w+A-.5,m[v++]=M,m[v++]=B,m[v++]=x,m[v++]=T+C,m[v++]=S,m[v++]=D,m[v++]=F,m[v++]=I+.5,m[v++]=w+.5,m[v++]=I+C-.5,m[v++]=w+A-.5,m[v++]=M,m[v++]=B,m[v++]=x,m[v++]=T+C,m[v++]=S+A,m[v++]=O,m[v++]=X,m[v++]=I+.5,m[v++]=w+.5,m[v++]=I+C-.5,m[v++]=w+A-.5,m[v++]=M,m[v++]=B,m[v++]=x,m[v++]=T,m[v++]=S+A,m[v++]=E,m[v++]=k,m[v++]=I+.5,m[v++]=w+.5,m[v++]=I+C-.5,m[v++]=w+A-.5,m[v++]=M,m[v++]=B,m[v++]=x}l.update(m)}e.geometry.bind(u,a),e.geometry.draw(i.DRAW_MODES.TRIANGLES,6*o,0)}}}},t.prototype.isModified=function(e){return!!(this.modificationMarker!==this.pointsBuf.length||e&&this.hasAnim)},t.prototype.clearModify=function(){this.modificationMarker=this.pointsBuf.length},t.prototype.destroy=function(t){e.prototype.destroy.call(this,t),this.destroyVb()},t}(t.Container),p=function(e){function t(t,r,i){var n=e.call(this)||this;return n.modificationMarker=0,n.shadowColor=new Float32Array([0,0,0,.5]),n._globalMat=null,n._lastLayer=null,n.initialize.apply(n,arguments),n}return l(t,e),t.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},t.prototype.initialize=function(e,t,r){!0===r&&(r=0),this.z=this.zIndex=e,this.texPerChild=r||f.boundCountPerBuffer*f.maxTextures,t&&this.setBitmaps(t)},t.prototype.setBitmaps=function(e){for(var t=0;t 5.2.1, it does not exist there.");var r,i=this.texPerChild,n=this.children.length,o=Math.ceil(e.length/i);for(r=0;r>0,p=e%this.texPerChild;return this.children[d]&&this.children[d].textures?(this._lastLayer=this.children[d],this._lastLayer.addRect(p,t,r,i,n,o,a,s,u,h,l,f)):this._lastLayer=null,this},t.prototype.tileRotate=function(e){return this._lastLayer&&this._lastLayer.tileRotate(e),this},t.prototype.tileAnimX=function(e,t){return this._lastLayer&&this._lastLayer.tileAnimX(e,t),this},t.prototype.tileAnimY=function(e,t){return this._lastLayer&&this._lastLayer.tileAnimY(e,t),this},t.prototype.addFrame=function(e,t,i,n,o,a,s){var u,h=null,l=0,p=this.children;if(this._lastLayer=null,"number"==typeof e){if(h=p[e/this.texPerChild>>0])l=e%this.texPerChild;else{if(!(h=p[0]))return this;l=0}u=h.textures[l]}else{u="string"==typeof e?r.Texture.from(e):e;for(var c=0;c>1),i.push(s),n.push(0)}return r.DO_CLEAR=!!t.DO_CLEAR,r}return l(t,e),t.prototype.bind=function(t){if(this.baseTex)throw new Error("Only one baseTexture is allowed for this resource!");this.baseTex=t,e.prototype.bind.call(this,t)},t.prototype.setTexture=function(e,t){var r=this.boundSprites[e];r.texture.baseTexture!==t.baseTexture&&(r.texture=t,this.baseTex.update(),this.dirties[e]=this.baseTex.dirtyId)},t.prototype.upload=function(e,t,r){var n=e.gl,o=this.width,a=this.height;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,void 0===t.alphaMode||t.alphaMode===i.ALPHA_MODES.UNPACK),r.dirtyId<0&&(r.width=o,r.height=a,n.texImage2D(t.target,0,t.format,o,a,0,t.format,t.type,null));var s=this.DO_CLEAR;s&&!this._clearBuffer&&(this._clearBuffer=new Uint8Array(f.boundSize*f.boundSize*4));for(var u=this.boundSprites,h=0;h=this.dirties[h])){var p=d.resource;d.valid&&p&&p.source&&(s&&(d.widthf.boundCountPerBuffer*f.maxTextures))if(f.boundCountPerBuffer<=1)this.bindTexturesWithoutRT(e,t,r);else{for(var n=0;n>2].setTexture(3&n,o)}var a=n+3>>2;for(n=0;n0||u>0,d.push(t),d.push(r),d.push(i),d.push(n),d.push(o),d.push(a),d.push(h),d.push(0|s),d.push(0|u),d.push(e),d.push(l),d.push(f),this},t.prototype.tileRotate=function(e){var t=this.pointsBuf;t[t.length-3]=e},t.prototype.tileAnimX=function(e,t){var r=this.pointsBuf;r[r.length-5]=e,r[r.length-2]=t},t.prototype.tileAnimY=function(e,t){var r=this.pointsBuf;r[r.length-4]=e,r[r.length-1]=t},t.prototype.renderCanvas=function(e){if(!e.plugins.tilemap.dontUseTransform){var t=this.worldTransform;e.context.setTransform(t.a,t.b,t.c,t.d,t.tx*e.resolution,t.ty*e.resolution)}this.renderCanvasCore(e)},t.prototype.renderCanvasCore=function(e){if(0!==this.textures.length){var t=this.pointsBuf;e.context.fillStyle="#000000";for(var r=0,i=t.length;r=0?e.context.drawImage(this.textures[l].baseTexture.getDrawableSource(),n,o,u,h,a,s,u,h):(e.context.globalAlpha=.5,e.context.fillRect(a,s,u,h),e.context.globalAlpha=1)}}},t.prototype.destroyVb=function(){this.vb&&(this.vb.destroy(),this.vb=null)},t.prototype.render=function(e){var t=e.plugins.tilemap,r=t.getShader();e.batch.setObjectRenderer(t),this._globalMat=r.uniforms.projTransMatrix,e.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform),r.uniforms.shadowColor=this.shadowColor,r.uniforms.animationFrame=t.tileAnim,this.renderWebGLCore(e,t)},t.prototype.renderWebGLCore=function(e,t){var r=this.pointsBuf;if(0!==r.length){var o=r.length/12,a=t.getShader(),s=this.textures;if(0!==s.length){t.bindTextures(e,a,s),e.shader.bind(a,!1);var u=this.vb;u||(u=t.createVb(),this.vb=u,this.vbId=u.id,this.vbBuffer=null,this.modificationMarker=0),t.checkIndexBuffer(o,u);var h=f.boundCountPerBuffer,l=u.getBuffer("aVertexPosition"),d=o*u.vertPerQuad;if(0!==d){if(this.modificationMarker!==d){this.modificationMarker=d;var p=u.stride*d;if(!this.vbBuffer||this.vbBuffer.byteLength1?(x=r[g+9]>>2,y=this.offsetX*(1&r[g+9]),b=this.offsetY*(r[g+9]>>1&1)):(x=r[g+9],y=0,b=0));var T=r[g+2],S=r[g+3],I=r[g+4],C=r[g+5],A=r[g]+y,_=r[g+1]+b,w=r[g+6],P=r[g+7],R=r[g+8],M=P+2048*(r[g+10]||1024),B=R+2048*(r[g+11]||1024),L=void 0,z=void 0,D=void 0,F=void 0,O=void 0,X=void 0,E=void 0,k=void 0;if(0===w)L=A,z=_,D=A+I,F=_,O=A+I,X=_+C,E=A,k=_+C;else{var U=I/2,j=C/2;w%4!=0&&(U=C/2,j=I/2);var Y=A+U,G=_+j;w=n.groupD8.add(w,n.groupD8.NW),L=Y+U*n.groupD8.uX(w),z=G+j*n.groupD8.uY(w),w=n.groupD8.add(w,2),D=Y+U*n.groupD8.uX(w),F=G+j*n.groupD8.uY(w),w=n.groupD8.add(w,2),O=Y+U*n.groupD8.uX(w),X=G+j*n.groupD8.uY(w),w=n.groupD8.add(w,2),E=Y+U*n.groupD8.uX(w),k=G+j*n.groupD8.uY(w)}m[v++]=T,m[v++]=S,m[v++]=L,m[v++]=z,m[v++]=A+.5,m[v++]=_+.5,m[v++]=A+I-.5,m[v++]=_+C-.5,m[v++]=M,m[v++]=B,m[v++]=x,m[v++]=T+I,m[v++]=S,m[v++]=D,m[v++]=F,m[v++]=A+.5,m[v++]=_+.5,m[v++]=A+I-.5,m[v++]=_+C-.5,m[v++]=M,m[v++]=B,m[v++]=x,m[v++]=T+I,m[v++]=S+C,m[v++]=O,m[v++]=X,m[v++]=A+.5,m[v++]=_+.5,m[v++]=A+I-.5,m[v++]=_+C-.5,m[v++]=M,m[v++]=B,m[v++]=x,m[v++]=T,m[v++]=S+C,m[v++]=E,m[v++]=k,m[v++]=A+.5,m[v++]=_+.5,m[v++]=A+I-.5,m[v++]=_+C-.5,m[v++]=M,m[v++]=B,m[v++]=x}l.update(m)}e.geometry.bind(u,a),e.geometry.draw(i.DRAW_MODES.TRIANGLES,6*o,0)}}}},t.prototype.isModified=function(e){return!!(this.modificationMarker!==this.pointsBuf.length||e&&this.hasAnim)},t.prototype.clearModify=function(){this.modificationMarker=this.pointsBuf.length},t.prototype.destroy=function(t){e.prototype.destroy.call(this,t),this.destroyVb()},t}(t.Container),p=function(e){function t(t,r,i){var n=e.call(this)||this;return n.modificationMarker=0,n.shadowColor=new Float32Array([0,0,0,.5]),n._globalMat=null,n._lastLayer=null,n.initialize.apply(n,arguments),n}return l(t,e),t.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},t.prototype.initialize=function(e,t,r){!0===r&&(r=0),this.z=this.zIndex=e,this.texPerChild=r||f.boundCountPerBuffer*f.maxTextures,t&&this.setBitmaps(t)},t.prototype.setBitmaps=function(e){for(var t=0;t 5.2.1, it does not exist there.");var r,i=this.texPerChild,n=this.children.length,o=Math.ceil(e.length/i);for(r=0;r>0,p=e%this.texPerChild;return this.children[d]&&this.children[d].textures?(this._lastLayer=this.children[d],this._lastLayer.addRect(p,t,r,i,n,o,a,s,u,h,l,f)):this._lastLayer=null,this},t.prototype.tileRotate=function(e){return this._lastLayer&&this._lastLayer.tileRotate(e),this},t.prototype.tileAnimX=function(e,t){return this._lastLayer&&this._lastLayer.tileAnimX(e,t),this},t.prototype.tileAnimY=function(e,t){return this._lastLayer&&this._lastLayer.tileAnimY(e,t),this},t.prototype.addFrame=function(e,t,i,n,o,a,s){var u,h=null,l=0,p=this.children;if(this._lastLayer=null,"number"==typeof e){if(h=p[e/this.texPerChild>>0])l=e%this.texPerChild;else{if(!(h=p[0]))return this;l=0}u=h.textures[l]}else{u="string"==typeof e?r.Texture.from(e):e;for(var c=0;c>1),i.push(s),n.push(0)}return r.DO_CLEAR=!!t.DO_CLEAR,r}return l(t,e),t.prototype.bind=function(t){if(this.baseTex)throw new Error("Only one baseTexture is allowed for this resource!");this.baseTex=t,e.prototype.bind.call(this,t)},t.prototype.setTexture=function(e,t){var r=this.boundSprites[e];r.texture.baseTexture!==t.baseTexture&&(r.texture=t,this.baseTex.update(),this.dirties[e]=this.baseTex.dirtyId)},t.prototype.upload=function(e,t,r){var n=e.gl,o=this.width,a=this.height;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,void 0===t.alphaMode||t.alphaMode===i.ALPHA_MODES.UNPACK),r.dirtyId<0&&(r.width=o,r.height=a,n.texImage2D(t.target,0,t.format,o,a,0,t.format,t.type,null));var s=this.DO_CLEAR;s&&!this._clearBuffer&&(this._clearBuffer=new Uint8Array(f.boundSize*f.boundSize*4));for(var u=this.boundSprites,h=0;h=this.dirties[h])){var p=d.resource;d.valid&&p&&p.source&&(s&&(d.widthf.boundCountPerBuffer*f.maxTextures))if(f.boundCountPerBuffer<=1)this.bindTexturesWithoutRT(e,t,r);else{for(var n=0;n>2].setTexture(3&n,o)}var a=n+3>>2;for(n=0;n Date: Fri, 14 Aug 2020 14:32:49 -0400 Subject: [PATCH 7/8] _pixi_tilemap -> pixi_tilemap --- dist/pixi-tilemap.js | 2 +- dist/pixi-tilemap.umd.js | 4 ++-- dist/pixi-tilemap.umd.min.js | 4 ++-- lib/pixi-tilemap.es.js | 2 +- rollup.config.js | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dist/pixi-tilemap.js b/dist/pixi-tilemap.js index fe77e253..9b288770 100644 --- a/dist/pixi-tilemap.js +++ b/dist/pixi-tilemap.js @@ -2,7 +2,7 @@ /*! * pixi-tilemap - v2.0.6 - * Compiled Fri, 14 Aug 2020 18:27:09 UTC + * Compiled Fri, 14 Aug 2020 18:32:35 UTC * * pixi-tilemap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license diff --git a/dist/pixi-tilemap.umd.js b/dist/pixi-tilemap.umd.js index aa469c8d..5d1ff1f5 100644 --- a/dist/pixi-tilemap.umd.js +++ b/dist/pixi-tilemap.umd.js @@ -2,7 +2,7 @@ /*! * pixi-tilemap - v2.0.6 - * Compiled Fri, 14 Aug 2020 18:27:09 UTC + * Compiled Fri, 14 Aug 2020 18:32:35 UTC * * pixi-tilemap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -971,5 +971,5 @@ var pixi_tilemap = (function (exports, display, core, constants, math, graphics, }({}, PIXI, PIXI, PIXI, PIXI, PIXI, PIXI)); PIXI.tilemap = PIXI.tilemap || {}; -Object.assign(PIXI.tilemap, _pixi_tilemap) +Object.assign(PIXI.tilemap, pixi_tilemap) //# sourceMappingURL=pixi-tilemap.umd.js.map diff --git a/dist/pixi-tilemap.umd.min.js b/dist/pixi-tilemap.umd.min.js index d0a069fb..fa589245 100644 --- a/dist/pixi-tilemap.umd.min.js +++ b/dist/pixi-tilemap.umd.min.js @@ -1,6 +1,6 @@ /*! * pixi-tilemap - v2.0.6 - * Compiled Fri, 14 Aug 2020 18:27:09 UTC + * Compiled Fri, 14 Aug 2020 18:32:35 UTC * * pixi-tilemap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -21,5 +21,5 @@ var pixi_tilemap=function(e,t,r,i,n,o,a){"use strict";var s=function(e){this.til See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. - ***************************************************************************** */;var h=function(e,t){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function l(e,t){function r(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var f={maxTextures:16,bufferSize:2048,boundSize:1024,boundCountPerBuffer:1,use32bitIndex:!1,SCALE_MODE:PIXI.SCALE_MODES.LINEAR,DO_CLEAR:!0},d=function(e){function t(t,r){var i=e.call(this)||this;return i.zIndex=0,i.modificationMarker=0,i.shadowColor=new Float32Array([0,0,0,.5]),i._globalMat=null,i.pointsBuf=[],i.hasAnim=!1,i.offsetX=0,i.offsetY=0,i.compositeParent=!1,i.vbId=0,i.vb=null,i.vbBuffer=null,i.vbArray=null,i.vbInts=null,i.initialize(t,r),i}return l(t,e),t.prototype.initialize=function(e,t){t?t instanceof Array||!t.baseTexture||(t=[t]):t=[],this.textures=t,this.zIndex=e},t.prototype.clear=function(){this.pointsBuf.length=0,this.modificationMarker=0,this.hasAnim=!1},t.prototype.addFrame=function(e,t,i,n,o){var a,s=0;if("number"==typeof e)s=e,a=this.textures[s];else{a="string"==typeof e?r.Texture.from(e):e;for(var u=!1,h=this.textures,l=0;l0||u>0,d.push(t),d.push(r),d.push(i),d.push(n),d.push(o),d.push(a),d.push(h),d.push(0|s),d.push(0|u),d.push(e),d.push(l),d.push(f),this},t.prototype.tileRotate=function(e){var t=this.pointsBuf;t[t.length-3]=e},t.prototype.tileAnimX=function(e,t){var r=this.pointsBuf;r[r.length-5]=e,r[r.length-2]=t},t.prototype.tileAnimY=function(e,t){var r=this.pointsBuf;r[r.length-4]=e,r[r.length-1]=t},t.prototype.renderCanvas=function(e){if(!e.plugins.tilemap.dontUseTransform){var t=this.worldTransform;e.context.setTransform(t.a,t.b,t.c,t.d,t.tx*e.resolution,t.ty*e.resolution)}this.renderCanvasCore(e)},t.prototype.renderCanvasCore=function(e){if(0!==this.textures.length){var t=this.pointsBuf;e.context.fillStyle="#000000";for(var r=0,i=t.length;r=0?e.context.drawImage(this.textures[l].baseTexture.getDrawableSource(),n,o,u,h,a,s,u,h):(e.context.globalAlpha=.5,e.context.fillRect(a,s,u,h),e.context.globalAlpha=1)}}},t.prototype.destroyVb=function(){this.vb&&(this.vb.destroy(),this.vb=null)},t.prototype.render=function(e){var t=e.plugins.tilemap,r=t.getShader();e.batch.setObjectRenderer(t),this._globalMat=r.uniforms.projTransMatrix,e.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform),r.uniforms.shadowColor=this.shadowColor,r.uniforms.animationFrame=t.tileAnim,this.renderWebGLCore(e,t)},t.prototype.renderWebGLCore=function(e,t){var r=this.pointsBuf;if(0!==r.length){var o=r.length/12,a=t.getShader(),s=this.textures;if(0!==s.length){t.bindTextures(e,a,s),e.shader.bind(a,!1);var u=this.vb;u||(u=t.createVb(),this.vb=u,this.vbId=u.id,this.vbBuffer=null,this.modificationMarker=0),t.checkIndexBuffer(o,u);var h=f.boundCountPerBuffer,l=u.getBuffer("aVertexPosition"),d=o*u.vertPerQuad;if(0!==d){if(this.modificationMarker!==d){this.modificationMarker=d;var p=u.stride*d;if(!this.vbBuffer||this.vbBuffer.byteLength1?(x=r[g+9]>>2,y=this.offsetX*(1&r[g+9]),b=this.offsetY*(r[g+9]>>1&1)):(x=r[g+9],y=0,b=0));var T=r[g+2],S=r[g+3],I=r[g+4],C=r[g+5],A=r[g]+y,_=r[g+1]+b,w=r[g+6],P=r[g+7],R=r[g+8],M=P+2048*(r[g+10]||1024),B=R+2048*(r[g+11]||1024),L=void 0,z=void 0,D=void 0,F=void 0,O=void 0,X=void 0,E=void 0,k=void 0;if(0===w)L=A,z=_,D=A+I,F=_,O=A+I,X=_+C,E=A,k=_+C;else{var U=I/2,j=C/2;w%4!=0&&(U=C/2,j=I/2);var Y=A+U,G=_+j;w=n.groupD8.add(w,n.groupD8.NW),L=Y+U*n.groupD8.uX(w),z=G+j*n.groupD8.uY(w),w=n.groupD8.add(w,2),D=Y+U*n.groupD8.uX(w),F=G+j*n.groupD8.uY(w),w=n.groupD8.add(w,2),O=Y+U*n.groupD8.uX(w),X=G+j*n.groupD8.uY(w),w=n.groupD8.add(w,2),E=Y+U*n.groupD8.uX(w),k=G+j*n.groupD8.uY(w)}m[v++]=T,m[v++]=S,m[v++]=L,m[v++]=z,m[v++]=A+.5,m[v++]=_+.5,m[v++]=A+I-.5,m[v++]=_+C-.5,m[v++]=M,m[v++]=B,m[v++]=x,m[v++]=T+I,m[v++]=S,m[v++]=D,m[v++]=F,m[v++]=A+.5,m[v++]=_+.5,m[v++]=A+I-.5,m[v++]=_+C-.5,m[v++]=M,m[v++]=B,m[v++]=x,m[v++]=T+I,m[v++]=S+C,m[v++]=O,m[v++]=X,m[v++]=A+.5,m[v++]=_+.5,m[v++]=A+I-.5,m[v++]=_+C-.5,m[v++]=M,m[v++]=B,m[v++]=x,m[v++]=T,m[v++]=S+C,m[v++]=E,m[v++]=k,m[v++]=A+.5,m[v++]=_+.5,m[v++]=A+I-.5,m[v++]=_+C-.5,m[v++]=M,m[v++]=B,m[v++]=x}l.update(m)}e.geometry.bind(u,a),e.geometry.draw(i.DRAW_MODES.TRIANGLES,6*o,0)}}}},t.prototype.isModified=function(e){return!!(this.modificationMarker!==this.pointsBuf.length||e&&this.hasAnim)},t.prototype.clearModify=function(){this.modificationMarker=this.pointsBuf.length},t.prototype.destroy=function(t){e.prototype.destroy.call(this,t),this.destroyVb()},t}(t.Container),p=function(e){function t(t,r,i){var n=e.call(this)||this;return n.modificationMarker=0,n.shadowColor=new Float32Array([0,0,0,.5]),n._globalMat=null,n._lastLayer=null,n.initialize.apply(n,arguments),n}return l(t,e),t.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},t.prototype.initialize=function(e,t,r){!0===r&&(r=0),this.z=this.zIndex=e,this.texPerChild=r||f.boundCountPerBuffer*f.maxTextures,t&&this.setBitmaps(t)},t.prototype.setBitmaps=function(e){for(var t=0;t 5.2.1, it does not exist there.");var r,i=this.texPerChild,n=this.children.length,o=Math.ceil(e.length/i);for(r=0;r>0,p=e%this.texPerChild;return this.children[d]&&this.children[d].textures?(this._lastLayer=this.children[d],this._lastLayer.addRect(p,t,r,i,n,o,a,s,u,h,l,f)):this._lastLayer=null,this},t.prototype.tileRotate=function(e){return this._lastLayer&&this._lastLayer.tileRotate(e),this},t.prototype.tileAnimX=function(e,t){return this._lastLayer&&this._lastLayer.tileAnimX(e,t),this},t.prototype.tileAnimY=function(e,t){return this._lastLayer&&this._lastLayer.tileAnimY(e,t),this},t.prototype.addFrame=function(e,t,i,n,o,a,s){var u,h=null,l=0,p=this.children;if(this._lastLayer=null,"number"==typeof e){if(h=p[e/this.texPerChild>>0])l=e%this.texPerChild;else{if(!(h=p[0]))return this;l=0}u=h.textures[l]}else{u="string"==typeof e?r.Texture.from(e):e;for(var c=0;c>1),i.push(s),n.push(0)}return r.DO_CLEAR=!!t.DO_CLEAR,r}return l(t,e),t.prototype.bind=function(t){if(this.baseTex)throw new Error("Only one baseTexture is allowed for this resource!");this.baseTex=t,e.prototype.bind.call(this,t)},t.prototype.setTexture=function(e,t){var r=this.boundSprites[e];r.texture.baseTexture!==t.baseTexture&&(r.texture=t,this.baseTex.update(),this.dirties[e]=this.baseTex.dirtyId)},t.prototype.upload=function(e,t,r){var n=e.gl,o=this.width,a=this.height;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,void 0===t.alphaMode||t.alphaMode===i.ALPHA_MODES.UNPACK),r.dirtyId<0&&(r.width=o,r.height=a,n.texImage2D(t.target,0,t.format,o,a,0,t.format,t.type,null));var s=this.DO_CLEAR;s&&!this._clearBuffer&&(this._clearBuffer=new Uint8Array(f.boundSize*f.boundSize*4));for(var u=this.boundSprites,h=0;h=this.dirties[h])){var p=d.resource;d.valid&&p&&p.source&&(s&&(d.widthf.boundCountPerBuffer*f.maxTextures))if(f.boundCountPerBuffer<=1)this.bindTexturesWithoutRT(e,t,r);else{for(var n=0;n>2].setTexture(3&n,o)}var a=n+3>>2;for(n=0;n0||u>0,d.push(t),d.push(r),d.push(i),d.push(n),d.push(o),d.push(a),d.push(h),d.push(0|s),d.push(0|u),d.push(e),d.push(l),d.push(f),this},t.prototype.tileRotate=function(e){var t=this.pointsBuf;t[t.length-3]=e},t.prototype.tileAnimX=function(e,t){var r=this.pointsBuf;r[r.length-5]=e,r[r.length-2]=t},t.prototype.tileAnimY=function(e,t){var r=this.pointsBuf;r[r.length-4]=e,r[r.length-1]=t},t.prototype.renderCanvas=function(e){if(!e.plugins.tilemap.dontUseTransform){var t=this.worldTransform;e.context.setTransform(t.a,t.b,t.c,t.d,t.tx*e.resolution,t.ty*e.resolution)}this.renderCanvasCore(e)},t.prototype.renderCanvasCore=function(e){if(0!==this.textures.length){var t=this.pointsBuf;e.context.fillStyle="#000000";for(var r=0,i=t.length;r=0?e.context.drawImage(this.textures[l].baseTexture.getDrawableSource(),n,o,u,h,a,s,u,h):(e.context.globalAlpha=.5,e.context.fillRect(a,s,u,h),e.context.globalAlpha=1)}}},t.prototype.destroyVb=function(){this.vb&&(this.vb.destroy(),this.vb=null)},t.prototype.render=function(e){var t=e.plugins.tilemap,r=t.getShader();e.batch.setObjectRenderer(t),this._globalMat=r.uniforms.projTransMatrix,e.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform),r.uniforms.shadowColor=this.shadowColor,r.uniforms.animationFrame=t.tileAnim,this.renderWebGLCore(e,t)},t.prototype.renderWebGLCore=function(e,t){var r=this.pointsBuf;if(0!==r.length){var o=r.length/12,a=t.getShader(),s=this.textures;if(0!==s.length){t.bindTextures(e,a,s),e.shader.bind(a,!1);var u=this.vb;u||(u=t.createVb(),this.vb=u,this.vbId=u.id,this.vbBuffer=null,this.modificationMarker=0),t.checkIndexBuffer(o,u);var h=f.boundCountPerBuffer,l=u.getBuffer("aVertexPosition"),d=o*u.vertPerQuad;if(0!==d){if(this.modificationMarker!==d){this.modificationMarker=d;var p=u.stride*d;if(!this.vbBuffer||this.vbBuffer.byteLength1?(x=r[g+9]>>2,y=this.offsetX*(1&r[g+9]),b=this.offsetY*(r[g+9]>>1&1)):(x=r[g+9],y=0,b=0));var T=r[g+2],S=r[g+3],I=r[g+4],C=r[g+5],A=r[g]+y,_=r[g+1]+b,w=r[g+6],P=r[g+7],R=r[g+8],M=P+2048*(r[g+10]||1024),B=R+2048*(r[g+11]||1024),L=void 0,z=void 0,D=void 0,F=void 0,O=void 0,X=void 0,E=void 0,k=void 0;if(0===w)L=A,z=_,D=A+I,F=_,O=A+I,X=_+C,E=A,k=_+C;else{var U=I/2,j=C/2;w%4!=0&&(U=C/2,j=I/2);var Y=A+U,G=_+j;w=n.groupD8.add(w,n.groupD8.NW),L=Y+U*n.groupD8.uX(w),z=G+j*n.groupD8.uY(w),w=n.groupD8.add(w,2),D=Y+U*n.groupD8.uX(w),F=G+j*n.groupD8.uY(w),w=n.groupD8.add(w,2),O=Y+U*n.groupD8.uX(w),X=G+j*n.groupD8.uY(w),w=n.groupD8.add(w,2),E=Y+U*n.groupD8.uX(w),k=G+j*n.groupD8.uY(w)}m[v++]=T,m[v++]=S,m[v++]=L,m[v++]=z,m[v++]=A+.5,m[v++]=_+.5,m[v++]=A+I-.5,m[v++]=_+C-.5,m[v++]=M,m[v++]=B,m[v++]=x,m[v++]=T+I,m[v++]=S,m[v++]=D,m[v++]=F,m[v++]=A+.5,m[v++]=_+.5,m[v++]=A+I-.5,m[v++]=_+C-.5,m[v++]=M,m[v++]=B,m[v++]=x,m[v++]=T+I,m[v++]=S+C,m[v++]=O,m[v++]=X,m[v++]=A+.5,m[v++]=_+.5,m[v++]=A+I-.5,m[v++]=_+C-.5,m[v++]=M,m[v++]=B,m[v++]=x,m[v++]=T,m[v++]=S+C,m[v++]=E,m[v++]=k,m[v++]=A+.5,m[v++]=_+.5,m[v++]=A+I-.5,m[v++]=_+C-.5,m[v++]=M,m[v++]=B,m[v++]=x}l.update(m)}e.geometry.bind(u,a),e.geometry.draw(i.DRAW_MODES.TRIANGLES,6*o,0)}}}},t.prototype.isModified=function(e){return!!(this.modificationMarker!==this.pointsBuf.length||e&&this.hasAnim)},t.prototype.clearModify=function(){this.modificationMarker=this.pointsBuf.length},t.prototype.destroy=function(t){e.prototype.destroy.call(this,t),this.destroyVb()},t}(t.Container),p=function(e){function t(t,r,i){var n=e.call(this)||this;return n.modificationMarker=0,n.shadowColor=new Float32Array([0,0,0,.5]),n._globalMat=null,n._lastLayer=null,n.initialize.apply(n,arguments),n}return l(t,e),t.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},t.prototype.initialize=function(e,t,r){!0===r&&(r=0),this.z=this.zIndex=e,this.texPerChild=r||f.boundCountPerBuffer*f.maxTextures,t&&this.setBitmaps(t)},t.prototype.setBitmaps=function(e){for(var t=0;t 5.2.1, it does not exist there.");var r,i=this.texPerChild,n=this.children.length,o=Math.ceil(e.length/i);for(r=0;r>0,p=e%this.texPerChild;return this.children[d]&&this.children[d].textures?(this._lastLayer=this.children[d],this._lastLayer.addRect(p,t,r,i,n,o,a,s,u,h,l,f)):this._lastLayer=null,this},t.prototype.tileRotate=function(e){return this._lastLayer&&this._lastLayer.tileRotate(e),this},t.prototype.tileAnimX=function(e,t){return this._lastLayer&&this._lastLayer.tileAnimX(e,t),this},t.prototype.tileAnimY=function(e,t){return this._lastLayer&&this._lastLayer.tileAnimY(e,t),this},t.prototype.addFrame=function(e,t,i,n,o,a,s){var u,h=null,l=0,p=this.children;if(this._lastLayer=null,"number"==typeof e){if(h=p[e/this.texPerChild>>0])l=e%this.texPerChild;else{if(!(h=p[0]))return this;l=0}u=h.textures[l]}else{u="string"==typeof e?r.Texture.from(e):e;for(var c=0;c>1),i.push(s),n.push(0)}return r.DO_CLEAR=!!t.DO_CLEAR,r}return l(t,e),t.prototype.bind=function(t){if(this.baseTex)throw new Error("Only one baseTexture is allowed for this resource!");this.baseTex=t,e.prototype.bind.call(this,t)},t.prototype.setTexture=function(e,t){var r=this.boundSprites[e];r.texture.baseTexture!==t.baseTexture&&(r.texture=t,this.baseTex.update(),this.dirties[e]=this.baseTex.dirtyId)},t.prototype.upload=function(e,t,r){var n=e.gl,o=this.width,a=this.height;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,void 0===t.alphaMode||t.alphaMode===i.ALPHA_MODES.UNPACK),r.dirtyId<0&&(r.width=o,r.height=a,n.texImage2D(t.target,0,t.format,o,a,0,t.format,t.type,null));var s=this.DO_CLEAR;s&&!this._clearBuffer&&(this._clearBuffer=new Uint8Array(f.boundSize*f.boundSize*4));for(var u=this.boundSprites,h=0;h=this.dirties[h])){var p=d.resource;d.valid&&p&&p.source&&(s&&(d.widthf.boundCountPerBuffer*f.maxTextures))if(f.boundCountPerBuffer<=1)this.bindTexturesWithoutRT(e,t,r);else{for(var n=0;n>2].setTexture(3&n,o)}var a=n+3>>2;for(n=0;n Date: Wed, 19 Aug 2020 22:14:51 -0400 Subject: [PATCH 8/8] Fix issues with "this" object in generateSampleSrc --- dist/pixi-tilemap.js | 4 ++-- dist/pixi-tilemap.js.map | 2 +- dist/pixi-tilemap.umd.js | 4 ++-- dist/pixi-tilemap.umd.js.map | 2 +- dist/pixi-tilemap.umd.min.js | 4 ++-- dist/pixi-tilemap.umd.min.js.map | 2 +- lib/pixi-tilemap.es.js | 4 ++-- lib/pixi-tilemap.es.js.map | 2 +- src/shaderGenerator.ts | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/dist/pixi-tilemap.js b/dist/pixi-tilemap.js index 9b288770..2c4923ae 100644 --- a/dist/pixi-tilemap.js +++ b/dist/pixi-tilemap.js @@ -2,7 +2,7 @@ /*! * pixi-tilemap - v2.0.6 - * Compiled Fri, 14 Aug 2020 18:32:35 UTC + * Compiled Thu, 20 Aug 2020 02:13:52 UTC * * pixi-tilemap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -706,7 +706,7 @@ function fillSamplers(shader, maxTextures) { } function generateFragmentSrc(maxTextures, fragmentSrc) { return fragmentSrc.replace(/%count%/gi, maxTextures + "") - .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures)); + .replace(/%forloop%/gi, generateSampleSrc(maxTextures)); } function generateSampleSrc(maxTextures) { var src = ''; diff --git a/dist/pixi-tilemap.js.map b/dist/pixi-tilemap.js.map index d89e33aa..b09db39c 100644 --- a/dist/pixi-tilemap.js.map +++ b/dist/pixi-tilemap.js.map @@ -1 +1 @@ -{"version":3,"file":"pixi-tilemap.js","sources":["../src/CanvasTileRenderer.ts","../node_modules/tslib/tslib.es6.js","../src/Constant.ts","../src/RectTileLayer.ts","../src/CompositeRectTileLayer.ts","../src/GraphicsLayer.ts","../src/MultiTextureResource.ts","../src/shaderGenerator.ts","../src/RectTileShader.ts","../src/TileRenderer.ts","../src/ZLayer.ts","../src/exporter.ts","../src/index.ts"],"sourcesContent":["/// \n\nimport { Renderer } from '@pixi/core';\n\nexport class CanvasTileRenderer {\n renderer: Renderer;\n tileAnim = [0, 0];\n dontUseTransform = false;\n\n constructor(renderer: Renderer) {\n this.renderer = renderer;\n this.tileAnim = [0, 0];\n }\n}\n\nconst cr = (PIXI as any).CanvasRenderer;\n\nif (cr) {\n cr.registerPlugin('tilemap', CanvasTileRenderer);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","export const Constant = {\n maxTextures: 16,\n bufferSize: 2048,\n boundSize: 1024,\n boundCountPerBuffer: 1,\n use32bitIndex: false,\n SCALE_MODE: PIXI.SCALE_MODES.LINEAR,\n DO_CLEAR: true\n};","/// \n\nimport { Container } from '@pixi/display';\nimport { Constant } from './Constant';\nimport { DRAW_MODES } from '@pixi/constants';\nimport { Texture, Renderer } from '@pixi/core';\nimport { TileRenderer } from './TileRenderer';\nimport { Matrix, groupD8 } from '@pixi/math';\n\nimport type { RectTileGeom } from './RectTileShader';\n\nexport const POINT_STRUCT_SIZE = 12;\n\nexport class RectTileLayer extends Container {\n constructor(zIndex: number, texture: Texture | Array) {\n super();\n this.initialize(zIndex, texture);\n }\n\n zIndex = 0;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n\n pointsBuf: Array = [];\n hasAnim = false;\n textures: Array;\n\n offsetX = 0;\n offsetY = 0;\n compositeParent = false;\n\n initialize(zIndex: number, textures: Texture | Array) {\n if (!textures) {\n textures = [];\n } else if (!(textures instanceof Array) && (textures as Texture).baseTexture) {\n textures = [textures as Texture];\n }\n this.textures = textures as Array;\n this.zIndex = zIndex;\n // this.visible = false;\n }\n\n clear() {\n this.pointsBuf.length = 0;\n this.modificationMarker = 0;\n this.hasAnim = false;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX: number, animY: number) {\n let texture: Texture;\n let textureIndex = 0;\n\n if (typeof texture_ === \"number\") {\n textureIndex = texture_;\n texture = this.textures[textureIndex];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n let found = false;\n let textureList = this.textures;\n for (let i = 0; i < textureList.length; i++) {\n if (textureList[i].baseTexture === texture.baseTexture) {\n textureIndex = i;\n found = true;\n break;\n }\n }\n\n if (!found) {\n // textureIndex = this.textures.length;\n // this.textures.push(texture);\n return false;\n }\n }\n\n this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate);\n return true;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number,\n animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this {\n let pb = this.pointsBuf;\n this.hasAnim = this.hasAnim || animX > 0 || animY > 0;\n pb.push(u);\n pb.push(v);\n pb.push(x);\n pb.push(y);\n pb.push(tileWidth);\n pb.push(tileHeight);\n pb.push(rotate);\n pb.push(animX | 0);\n pb.push(animY | 0);\n pb.push(textureIndex);\n pb.push(animCountX);\n pb.push(animCountY);\n\n return this;\n }\n\n tileRotate(rotate: number) {\n const pb = this.pointsBuf;\n pb[pb.length - 3] = rotate;\n }\n\n tileAnimX(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 5] = offset;\n pb[pb.length - 2] = count;\n }\n\n tileAnimY(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 4] = offset;\n pb[pb.length - 1] = count;\n }\n\n renderCanvas(renderer: any) {\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n this.renderCanvasCore(renderer);\n }\n\n renderCanvasCore(renderer: any) {\n if (this.textures.length === 0) return;\n let points = this.pointsBuf;\n renderer.context.fillStyle = '#000000';\n for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) {\n let x1 = points[i], y1 = points[i + 1];\n let x2 = points[i + 2], y2 = points[i + 3];\n let w = points[i + 4];\n let h = points[i + 5];\n var rotate = points[i + 6];\n x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0];\n y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1];\n let textureIndex = points[i + 9];\n // canvas does not work with rotate yet\n if (textureIndex >= 0) {\n renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h);\n } else {\n renderer.context.globalAlpha = 0.5;\n renderer.context.fillRect(x2, y2, w, h);\n renderer.context.globalAlpha = 1;\n }\n }\n }\n\n vbId = 0;\n vb: RectTileGeom = null;\n vbBuffer: ArrayBuffer = null;\n vbArray: Float32Array = null;\n vbInts: Uint32Array = null;\n\n destroyVb() {\n if (this.vb) {\n this.vb.destroy();\n this.vb = null;\n }\n }\n\n render(renderer: Renderer) {\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n this.renderWebGLCore(renderer, plugin);\n }\n\n renderWebGLCore(renderer: Renderer, plugin: TileRenderer) {\n let points = this.pointsBuf;\n if (points.length === 0) return;\n let rectsCount = points.length / POINT_STRUCT_SIZE;\n\n let shader = plugin.getShader();\n let textures = this.textures;\n if (textures.length === 0) return;\n\n plugin.bindTextures(renderer, shader, textures);\n renderer.shader.bind(shader, false);\n\n //lost context! recover!\n let vb = this.vb;\n if (!vb) {\n vb = plugin.createVb();\n this.vb = vb;\n this.vbId = (vb as any).id;\n this.vbBuffer = null;\n this.modificationMarker = 0;\n }\n\n plugin.checkIndexBuffer(rectsCount, vb);\n const boundCountPerBuffer = Constant.boundCountPerBuffer;\n\n let vertexBuf = vb.getBuffer('aVertexPosition');\n //if layer was changed, re-upload vertices\n let vertices = rectsCount * vb.vertPerQuad;\n if (vertices === 0) return;\n if (this.modificationMarker !== vertices) {\n this.modificationMarker = vertices;\n let vs = vb.stride * vertices;\n if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {\n //!@#$ happens, need resize\n let bk = vb.stride;\n while (bk < vs) {\n bk *= 2;\n }\n this.vbBuffer = new ArrayBuffer(bk);\n this.vbArray = new Float32Array(this.vbBuffer);\n this.vbInts = new Uint32Array(this.vbBuffer);\n vertexBuf.update(this.vbBuffer);\n }\n\n let arr = this.vbArray, ints = this.vbInts;\n //upload vertices!\n let sz = 0;\n //let tint = 0xffffffff;\n let textureId: number = 0;\n let shiftU: number = this.offsetX;\n let shiftV: number = this.offsetY;\n\n //let tint = 0xffffffff;\n let tint = -1;\n for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) {\n let eps = 0.5;\n if (this.compositeParent) {\n if (boundCountPerBuffer > 1) {\n //TODO: what if its more than 4?\n textureId = (points[i + 9] >> 2);\n shiftU = this.offsetX * (points[i + 9] & 1);\n shiftV = this.offsetY * ((points[i + 9] >> 1) & 1);\n } else {\n textureId = points[i + 9];\n shiftU = 0;\n shiftV = 0;\n }\n }\n let x = points[i + 2], y = points[i + 3];\n let w = points[i + 4], h = points[i + 5];\n let u = points[i] + shiftU, v = points[i + 1] + shiftV;\n let rotate = points[i + 6];\n\n const animX = points[i + 7], animY = points[i + 8];\n const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024;\n const animXEncoded = animX + (animWidth * 2048);\n const animYEncoded = animY + (animHeight * 2048);\n\n let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number;\n if (rotate === 0) {\n u0 = u;\n v0 = v;\n u1 = u + w;\n v1 = v;\n u2 = u + w;\n v2 = v + h;\n u3 = u;\n v3 = v + h;\n } else {\n let w2 = w / 2;\n let h2 = h / 2;\n if (rotate % 4 !== 0) {\n w2 = h / 2;\n h2 = w / 2;\n }\n const cX = u + w2;\n const cY = v + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW);\n u0 = cX + (w2 * groupD8.uX(rotate));\n v0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n u1 = cX + (w2 * groupD8.uX(rotate));\n v1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u2 = cX + (w2 * groupD8.uX(rotate));\n v2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u3 = cX + (w2 * groupD8.uX(rotate));\n v3 = cY + (h2 * groupD8.uY(rotate));\n }\n\n arr[sz++] = x;\n arr[sz++] = y;\n arr[sz++] = u0;\n arr[sz++] = v0;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y;\n arr[sz++] = u1;\n arr[sz++] = v1;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y + h;\n arr[sz++] = u2;\n arr[sz++] = v2;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x;\n arr[sz++] = y + h;\n arr[sz++] = u3;\n arr[sz++] = v3;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n }\n\n vertexBuf.update(arr);\n }\n\n (renderer.geometry as any).bind(vb, shader);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES, rectsCount * 6, 0);\n }\n\n isModified(anim: boolean) {\n if (this.modificationMarker !== this.pointsBuf.length ||\n anim && this.hasAnim) {\n return true;\n }\n return false;\n }\n\n clearModify() {\n this.modificationMarker = this.pointsBuf.length;\n }\n\n destroy(options?: any) {\n super.destroy(options);\n this.destroyVb();\n }\n}\n","/// \n\nimport { Container } from '@pixi/display';\nimport { Texture, Renderer } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { Constant } from './Constant';\nimport { RectTileLayer } from './RectTileLayer';\n\nexport class CompositeRectTileLayer extends Container {\n constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n super();\n this.initialize.apply(this, arguments);\n }\n\n updateTransform() {\n (this as any).displayObjectUpdateTransform();\n }\n\n z: number;\n zIndex: number;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n _lastLayer: RectTileLayer = null;\n\n texPerChild: number;\n\n initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n if (texPerChild as any === true) {\n //old format, ignore it!\n texPerChild = 0;\n }\n this.z = this.zIndex = zIndex;\n this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures;\n if (bitmaps) {\n this.setBitmaps(bitmaps);\n }\n }\n\n setBitmaps(bitmaps: Array) {\n for (let i=0;i 5.2.1, it does not exist there.`);\n }\n }\n let texPerChild = this.texPerChild;\n let len1 = this.children.length;\n let len2 = Math.ceil(bitmaps.length / texPerChild);\n let i: number;\n for (i = 0; i < len1; i++) {\n (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);\n }\n for (i = len1; i < len2; i++) {\n let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild));\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n this.addChild(layer);\n }\n }\n\n clear() {\n for (let i = 0; i < this.children.length; i++) {\n (this.children[i] as RectTileLayer).clear();\n }\n this.modificationMarker = 0;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this {\n const childIndex: number = textureIndex / this.texPerChild >> 0;\n const textureId: number = textureIndex % this.texPerChild;\n\n if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) {\n this._lastLayer = (this.children[childIndex] as RectTileLayer);\n this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight);\n } else {\n this._lastLayer = null;\n }\n\n return this;\n }\n\n tileRotate(rotate: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileRotate(rotate);\n }\n return this;\n }\n\n tileAnimX(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimX(offset, count);\n }\n return this;\n }\n\n tileAnimY(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimY(offset, count);\n }\n return this;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this {\n let texture: Texture;\n let layer: RectTileLayer = null;\n let ind: number = 0;\n let children = this.children;\n\n this._lastLayer = null;\n if (typeof texture_ === \"number\") {\n let childIndex = texture_ / this.texPerChild >> 0;\n layer = children[childIndex] as RectTileLayer;\n\n if (!layer) {\n layer = children[0] as RectTileLayer;\n if (!layer) {\n return this;\n }\n ind = 0;\n } else {\n ind = texture_ % this.texPerChild;\n }\n\n texture = layer.textures[ind];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n let tex = child.textures;\n for (let j = 0; j < tex.length; j++) {\n if (tex[j].baseTexture === texture.baseTexture) {\n layer = child;\n ind = j;\n break;\n }\n }\n if (layer) {\n break;\n }\n }\n\n if (!layer) {\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n if (child.textures.length < this.texPerChild) {\n layer = child;\n ind = child.textures.length;\n child.textures.push(texture);\n break;\n }\n }\n if (!layer) {\n layer = new RectTileLayer(this.zIndex, texture);\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n children.push(layer);\n ind = 0;\n }\n }\n }\n\n this._lastLayer = layer;\n layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight);\n return this;\n }\n\n renderCanvas(renderer: any) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderCanvasCore(renderer);\n }\n }\n\n render(renderer: Renderer) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n //TODO: dont create new array, please\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n renderer.shader.bind(shader, false);\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin);\n }\n }\n\n isModified(anim: boolean) {\n let layers = this.children;\n if (this.modificationMarker !== layers.length) {\n return true;\n }\n for (let i = 0; i < layers.length; i++) {\n if ((layers[i] as RectTileLayer).isModified(anim)) {\n return true;\n }\n }\n return false;\n }\n\n clearModify() {\n let layers = this.children;\n this.modificationMarker = layers.length;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).clearModify();\n }\n }\n}","/// \n\nimport { Matrix } from '@pixi/math';\nimport { Graphics } from '@pixi/graphics';\n\nexport class GraphicsLayer extends Graphics {\n constructor(zIndex: number) {\n super();\n this.zIndex = zIndex;\n }\n\n renderCanvas(renderer: any) {\n let wt: Matrix = null;\n if (renderer.plugins.tilemap.dontUseTransform) {\n wt = this.transform.worldTransform;\n this.transform.worldTransform = Matrix.IDENTITY;\n }\n renderer.plugins.graphics.render(this);\n if (renderer.plugins.tilemap.dontUseTransform) {\n this.transform.worldTransform = wt;\n }\n renderer.context.globalAlpha = 1.0;\n }\n\n // renderWebGL(renderer: PIXI.Renderer) {\n // if (!this._webGL[renderer.CONTEXT_UID])\n // this.dirty++;\n // super.renderWebGL(renderer)\n // }\n\n isModified(anim: boolean): boolean {\n return false;\n }\n\n clearModify() {\n }\n}\n","/// \n\nimport { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, Renderer, Texture, GLTexture, resources } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Constant } from './Constant';\n\nexport interface IMultiTextureOptions {\n\tboundCountPerBuffer: number;\n\tboundSize: number;\n\tbufferSize: number;\n\tDO_CLEAR?: boolean;\n}\n\nexport class MultiTextureResource extends resources.Resource {\n\tconstructor(options: IMultiTextureOptions) {\n\t\tsuper(options.bufferSize, options.bufferSize);\n\n\t\tconst bounds = this.boundSprites;\n\t\tconst dirties = this.dirties;\n\t\tthis.boundSize = options.boundSize;\n\t\tfor (let j = 0; j < options.boundCountPerBuffer; j++) {\n\t\t\tconst spr = new Sprite();\n\t\t\tspr.position.x = options.boundSize * (j & 1);\n\t\t\tspr.position.y = options.boundSize * (j >> 1);\n\t\t\tbounds.push(spr);\n\t\t\tdirties.push(0);\n\t\t}\n\t\tthis.DO_CLEAR = !!options.DO_CLEAR;\n\t}\n\n\tDO_CLEAR = false;\n\tboundSize: number = 0;\n\t_clearBuffer: Uint8Array = null;\n\n\tbind(baseTexture: BaseTexture) {\n\t\tif (this.baseTex) {\n\t\t\tthrow new Error('Only one baseTexture is allowed for this resource!')\n\t\t}\n\t\tthis.baseTex = baseTexture;\n\t\tsuper.bind(baseTexture);\n\t}\n\n\tbaseTex: BaseTexture = null;\n\tboundSprites: Array = [];\n\tdirties: Array = [];\n\n\tsetTexture(ind: number, texture: Texture) {\n\t\tconst spr = this.boundSprites[ind];\n\t\tif (spr.texture.baseTexture === texture.baseTexture) {\n\t\t\treturn;\n\t\t}\n\t\tspr.texture = texture;\n\t\tthis.baseTex.update();\n\t\tthis.dirties[ind] = (this.baseTex as any).dirtyId;\n\t}\n\n\tupload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture) {\n\t\tconst { gl } = renderer as any;\n\n\t\tconst {width, height} = this;\n\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined ||\n\t\t\ttexture.alphaMode === ALPHA_MODES.UNPACK);\n\n\t\tif (glTexture.dirtyId < 0) {\n\t\t\t(glTexture as any).width = width;\n\t\t\t(glTexture as any).height = height;\n\n\t\t\tgl.texImage2D(texture.target, 0,\n\t\t\t\ttexture.format,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\t0,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tnull);\n\t\t}\n\n\t\tconst doClear = this.DO_CLEAR;\n\t\tif (doClear && !this._clearBuffer) {\n\t\t\tthis._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4);\n\t\t}\n\n\t\tconst bounds = this.boundSprites;\n\t\tfor (let i = 0; i < bounds.length; i++) {\n\t\t\tconst spr = bounds[i];\n\t\t\tconst tex = spr.texture.baseTexture;\n\t\t\tif (glTexture.dirtyId >= this.dirties[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst res = tex.resource as any;\n\t\t\tif (!tex.valid || !res || !res.source) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (doClear && (tex.width < this.boundSize || tex.height < this.boundSize))\n\t\t\t{\n\t\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\t\tspr.position.x,\n\t\t\t\t\tspr.position.y,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\ttexture.format,\n\t\t\t\t\ttexture.type,\n\t\t\t\t\tthis._clearBuffer);\n\t\t\t}\n\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\tspr.position.x,\n\t\t\t\tspr.position.y,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tres.source);\n\t\t}\n\n\t\treturn true;\n\t}\n}\n","import { Constant } from './Constant';\n\nimport type { TilemapShader } from './RectTileShader';\n\n\nexport function fillSamplers(shader: TilemapShader, maxTextures: number) {\n let sampleValues: Array = [];\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n shader.uniforms.uSamplers = sampleValues;\n\n let samplerSize: Array = [];\n for (let i = 0; i < maxTextures; i++) {\n samplerSize.push(1.0 / Constant.bufferSize);\n samplerSize.push(1.0 / Constant.bufferSize);\n }\n shader.uniforms.uSamplerSize = samplerSize;\n}\n\nexport function generateFragmentSrc(maxTextures: number, fragmentSrc: string) {\n return fragmentSrc.replace(/%count%/gi, maxTextures + \"\")\n .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n}\n\nexport function generateSampleSrc(maxTextures: number) {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n src += 'if(vTextureId <= -1.0) {';\n src += '\\n\\tcolor = shadowColor;';\n src += '\\n}';\n\n for (let i = 0; i < maxTextures; i++)\n {\n src += '\\nelse ';\n\n if(i < maxTextures-1)\n {\n src += 'if(textureId == ' + i + '.0)';\n }\n\n src += '\\n{';\n src += '\\n\\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);';\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n}\n","/// \n\nimport * as shaderGenerator from './shaderGenerator';\n\nimport { Buffer, Geometry, Shader } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nlet rectShaderFrag = `\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n`;\nlet rectShaderVert = `\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n`;\n\nexport abstract class TilemapShader extends Shader {\n\tmaxTextures = 0;\n\n\tconstructor(maxTextures: number, shaderVert: string, shaderFrag: string) {\n\t\tsuper(\n\t\t\tnew PIXI.Program(\n\t\t\t\tshaderVert,\n\t\t\t\tshaderFrag),\n\t\t\t{\n\t\t\t\tanimationFrame: new Float32Array(2),\n\t\t\t\tuSamplers: [],\n\t\t\t\tuSamplerSize: [],\n\t\t\t\tprojTransMatrix: new Matrix()\n\t\t\t}\n\t\t);\n\t\tthis.maxTextures = maxTextures;\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileShader extends TilemapShader {\n\tconstructor(maxTextures: number) {\n\t\tsuper(\n\t\t\tmaxTextures,\n\t\t\trectShaderVert,\n\t\t\tshaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)\n\t\t);\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileGeom extends Geometry {\n\tvertSize = 11;\n\tvertPerQuad = 4;\n\tstride = this.vertSize * 4;\n\tlastTimeAccess = 0;\n\n\tconstructor() {\n\t\tsuper();\n\t\tconst buf = this.buf = new Buffer(new Float32Array(2), true, false);\n\t\tthis.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0)\n\t\t\t.addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4)\n\t\t\t.addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4)\n\t\t\t.addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4)\n\t\t\t.addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4);\n\t}\n\n\tbuf: PIXI.Buffer;\n}","import { WRAP_MODES } from '@pixi/constants';\nimport { BaseTexture, Buffer, resources, ObjectRenderer, Texture, Renderer } from '@pixi/core';\nimport { Constant } from './Constant';\nimport { RectTileGeom, RectTileShader } from './RectTileShader';\nimport { MultiTextureResource } from './MultiTextureResource';\n\nimport type { TilemapShader } from './RectTileShader';\n\n/**\n * Renderer for rectangle tiles.\n */\nexport class TileRenderer extends ObjectRenderer {\n\trenderer: Renderer;\n\tgl: WebGLRenderingContext;\n\tsn: number = -1;\n\tindexBuffer: PIXI.Buffer = null;\n\tibLen: number = 0;\n\ttileAnim = [0, 0];\n\ttexLoc: Array = [];\n\n\trectShader: RectTileShader;\n\ttexResources: Array = [];\n\n\tconstructor(renderer: Renderer) {\n\t\tsuper(renderer);\n\t\tthis.rectShader = new RectTileShader(Constant.maxTextures);\n\t\tthis.indexBuffer = new Buffer(undefined, true, true);\n\t\tthis.checkIndexBuffer(2000);\n\t\tthis.initBounds();\n\t}\n\n\tinitBounds() {\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tfor (let i = 0; i < maxTextures; i++) {\n\t\t\tconst resource = new MultiTextureResource(Constant);\n\t\t\tconst baseTex = new BaseTexture(resource);\n\t\t\tbaseTex.scaleMode = Constant.SCALE_MODE;\n\t\t\tbaseTex.wrapMode = WRAP_MODES.CLAMP;\n\t\t\tthis.texResources.push(resource);\n\t\t}\n\t}\n\n\tbindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tlet samplerSize: Array = (shader as any).uniforms.uSamplerSize;\n\t\tthis.texLoc.length = 0;\n\t\tfor (let i = 0; i < textures.length; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trenderer.texture.bind(textures[i], i);\n\t\t\t//TODO: add resolution here\n\t\t\tsamplerSize[i * 2] = 1.0 / textures[i].baseTexture.width;\n\t\t\tsamplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height;\n\t\t}\n\t\t(shader as any).uniforms.uSamplerSize = samplerSize;\n\t}\n\n\tbindTextures(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tconst len = textures.length;\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tif (len > Constant.boundCountPerBuffer * maxTextures) {\n\t\t\treturn;\n\t\t}\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\tthis.bindTexturesWithoutRT(renderer, shader, textures);\n\t\t\treturn;\n\t\t}\n\n\t\tlet i = 0;\n\t\tfor (; i < len; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) continue;\n\t\t\tconst multi = this.texResources[i >> 2];\n\t\t\tmulti.setTexture(i & 3, texture);\n\t\t}\n\n\t\tlet gltsUsed = (i + 3) >> 2;\n\t\tfor (i = 0; i < gltsUsed; i++) {\n\t\t\t//remove \"i, true\" after resolving a bug\n\t\t\trenderer.texture.bind(this.texResources[i].baseTex, i);\n\t\t}\n\t}\n\n\tstart() {\n\t\t//sorry, nothing\n\t}\n\n\tcreateVb() {\n\t\tconst geom = new RectTileGeom();\n\t\tgeom.addIndex(this.indexBuffer);\n\t\tgeom.lastTimeAccess = Date.now();\n\t\treturn geom;\n\t}\n\n\tcheckIndexBuffer(size: number, vb: RectTileGeom = null) {\n\t\tconst totalIndices = size * 6;\n\n\t\tif (totalIndices <= this.ibLen) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet len = totalIndices;\n\t\twhile (len < totalIndices) {\n\t\t\tlen <<= 1;\n\t\t}\n\n\t\tthis.ibLen = totalIndices;\n\t\tthis.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size,\n\t\t\tConstant.use32bitIndex ? new Uint32Array(size * 6) : undefined));\n\n\t\t// \tTODO: create new index buffer instead?\n\t\t// if (vb) {\n\t\t// \tconst curIndex = vb.getIndex();\n\t\t// \tif (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) {\n\t\t// \t\tthis.swapIndex(vb, this.indexBuffer);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t// swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) {\n\t\t// let buffers = (geom as any).buffers;\n\t\t// const oldIndex = geom.getIndex();\n\t\t// let ind = buffers.indexOf(oldIndex);\n\t\t// if (ind >= 0) {\n\t\t// \tbuffers.splice(ind, 1);\n\t\t// }\n\t\t// geom.addIndex(indexBuf);\n\t// }\n\n\tgetShader(): TilemapShader {\n\t\treturn this.rectShader;\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\t// this.rectShader.destroy();\n\t\tthis.rectShader = null;\n\t}\n}\n\nRenderer.registerPlugin('tilemap', TileRenderer as any);\n","/// \n\nimport { Container } from '@pixi/display';\n\nimport type { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport type { Matrix } from '@pixi/math';\n\nexport class ZLayer extends Container {\n\n constructor(tilemap: Container, zIndex: number) {\n super();\n this.tilemap = tilemap;\n this.z = zIndex;\n }\n\n tilemap: any;\n z: number;\n zIndex: number;\n _previousLayers: number;\n canvasBuffer: HTMLCanvasElement;\n _tempRender: any;\n _lastAnimationFrame: number = -1;\n layerTransform: Matrix;\n\n clear() {\n let layers = this.children as Array;\n for (let i = 0; i < layers.length; i++)\n layers[i].clear();\n this._previousLayers = 0;\n }\n\n cacheIfDirty() {\n let tilemap: any = this.tilemap;\n let layers = this.children as Array;\n let modified = this._previousLayers !== layers.length;\n this._previousLayers = layers.length;\n let buf = this.canvasBuffer;\n let tempRender = this._tempRender;\n if (!buf) {\n buf = this.canvasBuffer = document.createElement('canvas');\n tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf});\n tempRender.context = tempRender.rootContext;\n tempRender.plugins.tilemap.dontUseTransform = true;\n }\n if (buf.width !== tilemap._layerWidth ||\n buf.height !== tilemap._layerHeight) {\n buf.width = tilemap._layerWidth;\n buf.height = tilemap._layerHeight;\n modified = true;\n }\n let i: number;\n if (!modified) {\n for (i = 0; i < layers.length; i++) {\n if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) {\n modified = true;\n break;\n }\n }\n }\n this._lastAnimationFrame = tilemap.animationFrame;\n if (modified) {\n if (tilemap._hackRenderer) {\n tilemap._hackRenderer(tempRender);\n }\n tempRender.context.clearRect(0, 0, buf.width, buf.height);\n for (i = 0; i < layers.length; i++) {\n layers[i].clearModify();\n layers[i].renderCanvas(tempRender);\n }\n }\n this.layerTransform = this.worldTransform;\n for (i = 0; i < layers.length; i++) {\n this.layerTransform = layers[i].worldTransform;\n break;\n }\n }\n\n renderCanvas(renderer: any) {\n this.cacheIfDirty();\n let wt = this.layerTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n let tilemap = this.tilemap;\n renderer.context.drawImage(this.canvasBuffer, 0, 0);\n }\n}\n","/// \n\nnamespace pixi_tilemap {\n (PIXI as any).tilemap = pixi_tilemap;\n}\n\n// This makes exporter.ts a module!\nexport default {}\n","import { CanvasTileRenderer } from './CanvasTileRenderer';\nimport { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport { Constant } from './Constant';\nimport { GraphicsLayer } from './GraphicsLayer';\nimport { MultiTextureResource } from './MultiTextureResource';\nimport { RectTileLayer } from './RectTileLayer';\nimport { TilemapShader, RectTileShader, RectTileGeom } from './RectTileShader';\nimport { TileRenderer } from './TileRenderer';\nimport { ZLayer } from './ZLayer';\n\nexport const pixi_tilemap = {\n CanvasTileRenderer,\n CompositeRectTileLayer,\n Constant,\n GraphicsLayer,\n MultiTextureResource,\n RectTileLayer,\n TilemapShader,\n RectTileShader,\n RectTileGeom,\n TileRenderer,\n ZLayer,\n};\n\nexport * from './CanvasTileRenderer';\nexport * from './CompositeRectTileLayer';\nexport * from './Constant';\nexport * from './exporter';\nexport * from './GraphicsLayer';\nexport * from './MultiTextureResource';\nexport * from './RectTileLayer';\nexport * from './RectTileShader';\nexport * from './shaderGenerator';\nexport * from './TileRenderer';\nexport * from './ZLayer';"],"names":["Texture","groupD8","DRAW_MODES","Container","Matrix","Graphics","Sprite","ALPHA_MODES","resources","shaderGenerator.fillSamplers","Shader","shaderGenerator.generateFragmentSrc","Buffer","Geometry","BaseTexture","WRAP_MODES","ObjectRenderer","Renderer","pixi_tilemap"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;IASI,4BAAY,QAAkB;QAH9B,aAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAClB,qBAAgB,GAAG,KAAK,CAAC;QAGrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KAC1B;IACL,yBAAC;AAAD,CAAC,IAAA;AAED,IAAM,EAAE,GAAI,IAAY,CAAC,cAAc,CAAC;AAExC,IAAI,EAAE,EAAE;IACJ,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;;;AClBrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE;AACnC,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc;AACzC,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC;AACpF,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ts","../src/RectTileLayer.ts","../src/CompositeRectTileLayer.ts","../src/GraphicsLayer.ts","../src/MultiTextureResource.ts","../src/shaderGenerator.ts","../src/RectTileShader.ts","../src/TileRenderer.ts","../src/ZLayer.ts","../src/exporter.ts","../src/index.ts"],"sourcesContent":["/// \n\nimport { Renderer } from '@pixi/core';\n\nexport class CanvasTileRenderer {\n renderer: Renderer;\n tileAnim = [0, 0];\n dontUseTransform = false;\n\n constructor(renderer: Renderer) {\n this.renderer = renderer;\n this.tileAnim = [0, 0];\n }\n}\n\nconst cr = (PIXI as any).CanvasRenderer;\n\nif (cr) {\n cr.registerPlugin('tilemap', CanvasTileRenderer);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","export const Constant = {\n maxTextures: 16,\n bufferSize: 2048,\n boundSize: 1024,\n boundCountPerBuffer: 1,\n use32bitIndex: false,\n SCALE_MODE: PIXI.SCALE_MODES.LINEAR,\n DO_CLEAR: true\n};","/// \n\nimport { Container } from '@pixi/display';\nimport { Constant } from './Constant';\nimport { DRAW_MODES } from '@pixi/constants';\nimport { Texture, Renderer } from '@pixi/core';\nimport { TileRenderer } from './TileRenderer';\nimport { Matrix, groupD8 } from '@pixi/math';\n\nimport type { RectTileGeom } from './RectTileShader';\n\nexport const POINT_STRUCT_SIZE = 12;\n\nexport class RectTileLayer extends Container {\n constructor(zIndex: number, texture: Texture | Array) {\n super();\n this.initialize(zIndex, texture);\n }\n\n zIndex = 0;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n\n pointsBuf: Array = [];\n hasAnim = false;\n textures: Array;\n\n offsetX = 0;\n offsetY = 0;\n compositeParent = false;\n\n initialize(zIndex: number, textures: Texture | Array) {\n if (!textures) {\n textures = [];\n } else if (!(textures instanceof Array) && (textures as Texture).baseTexture) {\n textures = [textures as Texture];\n }\n this.textures = textures as Array;\n this.zIndex = zIndex;\n // this.visible = false;\n }\n\n clear() {\n this.pointsBuf.length = 0;\n this.modificationMarker = 0;\n this.hasAnim = false;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX: number, animY: number) {\n let texture: Texture;\n let textureIndex = 0;\n\n if (typeof texture_ === \"number\") {\n textureIndex = texture_;\n texture = this.textures[textureIndex];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n let found = false;\n let textureList = this.textures;\n for (let i = 0; i < textureList.length; i++) {\n if (textureList[i].baseTexture === texture.baseTexture) {\n textureIndex = i;\n found = true;\n break;\n }\n }\n\n if (!found) {\n // textureIndex = this.textures.length;\n // this.textures.push(texture);\n return false;\n }\n }\n\n this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate);\n return true;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number,\n animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this {\n let pb = this.pointsBuf;\n this.hasAnim = this.hasAnim || animX > 0 || animY > 0;\n pb.push(u);\n pb.push(v);\n pb.push(x);\n pb.push(y);\n pb.push(tileWidth);\n pb.push(tileHeight);\n pb.push(rotate);\n pb.push(animX | 0);\n pb.push(animY | 0);\n pb.push(textureIndex);\n pb.push(animCountX);\n pb.push(animCountY);\n\n return this;\n }\n\n tileRotate(rotate: number) {\n const pb = this.pointsBuf;\n pb[pb.length - 3] = rotate;\n }\n\n tileAnimX(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 5] = offset;\n pb[pb.length - 2] = count;\n }\n\n tileAnimY(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 4] = offset;\n pb[pb.length - 1] = count;\n }\n\n renderCanvas(renderer: any) {\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n this.renderCanvasCore(renderer);\n }\n\n renderCanvasCore(renderer: any) {\n if (this.textures.length === 0) return;\n let points = this.pointsBuf;\n renderer.context.fillStyle = '#000000';\n for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) {\n let x1 = points[i], y1 = points[i + 1];\n let x2 = points[i + 2], y2 = points[i + 3];\n let w = points[i + 4];\n let h = points[i + 5];\n var rotate = points[i + 6];\n x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0];\n y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1];\n let textureIndex = points[i + 9];\n // canvas does not work with rotate yet\n if (textureIndex >= 0) {\n renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h);\n } else {\n renderer.context.globalAlpha = 0.5;\n renderer.context.fillRect(x2, y2, w, h);\n renderer.context.globalAlpha = 1;\n }\n }\n }\n\n vbId = 0;\n vb: RectTileGeom = null;\n vbBuffer: ArrayBuffer = null;\n vbArray: Float32Array = null;\n vbInts: Uint32Array = null;\n\n destroyVb() {\n if (this.vb) {\n this.vb.destroy();\n this.vb = null;\n }\n }\n\n render(renderer: Renderer) {\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n this.renderWebGLCore(renderer, plugin);\n }\n\n renderWebGLCore(renderer: Renderer, plugin: TileRenderer) {\n let points = this.pointsBuf;\n if (points.length === 0) return;\n let rectsCount = points.length / POINT_STRUCT_SIZE;\n\n let shader = plugin.getShader();\n let textures = this.textures;\n if (textures.length === 0) return;\n\n plugin.bindTextures(renderer, shader, textures);\n renderer.shader.bind(shader, false);\n\n //lost context! recover!\n let vb = this.vb;\n if (!vb) {\n vb = plugin.createVb();\n this.vb = vb;\n this.vbId = (vb as any).id;\n this.vbBuffer = null;\n this.modificationMarker = 0;\n }\n\n plugin.checkIndexBuffer(rectsCount, vb);\n const boundCountPerBuffer = Constant.boundCountPerBuffer;\n\n let vertexBuf = vb.getBuffer('aVertexPosition');\n //if layer was changed, re-upload vertices\n let vertices = rectsCount * vb.vertPerQuad;\n if (vertices === 0) return;\n if (this.modificationMarker !== vertices) {\n this.modificationMarker = vertices;\n let vs = vb.stride * vertices;\n if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {\n //!@#$ happens, need resize\n let bk = vb.stride;\n while (bk < vs) {\n bk *= 2;\n }\n this.vbBuffer = new ArrayBuffer(bk);\n this.vbArray = new Float32Array(this.vbBuffer);\n this.vbInts = new Uint32Array(this.vbBuffer);\n vertexBuf.update(this.vbBuffer);\n }\n\n let arr = this.vbArray, ints = this.vbInts;\n //upload vertices!\n let sz = 0;\n //let tint = 0xffffffff;\n let textureId: number = 0;\n let shiftU: number = this.offsetX;\n let shiftV: number = this.offsetY;\n\n //let tint = 0xffffffff;\n let tint = -1;\n for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) {\n let eps = 0.5;\n if (this.compositeParent) {\n if (boundCountPerBuffer > 1) {\n //TODO: what if its more than 4?\n textureId = (points[i + 9] >> 2);\n shiftU = this.offsetX * (points[i + 9] & 1);\n shiftV = this.offsetY * ((points[i + 9] >> 1) & 1);\n } else {\n textureId = points[i + 9];\n shiftU = 0;\n shiftV = 0;\n }\n }\n let x = points[i + 2], y = points[i + 3];\n let w = points[i + 4], h = points[i + 5];\n let u = points[i] + shiftU, v = points[i + 1] + shiftV;\n let rotate = points[i + 6];\n\n const animX = points[i + 7], animY = points[i + 8];\n const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024;\n const animXEncoded = animX + (animWidth * 2048);\n const animYEncoded = animY + (animHeight * 2048);\n\n let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number;\n if (rotate === 0) {\n u0 = u;\n v0 = v;\n u1 = u + w;\n v1 = v;\n u2 = u + w;\n v2 = v + h;\n u3 = u;\n v3 = v + h;\n } else {\n let w2 = w / 2;\n let h2 = h / 2;\n if (rotate % 4 !== 0) {\n w2 = h / 2;\n h2 = w / 2;\n }\n const cX = u + w2;\n const cY = v + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW);\n u0 = cX + (w2 * groupD8.uX(rotate));\n v0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n u1 = cX + (w2 * groupD8.uX(rotate));\n v1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u2 = cX + (w2 * groupD8.uX(rotate));\n v2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u3 = cX + (w2 * groupD8.uX(rotate));\n v3 = cY + (h2 * groupD8.uY(rotate));\n }\n\n arr[sz++] = x;\n arr[sz++] = y;\n arr[sz++] = u0;\n arr[sz++] = v0;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y;\n arr[sz++] = u1;\n arr[sz++] = v1;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y + h;\n arr[sz++] = u2;\n arr[sz++] = v2;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x;\n arr[sz++] = y + h;\n arr[sz++] = u3;\n arr[sz++] = v3;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n }\n\n vertexBuf.update(arr);\n }\n\n (renderer.geometry as any).bind(vb, shader);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES, rectsCount * 6, 0);\n }\n\n isModified(anim: boolean) {\n if (this.modificationMarker !== this.pointsBuf.length ||\n anim && this.hasAnim) {\n return true;\n }\n return false;\n }\n\n clearModify() {\n this.modificationMarker = this.pointsBuf.length;\n }\n\n destroy(options?: any) {\n super.destroy(options);\n this.destroyVb();\n }\n}\n","/// \n\nimport { Container } from '@pixi/display';\nimport { Texture, Renderer } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { Constant } from './Constant';\nimport { RectTileLayer } from './RectTileLayer';\n\nexport class CompositeRectTileLayer extends Container {\n constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n super();\n this.initialize.apply(this, arguments);\n }\n\n updateTransform() {\n (this as any).displayObjectUpdateTransform();\n }\n\n z: number;\n zIndex: number;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n _lastLayer: RectTileLayer = null;\n\n texPerChild: number;\n\n initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n if (texPerChild as any === true) {\n //old format, ignore it!\n texPerChild = 0;\n }\n this.z = this.zIndex = zIndex;\n this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures;\n if (bitmaps) {\n this.setBitmaps(bitmaps);\n }\n }\n\n setBitmaps(bitmaps: Array) {\n for (let i=0;i 5.2.1, it does not exist there.`);\n }\n }\n let texPerChild = this.texPerChild;\n let len1 = this.children.length;\n let len2 = Math.ceil(bitmaps.length / texPerChild);\n let i: number;\n for (i = 0; i < len1; i++) {\n (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);\n }\n for (i = len1; i < len2; i++) {\n let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild));\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n this.addChild(layer);\n }\n }\n\n clear() {\n for (let i = 0; i < this.children.length; i++) {\n (this.children[i] as RectTileLayer).clear();\n }\n this.modificationMarker = 0;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this {\n const childIndex: number = textureIndex / this.texPerChild >> 0;\n const textureId: number = textureIndex % this.texPerChild;\n\n if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) {\n this._lastLayer = (this.children[childIndex] as RectTileLayer);\n this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight);\n } else {\n this._lastLayer = null;\n }\n\n return this;\n }\n\n tileRotate(rotate: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileRotate(rotate);\n }\n return this;\n }\n\n tileAnimX(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimX(offset, count);\n }\n return this;\n }\n\n tileAnimY(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimY(offset, count);\n }\n return this;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this {\n let texture: Texture;\n let layer: RectTileLayer = null;\n let ind: number = 0;\n let children = this.children;\n\n this._lastLayer = null;\n if (typeof texture_ === \"number\") {\n let childIndex = texture_ / this.texPerChild >> 0;\n layer = children[childIndex] as RectTileLayer;\n\n if (!layer) {\n layer = children[0] as RectTileLayer;\n if (!layer) {\n return this;\n }\n ind = 0;\n } else {\n ind = texture_ % this.texPerChild;\n }\n\n texture = layer.textures[ind];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n let tex = child.textures;\n for (let j = 0; j < tex.length; j++) {\n if (tex[j].baseTexture === texture.baseTexture) {\n layer = child;\n ind = j;\n break;\n }\n }\n if (layer) {\n break;\n }\n }\n\n if (!layer) {\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n if (child.textures.length < this.texPerChild) {\n layer = child;\n ind = child.textures.length;\n child.textures.push(texture);\n break;\n }\n }\n if (!layer) {\n layer = new RectTileLayer(this.zIndex, texture);\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n children.push(layer);\n ind = 0;\n }\n }\n }\n\n this._lastLayer = layer;\n layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight);\n return this;\n }\n\n renderCanvas(renderer: any) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderCanvasCore(renderer);\n }\n }\n\n render(renderer: Renderer) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n //TODO: dont create new array, please\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n renderer.shader.bind(shader, false);\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin);\n }\n }\n\n isModified(anim: boolean) {\n let layers = this.children;\n if (this.modificationMarker !== layers.length) {\n return true;\n }\n for (let i = 0; i < layers.length; i++) {\n if ((layers[i] as RectTileLayer).isModified(anim)) {\n return true;\n }\n }\n return false;\n }\n\n clearModify() {\n let layers = this.children;\n this.modificationMarker = layers.length;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).clearModify();\n }\n }\n}","/// \n\nimport { Matrix } from '@pixi/math';\nimport { Graphics } from '@pixi/graphics';\n\nexport class GraphicsLayer extends Graphics {\n constructor(zIndex: number) {\n super();\n this.zIndex = zIndex;\n }\n\n renderCanvas(renderer: any) {\n let wt: Matrix = null;\n if (renderer.plugins.tilemap.dontUseTransform) {\n wt = this.transform.worldTransform;\n this.transform.worldTransform = Matrix.IDENTITY;\n }\n renderer.plugins.graphics.render(this);\n if (renderer.plugins.tilemap.dontUseTransform) {\n this.transform.worldTransform = wt;\n }\n renderer.context.globalAlpha = 1.0;\n }\n\n // renderWebGL(renderer: PIXI.Renderer) {\n // if (!this._webGL[renderer.CONTEXT_UID])\n // this.dirty++;\n // super.renderWebGL(renderer)\n // }\n\n isModified(anim: boolean): boolean {\n return false;\n }\n\n clearModify() {\n }\n}\n","/// \n\nimport { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, Renderer, Texture, GLTexture, resources } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Constant } from './Constant';\n\nexport interface IMultiTextureOptions {\n\tboundCountPerBuffer: number;\n\tboundSize: number;\n\tbufferSize: number;\n\tDO_CLEAR?: boolean;\n}\n\nexport class MultiTextureResource extends resources.Resource {\n\tconstructor(options: IMultiTextureOptions) {\n\t\tsuper(options.bufferSize, options.bufferSize);\n\n\t\tconst bounds = this.boundSprites;\n\t\tconst dirties = this.dirties;\n\t\tthis.boundSize = options.boundSize;\n\t\tfor (let j = 0; j < options.boundCountPerBuffer; j++) {\n\t\t\tconst spr = new Sprite();\n\t\t\tspr.position.x = options.boundSize * (j & 1);\n\t\t\tspr.position.y = options.boundSize * (j >> 1);\n\t\t\tbounds.push(spr);\n\t\t\tdirties.push(0);\n\t\t}\n\t\tthis.DO_CLEAR = !!options.DO_CLEAR;\n\t}\n\n\tDO_CLEAR = false;\n\tboundSize: number = 0;\n\t_clearBuffer: Uint8Array = null;\n\n\tbind(baseTexture: BaseTexture) {\n\t\tif (this.baseTex) {\n\t\t\tthrow new Error('Only one baseTexture is allowed for this resource!')\n\t\t}\n\t\tthis.baseTex = baseTexture;\n\t\tsuper.bind(baseTexture);\n\t}\n\n\tbaseTex: BaseTexture = null;\n\tboundSprites: Array = [];\n\tdirties: Array = [];\n\n\tsetTexture(ind: number, texture: Texture) {\n\t\tconst spr = this.boundSprites[ind];\n\t\tif (spr.texture.baseTexture === texture.baseTexture) {\n\t\t\treturn;\n\t\t}\n\t\tspr.texture = texture;\n\t\tthis.baseTex.update();\n\t\tthis.dirties[ind] = (this.baseTex as any).dirtyId;\n\t}\n\n\tupload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture) {\n\t\tconst { gl } = renderer as any;\n\n\t\tconst {width, height} = this;\n\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined ||\n\t\t\ttexture.alphaMode === ALPHA_MODES.UNPACK);\n\n\t\tif (glTexture.dirtyId < 0) {\n\t\t\t(glTexture as any).width = width;\n\t\t\t(glTexture as any).height = height;\n\n\t\t\tgl.texImage2D(texture.target, 0,\n\t\t\t\ttexture.format,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\t0,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tnull);\n\t\t}\n\n\t\tconst doClear = this.DO_CLEAR;\n\t\tif (doClear && !this._clearBuffer) {\n\t\t\tthis._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4);\n\t\t}\n\n\t\tconst bounds = this.boundSprites;\n\t\tfor (let i = 0; i < bounds.length; i++) {\n\t\t\tconst spr = bounds[i];\n\t\t\tconst tex = spr.texture.baseTexture;\n\t\t\tif (glTexture.dirtyId >= this.dirties[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst res = tex.resource as any;\n\t\t\tif (!tex.valid || !res || !res.source) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (doClear && (tex.width < this.boundSize || tex.height < this.boundSize))\n\t\t\t{\n\t\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\t\tspr.position.x,\n\t\t\t\t\tspr.position.y,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\ttexture.format,\n\t\t\t\t\ttexture.type,\n\t\t\t\t\tthis._clearBuffer);\n\t\t\t}\n\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\tspr.position.x,\n\t\t\t\tspr.position.y,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tres.source);\n\t\t}\n\n\t\treturn true;\n\t}\n}\n","import { Constant } from './Constant';\n\nimport type { TilemapShader } from './RectTileShader';\n\n\nexport function fillSamplers(shader: TilemapShader, maxTextures: number) {\n let sampleValues: Array = [];\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n shader.uniforms.uSamplers = sampleValues;\n\n let samplerSize: Array = [];\n for (let i = 0; i < maxTextures; i++) {\n samplerSize.push(1.0 / Constant.bufferSize);\n samplerSize.push(1.0 / Constant.bufferSize);\n }\n shader.uniforms.uSamplerSize = samplerSize;\n}\n\nexport function generateFragmentSrc(maxTextures: number, fragmentSrc: string) {\n return fragmentSrc.replace(/%count%/gi, maxTextures + \"\")\n .replace(/%forloop%/gi, generateSampleSrc(maxTextures));\n}\n\nexport function generateSampleSrc(maxTextures: number) {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n src += 'if(vTextureId <= -1.0) {';\n src += '\\n\\tcolor = shadowColor;';\n src += '\\n}';\n\n for (let i = 0; i < maxTextures; i++)\n {\n src += '\\nelse ';\n\n if(i < maxTextures-1)\n {\n src += 'if(textureId == ' + i + '.0)';\n }\n\n src += '\\n{';\n src += '\\n\\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);';\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n}\n","/// \n\nimport * as shaderGenerator from './shaderGenerator';\n\nimport { Buffer, Geometry, Shader } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nlet rectShaderFrag = `\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n`;\nlet rectShaderVert = `\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n`;\n\nexport abstract class TilemapShader extends Shader {\n\tmaxTextures = 0;\n\n\tconstructor(maxTextures: number, shaderVert: string, shaderFrag: string) {\n\t\tsuper(\n\t\t\tnew PIXI.Program(\n\t\t\t\tshaderVert,\n\t\t\t\tshaderFrag),\n\t\t\t{\n\t\t\t\tanimationFrame: new Float32Array(2),\n\t\t\t\tuSamplers: [],\n\t\t\t\tuSamplerSize: [],\n\t\t\t\tprojTransMatrix: new Matrix()\n\t\t\t}\n\t\t);\n\t\tthis.maxTextures = maxTextures;\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileShader extends TilemapShader {\n\tconstructor(maxTextures: number) {\n\t\tsuper(\n\t\t\tmaxTextures,\n\t\t\trectShaderVert,\n\t\t\tshaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)\n\t\t);\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileGeom extends Geometry {\n\tvertSize = 11;\n\tvertPerQuad = 4;\n\tstride = this.vertSize * 4;\n\tlastTimeAccess = 0;\n\n\tconstructor() {\n\t\tsuper();\n\t\tconst buf = this.buf = new Buffer(new Float32Array(2), true, false);\n\t\tthis.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0)\n\t\t\t.addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4)\n\t\t\t.addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4)\n\t\t\t.addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4)\n\t\t\t.addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4);\n\t}\n\n\tbuf: PIXI.Buffer;\n}","import { WRAP_MODES } from '@pixi/constants';\nimport { BaseTexture, Buffer, resources, ObjectRenderer, Texture, Renderer } from '@pixi/core';\nimport { Constant } from './Constant';\nimport { RectTileGeom, RectTileShader } from './RectTileShader';\nimport { MultiTextureResource } from './MultiTextureResource';\n\nimport type { TilemapShader } from './RectTileShader';\n\n/**\n * Renderer for rectangle tiles.\n */\nexport class TileRenderer extends ObjectRenderer {\n\trenderer: Renderer;\n\tgl: WebGLRenderingContext;\n\tsn: number = -1;\n\tindexBuffer: PIXI.Buffer = null;\n\tibLen: number = 0;\n\ttileAnim = [0, 0];\n\ttexLoc: Array = [];\n\n\trectShader: RectTileShader;\n\ttexResources: Array = [];\n\n\tconstructor(renderer: Renderer) {\n\t\tsuper(renderer);\n\t\tthis.rectShader = new RectTileShader(Constant.maxTextures);\n\t\tthis.indexBuffer = new Buffer(undefined, true, true);\n\t\tthis.checkIndexBuffer(2000);\n\t\tthis.initBounds();\n\t}\n\n\tinitBounds() {\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tfor (let i = 0; i < maxTextures; i++) {\n\t\t\tconst resource = new MultiTextureResource(Constant);\n\t\t\tconst baseTex = new BaseTexture(resource);\n\t\t\tbaseTex.scaleMode = Constant.SCALE_MODE;\n\t\t\tbaseTex.wrapMode = WRAP_MODES.CLAMP;\n\t\t\tthis.texResources.push(resource);\n\t\t}\n\t}\n\n\tbindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tlet samplerSize: Array = (shader as any).uniforms.uSamplerSize;\n\t\tthis.texLoc.length = 0;\n\t\tfor (let i = 0; i < textures.length; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trenderer.texture.bind(textures[i], i);\n\t\t\t//TODO: add resolution here\n\t\t\tsamplerSize[i * 2] = 1.0 / textures[i].baseTexture.width;\n\t\t\tsamplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height;\n\t\t}\n\t\t(shader as any).uniforms.uSamplerSize = samplerSize;\n\t}\n\n\tbindTextures(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tconst len = textures.length;\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tif (len > Constant.boundCountPerBuffer * maxTextures) {\n\t\t\treturn;\n\t\t}\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\tthis.bindTexturesWithoutRT(renderer, shader, textures);\n\t\t\treturn;\n\t\t}\n\n\t\tlet i = 0;\n\t\tfor (; i < len; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) continue;\n\t\t\tconst multi = this.texResources[i >> 2];\n\t\t\tmulti.setTexture(i & 3, texture);\n\t\t}\n\n\t\tlet gltsUsed = (i + 3) >> 2;\n\t\tfor (i = 0; i < gltsUsed; i++) {\n\t\t\t//remove \"i, true\" after resolving a bug\n\t\t\trenderer.texture.bind(this.texResources[i].baseTex, i);\n\t\t}\n\t}\n\n\tstart() {\n\t\t//sorry, nothing\n\t}\n\n\tcreateVb() {\n\t\tconst geom = new RectTileGeom();\n\t\tgeom.addIndex(this.indexBuffer);\n\t\tgeom.lastTimeAccess = Date.now();\n\t\treturn geom;\n\t}\n\n\tcheckIndexBuffer(size: number, vb: RectTileGeom = null) {\n\t\tconst totalIndices = size * 6;\n\n\t\tif (totalIndices <= this.ibLen) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet len = totalIndices;\n\t\twhile (len < totalIndices) {\n\t\t\tlen <<= 1;\n\t\t}\n\n\t\tthis.ibLen = totalIndices;\n\t\tthis.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size,\n\t\t\tConstant.use32bitIndex ? new Uint32Array(size * 6) : undefined));\n\n\t\t// \tTODO: create new index buffer instead?\n\t\t// if (vb) {\n\t\t// \tconst curIndex = vb.getIndex();\n\t\t// \tif (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) {\n\t\t// \t\tthis.swapIndex(vb, this.indexBuffer);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t// swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) {\n\t\t// let buffers = (geom as any).buffers;\n\t\t// const oldIndex = geom.getIndex();\n\t\t// let ind = buffers.indexOf(oldIndex);\n\t\t// if (ind >= 0) {\n\t\t// \tbuffers.splice(ind, 1);\n\t\t// }\n\t\t// geom.addIndex(indexBuf);\n\t// }\n\n\tgetShader(): TilemapShader {\n\t\treturn this.rectShader;\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\t// this.rectShader.destroy();\n\t\tthis.rectShader = null;\n\t}\n}\n\nRenderer.registerPlugin('tilemap', TileRenderer as any);\n","/// \n\nimport { Container } from '@pixi/display';\n\nimport type { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport type { Matrix } from '@pixi/math';\n\nexport class ZLayer extends Container {\n\n constructor(tilemap: Container, zIndex: number) {\n super();\n this.tilemap = tilemap;\n this.z = zIndex;\n }\n\n tilemap: any;\n z: number;\n zIndex: number;\n _previousLayers: number;\n canvasBuffer: HTMLCanvasElement;\n _tempRender: any;\n _lastAnimationFrame: number = -1;\n layerTransform: Matrix;\n\n clear() {\n let layers = this.children as Array;\n for (let i = 0; i < layers.length; i++)\n layers[i].clear();\n this._previousLayers = 0;\n }\n\n cacheIfDirty() {\n let tilemap: any = this.tilemap;\n let layers = this.children as Array;\n let modified = this._previousLayers !== layers.length;\n this._previousLayers = layers.length;\n let buf = this.canvasBuffer;\n let tempRender = this._tempRender;\n if (!buf) {\n buf = this.canvasBuffer = document.createElement('canvas');\n tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf});\n tempRender.context = tempRender.rootContext;\n tempRender.plugins.tilemap.dontUseTransform = true;\n }\n if (buf.width !== tilemap._layerWidth ||\n buf.height !== tilemap._layerHeight) {\n buf.width = tilemap._layerWidth;\n buf.height = tilemap._layerHeight;\n modified = true;\n }\n let i: number;\n if (!modified) {\n for (i = 0; i < layers.length; i++) {\n if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) {\n modified = true;\n break;\n }\n }\n }\n this._lastAnimationFrame = tilemap.animationFrame;\n if (modified) {\n if (tilemap._hackRenderer) {\n tilemap._hackRenderer(tempRender);\n }\n tempRender.context.clearRect(0, 0, buf.width, buf.height);\n for (i = 0; i < layers.length; i++) {\n layers[i].clearModify();\n layers[i].renderCanvas(tempRender);\n }\n }\n this.layerTransform = this.worldTransform;\n for (i = 0; i < layers.length; i++) {\n this.layerTransform = layers[i].worldTransform;\n break;\n }\n }\n\n renderCanvas(renderer: any) {\n this.cacheIfDirty();\n let wt = this.layerTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n let tilemap = this.tilemap;\n renderer.context.drawImage(this.canvasBuffer, 0, 0);\n }\n}\n","/// \n\nnamespace pixi_tilemap {\n (PIXI as any).tilemap = pixi_tilemap;\n}\n\n// This makes exporter.ts a module!\nexport default {}\n","import { CanvasTileRenderer } from './CanvasTileRenderer';\nimport { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport { Constant } from './Constant';\nimport { GraphicsLayer } from './GraphicsLayer';\nimport { MultiTextureResource } from './MultiTextureResource';\nimport { RectTileLayer } from './RectTileLayer';\nimport { TilemapShader, RectTileShader, RectTileGeom } from './RectTileShader';\nimport { TileRenderer } from './TileRenderer';\nimport { ZLayer } from './ZLayer';\n\nexport const pixi_tilemap = {\n CanvasTileRenderer,\n CompositeRectTileLayer,\n Constant,\n GraphicsLayer,\n MultiTextureResource,\n RectTileLayer,\n TilemapShader,\n RectTileShader,\n RectTileGeom,\n TileRenderer,\n ZLayer,\n};\n\nexport * from './CanvasTileRenderer';\nexport * from './CompositeRectTileLayer';\nexport * from './Constant';\nexport * from './exporter';\nexport * from './GraphicsLayer';\nexport * from './MultiTextureResource';\nexport * from './RectTileLayer';\nexport * from './RectTileShader';\nexport * from './shaderGenerator';\nexport * from './TileRenderer';\nexport * from './ZLayer';"],"names":["Texture","groupD8","DRAW_MODES","Container","Matrix","Graphics","Sprite","ALPHA_MODES","resources","shaderGenerator.fillSamplers","Shader","shaderGenerator.generateFragmentSrc","Buffer","Geometry","BaseTexture","WRAP_MODES","ObjectRenderer","Renderer","pixi_tilemap"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;IASI,4BAAY,QAAkB;QAH9B,aAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAClB,qBAAgB,GAAG,KAAK,CAAC;QAGrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KAC1B;IACL,yBAAC;AAAD,CAAC,IAAA;AAED,IAAM,EAAE,GAAI,IAAY,CAAC,cAAc,CAAC;AAExC,IAAI,EAAE,EAAE;IACJ,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;;;AClBrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE;AACnC,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc;AACzC,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC;AACpF,QA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++ b/dist/pixi-tilemap.umd.js @@ -2,7 +2,7 @@ /*! * pixi-tilemap - v2.0.6 - * Compiled Fri, 14 Aug 2020 18:32:35 UTC + * Compiled Thu, 20 Aug 2020 02:13:52 UTC * * pixi-tilemap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -698,7 +698,7 @@ var pixi_tilemap = (function (exports, display, core, constants, math, graphics, } function generateFragmentSrc(maxTextures, fragmentSrc) { return fragmentSrc.replace(/%count%/gi, maxTextures + "") - .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures)); + .replace(/%forloop%/gi, generateSampleSrc(maxTextures)); } function generateSampleSrc(maxTextures) { var src = ''; diff --git a/dist/pixi-tilemap.umd.js.map b/dist/pixi-tilemap.umd.js.map index ab11509b..87716e92 100644 --- a/dist/pixi-tilemap.umd.js.map +++ b/dist/pixi-tilemap.umd.js.map @@ -1 +1 @@ -{"version":3,"file":"pixi-tilemap.umd.js","sources":["../src/CanvasTileRenderer.ts","../node_modules/tslib/tslib.es6.js","../src/Constant.ts","../src/RectTileLayer.ts","../src/CompositeRectTileLayer.ts","../src/GraphicsLayer.ts","../src/MultiTextureResource.ts","../src/shaderGenerator.ts","../src/RectTileShader.ts","../src/TileRenderer.ts","../src/ZLayer.ts","../src/exporter.ts","../src/index.ts"],"sourcesContent":["/// \n\nimport { Renderer } from '@pixi/core';\n\nexport class CanvasTileRenderer {\n renderer: Renderer;\n tileAnim = [0, 0];\n dontUseTransform = false;\n\n constructor(renderer: Renderer) {\n this.renderer = renderer;\n this.tileAnim = [0, 0];\n }\n}\n\nconst cr = (PIXI as any).CanvasRenderer;\n\nif (cr) {\n cr.registerPlugin('tilemap', CanvasTileRenderer);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","export const Constant = {\n maxTextures: 16,\n bufferSize: 2048,\n boundSize: 1024,\n boundCountPerBuffer: 1,\n use32bitIndex: false,\n SCALE_MODE: PIXI.SCALE_MODES.LINEAR,\n DO_CLEAR: true\n};","/// \n\nimport { Container } from '@pixi/display';\nimport { Constant } from './Constant';\nimport { DRAW_MODES } from '@pixi/constants';\nimport { Texture, Renderer } from '@pixi/core';\nimport { TileRenderer } from './TileRenderer';\nimport { Matrix, groupD8 } from '@pixi/math';\n\nimport type { RectTileGeom } from './RectTileShader';\n\nexport const POINT_STRUCT_SIZE = 12;\n\nexport class RectTileLayer extends Container {\n constructor(zIndex: number, texture: Texture | Array) {\n super();\n this.initialize(zIndex, texture);\n }\n\n zIndex = 0;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n\n pointsBuf: Array = [];\n hasAnim = false;\n textures: Array;\n\n offsetX = 0;\n offsetY = 0;\n compositeParent = false;\n\n initialize(zIndex: number, textures: Texture | Array) {\n if (!textures) {\n textures = [];\n } else if (!(textures instanceof Array) && (textures as Texture).baseTexture) {\n textures = [textures as Texture];\n }\n this.textures = textures as Array;\n this.zIndex = zIndex;\n // this.visible = false;\n }\n\n clear() {\n this.pointsBuf.length = 0;\n this.modificationMarker = 0;\n this.hasAnim = false;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX: number, animY: number) {\n let texture: Texture;\n let textureIndex = 0;\n\n if (typeof texture_ === \"number\") {\n textureIndex = texture_;\n texture = this.textures[textureIndex];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n let found = false;\n let textureList = this.textures;\n for (let i = 0; i < textureList.length; i++) {\n if (textureList[i].baseTexture === texture.baseTexture) {\n textureIndex = i;\n found = true;\n break;\n }\n }\n\n if (!found) {\n // textureIndex = this.textures.length;\n // this.textures.push(texture);\n return false;\n }\n }\n\n this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate);\n return true;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number,\n animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this {\n let pb = this.pointsBuf;\n this.hasAnim = this.hasAnim || animX > 0 || animY > 0;\n pb.push(u);\n pb.push(v);\n pb.push(x);\n pb.push(y);\n pb.push(tileWidth);\n pb.push(tileHeight);\n pb.push(rotate);\n pb.push(animX | 0);\n pb.push(animY | 0);\n pb.push(textureIndex);\n pb.push(animCountX);\n pb.push(animCountY);\n\n return this;\n }\n\n tileRotate(rotate: number) {\n const pb = this.pointsBuf;\n pb[pb.length - 3] = rotate;\n }\n\n tileAnimX(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 5] = offset;\n pb[pb.length - 2] = count;\n }\n\n tileAnimY(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 4] = offset;\n pb[pb.length - 1] = count;\n }\n\n renderCanvas(renderer: any) {\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n this.renderCanvasCore(renderer);\n }\n\n renderCanvasCore(renderer: any) {\n if (this.textures.length === 0) return;\n let points = this.pointsBuf;\n renderer.context.fillStyle = '#000000';\n for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) {\n let x1 = points[i], y1 = points[i + 1];\n let x2 = points[i + 2], y2 = points[i + 3];\n let w = points[i + 4];\n let h = points[i + 5];\n var rotate = points[i + 6];\n x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0];\n y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1];\n let textureIndex = points[i + 9];\n // canvas does not work with rotate yet\n if (textureIndex >= 0) {\n renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h);\n } else {\n renderer.context.globalAlpha = 0.5;\n renderer.context.fillRect(x2, y2, w, h);\n renderer.context.globalAlpha = 1;\n }\n }\n }\n\n vbId = 0;\n vb: RectTileGeom = null;\n vbBuffer: ArrayBuffer = null;\n vbArray: Float32Array = null;\n vbInts: Uint32Array = null;\n\n destroyVb() {\n if (this.vb) {\n this.vb.destroy();\n this.vb = null;\n }\n }\n\n render(renderer: Renderer) {\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n this.renderWebGLCore(renderer, plugin);\n }\n\n renderWebGLCore(renderer: Renderer, plugin: TileRenderer) {\n let points = this.pointsBuf;\n if (points.length === 0) return;\n let rectsCount = points.length / POINT_STRUCT_SIZE;\n\n let shader = plugin.getShader();\n let textures = this.textures;\n if (textures.length === 0) return;\n\n plugin.bindTextures(renderer, shader, textures);\n renderer.shader.bind(shader, false);\n\n //lost context! recover!\n let vb = this.vb;\n if (!vb) {\n vb = plugin.createVb();\n this.vb = vb;\n this.vbId = (vb as any).id;\n this.vbBuffer = null;\n this.modificationMarker = 0;\n }\n\n plugin.checkIndexBuffer(rectsCount, vb);\n const boundCountPerBuffer = Constant.boundCountPerBuffer;\n\n let vertexBuf = vb.getBuffer('aVertexPosition');\n //if layer was changed, re-upload vertices\n let vertices = rectsCount * vb.vertPerQuad;\n if (vertices === 0) return;\n if (this.modificationMarker !== vertices) {\n this.modificationMarker = vertices;\n let vs = vb.stride * vertices;\n if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {\n //!@#$ happens, need resize\n let bk = vb.stride;\n while (bk < vs) {\n bk *= 2;\n }\n this.vbBuffer = new ArrayBuffer(bk);\n this.vbArray = new Float32Array(this.vbBuffer);\n this.vbInts = new Uint32Array(this.vbBuffer);\n vertexBuf.update(this.vbBuffer);\n }\n\n let arr = this.vbArray, ints = this.vbInts;\n //upload vertices!\n let sz = 0;\n //let tint = 0xffffffff;\n let textureId: number = 0;\n let shiftU: number = this.offsetX;\n let shiftV: number = this.offsetY;\n\n //let tint = 0xffffffff;\n let tint = -1;\n for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) {\n let eps = 0.5;\n if (this.compositeParent) {\n if (boundCountPerBuffer > 1) {\n //TODO: what if its more than 4?\n textureId = (points[i + 9] >> 2);\n shiftU = this.offsetX * (points[i + 9] & 1);\n shiftV = this.offsetY * ((points[i + 9] >> 1) & 1);\n } else {\n textureId = points[i + 9];\n shiftU = 0;\n shiftV = 0;\n }\n }\n let x = points[i + 2], y = points[i + 3];\n let w = points[i + 4], h = points[i + 5];\n let u = points[i] + shiftU, v = points[i + 1] + shiftV;\n let rotate = points[i + 6];\n\n const animX = points[i + 7], animY = points[i + 8];\n const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024;\n const animXEncoded = animX + (animWidth * 2048);\n const animYEncoded = animY + (animHeight * 2048);\n\n let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number;\n if (rotate === 0) {\n u0 = u;\n v0 = v;\n u1 = u + w;\n v1 = v;\n u2 = u + w;\n v2 = v + h;\n u3 = u;\n v3 = v + h;\n } else {\n let w2 = w / 2;\n let h2 = h / 2;\n if (rotate % 4 !== 0) {\n w2 = h / 2;\n h2 = w / 2;\n }\n const cX = u + w2;\n const cY = v + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW);\n u0 = cX + (w2 * groupD8.uX(rotate));\n v0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n u1 = cX + (w2 * groupD8.uX(rotate));\n v1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u2 = cX + (w2 * groupD8.uX(rotate));\n v2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u3 = cX + (w2 * groupD8.uX(rotate));\n v3 = cY + (h2 * groupD8.uY(rotate));\n }\n\n arr[sz++] = x;\n arr[sz++] = y;\n arr[sz++] = u0;\n arr[sz++] = v0;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y;\n arr[sz++] = u1;\n arr[sz++] = v1;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y + h;\n arr[sz++] = u2;\n arr[sz++] = v2;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x;\n arr[sz++] = y + h;\n arr[sz++] = u3;\n arr[sz++] = v3;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n }\n\n vertexBuf.update(arr);\n }\n\n (renderer.geometry as any).bind(vb, shader);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES, rectsCount * 6, 0);\n }\n\n isModified(anim: boolean) {\n if (this.modificationMarker !== this.pointsBuf.length ||\n anim && this.hasAnim) {\n return true;\n }\n return false;\n }\n\n clearModify() {\n this.modificationMarker = this.pointsBuf.length;\n }\n\n destroy(options?: any) {\n super.destroy(options);\n this.destroyVb();\n }\n}\n","/// \n\nimport { Container } from '@pixi/display';\nimport { Texture, Renderer } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { Constant } from './Constant';\nimport { RectTileLayer } from './RectTileLayer';\n\nexport class CompositeRectTileLayer extends Container {\n constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n super();\n this.initialize.apply(this, arguments);\n }\n\n updateTransform() {\n (this as any).displayObjectUpdateTransform();\n }\n\n z: number;\n zIndex: number;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n _lastLayer: RectTileLayer = null;\n\n texPerChild: number;\n\n initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n if (texPerChild as any === true) {\n //old format, ignore it!\n texPerChild = 0;\n }\n this.z = this.zIndex = zIndex;\n this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures;\n if (bitmaps) {\n this.setBitmaps(bitmaps);\n }\n }\n\n setBitmaps(bitmaps: Array) {\n for (let i=0;i 5.2.1, it does not exist there.`);\n }\n }\n let texPerChild = this.texPerChild;\n let len1 = this.children.length;\n let len2 = Math.ceil(bitmaps.length / texPerChild);\n let i: number;\n for (i = 0; i < len1; i++) {\n (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);\n }\n for (i = len1; i < len2; i++) {\n let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild));\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n this.addChild(layer);\n }\n }\n\n clear() {\n for (let i = 0; i < this.children.length; i++) {\n (this.children[i] as RectTileLayer).clear();\n }\n this.modificationMarker = 0;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this {\n const childIndex: number = textureIndex / this.texPerChild >> 0;\n const textureId: number = textureIndex % this.texPerChild;\n\n if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) {\n this._lastLayer = (this.children[childIndex] as RectTileLayer);\n this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight);\n } else {\n this._lastLayer = null;\n }\n\n return this;\n }\n\n tileRotate(rotate: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileRotate(rotate);\n }\n return this;\n }\n\n tileAnimX(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimX(offset, count);\n }\n return this;\n }\n\n tileAnimY(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimY(offset, count);\n }\n return this;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this {\n let texture: Texture;\n let layer: RectTileLayer = null;\n let ind: number = 0;\n let children = this.children;\n\n this._lastLayer = null;\n if (typeof texture_ === \"number\") {\n let childIndex = texture_ / this.texPerChild >> 0;\n layer = children[childIndex] as RectTileLayer;\n\n if (!layer) {\n layer = children[0] as RectTileLayer;\n if (!layer) {\n return this;\n }\n ind = 0;\n } else {\n ind = texture_ % this.texPerChild;\n }\n\n texture = layer.textures[ind];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n let tex = child.textures;\n for (let j = 0; j < tex.length; j++) {\n if (tex[j].baseTexture === texture.baseTexture) {\n layer = child;\n ind = j;\n break;\n }\n }\n if (layer) {\n break;\n }\n }\n\n if (!layer) {\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n if (child.textures.length < this.texPerChild) {\n layer = child;\n ind = child.textures.length;\n child.textures.push(texture);\n break;\n }\n }\n if (!layer) {\n layer = new RectTileLayer(this.zIndex, texture);\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n children.push(layer);\n ind = 0;\n }\n }\n }\n\n this._lastLayer = layer;\n layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight);\n return this;\n }\n\n renderCanvas(renderer: any) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderCanvasCore(renderer);\n }\n }\n\n render(renderer: Renderer) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n //TODO: dont create new array, please\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n renderer.shader.bind(shader, false);\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin);\n }\n }\n\n isModified(anim: boolean) {\n let layers = this.children;\n if (this.modificationMarker !== layers.length) {\n return true;\n }\n for (let i = 0; i < layers.length; i++) {\n if ((layers[i] as RectTileLayer).isModified(anim)) {\n return true;\n }\n }\n return false;\n }\n\n clearModify() {\n let layers = this.children;\n this.modificationMarker = layers.length;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).clearModify();\n }\n }\n}","/// \n\nimport { Matrix } from '@pixi/math';\nimport { Graphics } from '@pixi/graphics';\n\nexport class GraphicsLayer extends Graphics {\n constructor(zIndex: number) {\n super();\n this.zIndex = zIndex;\n }\n\n renderCanvas(renderer: any) {\n let wt: Matrix = null;\n if (renderer.plugins.tilemap.dontUseTransform) {\n wt = this.transform.worldTransform;\n this.transform.worldTransform = Matrix.IDENTITY;\n }\n renderer.plugins.graphics.render(this);\n if (renderer.plugins.tilemap.dontUseTransform) {\n this.transform.worldTransform = wt;\n }\n renderer.context.globalAlpha = 1.0;\n }\n\n // renderWebGL(renderer: PIXI.Renderer) {\n // if (!this._webGL[renderer.CONTEXT_UID])\n // this.dirty++;\n // super.renderWebGL(renderer)\n // }\n\n isModified(anim: boolean): boolean {\n return false;\n }\n\n clearModify() {\n }\n}\n","/// \n\nimport { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, Renderer, Texture, GLTexture, resources } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Constant } from './Constant';\n\nexport interface IMultiTextureOptions {\n\tboundCountPerBuffer: number;\n\tboundSize: number;\n\tbufferSize: number;\n\tDO_CLEAR?: boolean;\n}\n\nexport class MultiTextureResource extends resources.Resource {\n\tconstructor(options: IMultiTextureOptions) {\n\t\tsuper(options.bufferSize, options.bufferSize);\n\n\t\tconst bounds = this.boundSprites;\n\t\tconst dirties = this.dirties;\n\t\tthis.boundSize = options.boundSize;\n\t\tfor (let j = 0; j < options.boundCountPerBuffer; j++) {\n\t\t\tconst spr = new Sprite();\n\t\t\tspr.position.x = options.boundSize * (j & 1);\n\t\t\tspr.position.y = options.boundSize * (j >> 1);\n\t\t\tbounds.push(spr);\n\t\t\tdirties.push(0);\n\t\t}\n\t\tthis.DO_CLEAR = !!options.DO_CLEAR;\n\t}\n\n\tDO_CLEAR = false;\n\tboundSize: number = 0;\n\t_clearBuffer: Uint8Array = null;\n\n\tbind(baseTexture: BaseTexture) {\n\t\tif (this.baseTex) {\n\t\t\tthrow new Error('Only one baseTexture is allowed for this resource!')\n\t\t}\n\t\tthis.baseTex = baseTexture;\n\t\tsuper.bind(baseTexture);\n\t}\n\n\tbaseTex: BaseTexture = null;\n\tboundSprites: Array = [];\n\tdirties: Array = [];\n\n\tsetTexture(ind: number, texture: Texture) {\n\t\tconst spr = this.boundSprites[ind];\n\t\tif (spr.texture.baseTexture === texture.baseTexture) {\n\t\t\treturn;\n\t\t}\n\t\tspr.texture = texture;\n\t\tthis.baseTex.update();\n\t\tthis.dirties[ind] = (this.baseTex as any).dirtyId;\n\t}\n\n\tupload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture) {\n\t\tconst { gl } = renderer as any;\n\n\t\tconst {width, height} = this;\n\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined ||\n\t\t\ttexture.alphaMode === ALPHA_MODES.UNPACK);\n\n\t\tif (glTexture.dirtyId < 0) {\n\t\t\t(glTexture as any).width = width;\n\t\t\t(glTexture as any).height = height;\n\n\t\t\tgl.texImage2D(texture.target, 0,\n\t\t\t\ttexture.format,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\t0,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tnull);\n\t\t}\n\n\t\tconst doClear = this.DO_CLEAR;\n\t\tif (doClear && !this._clearBuffer) {\n\t\t\tthis._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4);\n\t\t}\n\n\t\tconst bounds = this.boundSprites;\n\t\tfor (let i = 0; i < bounds.length; i++) {\n\t\t\tconst spr = bounds[i];\n\t\t\tconst tex = spr.texture.baseTexture;\n\t\t\tif (glTexture.dirtyId >= this.dirties[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst res = tex.resource as any;\n\t\t\tif (!tex.valid || !res || !res.source) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (doClear && (tex.width < this.boundSize || tex.height < this.boundSize))\n\t\t\t{\n\t\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\t\tspr.position.x,\n\t\t\t\t\tspr.position.y,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\ttexture.format,\n\t\t\t\t\ttexture.type,\n\t\t\t\t\tthis._clearBuffer);\n\t\t\t}\n\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\tspr.position.x,\n\t\t\t\tspr.position.y,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tres.source);\n\t\t}\n\n\t\treturn true;\n\t}\n}\n","import { Constant } from './Constant';\n\nimport type { TilemapShader } from './RectTileShader';\n\n\nexport function fillSamplers(shader: TilemapShader, maxTextures: number) {\n let sampleValues: Array = [];\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n shader.uniforms.uSamplers = sampleValues;\n\n let samplerSize: Array = [];\n for (let i = 0; i < maxTextures; i++) {\n samplerSize.push(1.0 / Constant.bufferSize);\n samplerSize.push(1.0 / Constant.bufferSize);\n }\n shader.uniforms.uSamplerSize = samplerSize;\n}\n\nexport function generateFragmentSrc(maxTextures: number, fragmentSrc: string) {\n return fragmentSrc.replace(/%count%/gi, maxTextures + \"\")\n .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n}\n\nexport function generateSampleSrc(maxTextures: number) {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n src += 'if(vTextureId <= -1.0) {';\n src += '\\n\\tcolor = shadowColor;';\n src += '\\n}';\n\n for (let i = 0; i < maxTextures; i++)\n {\n src += '\\nelse ';\n\n if(i < maxTextures-1)\n {\n src += 'if(textureId == ' + i + '.0)';\n }\n\n src += '\\n{';\n src += '\\n\\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);';\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n}\n","/// \n\nimport * as shaderGenerator from './shaderGenerator';\n\nimport { Buffer, Geometry, Shader } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nlet rectShaderFrag = `\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n`;\nlet rectShaderVert = `\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n`;\n\nexport abstract class TilemapShader extends Shader {\n\tmaxTextures = 0;\n\n\tconstructor(maxTextures: number, shaderVert: string, shaderFrag: string) {\n\t\tsuper(\n\t\t\tnew PIXI.Program(\n\t\t\t\tshaderVert,\n\t\t\t\tshaderFrag),\n\t\t\t{\n\t\t\t\tanimationFrame: new Float32Array(2),\n\t\t\t\tuSamplers: [],\n\t\t\t\tuSamplerSize: [],\n\t\t\t\tprojTransMatrix: new Matrix()\n\t\t\t}\n\t\t);\n\t\tthis.maxTextures = maxTextures;\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileShader extends TilemapShader {\n\tconstructor(maxTextures: number) {\n\t\tsuper(\n\t\t\tmaxTextures,\n\t\t\trectShaderVert,\n\t\t\tshaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)\n\t\t);\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileGeom extends Geometry {\n\tvertSize = 11;\n\tvertPerQuad = 4;\n\tstride = this.vertSize * 4;\n\tlastTimeAccess = 0;\n\n\tconstructor() {\n\t\tsuper();\n\t\tconst buf = this.buf = new Buffer(new Float32Array(2), true, false);\n\t\tthis.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0)\n\t\t\t.addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4)\n\t\t\t.addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4)\n\t\t\t.addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4)\n\t\t\t.addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4);\n\t}\n\n\tbuf: PIXI.Buffer;\n}","import { WRAP_MODES } from '@pixi/constants';\nimport { BaseTexture, Buffer, resources, ObjectRenderer, Texture, Renderer } from '@pixi/core';\nimport { Constant } from './Constant';\nimport { RectTileGeom, RectTileShader } from './RectTileShader';\nimport { MultiTextureResource } from './MultiTextureResource';\n\nimport type { TilemapShader } from './RectTileShader';\n\n/**\n * Renderer for rectangle tiles.\n */\nexport class TileRenderer extends ObjectRenderer {\n\trenderer: Renderer;\n\tgl: WebGLRenderingContext;\n\tsn: number = -1;\n\tindexBuffer: PIXI.Buffer = null;\n\tibLen: number = 0;\n\ttileAnim = [0, 0];\n\ttexLoc: Array = [];\n\n\trectShader: RectTileShader;\n\ttexResources: Array = [];\n\n\tconstructor(renderer: Renderer) {\n\t\tsuper(renderer);\n\t\tthis.rectShader = new RectTileShader(Constant.maxTextures);\n\t\tthis.indexBuffer = new Buffer(undefined, true, true);\n\t\tthis.checkIndexBuffer(2000);\n\t\tthis.initBounds();\n\t}\n\n\tinitBounds() {\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tfor (let i = 0; i < maxTextures; i++) {\n\t\t\tconst resource = new MultiTextureResource(Constant);\n\t\t\tconst baseTex = new BaseTexture(resource);\n\t\t\tbaseTex.scaleMode = Constant.SCALE_MODE;\n\t\t\tbaseTex.wrapMode = WRAP_MODES.CLAMP;\n\t\t\tthis.texResources.push(resource);\n\t\t}\n\t}\n\n\tbindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tlet samplerSize: Array = (shader as any).uniforms.uSamplerSize;\n\t\tthis.texLoc.length = 0;\n\t\tfor (let i = 0; i < textures.length; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trenderer.texture.bind(textures[i], i);\n\t\t\t//TODO: add resolution here\n\t\t\tsamplerSize[i * 2] = 1.0 / textures[i].baseTexture.width;\n\t\t\tsamplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height;\n\t\t}\n\t\t(shader as any).uniforms.uSamplerSize = samplerSize;\n\t}\n\n\tbindTextures(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tconst len = textures.length;\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tif (len > Constant.boundCountPerBuffer * maxTextures) {\n\t\t\treturn;\n\t\t}\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\tthis.bindTexturesWithoutRT(renderer, shader, textures);\n\t\t\treturn;\n\t\t}\n\n\t\tlet i = 0;\n\t\tfor (; i < len; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) continue;\n\t\t\tconst multi = this.texResources[i >> 2];\n\t\t\tmulti.setTexture(i & 3, texture);\n\t\t}\n\n\t\tlet gltsUsed = (i + 3) >> 2;\n\t\tfor (i = 0; i < gltsUsed; i++) {\n\t\t\t//remove \"i, true\" after resolving a bug\n\t\t\trenderer.texture.bind(this.texResources[i].baseTex, i);\n\t\t}\n\t}\n\n\tstart() {\n\t\t//sorry, nothing\n\t}\n\n\tcreateVb() {\n\t\tconst geom = new RectTileGeom();\n\t\tgeom.addIndex(this.indexBuffer);\n\t\tgeom.lastTimeAccess = Date.now();\n\t\treturn geom;\n\t}\n\n\tcheckIndexBuffer(size: number, vb: RectTileGeom = null) {\n\t\tconst totalIndices = size * 6;\n\n\t\tif (totalIndices <= this.ibLen) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet len = totalIndices;\n\t\twhile (len < totalIndices) {\n\t\t\tlen <<= 1;\n\t\t}\n\n\t\tthis.ibLen = totalIndices;\n\t\tthis.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size,\n\t\t\tConstant.use32bitIndex ? new Uint32Array(size * 6) : undefined));\n\n\t\t// \tTODO: create new index buffer instead?\n\t\t// if (vb) {\n\t\t// \tconst curIndex = vb.getIndex();\n\t\t// \tif (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) {\n\t\t// \t\tthis.swapIndex(vb, this.indexBuffer);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t// swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) {\n\t\t// let buffers = (geom as any).buffers;\n\t\t// const oldIndex = geom.getIndex();\n\t\t// let ind = buffers.indexOf(oldIndex);\n\t\t// if (ind >= 0) {\n\t\t// \tbuffers.splice(ind, 1);\n\t\t// }\n\t\t// geom.addIndex(indexBuf);\n\t// }\n\n\tgetShader(): TilemapShader {\n\t\treturn this.rectShader;\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\t// this.rectShader.destroy();\n\t\tthis.rectShader = null;\n\t}\n}\n\nRenderer.registerPlugin('tilemap', TileRenderer as any);\n","/// \n\nimport { Container } from '@pixi/display';\n\nimport type { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport type { Matrix } from '@pixi/math';\n\nexport class ZLayer extends Container {\n\n constructor(tilemap: Container, zIndex: number) {\n super();\n this.tilemap = tilemap;\n this.z = zIndex;\n }\n\n tilemap: any;\n z: number;\n zIndex: number;\n _previousLayers: number;\n canvasBuffer: HTMLCanvasElement;\n _tempRender: any;\n _lastAnimationFrame: number = -1;\n layerTransform: Matrix;\n\n clear() {\n let layers = this.children as Array;\n for (let i = 0; i < layers.length; i++)\n layers[i].clear();\n this._previousLayers = 0;\n }\n\n cacheIfDirty() {\n let tilemap: any = this.tilemap;\n let layers = this.children as Array;\n let modified = this._previousLayers !== layers.length;\n this._previousLayers = layers.length;\n let buf = this.canvasBuffer;\n let tempRender = this._tempRender;\n if (!buf) {\n buf = this.canvasBuffer = document.createElement('canvas');\n tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf});\n tempRender.context = tempRender.rootContext;\n tempRender.plugins.tilemap.dontUseTransform = true;\n }\n if (buf.width !== tilemap._layerWidth ||\n buf.height !== tilemap._layerHeight) {\n buf.width = tilemap._layerWidth;\n buf.height = tilemap._layerHeight;\n modified = true;\n }\n let i: number;\n if (!modified) {\n for (i = 0; i < layers.length; i++) {\n if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) {\n modified = true;\n break;\n }\n }\n }\n this._lastAnimationFrame = tilemap.animationFrame;\n if (modified) {\n if (tilemap._hackRenderer) {\n tilemap._hackRenderer(tempRender);\n }\n tempRender.context.clearRect(0, 0, buf.width, buf.height);\n for (i = 0; i < layers.length; i++) {\n layers[i].clearModify();\n layers[i].renderCanvas(tempRender);\n }\n }\n this.layerTransform = this.worldTransform;\n for (i = 0; i < layers.length; i++) {\n this.layerTransform = layers[i].worldTransform;\n break;\n }\n }\n\n renderCanvas(renderer: any) {\n this.cacheIfDirty();\n let wt = this.layerTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n let tilemap = this.tilemap;\n renderer.context.drawImage(this.canvasBuffer, 0, 0);\n }\n}\n","/// \n\nnamespace pixi_tilemap {\n (PIXI as any).tilemap = pixi_tilemap;\n}\n\n// This makes exporter.ts a module!\nexport default {}\n","import { CanvasTileRenderer } from './CanvasTileRenderer';\nimport { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport { Constant } from './Constant';\nimport { GraphicsLayer } from './GraphicsLayer';\nimport { MultiTextureResource } from './MultiTextureResource';\nimport { RectTileLayer } from './RectTileLayer';\nimport { TilemapShader, RectTileShader, RectTileGeom } from './RectTileShader';\nimport { TileRenderer } from './TileRenderer';\nimport { ZLayer } from './ZLayer';\n\nexport const pixi_tilemap = {\n CanvasTileRenderer,\n CompositeRectTileLayer,\n Constant,\n GraphicsLayer,\n MultiTextureResource,\n RectTileLayer,\n TilemapShader,\n RectTileShader,\n RectTileGeom,\n TileRenderer,\n ZLayer,\n};\n\nexport * from './CanvasTileRenderer';\nexport * from './CompositeRectTileLayer';\nexport * from './Constant';\nexport * from './exporter';\nexport * from './GraphicsLayer';\nexport * from './MultiTextureResource';\nexport * from './RectTileLayer';\nexport * from './RectTileShader';\nexport * from './shaderGenerator';\nexport * from './TileRenderer';\nexport * from './ZLayer';"],"names":["Texture","groupD8","DRAW_MODES","Container","Matrix","Graphics","Sprite","ALPHA_MODES","resources","shaderGenerator.fillSamplers","Shader","shaderGenerator.generateFragmentSrc","Buffer","Geometry","BaseTexture","WRAP_MODES","ObjectRenderer","Renderer","pixi_tilemap"],"mappings":";;;;;;;;;;;;;;;QASI,4BAAY,QAAkB;YAH9B,aAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAClB,qBAAgB,G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AC,CAAC,EACJ,EAAE,CAAC,CAAC,EACJ,EAAE,CAAC,CAAC,EACJ,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,UAAU,EAC3B,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,UAAU,CAC9B,CAAC;YACF,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;YAC3B,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;SACvD;QACL,aAAC;IAAD,CApFA,CAA4Bd,iBAAS;;ICLrC,IAAU,YAAY,CAErB;IAFD,WAAU,YAAY;QACjB,IAAY,CAAC,OAAO,GAAG,YAAY,CAAC;IACzC,CAAC,EAFS,YAAY,KAAZ,YAAY;;QCQTe,cAAY,GAAG;QACxB,kBAAkB,oBAAA;QAClB,sBAAsB,wBAAA;QACtB,QAAQ,UAAA;QACR,aAAa,eAAA;QACb,oBAAoB,sBAAA;QACpB,aAAa,eAAA;QACb,aAAa,eAAA;QACb,cAAc,gBAAA;QACd,YAAY,cAAA;QACZ,YAAY,cAAA;QACZ,MAAM,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"pixi-tilemap.umd.js","sources":["../src/CanvasTileRenderer.ts","../node_modules/tslib/tslib.es6.js","../src/Constant.ts","../src/RectTileLayer.ts","../src/CompositeRectTileLayer.ts","../src/GraphicsLayer.ts","../src/MultiTextureResource.ts","../src/shaderGenerator.ts","../src/RectTileShader.ts","../src/TileRenderer.ts","../src/ZLayer.ts","../src/exporter.ts","../src/index.ts"],"sourcesContent":["/// \n\nimport { Renderer } from '@pixi/core';\n\nexport class CanvasTileRenderer {\n renderer: Renderer;\n tileAnim = [0, 0];\n dontUseTransform = false;\n\n constructor(renderer: Renderer) {\n this.renderer = renderer;\n this.tileAnim = [0, 0];\n }\n}\n\nconst cr = (PIXI as any).CanvasRenderer;\n\nif (cr) {\n cr.registerPlugin('tilemap', CanvasTileRenderer);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","export const Constant = {\n maxTextures: 16,\n bufferSize: 2048,\n boundSize: 1024,\n boundCountPerBuffer: 1,\n use32bitIndex: false,\n SCALE_MODE: PIXI.SCALE_MODES.LINEAR,\n DO_CLEAR: true\n};","/// \n\nimport { Container } from '@pixi/display';\nimport { Constant } from './Constant';\nimport { DRAW_MODES } from '@pixi/constants';\nimport { Texture, Renderer } from '@pixi/core';\nimport { TileRenderer } from './TileRenderer';\nimport { Matrix, groupD8 } from '@pixi/math';\n\nimport type { RectTileGeom } from './RectTileShader';\n\nexport const POINT_STRUCT_SIZE = 12;\n\nexport class RectTileLayer extends Container {\n constructor(zIndex: number, texture: Texture | Array) {\n super();\n this.initialize(zIndex, texture);\n }\n\n zIndex = 0;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n\n pointsBuf: Array = [];\n hasAnim = false;\n textures: Array;\n\n offsetX = 0;\n offsetY = 0;\n compositeParent = false;\n\n initialize(zIndex: number, textures: Texture | Array) {\n if (!textures) {\n textures = [];\n } else if (!(textures instanceof Array) && (textures as Texture).baseTexture) {\n textures = [textures as Texture];\n }\n this.textures = textures as Array;\n this.zIndex = zIndex;\n // this.visible = false;\n }\n\n clear() {\n this.pointsBuf.length = 0;\n this.modificationMarker = 0;\n this.hasAnim = false;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX: number, animY: number) {\n let texture: Texture;\n let textureIndex = 0;\n\n if (typeof texture_ === \"number\") {\n textureIndex = texture_;\n texture = this.textures[textureIndex];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n let found = false;\n let textureList = this.textures;\n for (let i = 0; i < textureList.length; i++) {\n if (textureList[i].baseTexture === texture.baseTexture) {\n textureIndex = i;\n found = true;\n break;\n }\n }\n\n if (!found) {\n // textureIndex = this.textures.length;\n // this.textures.push(texture);\n return false;\n }\n }\n\n this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate);\n return true;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number,\n animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this {\n let pb = this.pointsBuf;\n this.hasAnim = this.hasAnim || animX > 0 || animY > 0;\n pb.push(u);\n pb.push(v);\n pb.push(x);\n pb.push(y);\n pb.push(tileWidth);\n pb.push(tileHeight);\n pb.push(rotate);\n pb.push(animX | 0);\n pb.push(animY | 0);\n pb.push(textureIndex);\n pb.push(animCountX);\n pb.push(animCountY);\n\n return this;\n }\n\n tileRotate(rotate: number) {\n const pb = this.pointsBuf;\n pb[pb.length - 3] = rotate;\n }\n\n tileAnimX(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 5] = offset;\n pb[pb.length - 2] = count;\n }\n\n tileAnimY(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 4] = offset;\n pb[pb.length - 1] = count;\n }\n\n renderCanvas(renderer: any) {\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n this.renderCanvasCore(renderer);\n }\n\n renderCanvasCore(renderer: any) {\n if (this.textures.length === 0) return;\n let points = this.pointsBuf;\n renderer.context.fillStyle = '#000000';\n for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) {\n let x1 = points[i], y1 = points[i + 1];\n let x2 = points[i + 2], y2 = points[i + 3];\n let w = points[i + 4];\n let h = points[i + 5];\n var rotate = points[i + 6];\n x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0];\n y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1];\n let textureIndex = points[i + 9];\n // canvas does not work with rotate yet\n if (textureIndex >= 0) {\n renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h);\n } else {\n renderer.context.globalAlpha = 0.5;\n renderer.context.fillRect(x2, y2, w, h);\n renderer.context.globalAlpha = 1;\n }\n }\n }\n\n vbId = 0;\n vb: RectTileGeom = null;\n vbBuffer: ArrayBuffer = null;\n vbArray: Float32Array = null;\n vbInts: Uint32Array = null;\n\n destroyVb() {\n if (this.vb) {\n this.vb.destroy();\n this.vb = null;\n }\n }\n\n render(renderer: Renderer) {\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n this.renderWebGLCore(renderer, plugin);\n }\n\n renderWebGLCore(renderer: Renderer, plugin: TileRenderer) {\n let points = this.pointsBuf;\n if (points.length === 0) return;\n let rectsCount = points.length / POINT_STRUCT_SIZE;\n\n let shader = plugin.getShader();\n let textures = this.textures;\n if (textures.length === 0) return;\n\n plugin.bindTextures(renderer, shader, textures);\n renderer.shader.bind(shader, false);\n\n //lost context! recover!\n let vb = this.vb;\n if (!vb) {\n vb = plugin.createVb();\n this.vb = vb;\n this.vbId = (vb as any).id;\n this.vbBuffer = null;\n this.modificationMarker = 0;\n }\n\n plugin.checkIndexBuffer(rectsCount, vb);\n const boundCountPerBuffer = Constant.boundCountPerBuffer;\n\n let vertexBuf = vb.getBuffer('aVertexPosition');\n //if layer was changed, re-upload vertices\n let vertices = rectsCount * vb.vertPerQuad;\n if (vertices === 0) return;\n if (this.modificationMarker !== vertices) {\n this.modificationMarker = vertices;\n let vs = vb.stride * vertices;\n if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {\n //!@#$ happens, need resize\n let bk = vb.stride;\n while (bk < vs) {\n bk *= 2;\n }\n this.vbBuffer = new ArrayBuffer(bk);\n this.vbArray = new Float32Array(this.vbBuffer);\n this.vbInts = new Uint32Array(this.vbBuffer);\n vertexBuf.update(this.vbBuffer);\n }\n\n let arr = this.vbArray, ints = this.vbInts;\n //upload vertices!\n let sz = 0;\n //let tint = 0xffffffff;\n let textureId: number = 0;\n let shiftU: number = this.offsetX;\n let shiftV: number = this.offsetY;\n\n //let tint = 0xffffffff;\n let tint = -1;\n for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) {\n let eps = 0.5;\n if (this.compositeParent) {\n if (boundCountPerBuffer > 1) {\n //TODO: what if its more than 4?\n textureId = (points[i + 9] >> 2);\n shiftU = this.offsetX * (points[i + 9] & 1);\n shiftV = this.offsetY * ((points[i + 9] >> 1) & 1);\n } else {\n textureId = points[i + 9];\n shiftU = 0;\n shiftV = 0;\n }\n }\n let x = points[i + 2], y = points[i + 3];\n let w = points[i + 4], h = points[i + 5];\n let u = points[i] + shiftU, v = points[i + 1] + shiftV;\n let rotate = points[i + 6];\n\n const animX = points[i + 7], animY = points[i + 8];\n const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024;\n const animXEncoded = animX + (animWidth * 2048);\n const animYEncoded = animY + (animHeight * 2048);\n\n let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number;\n if (rotate === 0) {\n u0 = u;\n v0 = v;\n u1 = u + w;\n v1 = v;\n u2 = u + w;\n v2 = v + h;\n u3 = u;\n v3 = v + h;\n } else {\n let w2 = w / 2;\n let h2 = h / 2;\n if (rotate % 4 !== 0) {\n w2 = h / 2;\n h2 = w / 2;\n }\n const cX = u + w2;\n const cY = v + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW);\n u0 = cX + (w2 * groupD8.uX(rotate));\n v0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n u1 = cX + (w2 * groupD8.uX(rotate));\n v1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u2 = cX + (w2 * groupD8.uX(rotate));\n v2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u3 = cX + (w2 * groupD8.uX(rotate));\n v3 = cY + (h2 * groupD8.uY(rotate));\n }\n\n arr[sz++] = x;\n arr[sz++] = y;\n arr[sz++] = u0;\n arr[sz++] = v0;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y;\n arr[sz++] = u1;\n arr[sz++] = v1;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y + h;\n arr[sz++] = u2;\n arr[sz++] = v2;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x;\n arr[sz++] = y + h;\n arr[sz++] = u3;\n arr[sz++] = v3;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n }\n\n vertexBuf.update(arr);\n }\n\n (renderer.geometry as any).bind(vb, shader);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES, rectsCount * 6, 0);\n }\n\n isModified(anim: boolean) {\n if (this.modificationMarker !== this.pointsBuf.length ||\n anim && this.hasAnim) {\n return true;\n }\n return false;\n }\n\n clearModify() {\n this.modificationMarker = this.pointsBuf.length;\n }\n\n destroy(options?: any) {\n super.destroy(options);\n this.destroyVb();\n }\n}\n","/// \n\nimport { Container } from '@pixi/display';\nimport { Texture, Renderer } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { Constant } from './Constant';\nimport { RectTileLayer } from './RectTileLayer';\n\nexport class CompositeRectTileLayer extends Container {\n constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n super();\n this.initialize.apply(this, arguments);\n }\n\n updateTransform() {\n (this as any).displayObjectUpdateTransform();\n }\n\n z: number;\n zIndex: number;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n _lastLayer: RectTileLayer = null;\n\n texPerChild: number;\n\n initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n if (texPerChild as any === true) {\n //old format, ignore it!\n texPerChild = 0;\n }\n this.z = this.zIndex = zIndex;\n this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures;\n if (bitmaps) {\n this.setBitmaps(bitmaps);\n }\n }\n\n setBitmaps(bitmaps: Array) {\n for (let i=0;i 5.2.1, it does not exist there.`);\n }\n }\n let texPerChild = this.texPerChild;\n let len1 = this.children.length;\n let len2 = Math.ceil(bitmaps.length / texPerChild);\n let i: number;\n for (i = 0; i < len1; i++) {\n (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);\n }\n for (i = len1; i < len2; i++) {\n let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild));\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n this.addChild(layer);\n }\n }\n\n clear() {\n for (let i = 0; i < this.children.length; i++) {\n (this.children[i] as RectTileLayer).clear();\n }\n this.modificationMarker = 0;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this {\n const childIndex: number = textureIndex / this.texPerChild >> 0;\n const textureId: number = textureIndex % this.texPerChild;\n\n if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) {\n this._lastLayer = (this.children[childIndex] as RectTileLayer);\n this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight);\n } else {\n this._lastLayer = null;\n }\n\n return this;\n }\n\n tileRotate(rotate: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileRotate(rotate);\n }\n return this;\n }\n\n tileAnimX(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimX(offset, count);\n }\n return this;\n }\n\n tileAnimY(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimY(offset, count);\n }\n return this;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this {\n let texture: Texture;\n let layer: RectTileLayer = null;\n let ind: number = 0;\n let children = this.children;\n\n this._lastLayer = null;\n if (typeof texture_ === \"number\") {\n let childIndex = texture_ / this.texPerChild >> 0;\n layer = children[childIndex] as RectTileLayer;\n\n if (!layer) {\n layer = children[0] as RectTileLayer;\n if (!layer) {\n return this;\n }\n ind = 0;\n } else {\n ind = texture_ % this.texPerChild;\n }\n\n texture = layer.textures[ind];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n let tex = child.textures;\n for (let j = 0; j < tex.length; j++) {\n if (tex[j].baseTexture === texture.baseTexture) {\n layer = child;\n ind = j;\n break;\n }\n }\n if (layer) {\n break;\n }\n }\n\n if (!layer) {\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n if (child.textures.length < this.texPerChild) {\n layer = child;\n ind = child.textures.length;\n child.textures.push(texture);\n break;\n }\n }\n if (!layer) {\n layer = new RectTileLayer(this.zIndex, texture);\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n children.push(layer);\n ind = 0;\n }\n }\n }\n\n this._lastLayer = layer;\n layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight);\n return this;\n }\n\n renderCanvas(renderer: any) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderCanvasCore(renderer);\n }\n }\n\n render(renderer: Renderer) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n //TODO: dont create new array, please\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n renderer.shader.bind(shader, false);\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin);\n }\n }\n\n isModified(anim: boolean) {\n let layers = this.children;\n if (this.modificationMarker !== layers.length) {\n return true;\n }\n for (let i = 0; i < layers.length; i++) {\n if ((layers[i] as RectTileLayer).isModified(anim)) {\n return true;\n }\n }\n return false;\n }\n\n clearModify() {\n let layers = this.children;\n this.modificationMarker = layers.length;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).clearModify();\n }\n }\n}","/// \n\nimport { Matrix } from '@pixi/math';\nimport { Graphics } from '@pixi/graphics';\n\nexport class GraphicsLayer extends Graphics {\n constructor(zIndex: number) {\n super();\n this.zIndex = zIndex;\n }\n\n renderCanvas(renderer: any) {\n let wt: Matrix = null;\n if (renderer.plugins.tilemap.dontUseTransform) {\n wt = this.transform.worldTransform;\n this.transform.worldTransform = Matrix.IDENTITY;\n }\n renderer.plugins.graphics.render(this);\n if (renderer.plugins.tilemap.dontUseTransform) {\n this.transform.worldTransform = wt;\n }\n renderer.context.globalAlpha = 1.0;\n }\n\n // renderWebGL(renderer: PIXI.Renderer) {\n // if (!this._webGL[renderer.CONTEXT_UID])\n // this.dirty++;\n // super.renderWebGL(renderer)\n // }\n\n isModified(anim: boolean): boolean {\n return false;\n }\n\n clearModify() {\n }\n}\n","/// \n\nimport { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, Renderer, Texture, GLTexture, resources } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Constant } from './Constant';\n\nexport interface IMultiTextureOptions {\n\tboundCountPerBuffer: number;\n\tboundSize: number;\n\tbufferSize: number;\n\tDO_CLEAR?: boolean;\n}\n\nexport class MultiTextureResource extends resources.Resource {\n\tconstructor(options: IMultiTextureOptions) {\n\t\tsuper(options.bufferSize, options.bufferSize);\n\n\t\tconst bounds = this.boundSprites;\n\t\tconst dirties = this.dirties;\n\t\tthis.boundSize = options.boundSize;\n\t\tfor (let j = 0; j < options.boundCountPerBuffer; j++) {\n\t\t\tconst spr = new Sprite();\n\t\t\tspr.position.x = options.boundSize * (j & 1);\n\t\t\tspr.position.y = options.boundSize * (j >> 1);\n\t\t\tbounds.push(spr);\n\t\t\tdirties.push(0);\n\t\t}\n\t\tthis.DO_CLEAR = !!options.DO_CLEAR;\n\t}\n\n\tDO_CLEAR = false;\n\tboundSize: number = 0;\n\t_clearBuffer: Uint8Array = null;\n\n\tbind(baseTexture: BaseTexture) {\n\t\tif (this.baseTex) {\n\t\t\tthrow new Error('Only one baseTexture is allowed for this resource!')\n\t\t}\n\t\tthis.baseTex = baseTexture;\n\t\tsuper.bind(baseTexture);\n\t}\n\n\tbaseTex: BaseTexture = null;\n\tboundSprites: Array = [];\n\tdirties: Array = [];\n\n\tsetTexture(ind: number, texture: Texture) {\n\t\tconst spr = this.boundSprites[ind];\n\t\tif (spr.texture.baseTexture === texture.baseTexture) {\n\t\t\treturn;\n\t\t}\n\t\tspr.texture = texture;\n\t\tthis.baseTex.update();\n\t\tthis.dirties[ind] = (this.baseTex as any).dirtyId;\n\t}\n\n\tupload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture) {\n\t\tconst { gl } = renderer as any;\n\n\t\tconst {width, height} = this;\n\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined ||\n\t\t\ttexture.alphaMode === ALPHA_MODES.UNPACK);\n\n\t\tif (glTexture.dirtyId < 0) {\n\t\t\t(glTexture as any).width = width;\n\t\t\t(glTexture as any).height = height;\n\n\t\t\tgl.texImage2D(texture.target, 0,\n\t\t\t\ttexture.format,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\t0,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tnull);\n\t\t}\n\n\t\tconst doClear = this.DO_CLEAR;\n\t\tif (doClear && !this._clearBuffer) {\n\t\t\tthis._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4);\n\t\t}\n\n\t\tconst bounds = this.boundSprites;\n\t\tfor (let i = 0; i < bounds.length; i++) {\n\t\t\tconst spr = bounds[i];\n\t\t\tconst tex = spr.texture.baseTexture;\n\t\t\tif (glTexture.dirtyId >= this.dirties[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst res = tex.resource as any;\n\t\t\tif (!tex.valid || !res || !res.source) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (doClear && (tex.width < this.boundSize || tex.height < this.boundSize))\n\t\t\t{\n\t\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\t\tspr.position.x,\n\t\t\t\t\tspr.position.y,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\ttexture.format,\n\t\t\t\t\ttexture.type,\n\t\t\t\t\tthis._clearBuffer);\n\t\t\t}\n\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\tspr.position.x,\n\t\t\t\tspr.position.y,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tres.source);\n\t\t}\n\n\t\treturn true;\n\t}\n}\n","import { Constant } from './Constant';\n\nimport type { TilemapShader } from './RectTileShader';\n\n\nexport function fillSamplers(shader: TilemapShader, maxTextures: number) {\n let sampleValues: Array = [];\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n shader.uniforms.uSamplers = sampleValues;\n\n let samplerSize: Array = [];\n for (let i = 0; i < maxTextures; i++) {\n samplerSize.push(1.0 / Constant.bufferSize);\n samplerSize.push(1.0 / Constant.bufferSize);\n }\n shader.uniforms.uSamplerSize = samplerSize;\n}\n\nexport function generateFragmentSrc(maxTextures: number, fragmentSrc: string) {\n return fragmentSrc.replace(/%count%/gi, maxTextures + \"\")\n .replace(/%forloop%/gi, generateSampleSrc(maxTextures));\n}\n\nexport function generateSampleSrc(maxTextures: number) {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n src += 'if(vTextureId <= -1.0) {';\n src += '\\n\\tcolor = shadowColor;';\n src += '\\n}';\n\n for (let i = 0; i < maxTextures; i++)\n {\n src += '\\nelse ';\n\n if(i < maxTextures-1)\n {\n src += 'if(textureId == ' + i + '.0)';\n }\n\n src += '\\n{';\n src += '\\n\\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);';\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n}\n","/// \n\nimport * as shaderGenerator from './shaderGenerator';\n\nimport { Buffer, Geometry, Shader } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nlet rectShaderFrag = `\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n`;\nlet rectShaderVert = `\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n`;\n\nexport abstract class TilemapShader extends Shader {\n\tmaxTextures = 0;\n\n\tconstructor(maxTextures: number, shaderVert: string, shaderFrag: string) {\n\t\tsuper(\n\t\t\tnew PIXI.Program(\n\t\t\t\tshaderVert,\n\t\t\t\tshaderFrag),\n\t\t\t{\n\t\t\t\tanimationFrame: new Float32Array(2),\n\t\t\t\tuSamplers: [],\n\t\t\t\tuSamplerSize: [],\n\t\t\t\tprojTransMatrix: new Matrix()\n\t\t\t}\n\t\t);\n\t\tthis.maxTextures = maxTextures;\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileShader extends TilemapShader {\n\tconstructor(maxTextures: number) {\n\t\tsuper(\n\t\t\tmaxTextures,\n\t\t\trectShaderVert,\n\t\t\tshaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)\n\t\t);\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileGeom extends Geometry {\n\tvertSize = 11;\n\tvertPerQuad = 4;\n\tstride = this.vertSize * 4;\n\tlastTimeAccess = 0;\n\n\tconstructor() {\n\t\tsuper();\n\t\tconst buf = this.buf = new Buffer(new Float32Array(2), true, false);\n\t\tthis.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0)\n\t\t\t.addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4)\n\t\t\t.addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4)\n\t\t\t.addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4)\n\t\t\t.addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4);\n\t}\n\n\tbuf: PIXI.Buffer;\n}","import { WRAP_MODES } from '@pixi/constants';\nimport { BaseTexture, Buffer, resources, ObjectRenderer, Texture, Renderer } from '@pixi/core';\nimport { Constant } from './Constant';\nimport { RectTileGeom, RectTileShader } from './RectTileShader';\nimport { MultiTextureResource } from './MultiTextureResource';\n\nimport type { TilemapShader } from './RectTileShader';\n\n/**\n * Renderer for rectangle tiles.\n */\nexport class TileRenderer extends ObjectRenderer {\n\trenderer: Renderer;\n\tgl: WebGLRenderingContext;\n\tsn: number = -1;\n\tindexBuffer: PIXI.Buffer = null;\n\tibLen: number = 0;\n\ttileAnim = [0, 0];\n\ttexLoc: Array = [];\n\n\trectShader: RectTileShader;\n\ttexResources: Array = [];\n\n\tconstructor(renderer: Renderer) {\n\t\tsuper(renderer);\n\t\tthis.rectShader = new RectTileShader(Constant.maxTextures);\n\t\tthis.indexBuffer = new Buffer(undefined, true, true);\n\t\tthis.checkIndexBuffer(2000);\n\t\tthis.initBounds();\n\t}\n\n\tinitBounds() {\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tfor (let i = 0; i < maxTextures; i++) {\n\t\t\tconst resource = new MultiTextureResource(Constant);\n\t\t\tconst baseTex = new BaseTexture(resource);\n\t\t\tbaseTex.scaleMode = Constant.SCALE_MODE;\n\t\t\tbaseTex.wrapMode = WRAP_MODES.CLAMP;\n\t\t\tthis.texResources.push(resource);\n\t\t}\n\t}\n\n\tbindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tlet samplerSize: Array = (shader as any).uniforms.uSamplerSize;\n\t\tthis.texLoc.length = 0;\n\t\tfor (let i = 0; i < textures.length; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trenderer.texture.bind(textures[i], i);\n\t\t\t//TODO: add resolution here\n\t\t\tsamplerSize[i * 2] = 1.0 / textures[i].baseTexture.width;\n\t\t\tsamplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height;\n\t\t}\n\t\t(shader as any).uniforms.uSamplerSize = samplerSize;\n\t}\n\n\tbindTextures(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tconst len = textures.length;\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tif (len > Constant.boundCountPerBuffer * maxTextures) {\n\t\t\treturn;\n\t\t}\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\tthis.bindTexturesWithoutRT(renderer, shader, textures);\n\t\t\treturn;\n\t\t}\n\n\t\tlet i = 0;\n\t\tfor (; i < len; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) continue;\n\t\t\tconst multi = this.texResources[i >> 2];\n\t\t\tmulti.setTexture(i & 3, texture);\n\t\t}\n\n\t\tlet gltsUsed = (i + 3) >> 2;\n\t\tfor (i = 0; i < gltsUsed; i++) {\n\t\t\t//remove \"i, true\" after resolving a bug\n\t\t\trenderer.texture.bind(this.texResources[i].baseTex, i);\n\t\t}\n\t}\n\n\tstart() {\n\t\t//sorry, nothing\n\t}\n\n\tcreateVb() {\n\t\tconst geom = new RectTileGeom();\n\t\tgeom.addIndex(this.indexBuffer);\n\t\tgeom.lastTimeAccess = Date.now();\n\t\treturn geom;\n\t}\n\n\tcheckIndexBuffer(size: number, vb: RectTileGeom = null) {\n\t\tconst totalIndices = size * 6;\n\n\t\tif (totalIndices <= this.ibLen) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet len = totalIndices;\n\t\twhile (len < totalIndices) {\n\t\t\tlen <<= 1;\n\t\t}\n\n\t\tthis.ibLen = totalIndices;\n\t\tthis.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size,\n\t\t\tConstant.use32bitIndex ? new Uint32Array(size * 6) : undefined));\n\n\t\t// \tTODO: create new index buffer instead?\n\t\t// if (vb) {\n\t\t// \tconst curIndex = vb.getIndex();\n\t\t// \tif (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) {\n\t\t// \t\tthis.swapIndex(vb, this.indexBuffer);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t// swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) {\n\t\t// let buffers = (geom as any).buffers;\n\t\t// const oldIndex = geom.getIndex();\n\t\t// let ind = buffers.indexOf(oldIndex);\n\t\t// if (ind >= 0) {\n\t\t// \tbuffers.splice(ind, 1);\n\t\t// }\n\t\t// geom.addIndex(indexBuf);\n\t// }\n\n\tgetShader(): TilemapShader {\n\t\treturn this.rectShader;\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\t// this.rectShader.destroy();\n\t\tthis.rectShader = null;\n\t}\n}\n\nRenderer.registerPlugin('tilemap', TileRenderer as any);\n","/// \n\nimport { Container } from '@pixi/display';\n\nimport type { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport type { Matrix } from '@pixi/math';\n\nexport class ZLayer extends Container {\n\n constructor(tilemap: Container, zIndex: number) {\n super();\n this.tilemap = tilemap;\n this.z = zIndex;\n }\n\n tilemap: any;\n z: number;\n zIndex: number;\n _previousLayers: number;\n canvasBuffer: HTMLCanvasElement;\n _tempRender: any;\n _lastAnimationFrame: number = -1;\n layerTransform: Matrix;\n\n clear() {\n let layers = this.children as Array;\n for (let i = 0; i < layers.length; i++)\n layers[i].clear();\n this._previousLayers = 0;\n }\n\n cacheIfDirty() {\n let tilemap: any = this.tilemap;\n let layers = this.children as Array;\n let modified = this._previousLayers !== layers.length;\n this._previousLayers = layers.length;\n let buf = this.canvasBuffer;\n let tempRender = this._tempRender;\n if (!buf) {\n buf = this.canvasBuffer = document.createElement('canvas');\n tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf});\n tempRender.context = tempRender.rootContext;\n tempRender.plugins.tilemap.dontUseTransform = true;\n }\n if (buf.width !== tilemap._layerWidth ||\n buf.height !== tilemap._layerHeight) {\n buf.width = tilemap._layerWidth;\n buf.height = tilemap._layerHeight;\n modified = true;\n }\n let i: number;\n if (!modified) {\n for (i = 0; i < layers.length; i++) {\n if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) {\n modified = true;\n break;\n }\n }\n }\n this._lastAnimationFrame = tilemap.animationFrame;\n if (modified) {\n if (tilemap._hackRenderer) {\n tilemap._hackRenderer(tempRender);\n }\n tempRender.context.clearRect(0, 0, buf.width, buf.height);\n for (i = 0; i < layers.length; i++) {\n layers[i].clearModify();\n layers[i].renderCanvas(tempRender);\n }\n }\n this.layerTransform = this.worldTransform;\n for (i = 0; i < layers.length; i++) {\n this.layerTransform = layers[i].worldTransform;\n break;\n }\n }\n\n renderCanvas(renderer: any) {\n this.cacheIfDirty();\n let wt = this.layerTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n let tilemap = this.tilemap;\n renderer.context.drawImage(this.canvasBuffer, 0, 0);\n }\n}\n","/// \n\nnamespace pixi_tilemap {\n (PIXI as any).tilemap = pixi_tilemap;\n}\n\n// This makes exporter.ts a module!\nexport default {}\n","import { CanvasTileRenderer } from './CanvasTileRenderer';\nimport { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport { Constant } from './Constant';\nimport { GraphicsLayer } from './GraphicsLayer';\nimport { MultiTextureResource } from './MultiTextureResource';\nimport { RectTileLayer } from './RectTileLayer';\nimport { TilemapShader, RectTileShader, RectTileGeom } from './RectTileShader';\nimport { TileRenderer } from './TileRenderer';\nimport { ZLayer } from './ZLayer';\n\nexport const pixi_tilemap = {\n CanvasTileRenderer,\n CompositeRectTileLayer,\n Constant,\n GraphicsLayer,\n MultiTextureResource,\n RectTileLayer,\n TilemapShader,\n RectTileShader,\n RectTileGeom,\n TileRenderer,\n ZLayer,\n};\n\nexport * from './CanvasTileRenderer';\nexport * from './CompositeRectTileLayer';\nexport * from './Constant';\nexport * from './exporter';\nexport * from './GraphicsLayer';\nexport * from './MultiTextureResource';\nexport * from './RectTileLayer';\nexport * from './RectTileShader';\nexport * from './shaderGenerator';\nexport * from './TileRenderer';\nexport * from './ZLayer';"],"names":["Texture","groupD8","DRAW_MODES","Container","Matrix","Graphics","Sprite","ALPHA_MODES","resources","shaderGenerator.fillSamplers","Shader","shaderGenerator.generateFragmentSrc","Buffer","Geometry","BaseTexture","WRAP_MODES","ObjectRenderer","Renderer","pixi_tilemap"],"mappings":";;;;;;;;;;;;;;;QASI,4BAAY,QAAkB;YAH9B,aAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAClB,qBAAgB,GAAG,KAAK,CAAC;YAGrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SAC1B;QACL,yBAAC;IAAD,CAAC,IAAA;IAED,IAAM,EAAE,GAAI,IAAY,CAAC,cAAc,CAAC;IAExC,IAAI,EAAE,EAAE;QACJ,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;;;IClBrD;IACA;IACA;IACA;IACA;AACA;IACA;IACA;IACA;IACA;AACA;IACA;IACA;IACA;IACA;AACA;IACA,IAAI,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE;IACnC,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc;IACzC,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC;IACpF,QAAQ,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACnF,IAAI,OAAO,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/B,CAAC,CAAC;AACF;IACO,SAAS,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE;IAChC,IAAI,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACxB,IAA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ACJ;QAED,6BAAY,GAAZ,UAAa,QAAa;YACtB,IAAI,CAAC,YAAY,EAAE,CAAC;YACpB,IAAI,EAAE,GAAG,IAAI,CAAC,cAAc,CAAC;YAC7B,QAAQ,CAAC,OAAO,CAAC,YAAY,CACzB,EAAE,CAAC,CAAC,EACJ,EAAE,CAAC,CAAC,EACJ,EAAE,CAAC,CAAC,EACJ,EAAE,CAAC,CAAC,EACJ,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,UAAU,EAC3B,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,UAAU,CAC9B,CAAC;YACF,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;YAC3B,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;SACvD;QACL,aAAC;IAAD,CApFA,CAA4Bd,iBAAS;;ICLrC,IAAU,YAAY,CAErB;IAFD,WAAU,YAAY;QACjB,IAAY,CAAC,OAAO,GAAG,YAAY,CAAC;IACzC,CAAC,EAFS,YAAY,KAAZ,YAAY;;QCQTe,cAAY,GAAG;QACxB,kBAAkB,oBAAA;QAClB,sBAAsB,wBAAA;QACtB,QAAQ,UAAA;QACR,aAAa,eAAA;QACb,oBAAoB,sBAAA;QACpB,aAAa,eAAA;QACb,aAAa,eAAA;QACb,cAAc,gBAAA;QACd,YAAY,cAAA;QACZ,YAAY,cAAA;QACZ,MAAM,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/pixi-tilemap.umd.min.js b/dist/pixi-tilemap.umd.min.js index fa589245..8d316c7f 100644 --- a/dist/pixi-tilemap.umd.min.js +++ b/dist/pixi-tilemap.umd.min.js @@ -1,6 +1,6 @@ /*! * pixi-tilemap - v2.0.6 - * Compiled Fri, 14 Aug 2020 18:32:35 UTC + * Compiled Thu, 20 Aug 2020 02:13:52 UTC * * pixi-tilemap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -21,5 +21,5 @@ var pixi_tilemap=function(e,t,r,i,n,o,a){"use strict";var s=function(e){this.til See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. - ***************************************************************************** */;var h=function(e,t){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function l(e,t){function r(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var f={maxTextures:16,bufferSize:2048,boundSize:1024,boundCountPerBuffer:1,use32bitIndex:!1,SCALE_MODE:PIXI.SCALE_MODES.LINEAR,DO_CLEAR:!0},d=function(e){function t(t,r){var i=e.call(this)||this;return i.zIndex=0,i.modificationMarker=0,i.shadowColor=new Float32Array([0,0,0,.5]),i._globalMat=null,i.pointsBuf=[],i.hasAnim=!1,i.offsetX=0,i.offsetY=0,i.compositeParent=!1,i.vbId=0,i.vb=null,i.vbBuffer=null,i.vbArray=null,i.vbInts=null,i.initialize(t,r),i}return l(t,e),t.prototype.initialize=function(e,t){t?t instanceof Array||!t.baseTexture||(t=[t]):t=[],this.textures=t,this.zIndex=e},t.prototype.clear=function(){this.pointsBuf.length=0,this.modificationMarker=0,this.hasAnim=!1},t.prototype.addFrame=function(e,t,i,n,o){var a,s=0;if("number"==typeof e)s=e,a=this.textures[s];else{a="string"==typeof e?r.Texture.from(e):e;for(var u=!1,h=this.textures,l=0;l0||u>0,d.push(t),d.push(r),d.push(i),d.push(n),d.push(o),d.push(a),d.push(h),d.push(0|s),d.push(0|u),d.push(e),d.push(l),d.push(f),this},t.prototype.tileRotate=function(e){var t=this.pointsBuf;t[t.length-3]=e},t.prototype.tileAnimX=function(e,t){var r=this.pointsBuf;r[r.length-5]=e,r[r.length-2]=t},t.prototype.tileAnimY=function(e,t){var r=this.pointsBuf;r[r.length-4]=e,r[r.length-1]=t},t.prototype.renderCanvas=function(e){if(!e.plugins.tilemap.dontUseTransform){var t=this.worldTransform;e.context.setTransform(t.a,t.b,t.c,t.d,t.tx*e.resolution,t.ty*e.resolution)}this.renderCanvasCore(e)},t.prototype.renderCanvasCore=function(e){if(0!==this.textures.length){var t=this.pointsBuf;e.context.fillStyle="#000000";for(var r=0,i=t.length;r=0?e.context.drawImage(this.textures[l].baseTexture.getDrawableSource(),n,o,u,h,a,s,u,h):(e.context.globalAlpha=.5,e.context.fillRect(a,s,u,h),e.context.globalAlpha=1)}}},t.prototype.destroyVb=function(){this.vb&&(this.vb.destroy(),this.vb=null)},t.prototype.render=function(e){var t=e.plugins.tilemap,r=t.getShader();e.batch.setObjectRenderer(t),this._globalMat=r.uniforms.projTransMatrix,e.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform),r.uniforms.shadowColor=this.shadowColor,r.uniforms.animationFrame=t.tileAnim,this.renderWebGLCore(e,t)},t.prototype.renderWebGLCore=function(e,t){var r=this.pointsBuf;if(0!==r.length){var o=r.length/12,a=t.getShader(),s=this.textures;if(0!==s.length){t.bindTextures(e,a,s),e.shader.bind(a,!1);var u=this.vb;u||(u=t.createVb(),this.vb=u,this.vbId=u.id,this.vbBuffer=null,this.modificationMarker=0),t.checkIndexBuffer(o,u);var h=f.boundCountPerBuffer,l=u.getBuffer("aVertexPosition"),d=o*u.vertPerQuad;if(0!==d){if(this.modificationMarker!==d){this.modificationMarker=d;var p=u.stride*d;if(!this.vbBuffer||this.vbBuffer.byteLength1?(x=r[g+9]>>2,y=this.offsetX*(1&r[g+9]),b=this.offsetY*(r[g+9]>>1&1)):(x=r[g+9],y=0,b=0));var T=r[g+2],S=r[g+3],I=r[g+4],C=r[g+5],A=r[g]+y,_=r[g+1]+b,w=r[g+6],P=r[g+7],R=r[g+8],M=P+2048*(r[g+10]||1024),B=R+2048*(r[g+11]||1024),L=void 0,z=void 0,D=void 0,F=void 0,O=void 0,X=void 0,E=void 0,k=void 0;if(0===w)L=A,z=_,D=A+I,F=_,O=A+I,X=_+C,E=A,k=_+C;else{var U=I/2,j=C/2;w%4!=0&&(U=C/2,j=I/2);var Y=A+U,G=_+j;w=n.groupD8.add(w,n.groupD8.NW),L=Y+U*n.groupD8.uX(w),z=G+j*n.groupD8.uY(w),w=n.groupD8.add(w,2),D=Y+U*n.groupD8.uX(w),F=G+j*n.groupD8.uY(w),w=n.groupD8.add(w,2),O=Y+U*n.groupD8.uX(w),X=G+j*n.groupD8.uY(w),w=n.groupD8.add(w,2),E=Y+U*n.groupD8.uX(w),k=G+j*n.groupD8.uY(w)}m[v++]=T,m[v++]=S,m[v++]=L,m[v++]=z,m[v++]=A+.5,m[v++]=_+.5,m[v++]=A+I-.5,m[v++]=_+C-.5,m[v++]=M,m[v++]=B,m[v++]=x,m[v++]=T+I,m[v++]=S,m[v++]=D,m[v++]=F,m[v++]=A+.5,m[v++]=_+.5,m[v++]=A+I-.5,m[v++]=_+C-.5,m[v++]=M,m[v++]=B,m[v++]=x,m[v++]=T+I,m[v++]=S+C,m[v++]=O,m[v++]=X,m[v++]=A+.5,m[v++]=_+.5,m[v++]=A+I-.5,m[v++]=_+C-.5,m[v++]=M,m[v++]=B,m[v++]=x,m[v++]=T,m[v++]=S+C,m[v++]=E,m[v++]=k,m[v++]=A+.5,m[v++]=_+.5,m[v++]=A+I-.5,m[v++]=_+C-.5,m[v++]=M,m[v++]=B,m[v++]=x}l.update(m)}e.geometry.bind(u,a),e.geometry.draw(i.DRAW_MODES.TRIANGLES,6*o,0)}}}},t.prototype.isModified=function(e){return!!(this.modificationMarker!==this.pointsBuf.length||e&&this.hasAnim)},t.prototype.clearModify=function(){this.modificationMarker=this.pointsBuf.length},t.prototype.destroy=function(t){e.prototype.destroy.call(this,t),this.destroyVb()},t}(t.Container),p=function(e){function t(t,r,i){var n=e.call(this)||this;return n.modificationMarker=0,n.shadowColor=new Float32Array([0,0,0,.5]),n._globalMat=null,n._lastLayer=null,n.initialize.apply(n,arguments),n}return l(t,e),t.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},t.prototype.initialize=function(e,t,r){!0===r&&(r=0),this.z=this.zIndex=e,this.texPerChild=r||f.boundCountPerBuffer*f.maxTextures,t&&this.setBitmaps(t)},t.prototype.setBitmaps=function(e){for(var t=0;t 5.2.1, it does not exist there.");var r,i=this.texPerChild,n=this.children.length,o=Math.ceil(e.length/i);for(r=0;r>0,p=e%this.texPerChild;return this.children[d]&&this.children[d].textures?(this._lastLayer=this.children[d],this._lastLayer.addRect(p,t,r,i,n,o,a,s,u,h,l,f)):this._lastLayer=null,this},t.prototype.tileRotate=function(e){return this._lastLayer&&this._lastLayer.tileRotate(e),this},t.prototype.tileAnimX=function(e,t){return this._lastLayer&&this._lastLayer.tileAnimX(e,t),this},t.prototype.tileAnimY=function(e,t){return this._lastLayer&&this._lastLayer.tileAnimY(e,t),this},t.prototype.addFrame=function(e,t,i,n,o,a,s){var u,h=null,l=0,p=this.children;if(this._lastLayer=null,"number"==typeof e){if(h=p[e/this.texPerChild>>0])l=e%this.texPerChild;else{if(!(h=p[0]))return this;l=0}u=h.textures[l]}else{u="string"==typeof e?r.Texture.from(e):e;for(var c=0;c>1),i.push(s),n.push(0)}return r.DO_CLEAR=!!t.DO_CLEAR,r}return l(t,e),t.prototype.bind=function(t){if(this.baseTex)throw new Error("Only one baseTexture is allowed for this resource!");this.baseTex=t,e.prototype.bind.call(this,t)},t.prototype.setTexture=function(e,t){var r=this.boundSprites[e];r.texture.baseTexture!==t.baseTexture&&(r.texture=t,this.baseTex.update(),this.dirties[e]=this.baseTex.dirtyId)},t.prototype.upload=function(e,t,r){var n=e.gl,o=this.width,a=this.height;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,void 0===t.alphaMode||t.alphaMode===i.ALPHA_MODES.UNPACK),r.dirtyId<0&&(r.width=o,r.height=a,n.texImage2D(t.target,0,t.format,o,a,0,t.format,t.type,null));var s=this.DO_CLEAR;s&&!this._clearBuffer&&(this._clearBuffer=new Uint8Array(f.boundSize*f.boundSize*4));for(var u=this.boundSprites,h=0;h=this.dirties[h])){var p=d.resource;d.valid&&p&&p.source&&(s&&(d.widthf.boundCountPerBuffer*f.maxTextures))if(f.boundCountPerBuffer<=1)this.bindTexturesWithoutRT(e,t,r);else{for(var n=0;n>2].setTexture(3&n,o)}var a=n+3>>2;for(n=0;n0||u>0,d.push(t),d.push(r),d.push(i),d.push(n),d.push(o),d.push(a),d.push(h),d.push(0|s),d.push(0|u),d.push(e),d.push(l),d.push(f),this},t.prototype.tileRotate=function(e){var t=this.pointsBuf;t[t.length-3]=e},t.prototype.tileAnimX=function(e,t){var r=this.pointsBuf;r[r.length-5]=e,r[r.length-2]=t},t.prototype.tileAnimY=function(e,t){var r=this.pointsBuf;r[r.length-4]=e,r[r.length-1]=t},t.prototype.renderCanvas=function(e){if(!e.plugins.tilemap.dontUseTransform){var t=this.worldTransform;e.context.setTransform(t.a,t.b,t.c,t.d,t.tx*e.resolution,t.ty*e.resolution)}this.renderCanvasCore(e)},t.prototype.renderCanvasCore=function(e){if(0!==this.textures.length){var t=this.pointsBuf;e.context.fillStyle="#000000";for(var r=0,i=t.length;r=0?e.context.drawImage(this.textures[l].baseTexture.getDrawableSource(),n,o,u,h,a,s,u,h):(e.context.globalAlpha=.5,e.context.fillRect(a,s,u,h),e.context.globalAlpha=1)}}},t.prototype.destroyVb=function(){this.vb&&(this.vb.destroy(),this.vb=null)},t.prototype.render=function(e){var t=e.plugins.tilemap,r=t.getShader();e.batch.setObjectRenderer(t),this._globalMat=r.uniforms.projTransMatrix,e.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform),r.uniforms.shadowColor=this.shadowColor,r.uniforms.animationFrame=t.tileAnim,this.renderWebGLCore(e,t)},t.prototype.renderWebGLCore=function(e,t){var r=this.pointsBuf;if(0!==r.length){var o=r.length/12,a=t.getShader(),s=this.textures;if(0!==s.length){t.bindTextures(e,a,s),e.shader.bind(a,!1);var u=this.vb;u||(u=t.createVb(),this.vb=u,this.vbId=u.id,this.vbBuffer=null,this.modificationMarker=0),t.checkIndexBuffer(o,u);var h=f.boundCountPerBuffer,l=u.getBuffer("aVertexPosition"),d=o*u.vertPerQuad;if(0!==d){if(this.modificationMarker!==d){this.modificationMarker=d;var p=u.stride*d;if(!this.vbBuffer||this.vbBuffer.byteLength1?(x=r[g+9]>>2,y=this.offsetX*(1&r[g+9]),b=this.offsetY*(r[g+9]>>1&1)):(x=r[g+9],y=0,b=0));var T=r[g+2],I=r[g+3],S=r[g+4],C=r[g+5],A=r[g]+y,_=r[g+1]+b,w=r[g+6],P=r[g+7],R=r[g+8],M=P+2048*(r[g+10]||1024),B=R+2048*(r[g+11]||1024),L=void 0,z=void 0,D=void 0,F=void 0,O=void 0,X=void 0,E=void 0,k=void 0;if(0===w)L=A,z=_,D=A+S,F=_,O=A+S,X=_+C,E=A,k=_+C;else{var U=S/2,j=C/2;w%4!=0&&(U=C/2,j=S/2);var Y=A+U,G=_+j;w=n.groupD8.add(w,n.groupD8.NW),L=Y+U*n.groupD8.uX(w),z=G+j*n.groupD8.uY(w),w=n.groupD8.add(w,2),D=Y+U*n.groupD8.uX(w),F=G+j*n.groupD8.uY(w),w=n.groupD8.add(w,2),O=Y+U*n.groupD8.uX(w),X=G+j*n.groupD8.uY(w),w=n.groupD8.add(w,2),E=Y+U*n.groupD8.uX(w),k=G+j*n.groupD8.uY(w)}m[v++]=T,m[v++]=I,m[v++]=L,m[v++]=z,m[v++]=A+.5,m[v++]=_+.5,m[v++]=A+S-.5,m[v++]=_+C-.5,m[v++]=M,m[v++]=B,m[v++]=x,m[v++]=T+S,m[v++]=I,m[v++]=D,m[v++]=F,m[v++]=A+.5,m[v++]=_+.5,m[v++]=A+S-.5,m[v++]=_+C-.5,m[v++]=M,m[v++]=B,m[v++]=x,m[v++]=T+S,m[v++]=I+C,m[v++]=O,m[v++]=X,m[v++]=A+.5,m[v++]=_+.5,m[v++]=A+S-.5,m[v++]=_+C-.5,m[v++]=M,m[v++]=B,m[v++]=x,m[v++]=T,m[v++]=I+C,m[v++]=E,m[v++]=k,m[v++]=A+.5,m[v++]=_+.5,m[v++]=A+S-.5,m[v++]=_+C-.5,m[v++]=M,m[v++]=B,m[v++]=x}l.update(m)}e.geometry.bind(u,a),e.geometry.draw(i.DRAW_MODES.TRIANGLES,6*o,0)}}}},t.prototype.isModified=function(e){return!!(this.modificationMarker!==this.pointsBuf.length||e&&this.hasAnim)},t.prototype.clearModify=function(){this.modificationMarker=this.pointsBuf.length},t.prototype.destroy=function(t){e.prototype.destroy.call(this,t),this.destroyVb()},t}(t.Container),p=function(e){function t(t,r,i){var n=e.call(this)||this;return n.modificationMarker=0,n.shadowColor=new Float32Array([0,0,0,.5]),n._globalMat=null,n._lastLayer=null,n.initialize.apply(n,arguments),n}return l(t,e),t.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},t.prototype.initialize=function(e,t,r){!0===r&&(r=0),this.z=this.zIndex=e,this.texPerChild=r||f.boundCountPerBuffer*f.maxTextures,t&&this.setBitmaps(t)},t.prototype.setBitmaps=function(e){for(var t=0;t 5.2.1, it does not exist there.");var r,i=this.texPerChild,n=this.children.length,o=Math.ceil(e.length/i);for(r=0;r>0,p=e%this.texPerChild;return this.children[d]&&this.children[d].textures?(this._lastLayer=this.children[d],this._lastLayer.addRect(p,t,r,i,n,o,a,s,u,h,l,f)):this._lastLayer=null,this},t.prototype.tileRotate=function(e){return this._lastLayer&&this._lastLayer.tileRotate(e),this},t.prototype.tileAnimX=function(e,t){return this._lastLayer&&this._lastLayer.tileAnimX(e,t),this},t.prototype.tileAnimY=function(e,t){return this._lastLayer&&this._lastLayer.tileAnimY(e,t),this},t.prototype.addFrame=function(e,t,i,n,o,a,s){var u,h=null,l=0,p=this.children;if(this._lastLayer=null,"number"==typeof e){if(h=p[e/this.texPerChild>>0])l=e%this.texPerChild;else{if(!(h=p[0]))return this;l=0}u=h.textures[l]}else{u="string"==typeof e?r.Texture.from(e):e;for(var c=0;c>1),i.push(s),n.push(0)}return r.DO_CLEAR=!!t.DO_CLEAR,r}return l(t,e),t.prototype.bind=function(t){if(this.baseTex)throw new Error("Only one baseTexture is allowed for this resource!");this.baseTex=t,e.prototype.bind.call(this,t)},t.prototype.setTexture=function(e,t){var r=this.boundSprites[e];r.texture.baseTexture!==t.baseTexture&&(r.texture=t,this.baseTex.update(),this.dirties[e]=this.baseTex.dirtyId)},t.prototype.upload=function(e,t,r){var n=e.gl,o=this.width,a=this.height;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,void 0===t.alphaMode||t.alphaMode===i.ALPHA_MODES.UNPACK),r.dirtyId<0&&(r.width=o,r.height=a,n.texImage2D(t.target,0,t.format,o,a,0,t.format,t.type,null));var s=this.DO_CLEAR;s&&!this._clearBuffer&&(this._clearBuffer=new Uint8Array(f.boundSize*f.boundSize*4));for(var u=this.boundSprites,h=0;h=this.dirties[h])){var p=d.resource;d.valid&&p&&p.source&&(s&&(d.widthf.boundCountPerBuffer*f.maxTextures))if(f.boundCountPerBuffer<=1)this.bindTexturesWithoutRT(e,t,r);else{for(var n=0;n>2].setTexture(3&n,o)}var a=n+3>>2;for(n=0;n\n\nimport { Renderer } from '@pixi/core';\n\nexport class CanvasTileRenderer {\n renderer: Renderer;\n tileAnim = [0, 0];\n dontUseTransform = false;\n\n constructor(renderer: Renderer) {\n this.renderer = renderer;\n this.tileAnim = [0, 0];\n }\n}\n\nconst cr = (PIXI as any).CanvasRenderer;\n\nif (cr) {\n cr.registerPlugin('tilemap', CanvasTileRenderer);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","export const Constant = {\n maxTextures: 16,\n bufferSize: 2048,\n boundSize: 1024,\n boundCountPerBuffer: 1,\n use32bitIndex: false,\n SCALE_MODE: PIXI.SCALE_MODES.LINEAR,\n DO_CLEAR: true\n};","/// \n\nimport { Container } from '@pixi/display';\nimport { Constant } from './Constant';\nimport { DRAW_MODES } from '@pixi/constants';\nimport { Texture, Renderer } from '@pixi/core';\nimport { TileRenderer } from './TileRenderer';\nimport { Matrix, groupD8 } from '@pixi/math';\n\nimport type { RectTileGeom } from './RectTileShader';\n\nexport const POINT_STRUCT_SIZE = 12;\n\nexport class RectTileLayer extends Container {\n constructor(zIndex: number, texture: Texture | Array) {\n super();\n this.initialize(zIndex, texture);\n }\n\n zIndex = 0;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n\n pointsBuf: Array = [];\n hasAnim = false;\n textures: Array;\n\n offsetX = 0;\n offsetY = 0;\n compositeParent = false;\n\n initialize(zIndex: number, textures: Texture | Array) {\n if (!textures) {\n textures = [];\n } else if (!(textures instanceof Array) && (textures as Texture).baseTexture) {\n textures = [textures as Texture];\n }\n this.textures = textures as Array;\n this.zIndex = zIndex;\n // this.visible = false;\n }\n\n clear() {\n this.pointsBuf.length = 0;\n this.modificationMarker = 0;\n this.hasAnim = false;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX: number, animY: number) {\n let texture: Texture;\n let textureIndex = 0;\n\n if (typeof texture_ === \"number\") {\n textureIndex = texture_;\n texture = this.textures[textureIndex];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n let found = false;\n let textureList = this.textures;\n for (let i = 0; i < textureList.length; i++) {\n if (textureList[i].baseTexture === texture.baseTexture) {\n textureIndex = i;\n found = true;\n break;\n }\n }\n\n if (!found) {\n // textureIndex = this.textures.length;\n // this.textures.push(texture);\n return false;\n }\n }\n\n this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate);\n return true;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number,\n animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this {\n let pb = this.pointsBuf;\n this.hasAnim = this.hasAnim || animX > 0 || animY > 0;\n pb.push(u);\n pb.push(v);\n pb.push(x);\n pb.push(y);\n pb.push(tileWidth);\n pb.push(tileHeight);\n pb.push(rotate);\n pb.push(animX | 0);\n pb.push(animY | 0);\n pb.push(textureIndex);\n pb.push(animCountX);\n pb.push(animCountY);\n\n return this;\n }\n\n tileRotate(rotate: number) {\n const pb = this.pointsBuf;\n pb[pb.length - 3] = rotate;\n }\n\n tileAnimX(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 5] = offset;\n pb[pb.length - 2] = count;\n }\n\n tileAnimY(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 4] = offset;\n pb[pb.length - 1] = count;\n }\n\n renderCanvas(renderer: any) {\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n this.renderCanvasCore(renderer);\n }\n\n renderCanvasCore(renderer: any) {\n if (this.textures.length === 0) return;\n let points = this.pointsBuf;\n renderer.context.fillStyle = '#000000';\n for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) {\n let x1 = points[i], y1 = points[i + 1];\n let x2 = points[i + 2], y2 = points[i + 3];\n let w = points[i + 4];\n let h = points[i + 5];\n var rotate = points[i + 6];\n x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0];\n y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1];\n let textureIndex = points[i + 9];\n // canvas does not work with rotate yet\n if (textureIndex >= 0) {\n renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h);\n } else {\n renderer.context.globalAlpha = 0.5;\n renderer.context.fillRect(x2, y2, w, h);\n renderer.context.globalAlpha = 1;\n }\n }\n }\n\n vbId = 0;\n vb: RectTileGeom = null;\n vbBuffer: ArrayBuffer = null;\n vbArray: Float32Array = null;\n vbInts: Uint32Array = null;\n\n destroyVb() {\n if (this.vb) {\n this.vb.destroy();\n this.vb = null;\n }\n }\n\n render(renderer: Renderer) {\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n this.renderWebGLCore(renderer, plugin);\n }\n\n renderWebGLCore(renderer: Renderer, plugin: TileRenderer) {\n let points = this.pointsBuf;\n if (points.length === 0) return;\n let rectsCount = points.length / POINT_STRUCT_SIZE;\n\n let shader = plugin.getShader();\n let textures = this.textures;\n if (textures.length === 0) return;\n\n plugin.bindTextures(renderer, shader, textures);\n renderer.shader.bind(shader, false);\n\n //lost context! recover!\n let vb = this.vb;\n if (!vb) {\n vb = plugin.createVb();\n this.vb = vb;\n this.vbId = (vb as any).id;\n this.vbBuffer = null;\n this.modificationMarker = 0;\n }\n\n plugin.checkIndexBuffer(rectsCount, vb);\n const boundCountPerBuffer = Constant.boundCountPerBuffer;\n\n let vertexBuf = vb.getBuffer('aVertexPosition');\n //if layer was changed, re-upload vertices\n let vertices = rectsCount * vb.vertPerQuad;\n if (vertices === 0) return;\n if (this.modificationMarker !== vertices) {\n this.modificationMarker = vertices;\n let vs = vb.stride * vertices;\n if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {\n //!@#$ happens, need resize\n let bk = vb.stride;\n while (bk < vs) {\n bk *= 2;\n }\n this.vbBuffer = new ArrayBuffer(bk);\n this.vbArray = new Float32Array(this.vbBuffer);\n this.vbInts = new Uint32Array(this.vbBuffer);\n vertexBuf.update(this.vbBuffer);\n }\n\n let arr = this.vbArray, ints = this.vbInts;\n //upload vertices!\n let sz = 0;\n //let tint = 0xffffffff;\n let textureId: number = 0;\n let shiftU: number = this.offsetX;\n let shiftV: number = this.offsetY;\n\n //let tint = 0xffffffff;\n let tint = -1;\n for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) {\n let eps = 0.5;\n if (this.compositeParent) {\n if (boundCountPerBuffer > 1) {\n //TODO: what if its more than 4?\n textureId = (points[i + 9] >> 2);\n shiftU = this.offsetX * (points[i + 9] & 1);\n shiftV = this.offsetY * ((points[i + 9] >> 1) & 1);\n } else {\n textureId = points[i + 9];\n shiftU = 0;\n shiftV = 0;\n }\n }\n let x = points[i + 2], y = points[i + 3];\n let w = points[i + 4], h = points[i + 5];\n let u = points[i] + shiftU, v = points[i + 1] + shiftV;\n let rotate = points[i + 6];\n\n const animX = points[i + 7], animY = points[i + 8];\n const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024;\n const animXEncoded = animX + (animWidth * 2048);\n const animYEncoded = animY + (animHeight * 2048);\n\n let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number;\n if (rotate === 0) {\n u0 = u;\n v0 = v;\n u1 = u + w;\n v1 = v;\n u2 = u + w;\n v2 = v + h;\n u3 = u;\n v3 = v + h;\n } else {\n let w2 = w / 2;\n let h2 = h / 2;\n if (rotate % 4 !== 0) {\n w2 = h / 2;\n h2 = w / 2;\n }\n const cX = u + w2;\n const cY = v + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW);\n u0 = cX + (w2 * groupD8.uX(rotate));\n v0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n u1 = cX + (w2 * groupD8.uX(rotate));\n v1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u2 = cX + (w2 * groupD8.uX(rotate));\n v2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u3 = cX + (w2 * groupD8.uX(rotate));\n v3 = cY + (h2 * groupD8.uY(rotate));\n }\n\n arr[sz++] = x;\n arr[sz++] = y;\n arr[sz++] = u0;\n arr[sz++] = v0;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y;\n arr[sz++] = u1;\n arr[sz++] = v1;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y + h;\n arr[sz++] = u2;\n arr[sz++] = v2;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x;\n arr[sz++] = y + h;\n arr[sz++] = u3;\n arr[sz++] = v3;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n }\n\n vertexBuf.update(arr);\n }\n\n (renderer.geometry as any).bind(vb, shader);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES, rectsCount * 6, 0);\n }\n\n isModified(anim: boolean) {\n if (this.modificationMarker !== this.pointsBuf.length ||\n anim && this.hasAnim) {\n return true;\n }\n return false;\n }\n\n clearModify() {\n this.modificationMarker = this.pointsBuf.length;\n }\n\n destroy(options?: any) {\n super.destroy(options);\n this.destroyVb();\n }\n}\n","/// \n\nimport { Container } from '@pixi/display';\nimport { Texture, Renderer } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { Constant } from './Constant';\nimport { RectTileLayer } from './RectTileLayer';\n\nexport class CompositeRectTileLayer extends Container {\n constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n super();\n this.initialize.apply(this, arguments);\n }\n\n updateTransform() {\n (this as any).displayObjectUpdateTransform();\n }\n\n z: number;\n zIndex: number;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n _lastLayer: RectTileLayer = null;\n\n texPerChild: number;\n\n initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n if (texPerChild as any === true) {\n //old format, ignore it!\n texPerChild = 0;\n }\n this.z = this.zIndex = zIndex;\n this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures;\n if (bitmaps) {\n this.setBitmaps(bitmaps);\n }\n }\n\n setBitmaps(bitmaps: Array) {\n for (let i=0;i 5.2.1, it does not exist there.`);\n }\n }\n let texPerChild = this.texPerChild;\n let len1 = this.children.length;\n let len2 = Math.ceil(bitmaps.length / texPerChild);\n let i: number;\n for (i = 0; i < len1; i++) {\n (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);\n }\n for (i = len1; i < len2; i++) {\n let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild));\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n this.addChild(layer);\n }\n }\n\n clear() {\n for (let i = 0; i < this.children.length; i++) {\n (this.children[i] as RectTileLayer).clear();\n }\n this.modificationMarker = 0;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this {\n const childIndex: number = textureIndex / this.texPerChild >> 0;\n const textureId: number = textureIndex % this.texPerChild;\n\n if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) {\n this._lastLayer = (this.children[childIndex] as RectTileLayer);\n this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight);\n } else {\n this._lastLayer = null;\n }\n\n return this;\n }\n\n tileRotate(rotate: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileRotate(rotate);\n }\n return this;\n }\n\n tileAnimX(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimX(offset, count);\n }\n return this;\n }\n\n tileAnimY(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimY(offset, count);\n }\n return this;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this {\n let texture: Texture;\n let layer: RectTileLayer = null;\n let ind: number = 0;\n let children = this.children;\n\n this._lastLayer = null;\n if (typeof texture_ === \"number\") {\n let childIndex = texture_ / this.texPerChild >> 0;\n layer = children[childIndex] as RectTileLayer;\n\n if (!layer) {\n layer = children[0] as RectTileLayer;\n if (!layer) {\n return this;\n }\n ind = 0;\n } else {\n ind = texture_ % this.texPerChild;\n }\n\n texture = layer.textures[ind];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n let tex = child.textures;\n for (let j = 0; j < tex.length; j++) {\n if (tex[j].baseTexture === texture.baseTexture) {\n layer = child;\n ind = j;\n break;\n }\n }\n if (layer) {\n break;\n }\n }\n\n if (!layer) {\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n if (child.textures.length < this.texPerChild) {\n layer = child;\n ind = child.textures.length;\n child.textures.push(texture);\n break;\n }\n }\n if (!layer) {\n layer = new RectTileLayer(this.zIndex, texture);\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n children.push(layer);\n ind = 0;\n }\n }\n }\n\n this._lastLayer = layer;\n layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight);\n return this;\n }\n\n renderCanvas(renderer: any) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderCanvasCore(renderer);\n }\n }\n\n render(renderer: Renderer) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n //TODO: dont create new array, please\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n renderer.shader.bind(shader, false);\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin);\n }\n }\n\n isModified(anim: boolean) {\n let layers = this.children;\n if (this.modificationMarker !== layers.length) {\n return true;\n }\n for (let i = 0; i < layers.length; i++) {\n if ((layers[i] as RectTileLayer).isModified(anim)) {\n return true;\n }\n }\n return false;\n }\n\n clearModify() {\n let layers = this.children;\n this.modificationMarker = layers.length;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).clearModify();\n }\n }\n}","/// \n\nimport { Matrix } from '@pixi/math';\nimport { Graphics } from '@pixi/graphics';\n\nexport class GraphicsLayer extends Graphics {\n constructor(zIndex: number) {\n super();\n this.zIndex = zIndex;\n }\n\n renderCanvas(renderer: any) {\n let wt: Matrix = null;\n if (renderer.plugins.tilemap.dontUseTransform) {\n wt = this.transform.worldTransform;\n this.transform.worldTransform = Matrix.IDENTITY;\n }\n renderer.plugins.graphics.render(this);\n if (renderer.plugins.tilemap.dontUseTransform) {\n this.transform.worldTransform = wt;\n }\n renderer.context.globalAlpha = 1.0;\n }\n\n // renderWebGL(renderer: PIXI.Renderer) {\n // if (!this._webGL[renderer.CONTEXT_UID])\n // this.dirty++;\n // super.renderWebGL(renderer)\n // }\n\n isModified(anim: boolean): boolean {\n return false;\n }\n\n clearModify() {\n }\n}\n","/// \n\nimport { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, Renderer, Texture, GLTexture, resources } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Constant } from './Constant';\n\nexport interface IMultiTextureOptions {\n\tboundCountPerBuffer: number;\n\tboundSize: number;\n\tbufferSize: number;\n\tDO_CLEAR?: boolean;\n}\n\nexport class MultiTextureResource extends resources.Resource {\n\tconstructor(options: IMultiTextureOptions) {\n\t\tsuper(options.bufferSize, options.bufferSize);\n\n\t\tconst bounds = this.boundSprites;\n\t\tconst dirties = this.dirties;\n\t\tthis.boundSize = options.boundSize;\n\t\tfor (let j = 0; j < options.boundCountPerBuffer; j++) {\n\t\t\tconst spr = new Sprite();\n\t\t\tspr.position.x = options.boundSize * (j & 1);\n\t\t\tspr.position.y = options.boundSize * (j >> 1);\n\t\t\tbounds.push(spr);\n\t\t\tdirties.push(0);\n\t\t}\n\t\tthis.DO_CLEAR = !!options.DO_CLEAR;\n\t}\n\n\tDO_CLEAR = false;\n\tboundSize: number = 0;\n\t_clearBuffer: Uint8Array = null;\n\n\tbind(baseTexture: BaseTexture) {\n\t\tif (this.baseTex) {\n\t\t\tthrow new Error('Only one baseTexture is allowed for this resource!')\n\t\t}\n\t\tthis.baseTex = baseTexture;\n\t\tsuper.bind(baseTexture);\n\t}\n\n\tbaseTex: BaseTexture = null;\n\tboundSprites: Array = [];\n\tdirties: Array = [];\n\n\tsetTexture(ind: number, texture: Texture) {\n\t\tconst spr = this.boundSprites[ind];\n\t\tif (spr.texture.baseTexture === texture.baseTexture) {\n\t\t\treturn;\n\t\t}\n\t\tspr.texture = texture;\n\t\tthis.baseTex.update();\n\t\tthis.dirties[ind] = (this.baseTex as any).dirtyId;\n\t}\n\n\tupload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture) {\n\t\tconst { gl } = renderer as any;\n\n\t\tconst {width, height} = this;\n\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined ||\n\t\t\ttexture.alphaMode === ALPHA_MODES.UNPACK);\n\n\t\tif (glTexture.dirtyId < 0) {\n\t\t\t(glTexture as any).width = width;\n\t\t\t(glTexture as any).height = height;\n\n\t\t\tgl.texImage2D(texture.target, 0,\n\t\t\t\ttexture.format,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\t0,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tnull);\n\t\t}\n\n\t\tconst doClear = this.DO_CLEAR;\n\t\tif (doClear && !this._clearBuffer) {\n\t\t\tthis._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4);\n\t\t}\n\n\t\tconst bounds = this.boundSprites;\n\t\tfor (let i = 0; i < bounds.length; i++) {\n\t\t\tconst spr = bounds[i];\n\t\t\tconst tex = spr.texture.baseTexture;\n\t\t\tif (glTexture.dirtyId >= this.dirties[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst res = tex.resource as any;\n\t\t\tif (!tex.valid || !res || !res.source) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (doClear && (tex.width < this.boundSize || tex.height < this.boundSize))\n\t\t\t{\n\t\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\t\tspr.position.x,\n\t\t\t\t\tspr.position.y,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\ttexture.format,\n\t\t\t\t\ttexture.type,\n\t\t\t\t\tthis._clearBuffer);\n\t\t\t}\n\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\tspr.position.x,\n\t\t\t\tspr.position.y,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tres.source);\n\t\t}\n\n\t\treturn true;\n\t}\n}\n","import { Constant } from './Constant';\n\nimport type { TilemapShader } from './RectTileShader';\n\n\nexport function fillSamplers(shader: TilemapShader, maxTextures: number) {\n let sampleValues: Array = [];\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n shader.uniforms.uSamplers = sampleValues;\n\n let samplerSize: Array = [];\n for (let i = 0; i < maxTextures; i++) {\n samplerSize.push(1.0 / Constant.bufferSize);\n samplerSize.push(1.0 / Constant.bufferSize);\n }\n shader.uniforms.uSamplerSize = samplerSize;\n}\n\nexport function generateFragmentSrc(maxTextures: number, fragmentSrc: string) {\n return fragmentSrc.replace(/%count%/gi, maxTextures + \"\")\n .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n}\n\nexport function generateSampleSrc(maxTextures: number) {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n src += 'if(vTextureId <= -1.0) {';\n src += '\\n\\tcolor = shadowColor;';\n src += '\\n}';\n\n for (let i = 0; i < maxTextures; i++)\n {\n src += '\\nelse ';\n\n if(i < maxTextures-1)\n {\n src += 'if(textureId == ' + i + '.0)';\n }\n\n src += '\\n{';\n src += '\\n\\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);';\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n}\n","/// \n\nimport * as shaderGenerator from './shaderGenerator';\n\nimport { Buffer, Geometry, Shader } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nlet rectShaderFrag = `\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n`;\nlet rectShaderVert = `\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n`;\n\nexport abstract class TilemapShader extends Shader {\n\tmaxTextures = 0;\n\n\tconstructor(maxTextures: number, shaderVert: string, shaderFrag: string) {\n\t\tsuper(\n\t\t\tnew PIXI.Program(\n\t\t\t\tshaderVert,\n\t\t\t\tshaderFrag),\n\t\t\t{\n\t\t\t\tanimationFrame: new Float32Array(2),\n\t\t\t\tuSamplers: [],\n\t\t\t\tuSamplerSize: [],\n\t\t\t\tprojTransMatrix: new Matrix()\n\t\t\t}\n\t\t);\n\t\tthis.maxTextures = maxTextures;\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileShader extends TilemapShader {\n\tconstructor(maxTextures: number) {\n\t\tsuper(\n\t\t\tmaxTextures,\n\t\t\trectShaderVert,\n\t\t\tshaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)\n\t\t);\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileGeom extends Geometry {\n\tvertSize = 11;\n\tvertPerQuad = 4;\n\tstride = this.vertSize * 4;\n\tlastTimeAccess = 0;\n\n\tconstructor() {\n\t\tsuper();\n\t\tconst buf = this.buf = new Buffer(new Float32Array(2), true, false);\n\t\tthis.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0)\n\t\t\t.addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4)\n\t\t\t.addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4)\n\t\t\t.addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4)\n\t\t\t.addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4);\n\t}\n\n\tbuf: PIXI.Buffer;\n}","import { WRAP_MODES } from '@pixi/constants';\nimport { BaseTexture, Buffer, resources, ObjectRenderer, Texture, Renderer } from '@pixi/core';\nimport { Constant } from './Constant';\nimport { RectTileGeom, RectTileShader } from './RectTileShader';\nimport { MultiTextureResource } from './MultiTextureResource';\n\nimport type { TilemapShader } from './RectTileShader';\n\n/**\n * Renderer for rectangle tiles.\n */\nexport class TileRenderer extends ObjectRenderer {\n\trenderer: Renderer;\n\tgl: WebGLRenderingContext;\n\tsn: number = -1;\n\tindexBuffer: PIXI.Buffer = null;\n\tibLen: number = 0;\n\ttileAnim = [0, 0];\n\ttexLoc: Array = [];\n\n\trectShader: RectTileShader;\n\ttexResources: Array = [];\n\n\tconstructor(renderer: Renderer) {\n\t\tsuper(renderer);\n\t\tthis.rectShader = new RectTileShader(Constant.maxTextures);\n\t\tthis.indexBuffer = new Buffer(undefined, true, true);\n\t\tthis.checkIndexBuffer(2000);\n\t\tthis.initBounds();\n\t}\n\n\tinitBounds() {\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tfor (let i = 0; i < maxTextures; i++) {\n\t\t\tconst resource = new MultiTextureResource(Constant);\n\t\t\tconst baseTex = new BaseTexture(resource);\n\t\t\tbaseTex.scaleMode = Constant.SCALE_MODE;\n\t\t\tbaseTex.wrapMode = WRAP_MODES.CLAMP;\n\t\t\tthis.texResources.push(resource);\n\t\t}\n\t}\n\n\tbindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tlet samplerSize: Array = (shader as any).uniforms.uSamplerSize;\n\t\tthis.texLoc.length = 0;\n\t\tfor (let i = 0; i < textures.length; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trenderer.texture.bind(textures[i], i);\n\t\t\t//TODO: add resolution here\n\t\t\tsamplerSize[i * 2] = 1.0 / textures[i].baseTexture.width;\n\t\t\tsamplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height;\n\t\t}\n\t\t(shader as any).uniforms.uSamplerSize = samplerSize;\n\t}\n\n\tbindTextures(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tconst len = textures.length;\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tif (len > Constant.boundCountPerBuffer * maxTextures) {\n\t\t\treturn;\n\t\t}\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\tthis.bindTexturesWithoutRT(renderer, shader, textures);\n\t\t\treturn;\n\t\t}\n\n\t\tlet i = 0;\n\t\tfor (; i < len; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) continue;\n\t\t\tconst multi = this.texResources[i >> 2];\n\t\t\tmulti.setTexture(i & 3, texture);\n\t\t}\n\n\t\tlet gltsUsed = (i + 3) >> 2;\n\t\tfor (i = 0; i < gltsUsed; i++) {\n\t\t\t//remove \"i, true\" after resolving a bug\n\t\t\trenderer.texture.bind(this.texResources[i].baseTex, i);\n\t\t}\n\t}\n\n\tstart() {\n\t\t//sorry, nothing\n\t}\n\n\tcreateVb() {\n\t\tconst geom = new RectTileGeom();\n\t\tgeom.addIndex(this.indexBuffer);\n\t\tgeom.lastTimeAccess = Date.now();\n\t\treturn geom;\n\t}\n\n\tcheckIndexBuffer(size: number, vb: RectTileGeom = null) {\n\t\tconst totalIndices = size * 6;\n\n\t\tif (totalIndices <= this.ibLen) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet len = totalIndices;\n\t\twhile (len < totalIndices) {\n\t\t\tlen <<= 1;\n\t\t}\n\n\t\tthis.ibLen = totalIndices;\n\t\tthis.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size,\n\t\t\tConstant.use32bitIndex ? new Uint32Array(size * 6) : undefined));\n\n\t\t// \tTODO: create new index buffer instead?\n\t\t// if (vb) {\n\t\t// \tconst curIndex = vb.getIndex();\n\t\t// \tif (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) {\n\t\t// \t\tthis.swapIndex(vb, this.indexBuffer);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t// swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) {\n\t\t// let buffers = (geom as any).buffers;\n\t\t// const oldIndex = geom.getIndex();\n\t\t// let ind = buffers.indexOf(oldIndex);\n\t\t// if (ind >= 0) {\n\t\t// \tbuffers.splice(ind, 1);\n\t\t// }\n\t\t// geom.addIndex(indexBuf);\n\t// }\n\n\tgetShader(): TilemapShader {\n\t\treturn this.rectShader;\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\t// this.rectShader.destroy();\n\t\tthis.rectShader = null;\n\t}\n}\n\nRenderer.registerPlugin('tilemap', TileRenderer as any);\n","/// \n\nnamespace pixi_tilemap {\n (PIXI as any).tilemap = pixi_tilemap;\n}\n\n// This makes exporter.ts a module!\nexport default {}\n","/// \n\nimport { Container } from '@pixi/display';\n\nimport type { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport type { Matrix } from '@pixi/math';\n\nexport class ZLayer extends Container {\n\n constructor(tilemap: Container, zIndex: number) {\n super();\n this.tilemap = tilemap;\n this.z = zIndex;\n }\n\n tilemap: any;\n z: number;\n zIndex: number;\n _previousLayers: number;\n canvasBuffer: HTMLCanvasElement;\n _tempRender: any;\n _lastAnimationFrame: number = -1;\n layerTransform: Matrix;\n\n clear() {\n let layers = this.children as Array;\n for (let i = 0; i < layers.length; i++)\n layers[i].clear();\n this._previousLayers = 0;\n }\n\n cacheIfDirty() {\n let tilemap: any = this.tilemap;\n let layers = this.children as Array;\n let modified = this._previousLayers !== layers.length;\n this._previousLayers = layers.length;\n let buf = this.canvasBuffer;\n let tempRender = this._tempRender;\n if (!buf) {\n buf = this.canvasBuffer = document.createElement('canvas');\n tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf});\n tempRender.context = tempRender.rootContext;\n tempRender.plugins.tilemap.dontUseTransform = true;\n }\n if (buf.width !== tilemap._layerWidth ||\n buf.height !== tilemap._layerHeight) {\n buf.width = tilemap._layerWidth;\n buf.height = tilemap._layerHeight;\n modified = true;\n }\n let i: number;\n if (!modified) {\n for (i = 0; i < layers.length; i++) {\n if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) {\n modified = true;\n break;\n }\n }\n }\n this._lastAnimationFrame = tilemap.animationFrame;\n if (modified) {\n if (tilemap._hackRenderer) {\n tilemap._hackRenderer(tempRender);\n }\n tempRender.context.clearRect(0, 0, buf.width, buf.height);\n for (i = 0; i < layers.length; i++) {\n layers[i].clearModify();\n layers[i].renderCanvas(tempRender);\n }\n }\n this.layerTransform = this.worldTransform;\n for (i = 0; i < layers.length; i++) {\n this.layerTransform = layers[i].worldTransform;\n break;\n }\n }\n\n renderCanvas(renderer: any) {\n this.cacheIfDirty();\n let wt = this.layerTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n let tilemap = this.tilemap;\n renderer.context.drawImage(this.canvasBuffer, 0, 0);\n }\n}\n","import { CanvasTileRenderer } from './CanvasTileRenderer';\nimport { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport { Constant } from './Constant';\nimport { GraphicsLayer } from './GraphicsLayer';\nimport { MultiTextureResource } from './MultiTextureResource';\nimport { RectTileLayer } from './RectTileLayer';\nimport { TilemapShader, RectTileShader, RectTileGeom } from './RectTileShader';\nimport { TileRenderer } from './TileRenderer';\nimport { ZLayer } from './ZLayer';\n\nexport const pixi_tilemap = {\n CanvasTileRenderer,\n CompositeRectTileLayer,\n Constant,\n GraphicsLayer,\n MultiTextureResource,\n RectTileLayer,\n TilemapShader,\n RectTileShader,\n RectTileGeom,\n TileRenderer,\n ZLayer,\n};\n\nexport * from './CanvasTileRenderer';\nexport * from './CompositeRectTileLayer';\nexport * from './Constant';\nexport * from './exporter';\nexport * from './GraphicsLayer';\nexport * from './MultiTextureResource';\nexport * from './RectTileLayer';\nexport * from './RectTileShader';\nexport * from './shaderGenerator';\nexport * from './TileRenderer';\nexport * from './ZLayer';"],"names":["renderer","this","tileAnim","cr","PIXI","CanvasRenderer","registerPlugin","CanvasTileRenderer","extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","__extends","__","constructor","prototype","create","Constant","maxTextures","bufferSize","boundSize","boundCountPerBuffer","use32bitIndex","SCALE_MODE","SCALE_MODES","LINEAR","DO_CLEAR","zIndex","texture","_super","_this","Float32Array","initialize","RectTileLayer","textures","baseTexture","pointsBuf","length","modificationMarker","hasAnim","texture_","x","y","animX","animY","textureIndex","Texture","from","found","textureList","i","addRect","frame","orig","width","height","rotate","u","v","tileWidth","tileHeight","animCountX","animCountY","pb","push","offset","count","plugins","tilemap","dontUseTransform","wt","worldTransform","context","setTransform","a","c","tx","resolution","ty","renderCanvasCore","points","fillStyle","n","x1","y1","x2","y2","w","h","drawImage","getDrawableSource","globalAlpha","fillRect","vb","destroy","plugin","shader","getShader","batch","setObjectRenderer","_globalMat","uniforms","projTransMatrix","globalUniforms","projectionMatrix","copyTo","append","shadowColor","animationFrame","renderWebGLCore","rectsCount","bindTextures","bind","createVb","vbId","id","vbBuffer","checkIndexBuffer","vertexBuf","getBuffer","vertices","vertPerQuad","vs","stride","byteLength","bk","ArrayBuffer","vbArray","vbInts","Uint32Array","update","arr","sz","textureId","shiftU","offsetX","shiftV","offsetY","compositeParent","animXEncoded","animYEncoded","u0","v0","u1","v1","u2","v2","u3","v3","w2","h2","cX","cY","groupD8","add","NW","uX","uY","geometry","draw","DRAW_MODES","TRIANGLES","anim","options","destroyVb","Container","bitmaps","texPerChild","apply","arguments","CompositeRectTileLayer","displayObjectUpdateTransform","z","setBitmaps","i_1","Error","len1","children","len2","Math","ceil","slice","layer","addChild","clear","animWidth","animHeight","childIndex","_lastLayer","tileRotate","tileAnimX","tileAnimY","ind","tex","child","j","visible","worldAlpha","renderable","layers","isModified","clearModify","GraphicsLayer","transform","Matrix","IDENTITY","graphics","render","Graphics","bounds","boundSprites","dirties","spr","Sprite","position","MultiTextureResource","baseTex","dirtyId","glTexture","gl","pixelStorei","UNPACK_PREMULTIPLY_ALPHA_WEBGL","undefined","alphaMode","ALPHA_MODES","UNPACK","texImage2D","target","format","type","doClear","_clearBuffer","Uint8Array","res","resource","valid","source","texSubImage2D","resources","Resource","fillSamplers","sampleValues","uSamplers","samplerSize","uSamplerSize","generateFragmentSrc","fragmentSrc","replace","generateSampleSrc","shaderVert","shaderFrag","Program","shaderGenerator.fillSamplers","Shader","shaderGenerator.generateFragmentSrc","TilemapShader","vertSize","buf","Buffer","addAttribute","Geometry","rectShader","RectTileShader","indexBuffer","initBounds","TileRenderer","BaseTexture","scaleMode","wrapMode","WRAP_MODES","CLAMP","texResources","texLoc","len","bindTexturesWithoutRT","setTexture","gltsUsed","geom","RectTileGeom","addIndex","lastTimeAccess","Date","now","size","totalIndices","ibLen","utils","createIndicesForQuads","ObjectRenderer","pixi_tilemap","ZLayer","_previousLayers","modified","canvasBuffer","tempRender","_tempRender","document","createElement","view","rootContext","_layerWidth","_layerHeight","_lastAnimationFrame","_hackRenderer","clearRect","renderCanvas","layerTransform","cacheIfDirty","src"],"mappings":";;;;;;;;;4DASI,SAAYA,GAHZC,cAAW,CAAC,EAAG,GACfA,uBAAmB,EAGfA,KAAKD,SAAWA,EAChBC,KAAKC,SAAW,CAAC,EAAG,IAItBC,EAAMC,KAAaC,eAErBF,GACAA,EAAGG,eAAe,UAAWC;;;;;;;;;;;;;;qFCFjC,IAAIC,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,IACvE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOA,EAAEM,eAAeD,KAAIN,EAAEM,GAAKL,EAAEK,MACpDN,EAAGC,IAGrB,SAASO,EAAUR,EAAGC,GAEzB,SAASQ,IAAOjB,KAAKkB,YAAcV,EADnCD,EAAcC,EAAGC,GAEjBD,EAAEW,UAAkB,OAANV,EAAaC,OAAOU,OAAOX,IAAMQ,EAAGE,UAAYV,EAAEU,UAAW,IAAIF,OC1BtEI,EAAW,CACpBC,YAAa,GACbC,WAAY,KACZC,UAAW,KACXC,oBAAqB,EACrBC,eAAe,EACfC,WAAYxB,KAAKyB,YAAYC,OAC7BC,UAAU,iBCOV,WAAYC,EAAgBC,GAA5B,MACIC,0BAIJC,SAAS,EACTA,qBAAqB,EACrBA,cAAc,IAAIC,aAAa,CAAC,EAAK,EAAK,EAAK,KAC/CD,aAAqB,KAErBA,YAA2B,GAC3BA,WAAU,EAGVA,UAAU,EACVA,UAAU,EACVA,mBAA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VF,EAAOrJ,GAAG+P,aAAaX,GAI/B,IADA1S,KAAKsT,eAAiBtT,KAAK2E,eACtBrB,EAAI,EAAGA,EAAIqJ,EAAOlK,OAAQa,IAAK,CAChCtD,KAAKsT,eAAiB3G,EAAOrJ,GAAGqB,eAChC,QAIR2N,yBAAA,SAAavS,GACTC,KAAKuT,eACL,IAAI7O,EAAK1E,KAAKsT,eACdvT,EAAS6E,QAAQC,aACbH,EAAGI,EACHJ,EAAGjE,EACHiE,EAAGK,EACHL,EAAGlE,EACHkE,EAAGM,GAAKjF,EAASkF,WACjBP,EAAGQ,GAAKnF,EAASkF,YAEPjF,KAAKwE,QACnBzE,EAAS6E,QAAQiB,UAAU7F,KAAKyS,aAAc,EAAG,OAlF7BhI,cDL5B,SAAU4H,GACLlS,KAAaqE,QAAU6N,EAD5B,CAAUA,IAAAA,WEQGA,EAAe,CACxB/R,qBACAwK,yBACAzJ,WACAyL,gBACAa,uBACAtL,gBACA8N,gBACAO,iBACAgB,eACAb,eACAyB,+ITV6B,6KIeChR,GAC9B,IAAIkS,EAAM,GAEVA,GAAO,KACPA,GAAO,KAEPA,GAAO,2BACPA,GAAO,2BACPA,GAAO,MAEP,IAAK,IAAIlQ,EAAI,EAAGA,EAAIhC,EAAagC,IAE7BkQ,GAAO,UAEJlQ,EAAIhC,EAAY,IAEfkS,GAAO,mBAAqBlQ,EAAI,OAGpCkQ,GAAO,MACPA,GAAO,mCAAmClQ,EAAE,kCAAkCA,EAAE,MAChFkQ,GAAO,MAMX,OAHAA,GAAO,KACPA,GAAO"} \ No newline at end of file +{"version":3,"file":"pixi-tilemap.umd.min.js","sources":["../src/CanvasTileRenderer.ts","../node_modules/tslib/tslib.es6.js","../src/Constant.ts","../src/RectTileLayer.ts","../src/CompositeRectTileLayer.ts","../src/GraphicsLayer.ts","../src/MultiTextureResource.ts","../src/shaderGenerator.ts","../src/RectTileShader.ts","../src/TileRenderer.ts","../src/exporter.ts","../src/ZLayer.ts","../src/index.ts"],"sourcesContent":["/// \n\nimport { Renderer } from '@pixi/core';\n\nexport class CanvasTileRenderer {\n renderer: Renderer;\n tileAnim = [0, 0];\n dontUseTransform = false;\n\n constructor(renderer: Renderer) {\n this.renderer = renderer;\n this.tileAnim = [0, 0];\n }\n}\n\nconst cr = (PIXI as any).CanvasRenderer;\n\nif (cr) {\n cr.registerPlugin('tilemap', CanvasTileRenderer);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","export const Constant = {\n maxTextures: 16,\n bufferSize: 2048,\n boundSize: 1024,\n boundCountPerBuffer: 1,\n use32bitIndex: false,\n SCALE_MODE: PIXI.SCALE_MODES.LINEAR,\n DO_CLEAR: true\n};","/// \n\nimport { Container } from '@pixi/display';\nimport { Constant } from './Constant';\nimport { DRAW_MODES } from '@pixi/constants';\nimport { Texture, Renderer } from '@pixi/core';\nimport { TileRenderer } from './TileRenderer';\nimport { Matrix, groupD8 } from '@pixi/math';\n\nimport type { RectTileGeom } from './RectTileShader';\n\nexport const POINT_STRUCT_SIZE = 12;\n\nexport class RectTileLayer extends Container {\n constructor(zIndex: number, texture: Texture | Array) {\n super();\n this.initialize(zIndex, texture);\n }\n\n zIndex = 0;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n\n pointsBuf: Array = [];\n hasAnim = false;\n textures: Array;\n\n offsetX = 0;\n offsetY = 0;\n compositeParent = false;\n\n initialize(zIndex: number, textures: Texture | Array) {\n if (!textures) {\n textures = [];\n } else if (!(textures instanceof Array) && (textures as Texture).baseTexture) {\n textures = [textures as Texture];\n }\n this.textures = textures as Array;\n this.zIndex = zIndex;\n // this.visible = false;\n }\n\n clear() {\n this.pointsBuf.length = 0;\n this.modificationMarker = 0;\n this.hasAnim = false;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX: number, animY: number) {\n let texture: Texture;\n let textureIndex = 0;\n\n if (typeof texture_ === \"number\") {\n textureIndex = texture_;\n texture = this.textures[textureIndex];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n let found = false;\n let textureList = this.textures;\n for (let i = 0; i < textureList.length; i++) {\n if (textureList[i].baseTexture === texture.baseTexture) {\n textureIndex = i;\n found = true;\n break;\n }\n }\n\n if (!found) {\n // textureIndex = this.textures.length;\n // this.textures.push(texture);\n return false;\n }\n }\n\n this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate);\n return true;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number,\n animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this {\n let pb = this.pointsBuf;\n this.hasAnim = this.hasAnim || animX > 0 || animY > 0;\n pb.push(u);\n pb.push(v);\n pb.push(x);\n pb.push(y);\n pb.push(tileWidth);\n pb.push(tileHeight);\n pb.push(rotate);\n pb.push(animX | 0);\n pb.push(animY | 0);\n pb.push(textureIndex);\n pb.push(animCountX);\n pb.push(animCountY);\n\n return this;\n }\n\n tileRotate(rotate: number) {\n const pb = this.pointsBuf;\n pb[pb.length - 3] = rotate;\n }\n\n tileAnimX(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 5] = offset;\n pb[pb.length - 2] = count;\n }\n\n tileAnimY(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 4] = offset;\n pb[pb.length - 1] = count;\n }\n\n renderCanvas(renderer: any) {\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n this.renderCanvasCore(renderer);\n }\n\n renderCanvasCore(renderer: any) {\n if (this.textures.length === 0) return;\n let points = this.pointsBuf;\n renderer.context.fillStyle = '#000000';\n for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) {\n let x1 = points[i], y1 = points[i + 1];\n let x2 = points[i + 2], y2 = points[i + 3];\n let w = points[i + 4];\n let h = points[i + 5];\n var rotate = points[i + 6];\n x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0];\n y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1];\n let textureIndex = points[i + 9];\n // canvas does not work with rotate yet\n if (textureIndex >= 0) {\n renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h);\n } else {\n renderer.context.globalAlpha = 0.5;\n renderer.context.fillRect(x2, y2, w, h);\n renderer.context.globalAlpha = 1;\n }\n }\n }\n\n vbId = 0;\n vb: RectTileGeom = null;\n vbBuffer: ArrayBuffer = null;\n vbArray: Float32Array = null;\n vbInts: Uint32Array = null;\n\n destroyVb() {\n if (this.vb) {\n this.vb.destroy();\n this.vb = null;\n }\n }\n\n render(renderer: Renderer) {\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n this.renderWebGLCore(renderer, plugin);\n }\n\n renderWebGLCore(renderer: Renderer, plugin: TileRenderer) {\n let points = this.pointsBuf;\n if (points.length === 0) return;\n let rectsCount = points.length / POINT_STRUCT_SIZE;\n\n let shader = plugin.getShader();\n let textures = this.textures;\n if (textures.length === 0) return;\n\n plugin.bindTextures(renderer, shader, textures);\n renderer.shader.bind(shader, false);\n\n //lost context! recover!\n let vb = this.vb;\n if (!vb) {\n vb = plugin.createVb();\n this.vb = vb;\n this.vbId = (vb as any).id;\n this.vbBuffer = null;\n this.modificationMarker = 0;\n }\n\n plugin.checkIndexBuffer(rectsCount, vb);\n const boundCountPerBuffer = Constant.boundCountPerBuffer;\n\n let vertexBuf = vb.getBuffer('aVertexPosition');\n //if layer was changed, re-upload vertices\n let vertices = rectsCount * vb.vertPerQuad;\n if (vertices === 0) return;\n if (this.modificationMarker !== vertices) {\n this.modificationMarker = vertices;\n let vs = vb.stride * vertices;\n if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {\n //!@#$ happens, need resize\n let bk = vb.stride;\n while (bk < vs) {\n bk *= 2;\n }\n this.vbBuffer = new ArrayBuffer(bk);\n this.vbArray = new Float32Array(this.vbBuffer);\n this.vbInts = new Uint32Array(this.vbBuffer);\n vertexBuf.update(this.vbBuffer);\n }\n\n let arr = this.vbArray, ints = this.vbInts;\n //upload vertices!\n let sz = 0;\n //let tint = 0xffffffff;\n let textureId: number = 0;\n let shiftU: number = this.offsetX;\n let shiftV: number = this.offsetY;\n\n //let tint = 0xffffffff;\n let tint = -1;\n for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) {\n let eps = 0.5;\n if (this.compositeParent) {\n if (boundCountPerBuffer > 1) {\n //TODO: what if its more than 4?\n textureId = (points[i + 9] >> 2);\n shiftU = this.offsetX * (points[i + 9] & 1);\n shiftV = this.offsetY * ((points[i + 9] >> 1) & 1);\n } else {\n textureId = points[i + 9];\n shiftU = 0;\n shiftV = 0;\n }\n }\n let x = points[i + 2], y = points[i + 3];\n let w = points[i + 4], h = points[i + 5];\n let u = points[i] + shiftU, v = points[i + 1] + shiftV;\n let rotate = points[i + 6];\n\n const animX = points[i + 7], animY = points[i + 8];\n const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024;\n const animXEncoded = animX + (animWidth * 2048);\n const animYEncoded = animY + (animHeight * 2048);\n\n let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number;\n if (rotate === 0) {\n u0 = u;\n v0 = v;\n u1 = u + w;\n v1 = v;\n u2 = u + w;\n v2 = v + h;\n u3 = u;\n v3 = v + h;\n } else {\n let w2 = w / 2;\n let h2 = h / 2;\n if (rotate % 4 !== 0) {\n w2 = h / 2;\n h2 = w / 2;\n }\n const cX = u + w2;\n const cY = v + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW);\n u0 = cX + (w2 * groupD8.uX(rotate));\n v0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n u1 = cX + (w2 * groupD8.uX(rotate));\n v1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u2 = cX + (w2 * groupD8.uX(rotate));\n v2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u3 = cX + (w2 * groupD8.uX(rotate));\n v3 = cY + (h2 * groupD8.uY(rotate));\n }\n\n arr[sz++] = x;\n arr[sz++] = y;\n arr[sz++] = u0;\n arr[sz++] = v0;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y;\n arr[sz++] = u1;\n arr[sz++] = v1;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y + h;\n arr[sz++] = u2;\n arr[sz++] = v2;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x;\n arr[sz++] = y + h;\n arr[sz++] = u3;\n arr[sz++] = v3;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n }\n\n vertexBuf.update(arr);\n }\n\n (renderer.geometry as any).bind(vb, shader);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES, rectsCount * 6, 0);\n }\n\n isModified(anim: boolean) {\n if (this.modificationMarker !== this.pointsBuf.length ||\n anim && this.hasAnim) {\n return true;\n }\n return false;\n }\n\n clearModify() {\n this.modificationMarker = this.pointsBuf.length;\n }\n\n destroy(options?: any) {\n super.destroy(options);\n this.destroyVb();\n }\n}\n","/// \n\nimport { Container } from '@pixi/display';\nimport { Texture, Renderer } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { Constant } from './Constant';\nimport { RectTileLayer } from './RectTileLayer';\n\nexport class CompositeRectTileLayer extends Container {\n constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n super();\n this.initialize.apply(this, arguments);\n }\n\n updateTransform() {\n (this as any).displayObjectUpdateTransform();\n }\n\n z: number;\n zIndex: number;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n _lastLayer: RectTileLayer = null;\n\n texPerChild: number;\n\n initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n if (texPerChild as any === true) {\n //old format, ignore it!\n texPerChild = 0;\n }\n this.z = this.zIndex = zIndex;\n this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures;\n if (bitmaps) {\n this.setBitmaps(bitmaps);\n }\n }\n\n setBitmaps(bitmaps: Array) {\n for (let i=0;i 5.2.1, it does not exist there.`);\n }\n }\n let texPerChild = this.texPerChild;\n let len1 = this.children.length;\n let len2 = Math.ceil(bitmaps.length / texPerChild);\n let i: number;\n for (i = 0; i < len1; i++) {\n (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);\n }\n for (i = len1; i < len2; i++) {\n let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild));\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n this.addChild(layer);\n }\n }\n\n clear() {\n for (let i = 0; i < this.children.length; i++) {\n (this.children[i] as RectTileLayer).clear();\n }\n this.modificationMarker = 0;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this {\n const childIndex: number = textureIndex / this.texPerChild >> 0;\n const textureId: number = textureIndex % this.texPerChild;\n\n if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) {\n this._lastLayer = (this.children[childIndex] as RectTileLayer);\n this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight);\n } else {\n this._lastLayer = null;\n }\n\n return this;\n }\n\n tileRotate(rotate: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileRotate(rotate);\n }\n return this;\n }\n\n tileAnimX(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimX(offset, count);\n }\n return this;\n }\n\n tileAnimY(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimY(offset, count);\n }\n return this;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this {\n let texture: Texture;\n let layer: RectTileLayer = null;\n let ind: number = 0;\n let children = this.children;\n\n this._lastLayer = null;\n if (typeof texture_ === \"number\") {\n let childIndex = texture_ / this.texPerChild >> 0;\n layer = children[childIndex] as RectTileLayer;\n\n if (!layer) {\n layer = children[0] as RectTileLayer;\n if (!layer) {\n return this;\n }\n ind = 0;\n } else {\n ind = texture_ % this.texPerChild;\n }\n\n texture = layer.textures[ind];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n let tex = child.textures;\n for (let j = 0; j < tex.length; j++) {\n if (tex[j].baseTexture === texture.baseTexture) {\n layer = child;\n ind = j;\n break;\n }\n }\n if (layer) {\n break;\n }\n }\n\n if (!layer) {\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n if (child.textures.length < this.texPerChild) {\n layer = child;\n ind = child.textures.length;\n child.textures.push(texture);\n break;\n }\n }\n if (!layer) {\n layer = new RectTileLayer(this.zIndex, texture);\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n children.push(layer);\n ind = 0;\n }\n }\n }\n\n this._lastLayer = layer;\n layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight);\n return this;\n }\n\n renderCanvas(renderer: any) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderCanvasCore(renderer);\n }\n }\n\n render(renderer: Renderer) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n //TODO: dont create new array, please\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n renderer.shader.bind(shader, false);\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin);\n }\n }\n\n isModified(anim: boolean) {\n let layers = this.children;\n if (this.modificationMarker !== layers.length) {\n return true;\n }\n for (let i = 0; i < layers.length; i++) {\n if ((layers[i] as RectTileLayer).isModified(anim)) {\n return true;\n }\n }\n return false;\n }\n\n clearModify() {\n let layers = this.children;\n this.modificationMarker = layers.length;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).clearModify();\n }\n }\n}","/// \n\nimport { Matrix } from '@pixi/math';\nimport { Graphics } from '@pixi/graphics';\n\nexport class GraphicsLayer extends Graphics {\n constructor(zIndex: number) {\n super();\n this.zIndex = zIndex;\n }\n\n renderCanvas(renderer: any) {\n let wt: Matrix = null;\n if (renderer.plugins.tilemap.dontUseTransform) {\n wt = this.transform.worldTransform;\n this.transform.worldTransform = Matrix.IDENTITY;\n }\n renderer.plugins.graphics.render(this);\n if (renderer.plugins.tilemap.dontUseTransform) {\n this.transform.worldTransform = wt;\n }\n renderer.context.globalAlpha = 1.0;\n }\n\n // renderWebGL(renderer: PIXI.Renderer) {\n // if (!this._webGL[renderer.CONTEXT_UID])\n // this.dirty++;\n // super.renderWebGL(renderer)\n // }\n\n isModified(anim: boolean): boolean {\n return false;\n }\n\n clearModify() {\n }\n}\n","/// \n\nimport { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, Renderer, Texture, GLTexture, resources } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Constant } from './Constant';\n\nexport interface IMultiTextureOptions {\n\tboundCountPerBuffer: number;\n\tboundSize: number;\n\tbufferSize: number;\n\tDO_CLEAR?: boolean;\n}\n\nexport class MultiTextureResource extends resources.Resource {\n\tconstructor(options: IMultiTextureOptions) {\n\t\tsuper(options.bufferSize, options.bufferSize);\n\n\t\tconst bounds = this.boundSprites;\n\t\tconst dirties = this.dirties;\n\t\tthis.boundSize = options.boundSize;\n\t\tfor (let j = 0; j < options.boundCountPerBuffer; j++) {\n\t\t\tconst spr = new Sprite();\n\t\t\tspr.position.x = options.boundSize * (j & 1);\n\t\t\tspr.position.y = options.boundSize * (j >> 1);\n\t\t\tbounds.push(spr);\n\t\t\tdirties.push(0);\n\t\t}\n\t\tthis.DO_CLEAR = !!options.DO_CLEAR;\n\t}\n\n\tDO_CLEAR = false;\n\tboundSize: number = 0;\n\t_clearBuffer: Uint8Array = null;\n\n\tbind(baseTexture: BaseTexture) {\n\t\tif (this.baseTex) {\n\t\t\tthrow new Error('Only one baseTexture is allowed for this resource!')\n\t\t}\n\t\tthis.baseTex = baseTexture;\n\t\tsuper.bind(baseTexture);\n\t}\n\n\tbaseTex: BaseTexture = null;\n\tboundSprites: Array = [];\n\tdirties: Array = [];\n\n\tsetTexture(ind: number, texture: Texture) {\n\t\tconst spr = this.boundSprites[ind];\n\t\tif (spr.texture.baseTexture === texture.baseTexture) {\n\t\t\treturn;\n\t\t}\n\t\tspr.texture = texture;\n\t\tthis.baseTex.update();\n\t\tthis.dirties[ind] = (this.baseTex as any).dirtyId;\n\t}\n\n\tupload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture) {\n\t\tconst { gl } = renderer as any;\n\n\t\tconst {width, height} = this;\n\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined ||\n\t\t\ttexture.alphaMode === ALPHA_MODES.UNPACK);\n\n\t\tif (glTexture.dirtyId < 0) {\n\t\t\t(glTexture as any).width = width;\n\t\t\t(glTexture as any).height = height;\n\n\t\t\tgl.texImage2D(texture.target, 0,\n\t\t\t\ttexture.format,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\t0,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tnull);\n\t\t}\n\n\t\tconst doClear = this.DO_CLEAR;\n\t\tif (doClear && !this._clearBuffer) {\n\t\t\tthis._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4);\n\t\t}\n\n\t\tconst bounds = this.boundSprites;\n\t\tfor (let i = 0; i < bounds.length; i++) {\n\t\t\tconst spr = bounds[i];\n\t\t\tconst tex = spr.texture.baseTexture;\n\t\t\tif (glTexture.dirtyId >= this.dirties[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst res = tex.resource as any;\n\t\t\tif (!tex.valid || !res || !res.source) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (doClear && (tex.width < this.boundSize || tex.height < this.boundSize))\n\t\t\t{\n\t\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\t\tspr.position.x,\n\t\t\t\t\tspr.position.y,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\ttexture.format,\n\t\t\t\t\ttexture.type,\n\t\t\t\t\tthis._clearBuffer);\n\t\t\t}\n\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\tspr.position.x,\n\t\t\t\tspr.position.y,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tres.source);\n\t\t}\n\n\t\treturn true;\n\t}\n}\n","import { Constant } from './Constant';\n\nimport type { TilemapShader } from './RectTileShader';\n\n\nexport function fillSamplers(shader: TilemapShader, maxTextures: number) {\n let sampleValues: Array = [];\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n shader.uniforms.uSamplers = sampleValues;\n\n let samplerSize: Array = [];\n for (let i = 0; i < maxTextures; i++) {\n samplerSize.push(1.0 / Constant.bufferSize);\n samplerSize.push(1.0 / Constant.bufferSize);\n }\n shader.uniforms.uSamplerSize = samplerSize;\n}\n\nexport function generateFragmentSrc(maxTextures: number, fragmentSrc: string) {\n return fragmentSrc.replace(/%count%/gi, maxTextures + \"\")\n .replace(/%forloop%/gi, generateSampleSrc(maxTextures));\n}\n\nexport function generateSampleSrc(maxTextures: number) {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n src += 'if(vTextureId <= -1.0) {';\n src += '\\n\\tcolor = shadowColor;';\n src += '\\n}';\n\n for (let i = 0; i < maxTextures; i++)\n {\n src += '\\nelse ';\n\n if(i < maxTextures-1)\n {\n src += 'if(textureId == ' + i + '.0)';\n }\n\n src += '\\n{';\n src += '\\n\\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);';\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n}\n","/// \n\nimport * as shaderGenerator from './shaderGenerator';\n\nimport { Buffer, Geometry, Shader } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nlet rectShaderFrag = `\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n`;\nlet rectShaderVert = `\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n`;\n\nexport abstract class TilemapShader extends Shader {\n\tmaxTextures = 0;\n\n\tconstructor(maxTextures: number, shaderVert: string, shaderFrag: string) {\n\t\tsuper(\n\t\t\tnew PIXI.Program(\n\t\t\t\tshaderVert,\n\t\t\t\tshaderFrag),\n\t\t\t{\n\t\t\t\tanimationFrame: new Float32Array(2),\n\t\t\t\tuSamplers: [],\n\t\t\t\tuSamplerSize: [],\n\t\t\t\tprojTransMatrix: new Matrix()\n\t\t\t}\n\t\t);\n\t\tthis.maxTextures = maxTextures;\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileShader extends TilemapShader {\n\tconstructor(maxTextures: number) {\n\t\tsuper(\n\t\t\tmaxTextures,\n\t\t\trectShaderVert,\n\t\t\tshaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)\n\t\t);\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileGeom extends Geometry {\n\tvertSize = 11;\n\tvertPerQuad = 4;\n\tstride = this.vertSize * 4;\n\tlastTimeAccess = 0;\n\n\tconstructor() {\n\t\tsuper();\n\t\tconst buf = this.buf = new Buffer(new Float32Array(2), true, false);\n\t\tthis.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0)\n\t\t\t.addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4)\n\t\t\t.addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4)\n\t\t\t.addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4)\n\t\t\t.addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4);\n\t}\n\n\tbuf: PIXI.Buffer;\n}","import { WRAP_MODES } from '@pixi/constants';\nimport { BaseTexture, Buffer, resources, ObjectRenderer, Texture, Renderer } from '@pixi/core';\nimport { Constant } from './Constant';\nimport { RectTileGeom, RectTileShader } from './RectTileShader';\nimport { MultiTextureResource } from './MultiTextureResource';\n\nimport type { TilemapShader } from './RectTileShader';\n\n/**\n * Renderer for rectangle tiles.\n */\nexport class TileRenderer extends ObjectRenderer {\n\trenderer: Renderer;\n\tgl: WebGLRenderingContext;\n\tsn: number = -1;\n\tindexBuffer: PIXI.Buffer = null;\n\tibLen: number = 0;\n\ttileAnim = [0, 0];\n\ttexLoc: Array = [];\n\n\trectShader: RectTileShader;\n\ttexResources: Array = [];\n\n\tconstructor(renderer: Renderer) {\n\t\tsuper(renderer);\n\t\tthis.rectShader = new RectTileShader(Constant.maxTextures);\n\t\tthis.indexBuffer = new Buffer(undefined, true, true);\n\t\tthis.checkIndexBuffer(2000);\n\t\tthis.initBounds();\n\t}\n\n\tinitBounds() {\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tfor (let i = 0; i < maxTextures; i++) {\n\t\t\tconst resource = new MultiTextureResource(Constant);\n\t\t\tconst baseTex = new BaseTexture(resource);\n\t\t\tbaseTex.scaleMode = Constant.SCALE_MODE;\n\t\t\tbaseTex.wrapMode = WRAP_MODES.CLAMP;\n\t\t\tthis.texResources.push(resource);\n\t\t}\n\t}\n\n\tbindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tlet samplerSize: Array = (shader as any).uniforms.uSamplerSize;\n\t\tthis.texLoc.length = 0;\n\t\tfor (let i = 0; i < textures.length; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trenderer.texture.bind(textures[i], i);\n\t\t\t//TODO: add resolution here\n\t\t\tsamplerSize[i * 2] = 1.0 / textures[i].baseTexture.width;\n\t\t\tsamplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height;\n\t\t}\n\t\t(shader as any).uniforms.uSamplerSize = samplerSize;\n\t}\n\n\tbindTextures(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tconst len = textures.length;\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tif (len > Constant.boundCountPerBuffer * maxTextures) {\n\t\t\treturn;\n\t\t}\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\tthis.bindTexturesWithoutRT(renderer, shader, textures);\n\t\t\treturn;\n\t\t}\n\n\t\tlet i = 0;\n\t\tfor (; i < len; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) continue;\n\t\t\tconst multi = this.texResources[i >> 2];\n\t\t\tmulti.setTexture(i & 3, texture);\n\t\t}\n\n\t\tlet gltsUsed = (i + 3) >> 2;\n\t\tfor (i = 0; i < gltsUsed; i++) {\n\t\t\t//remove \"i, true\" after resolving a bug\n\t\t\trenderer.texture.bind(this.texResources[i].baseTex, i);\n\t\t}\n\t}\n\n\tstart() {\n\t\t//sorry, nothing\n\t}\n\n\tcreateVb() {\n\t\tconst geom = new RectTileGeom();\n\t\tgeom.addIndex(this.indexBuffer);\n\t\tgeom.lastTimeAccess = Date.now();\n\t\treturn geom;\n\t}\n\n\tcheckIndexBuffer(size: number, vb: RectTileGeom = null) {\n\t\tconst totalIndices = size * 6;\n\n\t\tif (totalIndices <= this.ibLen) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet len = totalIndices;\n\t\twhile (len < totalIndices) {\n\t\t\tlen <<= 1;\n\t\t}\n\n\t\tthis.ibLen = totalIndices;\n\t\tthis.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size,\n\t\t\tConstant.use32bitIndex ? new Uint32Array(size * 6) : undefined));\n\n\t\t// \tTODO: create new index buffer instead?\n\t\t// if (vb) {\n\t\t// \tconst curIndex = vb.getIndex();\n\t\t// \tif (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) {\n\t\t// \t\tthis.swapIndex(vb, this.indexBuffer);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t// swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) {\n\t\t// let buffers = (geom as any).buffers;\n\t\t// const oldIndex = geom.getIndex();\n\t\t// let ind = buffers.indexOf(oldIndex);\n\t\t// if (ind >= 0) {\n\t\t// \tbuffers.splice(ind, 1);\n\t\t// }\n\t\t// geom.addIndex(indexBuf);\n\t// }\n\n\tgetShader(): TilemapShader {\n\t\treturn this.rectShader;\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\t// this.rectShader.destroy();\n\t\tthis.rectShader = null;\n\t}\n}\n\nRenderer.registerPlugin('tilemap', TileRenderer as any);\n","/// \n\nnamespace pixi_tilemap {\n (PIXI as any).tilemap = pixi_tilemap;\n}\n\n// This makes exporter.ts a module!\nexport default {}\n","/// \n\nimport { Container } from '@pixi/display';\n\nimport type { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport type { Matrix } from '@pixi/math';\n\nexport class ZLayer extends Container {\n\n constructor(tilemap: Container, zIndex: number) {\n super();\n this.tilemap = tilemap;\n this.z = zIndex;\n }\n\n tilemap: any;\n z: number;\n zIndex: number;\n _previousLayers: number;\n canvasBuffer: HTMLCanvasElement;\n _tempRender: any;\n _lastAnimationFrame: number = -1;\n layerTransform: Matrix;\n\n clear() {\n let layers = this.children as Array;\n for (let i = 0; i < layers.length; i++)\n layers[i].clear();\n this._previousLayers = 0;\n }\n\n cacheIfDirty() {\n let tilemap: any = this.tilemap;\n let layers = this.children as Array;\n let modified = this._previousLayers !== layers.length;\n this._previousLayers = layers.length;\n let buf = this.canvasBuffer;\n let tempRender = this._tempRender;\n if (!buf) {\n buf = this.canvasBuffer = document.createElement('canvas');\n tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf});\n tempRender.context = tempRender.rootContext;\n tempRender.plugins.tilemap.dontUseTransform = true;\n }\n if (buf.width !== tilemap._layerWidth ||\n buf.height !== tilemap._layerHeight) {\n buf.width = tilemap._layerWidth;\n buf.height = tilemap._layerHeight;\n modified = true;\n }\n let i: number;\n if (!modified) {\n for (i = 0; i < layers.length; i++) {\n if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) {\n modified = true;\n break;\n }\n }\n }\n this._lastAnimationFrame = tilemap.animationFrame;\n if (modified) {\n if (tilemap._hackRenderer) {\n tilemap._hackRenderer(tempRender);\n }\n tempRender.context.clearRect(0, 0, buf.width, buf.height);\n for (i = 0; i < layers.length; i++) {\n layers[i].clearModify();\n layers[i].renderCanvas(tempRender);\n }\n }\n this.layerTransform = this.worldTransform;\n for (i = 0; i < layers.length; i++) {\n this.layerTransform = layers[i].worldTransform;\n break;\n }\n }\n\n renderCanvas(renderer: any) {\n this.cacheIfDirty();\n let wt = this.layerTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n let tilemap = this.tilemap;\n renderer.context.drawImage(this.canvasBuffer, 0, 0);\n }\n}\n","import { CanvasTileRenderer } from './CanvasTileRenderer';\nimport { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport { Constant } from './Constant';\nimport { GraphicsLayer } from './GraphicsLayer';\nimport { MultiTextureResource } from './MultiTextureResource';\nimport { RectTileLayer } from './RectTileLayer';\nimport { TilemapShader, RectTileShader, RectTileGeom } from './RectTileShader';\nimport { TileRenderer } from './TileRenderer';\nimport { ZLayer } from './ZLayer';\n\nexport const pixi_tilemap = {\n CanvasTileRenderer,\n CompositeRectTileLayer,\n Constant,\n GraphicsLayer,\n MultiTextureResource,\n RectTileLayer,\n TilemapShader,\n RectTileShader,\n RectTileGeom,\n TileRenderer,\n ZLayer,\n};\n\nexport * from './CanvasTileRenderer';\nexport * from './CompositeRectTileLayer';\nexport * from './Constant';\nexport * from './exporter';\nexport * from './GraphicsLayer';\nexport * from './MultiTextureResource';\nexport * from './RectTileLayer';\nexport * from './RectTileShader';\nexport * from './shaderGenerator';\nexport * from './TileRenderer';\nexport * from './ZLayer';"],"names":["renderer","this","tileAnim","cr","PIXI","CanvasRenderer","registerPlugin","CanvasTileRenderer","extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","__extends","__","constructor","prototype","create","Constant","maxTextures","bufferSize","boundSize","boundCountPerBuffer","use32bitIndex","SCALE_MODE","SCALE_MODES","LINEAR","DO_CLEAR","zIndex","texture","_super","_this","Float32Array","initialize","RectTileLayer","textures","baseTexture","pointsBuf","length","modificationMarker","hasAnim","texture_","x","y","animX","animY","textureIndex","Texture","from","found","textureList","i","addRect","frame","orig","width","height","rotate","u","v","tileWidth","tileHeight","animCountX","animCountY","pb","push","offset","count","plugins","tilemap","dontUseTransform","wt","worldTransform","context","setTransform","a","c","tx","resolution","ty","renderCanvasCore","points","fillStyle","n","x1","y1","x2","y2","w","h","drawImage","getDrawableSource","globalAlpha","fillRect","vb","destroy","plugin","shader","getShader","batch","setObjectRenderer","_globalMat","uniforms","projTransMatrix","globalUniforms","projectionMatrix","copyTo","append","shadowColor","animationFrame","renderWebGLCore","rectsCount","bindTextures","bind","createVb","vbId","id","vbBuffer","checkIndexBuffer","vertexBuf","getBuffer","vertices","vertPerQuad","vs","stride","byteLength","bk","ArrayBuffer","vbArray","vbInts","Uint32Array","update","arr","sz","textureId","shiftU","offsetX","shiftV","offsetY","compositeParent","animXEncoded","animYEncoded","u0","v0","u1","v1","u2","v2","u3","v3","w2","h2","cX","cY","groupD8","add","NW","uX","uY","geometry","draw","DRAW_MODES","TRIANGLES","anim","options","destroyVb","Container","bitmaps","texPerChild","apply","arguments","CompositeRectTileLayer","displayObjectUpdateTransform","z","setBitmaps","i_1","Error","len1","children","len2","Math","ceil","slice","layer","addChild","clear","animWidth","animHeight","childIndex","_lastLayer","tileRotate","tileAnimX","tileAnimY","ind","tex","child","j","visible","worldAlpha","renderable","layers","isModified","clearModify","GraphicsLayer","transform","Matrix","IDENTITY","graphics","render","Graphics","bounds","boundSprites","dirties","spr","Sprite","position","MultiTextureResource","baseTex","dirtyId","glTexture","gl","pixelStorei","UNPACK_PREMULTIPLY_ALPHA_WEBGL","undefined","alphaMode","ALPHA_MODES","UNPACK","texImage2D","target","format","type","doClear","_clearBuffer","Uint8Array","res","resource","valid","source","texSubImage2D","resources","Resource","fillSamplers","sampleValues","uSamplers","samplerSize","uSamplerSize","generateFragmentSrc","fragmentSrc","replace","generateSampleSrc","src","shaderVert","shaderFrag","Program","shaderGenerator.fillSamplers","Shader","shaderGenerator.generateFragmentSrc","TilemapShader","vertSize","buf","Buffer","addAttribute","Geometry","rectShader","RectTileShader","indexBuffer","initBounds","TileRenderer","BaseTexture","scaleMode","wrapMode","WRAP_MODES","CLAMP","texResources","texLoc","len","bindTexturesWithoutRT","setTexture","gltsUsed","geom","RectTileGeom","addIndex","lastTimeAccess","Date","now","size","totalIndices","ibLen","utils","createIndicesForQuads","ObjectRenderer","pixi_tilemap","ZLayer","_previousLayers","modified","canvasBuffer","tempRender","_tempRender","document","createElement","view","rootContext","_layerWidth","_layerHeight","_lastAnimationFrame","_hackRenderer","clearRect","renderCanvas","layerTransform","cacheIfDirty"],"mappings":";;;;;;;;;4DASI,SAAYA,GAHZC,cAAW,CAAC,EAAG,GACfA,uBAAmB,EAGfA,KAAKD,SAAWA,EAChBC,KAAKC,SAAW,CAAC,EAAG,IAItBC,EAAMC,KAAaC,eAErBF,GACAA,EAAGG,eAAe,UAAWC;;;;;;;;;;;;;;qFCFjC,IAAIC,EAAgB,SAASC,EAAGC,GAI5B,OAHAF,EAAgBG,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,IACvE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOA,EAAEM,eAAeD,KAAIN,EAAEM,GAAKL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YAEPjF,KAAKwE,QACnBzE,EAAS6E,QAAQiB,UAAU7F,KAAK0S,aAAc,EAAG,OAlF7BjI,cDL5B,SAAU6H,GACLnS,KAAaqE,QAAU8N,EAD5B,CAAUA,IAAAA,WEQGA,EAAe,CACxBhS,qBACAwK,yBACAzJ,WACAyL,gBACAa,uBACAtL,gBACA+N,gBACAO,iBACAgB,eACAb,eACAyB,+ITV6B"} \ No newline at end of file diff --git a/lib/pixi-tilemap.es.js b/lib/pixi-tilemap.es.js index 444e263a..c7313a1d 100644 --- a/lib/pixi-tilemap.es.js +++ b/lib/pixi-tilemap.es.js @@ -2,7 +2,7 @@ /*! * pixi-tilemap - v2.0.6 - * Compiled Fri, 14 Aug 2020 18:32:35 UTC + * Compiled Thu, 20 Aug 2020 02:13:52 UTC * * pixi-tilemap is licensed under the MIT License. * http://www.opensource.org/licenses/mit-license @@ -702,7 +702,7 @@ function fillSamplers(shader, maxTextures) { } function generateFragmentSrc(maxTextures, fragmentSrc) { return fragmentSrc.replace(/%count%/gi, maxTextures + "") - .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures)); + .replace(/%forloop%/gi, generateSampleSrc(maxTextures)); } function generateSampleSrc(maxTextures) { var src = ''; diff --git a/lib/pixi-tilemap.es.js.map b/lib/pixi-tilemap.es.js.map index 459c5881..f6bc0dc9 100644 --- a/lib/pixi-tilemap.es.js.map +++ b/lib/pixi-tilemap.es.js.map @@ -1 +1 @@ -{"version":3,"file":"pixi-tilemap.es.js","sources":["../src/CanvasTileRenderer.ts","../node_modules/tslib/tslib.es6.js","../src/Constant.ts","../src/RectTileLayer.ts","../src/CompositeRectTileLayer.ts","../src/GraphicsLayer.ts","../src/MultiTextureResource.ts","../src/shaderGenerator.ts","../src/RectTileShader.ts","../src/TileRenderer.ts","../src/ZLayer.ts","../src/exporter.ts","../src/index.ts"],"sourcesContent":["/// \n\nimport { Renderer } from '@pixi/core';\n\nexport class CanvasTileRenderer {\n renderer: Renderer;\n tileAnim = [0, 0];\n dontUseTransform = false;\n\n constructor(renderer: Renderer) {\n this.renderer = renderer;\n this.tileAnim = [0, 0];\n }\n}\n\nconst cr = (PIXI as any).CanvasRenderer;\n\nif (cr) {\n cr.registerPlugin('tilemap', CanvasTileRenderer);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","export const Constant = {\n maxTextures: 16,\n bufferSize: 2048,\n boundSize: 1024,\n boundCountPerBuffer: 1,\n use32bitIndex: false,\n SCALE_MODE: PIXI.SCALE_MODES.LINEAR,\n DO_CLEAR: true\n};","/// \n\nimport { Container } from '@pixi/display';\nimport { Constant } from './Constant';\nimport { DRAW_MODES } from '@pixi/constants';\nimport { Texture, Renderer } from '@pixi/core';\nimport { TileRenderer } from './TileRenderer';\nimport { Matrix, groupD8 } from '@pixi/math';\n\nimport type { RectTileGeom } from './RectTileShader';\n\nexport const POINT_STRUCT_SIZE = 12;\n\nexport class RectTileLayer extends Container {\n constructor(zIndex: number, texture: Texture | Array) {\n super();\n this.initialize(zIndex, texture);\n }\n\n zIndex = 0;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n\n pointsBuf: Array = [];\n hasAnim = false;\n textures: Array;\n\n offsetX = 0;\n offsetY = 0;\n compositeParent = false;\n\n initialize(zIndex: number, textures: Texture | Array) {\n if (!textures) {\n textures = [];\n } else if (!(textures instanceof Array) && (textures as Texture).baseTexture) {\n textures = [textures as Texture];\n }\n this.textures = textures as Array;\n this.zIndex = zIndex;\n // this.visible = false;\n }\n\n clear() {\n this.pointsBuf.length = 0;\n this.modificationMarker = 0;\n this.hasAnim = false;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX: number, animY: number) {\n let texture: Texture;\n let textureIndex = 0;\n\n if (typeof texture_ === \"number\") {\n textureIndex = texture_;\n texture = this.textures[textureIndex];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n let found = false;\n let textureList = this.textures;\n for (let i = 0; i < textureList.length; i++) {\n if (textureList[i].baseTexture === texture.baseTexture) {\n textureIndex = i;\n found = true;\n break;\n }\n }\n\n if (!found) {\n // textureIndex = this.textures.length;\n // this.textures.push(texture);\n return false;\n }\n }\n\n this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate);\n return true;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number,\n animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this {\n let pb = this.pointsBuf;\n this.hasAnim = this.hasAnim || animX > 0 || animY > 0;\n pb.push(u);\n pb.push(v);\n pb.push(x);\n pb.push(y);\n pb.push(tileWidth);\n pb.push(tileHeight);\n pb.push(rotate);\n pb.push(animX | 0);\n pb.push(animY | 0);\n pb.push(textureIndex);\n pb.push(animCountX);\n pb.push(animCountY);\n\n return this;\n }\n\n tileRotate(rotate: number) {\n const pb = this.pointsBuf;\n pb[pb.length - 3] = rotate;\n }\n\n tileAnimX(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 5] = offset;\n pb[pb.length - 2] = count;\n }\n\n tileAnimY(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 4] = offset;\n pb[pb.length - 1] = count;\n }\n\n renderCanvas(renderer: any) {\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n this.renderCanvasCore(renderer);\n }\n\n renderCanvasCore(renderer: any) {\n if (this.textures.length === 0) return;\n let points = this.pointsBuf;\n renderer.context.fillStyle = '#000000';\n for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) {\n let x1 = points[i], y1 = points[i + 1];\n let x2 = points[i + 2], y2 = points[i + 3];\n let w = points[i + 4];\n let h = points[i + 5];\n var rotate = points[i + 6];\n x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0];\n y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1];\n let textureIndex = points[i + 9];\n // canvas does not work with rotate yet\n if (textureIndex >= 0) {\n renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h);\n } else {\n renderer.context.globalAlpha = 0.5;\n renderer.context.fillRect(x2, y2, w, h);\n renderer.context.globalAlpha = 1;\n }\n }\n }\n\n vbId = 0;\n vb: RectTileGeom = null;\n vbBuffer: ArrayBuffer = null;\n vbArray: Float32Array = null;\n vbInts: Uint32Array = null;\n\n destroyVb() {\n if (this.vb) {\n this.vb.destroy();\n this.vb = null;\n }\n }\n\n render(renderer: Renderer) {\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n this.renderWebGLCore(renderer, plugin);\n }\n\n renderWebGLCore(renderer: Renderer, plugin: TileRenderer) {\n let points = this.pointsBuf;\n if (points.length === 0) return;\n let rectsCount = points.length / POINT_STRUCT_SIZE;\n\n let shader = plugin.getShader();\n let textures = this.textures;\n if (textures.length === 0) return;\n\n plugin.bindTextures(renderer, shader, textures);\n renderer.shader.bind(shader, false);\n\n //lost context! recover!\n let vb = this.vb;\n if (!vb) {\n vb = plugin.createVb();\n this.vb = vb;\n this.vbId = (vb as any).id;\n this.vbBuffer = null;\n this.modificationMarker = 0;\n }\n\n plugin.checkIndexBuffer(rectsCount, vb);\n const boundCountPerBuffer = Constant.boundCountPerBuffer;\n\n let vertexBuf = vb.getBuffer('aVertexPosition');\n //if layer was changed, re-upload vertices\n let vertices = rectsCount * vb.vertPerQuad;\n if (vertices === 0) return;\n if (this.modificationMarker !== vertices) {\n this.modificationMarker = vertices;\n let vs = vb.stride * vertices;\n if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {\n //!@#$ happens, need resize\n let bk = vb.stride;\n while (bk < vs) {\n bk *= 2;\n }\n this.vbBuffer = new ArrayBuffer(bk);\n this.vbArray = new Float32Array(this.vbBuffer);\n this.vbInts = new Uint32Array(this.vbBuffer);\n vertexBuf.update(this.vbBuffer);\n }\n\n let arr = this.vbArray, ints = this.vbInts;\n //upload vertices!\n let sz = 0;\n //let tint = 0xffffffff;\n let textureId: number = 0;\n let shiftU: number = this.offsetX;\n let shiftV: number = this.offsetY;\n\n //let tint = 0xffffffff;\n let tint = -1;\n for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) {\n let eps = 0.5;\n if (this.compositeParent) {\n if (boundCountPerBuffer > 1) {\n //TODO: what if its more than 4?\n textureId = (points[i + 9] >> 2);\n shiftU = this.offsetX * (points[i + 9] & 1);\n shiftV = this.offsetY * ((points[i + 9] >> 1) & 1);\n } else {\n textureId = points[i + 9];\n shiftU = 0;\n shiftV = 0;\n }\n }\n let x = points[i + 2], y = points[i + 3];\n let w = points[i + 4], h = points[i + 5];\n let u = points[i] + shiftU, v = points[i + 1] + shiftV;\n let rotate = points[i + 6];\n\n const animX = points[i + 7], animY = points[i + 8];\n const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024;\n const animXEncoded = animX + (animWidth * 2048);\n const animYEncoded = animY + (animHeight * 2048);\n\n let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number;\n if (rotate === 0) {\n u0 = u;\n v0 = v;\n u1 = u + w;\n v1 = v;\n u2 = u + w;\n v2 = v + h;\n u3 = u;\n v3 = v + h;\n } else {\n let w2 = w / 2;\n let h2 = h / 2;\n if (rotate % 4 !== 0) {\n w2 = h / 2;\n h2 = w / 2;\n }\n const cX = u + w2;\n const cY = v + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW);\n u0 = cX + (w2 * groupD8.uX(rotate));\n v0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n u1 = cX + (w2 * groupD8.uX(rotate));\n v1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u2 = cX + (w2 * groupD8.uX(rotate));\n v2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u3 = cX + (w2 * groupD8.uX(rotate));\n v3 = cY + (h2 * groupD8.uY(rotate));\n }\n\n arr[sz++] = x;\n arr[sz++] = y;\n arr[sz++] = u0;\n arr[sz++] = v0;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y;\n arr[sz++] = u1;\n arr[sz++] = v1;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y + h;\n arr[sz++] = u2;\n arr[sz++] = v2;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x;\n arr[sz++] = y + h;\n arr[sz++] = u3;\n arr[sz++] = v3;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n }\n\n vertexBuf.update(arr);\n }\n\n (renderer.geometry as any).bind(vb, shader);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES, rectsCount * 6, 0);\n }\n\n isModified(anim: boolean) {\n if (this.modificationMarker !== this.pointsBuf.length ||\n anim && this.hasAnim) {\n return true;\n }\n return false;\n }\n\n clearModify() {\n this.modificationMarker = this.pointsBuf.length;\n }\n\n destroy(options?: any) {\n super.destroy(options);\n this.destroyVb();\n }\n}\n","/// \n\nimport { Container } from '@pixi/display';\nimport { Texture, Renderer } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { Constant } from './Constant';\nimport { RectTileLayer } from './RectTileLayer';\n\nexport class CompositeRectTileLayer extends Container {\n constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n super();\n this.initialize.apply(this, arguments);\n }\n\n updateTransform() {\n (this as any).displayObjectUpdateTransform();\n }\n\n z: number;\n zIndex: number;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n _lastLayer: RectTileLayer = null;\n\n texPerChild: number;\n\n initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n if (texPerChild as any === true) {\n //old format, ignore it!\n texPerChild = 0;\n }\n this.z = this.zIndex = zIndex;\n this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures;\n if (bitmaps) {\n this.setBitmaps(bitmaps);\n }\n }\n\n setBitmaps(bitmaps: Array) {\n for (let i=0;i 5.2.1, it does not exist there.`);\n }\n }\n let texPerChild = this.texPerChild;\n let len1 = this.children.length;\n let len2 = Math.ceil(bitmaps.length / texPerChild);\n let i: number;\n for (i = 0; i < len1; i++) {\n (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);\n }\n for (i = len1; i < len2; i++) {\n let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild));\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n this.addChild(layer);\n }\n }\n\n clear() {\n for (let i = 0; i < this.children.length; i++) {\n (this.children[i] as RectTileLayer).clear();\n }\n this.modificationMarker = 0;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this {\n const childIndex: number = textureIndex / this.texPerChild >> 0;\n const textureId: number = textureIndex % this.texPerChild;\n\n if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) {\n this._lastLayer = (this.children[childIndex] as RectTileLayer);\n this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight);\n } else {\n this._lastLayer = null;\n }\n\n return this;\n }\n\n tileRotate(rotate: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileRotate(rotate);\n }\n return this;\n }\n\n tileAnimX(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimX(offset, count);\n }\n return this;\n }\n\n tileAnimY(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimY(offset, count);\n }\n return this;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this {\n let texture: Texture;\n let layer: RectTileLayer = null;\n let ind: number = 0;\n let children = this.children;\n\n this._lastLayer = null;\n if (typeof texture_ === \"number\") {\n let childIndex = texture_ / this.texPerChild >> 0;\n layer = children[childIndex] as RectTileLayer;\n\n if (!layer) {\n layer = children[0] as RectTileLayer;\n if (!layer) {\n return this;\n }\n ind = 0;\n } else {\n ind = texture_ % this.texPerChild;\n }\n\n texture = layer.textures[ind];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n let tex = child.textures;\n for (let j = 0; j < tex.length; j++) {\n if (tex[j].baseTexture === texture.baseTexture) {\n layer = child;\n ind = j;\n break;\n }\n }\n if (layer) {\n break;\n }\n }\n\n if (!layer) {\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n if (child.textures.length < this.texPerChild) {\n layer = child;\n ind = child.textures.length;\n child.textures.push(texture);\n break;\n }\n }\n if (!layer) {\n layer = new RectTileLayer(this.zIndex, texture);\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n children.push(layer);\n ind = 0;\n }\n }\n }\n\n this._lastLayer = layer;\n layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight);\n return this;\n }\n\n renderCanvas(renderer: any) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderCanvasCore(renderer);\n }\n }\n\n render(renderer: Renderer) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n //TODO: dont create new array, please\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n renderer.shader.bind(shader, false);\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin);\n }\n }\n\n isModified(anim: boolean) {\n let layers = this.children;\n if (this.modificationMarker !== layers.length) {\n return true;\n }\n for (let i = 0; i < layers.length; i++) {\n if ((layers[i] as RectTileLayer).isModified(anim)) {\n return true;\n }\n }\n return false;\n }\n\n clearModify() {\n let layers = this.children;\n this.modificationMarker = layers.length;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).clearModify();\n }\n }\n}","/// \n\nimport { Matrix } from '@pixi/math';\nimport { Graphics } from '@pixi/graphics';\n\nexport class GraphicsLayer extends Graphics {\n constructor(zIndex: number) {\n super();\n this.zIndex = zIndex;\n }\n\n renderCanvas(renderer: any) {\n let wt: Matrix = null;\n if (renderer.plugins.tilemap.dontUseTransform) {\n wt = this.transform.worldTransform;\n this.transform.worldTransform = Matrix.IDENTITY;\n }\n renderer.plugins.graphics.render(this);\n if (renderer.plugins.tilemap.dontUseTransform) {\n this.transform.worldTransform = wt;\n }\n renderer.context.globalAlpha = 1.0;\n }\n\n // renderWebGL(renderer: PIXI.Renderer) {\n // if (!this._webGL[renderer.CONTEXT_UID])\n // this.dirty++;\n // super.renderWebGL(renderer)\n // }\n\n isModified(anim: boolean): boolean {\n return false;\n }\n\n clearModify() {\n }\n}\n","/// \n\nimport { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, Renderer, Texture, GLTexture, resources } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Constant } from './Constant';\n\nexport interface IMultiTextureOptions {\n\tboundCountPerBuffer: number;\n\tboundSize: number;\n\tbufferSize: number;\n\tDO_CLEAR?: boolean;\n}\n\nexport class MultiTextureResource extends resources.Resource {\n\tconstructor(options: IMultiTextureOptions) {\n\t\tsuper(options.bufferSize, options.bufferSize);\n\n\t\tconst bounds = this.boundSprites;\n\t\tconst dirties = this.dirties;\n\t\tthis.boundSize = options.boundSize;\n\t\tfor (let j = 0; j < options.boundCountPerBuffer; j++) {\n\t\t\tconst spr = new Sprite();\n\t\t\tspr.position.x = options.boundSize * (j & 1);\n\t\t\tspr.position.y = options.boundSize * (j >> 1);\n\t\t\tbounds.push(spr);\n\t\t\tdirties.push(0);\n\t\t}\n\t\tthis.DO_CLEAR = !!options.DO_CLEAR;\n\t}\n\n\tDO_CLEAR = false;\n\tboundSize: number = 0;\n\t_clearBuffer: Uint8Array = null;\n\n\tbind(baseTexture: BaseTexture) {\n\t\tif (this.baseTex) {\n\t\t\tthrow new Error('Only one baseTexture is allowed for this resource!')\n\t\t}\n\t\tthis.baseTex = baseTexture;\n\t\tsuper.bind(baseTexture);\n\t}\n\n\tbaseTex: BaseTexture = null;\n\tboundSprites: Array = [];\n\tdirties: Array = [];\n\n\tsetTexture(ind: number, texture: Texture) {\n\t\tconst spr = this.boundSprites[ind];\n\t\tif (spr.texture.baseTexture === texture.baseTexture) {\n\t\t\treturn;\n\t\t}\n\t\tspr.texture = texture;\n\t\tthis.baseTex.update();\n\t\tthis.dirties[ind] = (this.baseTex as any).dirtyId;\n\t}\n\n\tupload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture) {\n\t\tconst { gl } = renderer as any;\n\n\t\tconst {width, height} = this;\n\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined ||\n\t\t\ttexture.alphaMode === ALPHA_MODES.UNPACK);\n\n\t\tif (glTexture.dirtyId < 0) {\n\t\t\t(glTexture as any).width = width;\n\t\t\t(glTexture as any).height = height;\n\n\t\t\tgl.texImage2D(texture.target, 0,\n\t\t\t\ttexture.format,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\t0,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tnull);\n\t\t}\n\n\t\tconst doClear = this.DO_CLEAR;\n\t\tif (doClear && !this._clearBuffer) {\n\t\t\tthis._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4);\n\t\t}\n\n\t\tconst bounds = this.boundSprites;\n\t\tfor (let i = 0; i < bounds.length; i++) {\n\t\t\tconst spr = bounds[i];\n\t\t\tconst tex = spr.texture.baseTexture;\n\t\t\tif (glTexture.dirtyId >= this.dirties[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst res = tex.resource as any;\n\t\t\tif (!tex.valid || !res || !res.source) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (doClear && (tex.width < this.boundSize || tex.height < this.boundSize))\n\t\t\t{\n\t\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\t\tspr.position.x,\n\t\t\t\t\tspr.position.y,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\ttexture.format,\n\t\t\t\t\ttexture.type,\n\t\t\t\t\tthis._clearBuffer);\n\t\t\t}\n\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\tspr.position.x,\n\t\t\t\tspr.position.y,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tres.source);\n\t\t}\n\n\t\treturn true;\n\t}\n}\n","import { Constant } from './Constant';\n\nimport type { TilemapShader } from './RectTileShader';\n\n\nexport function fillSamplers(shader: TilemapShader, maxTextures: number) {\n let sampleValues: Array = [];\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n shader.uniforms.uSamplers = sampleValues;\n\n let samplerSize: Array = [];\n for (let i = 0; i < maxTextures; i++) {\n samplerSize.push(1.0 / Constant.bufferSize);\n samplerSize.push(1.0 / Constant.bufferSize);\n }\n shader.uniforms.uSamplerSize = samplerSize;\n}\n\nexport function generateFragmentSrc(maxTextures: number, fragmentSrc: string) {\n return fragmentSrc.replace(/%count%/gi, maxTextures + \"\")\n .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n}\n\nexport function generateSampleSrc(maxTextures: number) {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n src += 'if(vTextureId <= -1.0) {';\n src += '\\n\\tcolor = shadowColor;';\n src += '\\n}';\n\n for (let i = 0; i < maxTextures; i++)\n {\n src += '\\nelse ';\n\n if(i < maxTextures-1)\n {\n src += 'if(textureId == ' + i + '.0)';\n }\n\n src += '\\n{';\n src += '\\n\\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);';\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n}\n","/// \n\nimport * as shaderGenerator from './shaderGenerator';\n\nimport { Buffer, Geometry, Shader } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nlet rectShaderFrag = `\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n`;\nlet rectShaderVert = `\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n`;\n\nexport abstract class TilemapShader extends Shader {\n\tmaxTextures = 0;\n\n\tconstructor(maxTextures: number, shaderVert: string, shaderFrag: string) {\n\t\tsuper(\n\t\t\tnew PIXI.Program(\n\t\t\t\tshaderVert,\n\t\t\t\tshaderFrag),\n\t\t\t{\n\t\t\t\tanimationFrame: new Float32Array(2),\n\t\t\t\tuSamplers: [],\n\t\t\t\tuSamplerSize: [],\n\t\t\t\tprojTransMatrix: new Matrix()\n\t\t\t}\n\t\t);\n\t\tthis.maxTextures = maxTextures;\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileShader extends TilemapShader {\n\tconstructor(maxTextures: number) {\n\t\tsuper(\n\t\t\tmaxTextures,\n\t\t\trectShaderVert,\n\t\t\tshaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)\n\t\t);\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileGeom extends Geometry {\n\tvertSize = 11;\n\tvertPerQuad = 4;\n\tstride = this.vertSize * 4;\n\tlastTimeAccess = 0;\n\n\tconstructor() {\n\t\tsuper();\n\t\tconst buf = this.buf = new Buffer(new Float32Array(2), true, false);\n\t\tthis.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0)\n\t\t\t.addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4)\n\t\t\t.addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4)\n\t\t\t.addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4)\n\t\t\t.addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4);\n\t}\n\n\tbuf: PIXI.Buffer;\n}","import { WRAP_MODES } from '@pixi/constants';\nimport { BaseTexture, Buffer, resources, ObjectRenderer, Texture, Renderer } from '@pixi/core';\nimport { Constant } from './Constant';\nimport { RectTileGeom, RectTileShader } from './RectTileShader';\nimport { MultiTextureResource } from './MultiTextureResource';\n\nimport type { TilemapShader } from './RectTileShader';\n\n/**\n * Renderer for rectangle tiles.\n */\nexport class TileRenderer extends ObjectRenderer {\n\trenderer: Renderer;\n\tgl: WebGLRenderingContext;\n\tsn: number = -1;\n\tindexBuffer: PIXI.Buffer = null;\n\tibLen: number = 0;\n\ttileAnim = [0, 0];\n\ttexLoc: Array = [];\n\n\trectShader: RectTileShader;\n\ttexResources: Array = [];\n\n\tconstructor(renderer: Renderer) {\n\t\tsuper(renderer);\n\t\tthis.rectShader = new RectTileShader(Constant.maxTextures);\n\t\tthis.indexBuffer = new Buffer(undefined, true, true);\n\t\tthis.checkIndexBuffer(2000);\n\t\tthis.initBounds();\n\t}\n\n\tinitBounds() {\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tfor (let i = 0; i < maxTextures; i++) {\n\t\t\tconst resource = new MultiTextureResource(Constant);\n\t\t\tconst baseTex = new BaseTexture(resource);\n\t\t\tbaseTex.scaleMode = Constant.SCALE_MODE;\n\t\t\tbaseTex.wrapMode = WRAP_MODES.CLAMP;\n\t\t\tthis.texResources.push(resource);\n\t\t}\n\t}\n\n\tbindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tlet samplerSize: Array = (shader as any).uniforms.uSamplerSize;\n\t\tthis.texLoc.length = 0;\n\t\tfor (let i = 0; i < textures.length; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trenderer.texture.bind(textures[i], i);\n\t\t\t//TODO: add resolution here\n\t\t\tsamplerSize[i * 2] = 1.0 / textures[i].baseTexture.width;\n\t\t\tsamplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height;\n\t\t}\n\t\t(shader as any).uniforms.uSamplerSize = samplerSize;\n\t}\n\n\tbindTextures(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tconst len = textures.length;\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tif (len > Constant.boundCountPerBuffer * maxTextures) {\n\t\t\treturn;\n\t\t}\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\tthis.bindTexturesWithoutRT(renderer, shader, textures);\n\t\t\treturn;\n\t\t}\n\n\t\tlet i = 0;\n\t\tfor (; i < len; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) continue;\n\t\t\tconst multi = this.texResources[i >> 2];\n\t\t\tmulti.setTexture(i & 3, texture);\n\t\t}\n\n\t\tlet gltsUsed = (i + 3) >> 2;\n\t\tfor (i = 0; i < gltsUsed; i++) {\n\t\t\t//remove \"i, true\" after resolving a bug\n\t\t\trenderer.texture.bind(this.texResources[i].baseTex, i);\n\t\t}\n\t}\n\n\tstart() {\n\t\t//sorry, nothing\n\t}\n\n\tcreateVb() {\n\t\tconst geom = new RectTileGeom();\n\t\tgeom.addIndex(this.indexBuffer);\n\t\tgeom.lastTimeAccess = Date.now();\n\t\treturn geom;\n\t}\n\n\tcheckIndexBuffer(size: number, vb: RectTileGeom = null) {\n\t\tconst totalIndices = size * 6;\n\n\t\tif (totalIndices <= this.ibLen) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet len = totalIndices;\n\t\twhile (len < totalIndices) {\n\t\t\tlen <<= 1;\n\t\t}\n\n\t\tthis.ibLen = totalIndices;\n\t\tthis.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size,\n\t\t\tConstant.use32bitIndex ? new Uint32Array(size * 6) : undefined));\n\n\t\t// \tTODO: create new index buffer instead?\n\t\t// if (vb) {\n\t\t// \tconst curIndex = vb.getIndex();\n\t\t// \tif (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) {\n\t\t// \t\tthis.swapIndex(vb, this.indexBuffer);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t// swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) {\n\t\t// let buffers = (geom as any).buffers;\n\t\t// const oldIndex = geom.getIndex();\n\t\t// let ind = buffers.indexOf(oldIndex);\n\t\t// if (ind >= 0) {\n\t\t// \tbuffers.splice(ind, 1);\n\t\t// }\n\t\t// geom.addIndex(indexBuf);\n\t// }\n\n\tgetShader(): TilemapShader {\n\t\treturn this.rectShader;\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\t// this.rectShader.destroy();\n\t\tthis.rectShader = null;\n\t}\n}\n\nRenderer.registerPlugin('tilemap', TileRenderer as any);\n","/// \n\nimport { Container } from '@pixi/display';\n\nimport type { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport type { Matrix } from '@pixi/math';\n\nexport class ZLayer extends Container {\n\n constructor(tilemap: Container, zIndex: number) {\n super();\n this.tilemap = tilemap;\n this.z = zIndex;\n }\n\n tilemap: any;\n z: number;\n zIndex: number;\n _previousLayers: number;\n canvasBuffer: HTMLCanvasElement;\n _tempRender: any;\n _lastAnimationFrame: number = -1;\n layerTransform: Matrix;\n\n clear() {\n let layers = this.children as Array;\n for (let i = 0; i < layers.length; i++)\n layers[i].clear();\n this._previousLayers = 0;\n }\n\n cacheIfDirty() {\n let tilemap: any = this.tilemap;\n let layers = this.children as Array;\n let modified = this._previousLayers !== layers.length;\n this._previousLayers = layers.length;\n let buf = this.canvasBuffer;\n let tempRender = this._tempRender;\n if (!buf) {\n buf = this.canvasBuffer = document.createElement('canvas');\n tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf});\n tempRender.context = tempRender.rootContext;\n tempRender.plugins.tilemap.dontUseTransform = true;\n }\n if (buf.width !== tilemap._layerWidth ||\n buf.height !== tilemap._layerHeight) {\n buf.width = tilemap._layerWidth;\n buf.height = tilemap._layerHeight;\n modified = true;\n }\n let i: number;\n if (!modified) {\n for (i = 0; i < layers.length; i++) {\n if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) {\n modified = true;\n break;\n }\n }\n }\n this._lastAnimationFrame = tilemap.animationFrame;\n if (modified) {\n if (tilemap._hackRenderer) {\n tilemap._hackRenderer(tempRender);\n }\n tempRender.context.clearRect(0, 0, buf.width, buf.height);\n for (i = 0; i < layers.length; i++) {\n layers[i].clearModify();\n layers[i].renderCanvas(tempRender);\n }\n }\n this.layerTransform = this.worldTransform;\n for (i = 0; i < layers.length; i++) {\n this.layerTransform = layers[i].worldTransform;\n break;\n }\n }\n\n renderCanvas(renderer: any) {\n this.cacheIfDirty();\n let wt = this.layerTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n let tilemap = this.tilemap;\n renderer.context.drawImage(this.canvasBuffer, 0, 0);\n }\n}\n","/// \n\nnamespace pixi_tilemap {\n (PIXI as any).tilemap = pixi_tilemap;\n}\n\n// This makes exporter.ts a module!\nexport default {}\n","import { CanvasTileRenderer } from './CanvasTileRenderer';\nimport { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport { Constant } from './Constant';\nimport { GraphicsLayer } from './GraphicsLayer';\nimport { MultiTextureResource } from './MultiTextureResource';\nimport { RectTileLayer } from './RectTileLayer';\nimport { TilemapShader, RectTileShader, RectTileGeom } from './RectTileShader';\nimport { TileRenderer } from './TileRenderer';\nimport { ZLayer } from './ZLayer';\n\nexport const pixi_tilemap = {\n CanvasTileRenderer,\n CompositeRectTileLayer,\n Constant,\n GraphicsLayer,\n MultiTextureResource,\n RectTileLayer,\n TilemapShader,\n RectTileShader,\n RectTileGeom,\n TileRenderer,\n ZLayer,\n};\n\nexport * from './CanvasTileRenderer';\nexport * from './CompositeRectTileLayer';\nexport * from './Constant';\nexport * from './exporter';\nexport * from './GraphicsLayer';\nexport * from './MultiTextureResource';\nexport * from './RectTileLayer';\nexport * from './RectTileShader';\nexport * from './shaderGenerator';\nexport * from './TileRenderer';\nexport * from './ZLayer';"],"names":["shaderGenerator.fillSamplers","shaderGenerator.generateFragmentSrc","pixi_tilemap"],"mappings":";;;;;;;;;;;;;;;;;;;IASI,4BAAY,QAAkB;QAH9B,aAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAClB,qBAAgB,GAAG,KAAK,CAAC;QAGrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KAC1B;IACL,yBAAC;AAAD,CAAC,IAAA;AAED,IAAM,EAAE,GAAI,IAAY,CAAC,cAAc,CAAC;AAExC,IAAI,EAAE,EAAE;IACJ,EAAE,CAAC,cAAc,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;;;AClBrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,aAAa,GAAG,SAAS,CAAC,EAAE,CAAC,EAAE;AACnC,IAAI,aAAa,GAAG,MAAM,CAAC,cAAc;AACzC,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,KAAK,IAAI,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,CAAC,EAAE,CAAC;AACpF,QAAQ,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACnF,IAAI,OAAO,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAC;AACF;AACO,SAAS,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE;AAChC,IAAI,aAAa,CAAC,CAAC,EAAE,CAAC,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,CAAC,CAAC,EACJ,EAAE,CAAC,CAAC,EACJ,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,UAAU,EAC3B,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,UAAU,CAC9B,CAAC;QACF,IAAI,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC3B,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;KACvD;IACL,aAAC;AAAD,CApFA,CAA4B,SAAS;;ACLrC,IAAU,YAAY,CAErB;AAFD,WAAU,YAAY;IACjB,IAAY,CAAC,OAAO,GAAG,YAAY,CAAC;AACzC,CAAC,EAFS,YAAY,KAAZ,YAAY;;ICQTE,cAAY,GAAG;IACxB,kBAAkB,oBAAA;IAClB,sBAAsB,wBAAA;IACtB,QAAQ,UAAA;IACR,aAAa,eAAA;IACb,oBAAoB,sBAAA;IACpB,aAAa,eAAA;IACb,aAAa,eAAA;IACb,cAAc,gBAAA;IACd,YAAY,cAAA;IACZ,YAAY,cAAA;IACZ,MAAM,QAAA;;;;;"} \ No newline at end of file +{"version":3,"file":"pixi-tilemap.es.js","sources":["../src/CanvasTileRenderer.ts","../node_modules/tslib/tslib.es6.js","../src/Constant.ts","../src/RectTileLayer.ts","../src/CompositeRectTileLayer.ts","../src/GraphicsLayer.ts","../src/MultiTextureResource.ts","../src/shaderGenerator.ts","../src/RectTileShader.ts","../src/TileRenderer.ts","../src/ZLayer.ts","../src/exporter.ts","../src/index.ts"],"sourcesContent":["/// \n\nimport { Renderer } from '@pixi/core';\n\nexport class CanvasTileRenderer {\n renderer: Renderer;\n tileAnim = [0, 0];\n dontUseTransform = false;\n\n constructor(renderer: Renderer) {\n this.renderer = renderer;\n this.tileAnim = [0, 0];\n }\n}\n\nconst cr = (PIXI as any).CanvasRenderer;\n\nif (cr) {\n cr.registerPlugin('tilemap', CanvasTileRenderer);\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","export const Constant = {\n maxTextures: 16,\n bufferSize: 2048,\n boundSize: 1024,\n boundCountPerBuffer: 1,\n use32bitIndex: false,\n SCALE_MODE: PIXI.SCALE_MODES.LINEAR,\n DO_CLEAR: true\n};","/// \n\nimport { Container } from '@pixi/display';\nimport { Constant } from './Constant';\nimport { DRAW_MODES } from '@pixi/constants';\nimport { Texture, Renderer } from '@pixi/core';\nimport { TileRenderer } from './TileRenderer';\nimport { Matrix, groupD8 } from '@pixi/math';\n\nimport type { RectTileGeom } from './RectTileShader';\n\nexport const POINT_STRUCT_SIZE = 12;\n\nexport class RectTileLayer extends Container {\n constructor(zIndex: number, texture: Texture | Array) {\n super();\n this.initialize(zIndex, texture);\n }\n\n zIndex = 0;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n\n pointsBuf: Array = [];\n hasAnim = false;\n textures: Array;\n\n offsetX = 0;\n offsetY = 0;\n compositeParent = false;\n\n initialize(zIndex: number, textures: Texture | Array) {\n if (!textures) {\n textures = [];\n } else if (!(textures instanceof Array) && (textures as Texture).baseTexture) {\n textures = [textures as Texture];\n }\n this.textures = textures as Array;\n this.zIndex = zIndex;\n // this.visible = false;\n }\n\n clear() {\n this.pointsBuf.length = 0;\n this.modificationMarker = 0;\n this.hasAnim = false;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX: number, animY: number) {\n let texture: Texture;\n let textureIndex = 0;\n\n if (typeof texture_ === \"number\") {\n textureIndex = texture_;\n texture = this.textures[textureIndex];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n let found = false;\n let textureList = this.textures;\n for (let i = 0; i < textureList.length; i++) {\n if (textureList[i].baseTexture === texture.baseTexture) {\n textureIndex = i;\n found = true;\n break;\n }\n }\n\n if (!found) {\n // textureIndex = this.textures.length;\n // this.textures.push(texture);\n return false;\n }\n }\n\n this.addRect(textureIndex, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate);\n return true;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number,\n animX: number = 0, animY: number = 0, rotate: number = 0, animCountX: number = 1024, animCountY: number = 1024): this {\n let pb = this.pointsBuf;\n this.hasAnim = this.hasAnim || animX > 0 || animY > 0;\n pb.push(u);\n pb.push(v);\n pb.push(x);\n pb.push(y);\n pb.push(tileWidth);\n pb.push(tileHeight);\n pb.push(rotate);\n pb.push(animX | 0);\n pb.push(animY | 0);\n pb.push(textureIndex);\n pb.push(animCountX);\n pb.push(animCountY);\n\n return this;\n }\n\n tileRotate(rotate: number) {\n const pb = this.pointsBuf;\n pb[pb.length - 3] = rotate;\n }\n\n tileAnimX(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 5] = offset;\n pb[pb.length - 2] = count;\n }\n\n tileAnimY(offset: number, count: number) {\n const pb = this.pointsBuf;\n\n pb[pb.length - 4] = offset;\n pb[pb.length - 1] = count;\n }\n\n renderCanvas(renderer: any) {\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n this.renderCanvasCore(renderer);\n }\n\n renderCanvasCore(renderer: any) {\n if (this.textures.length === 0) return;\n let points = this.pointsBuf;\n renderer.context.fillStyle = '#000000';\n for (let i = 0, n = points.length; i < n; i += POINT_STRUCT_SIZE) {\n let x1 = points[i], y1 = points[i + 1];\n let x2 = points[i + 2], y2 = points[i + 3];\n let w = points[i + 4];\n let h = points[i + 5];\n var rotate = points[i + 6];\n x1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[0];\n y1 += points[i + 8] * renderer.plugins.tilemap.tileAnim[1];\n let textureIndex = points[i + 9];\n // canvas does not work with rotate yet\n if (textureIndex >= 0) {\n renderer.context.drawImage((this.textures[textureIndex].baseTexture as any).getDrawableSource(), x1, y1, w, h, x2, y2, w, h);\n } else {\n renderer.context.globalAlpha = 0.5;\n renderer.context.fillRect(x2, y2, w, h);\n renderer.context.globalAlpha = 1;\n }\n }\n }\n\n vbId = 0;\n vb: RectTileGeom = null;\n vbBuffer: ArrayBuffer = null;\n vbArray: Float32Array = null;\n vbInts: Uint32Array = null;\n\n destroyVb() {\n if (this.vb) {\n this.vb.destroy();\n this.vb = null;\n }\n }\n\n render(renderer: Renderer) {\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n this.renderWebGLCore(renderer, plugin);\n }\n\n renderWebGLCore(renderer: Renderer, plugin: TileRenderer) {\n let points = this.pointsBuf;\n if (points.length === 0) return;\n let rectsCount = points.length / POINT_STRUCT_SIZE;\n\n let shader = plugin.getShader();\n let textures = this.textures;\n if (textures.length === 0) return;\n\n plugin.bindTextures(renderer, shader, textures);\n renderer.shader.bind(shader, false);\n\n //lost context! recover!\n let vb = this.vb;\n if (!vb) {\n vb = plugin.createVb();\n this.vb = vb;\n this.vbId = (vb as any).id;\n this.vbBuffer = null;\n this.modificationMarker = 0;\n }\n\n plugin.checkIndexBuffer(rectsCount, vb);\n const boundCountPerBuffer = Constant.boundCountPerBuffer;\n\n let vertexBuf = vb.getBuffer('aVertexPosition');\n //if layer was changed, re-upload vertices\n let vertices = rectsCount * vb.vertPerQuad;\n if (vertices === 0) return;\n if (this.modificationMarker !== vertices) {\n this.modificationMarker = vertices;\n let vs = vb.stride * vertices;\n if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {\n //!@#$ happens, need resize\n let bk = vb.stride;\n while (bk < vs) {\n bk *= 2;\n }\n this.vbBuffer = new ArrayBuffer(bk);\n this.vbArray = new Float32Array(this.vbBuffer);\n this.vbInts = new Uint32Array(this.vbBuffer);\n vertexBuf.update(this.vbBuffer);\n }\n\n let arr = this.vbArray, ints = this.vbInts;\n //upload vertices!\n let sz = 0;\n //let tint = 0xffffffff;\n let textureId: number = 0;\n let shiftU: number = this.offsetX;\n let shiftV: number = this.offsetY;\n\n //let tint = 0xffffffff;\n let tint = -1;\n for (let i = 0; i < points.length; i += POINT_STRUCT_SIZE) {\n let eps = 0.5;\n if (this.compositeParent) {\n if (boundCountPerBuffer > 1) {\n //TODO: what if its more than 4?\n textureId = (points[i + 9] >> 2);\n shiftU = this.offsetX * (points[i + 9] & 1);\n shiftV = this.offsetY * ((points[i + 9] >> 1) & 1);\n } else {\n textureId = points[i + 9];\n shiftU = 0;\n shiftV = 0;\n }\n }\n let x = points[i + 2], y = points[i + 3];\n let w = points[i + 4], h = points[i + 5];\n let u = points[i] + shiftU, v = points[i + 1] + shiftV;\n let rotate = points[i + 6];\n\n const animX = points[i + 7], animY = points[i + 8];\n const animWidth = points[i + 10] || 1024, animHeight = points[i + 11] || 1024;\n const animXEncoded = animX + (animWidth * 2048);\n const animYEncoded = animY + (animHeight * 2048);\n\n let u0: number, v0: number, u1: number, v1: number, u2: number, v2: number, u3: number, v3: number;\n if (rotate === 0) {\n u0 = u;\n v0 = v;\n u1 = u + w;\n v1 = v;\n u2 = u + w;\n v2 = v + h;\n u3 = u;\n v3 = v + h;\n } else {\n let w2 = w / 2;\n let h2 = h / 2;\n if (rotate % 4 !== 0) {\n w2 = h / 2;\n h2 = w / 2;\n }\n const cX = u + w2;\n const cY = v + h2;\n\n rotate = groupD8.add(rotate, groupD8.NW);\n u0 = cX + (w2 * groupD8.uX(rotate));\n v0 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n u1 = cX + (w2 * groupD8.uX(rotate));\n v1 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u2 = cX + (w2 * groupD8.uX(rotate));\n v2 = cY + (h2 * groupD8.uY(rotate));\n\n rotate = groupD8.add(rotate, 2);\n u3 = cX + (w2 * groupD8.uX(rotate));\n v3 = cY + (h2 * groupD8.uY(rotate));\n }\n\n arr[sz++] = x;\n arr[sz++] = y;\n arr[sz++] = u0;\n arr[sz++] = v0;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y;\n arr[sz++] = u1;\n arr[sz++] = v1;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x + w;\n arr[sz++] = y + h;\n arr[sz++] = u2;\n arr[sz++] = v2;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n arr[sz++] = x;\n arr[sz++] = y + h;\n arr[sz++] = u3;\n arr[sz++] = v3;\n arr[sz++] = u + eps;\n arr[sz++] = v + eps;\n arr[sz++] = u + w - eps;\n arr[sz++] = v + h - eps;\n arr[sz++] = animXEncoded;\n arr[sz++] = animYEncoded;\n arr[sz++] = textureId;\n }\n\n vertexBuf.update(arr);\n }\n\n (renderer.geometry as any).bind(vb, shader);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES, rectsCount * 6, 0);\n }\n\n isModified(anim: boolean) {\n if (this.modificationMarker !== this.pointsBuf.length ||\n anim && this.hasAnim) {\n return true;\n }\n return false;\n }\n\n clearModify() {\n this.modificationMarker = this.pointsBuf.length;\n }\n\n destroy(options?: any) {\n super.destroy(options);\n this.destroyVb();\n }\n}\n","/// \n\nimport { Container } from '@pixi/display';\nimport { Texture, Renderer } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { Constant } from './Constant';\nimport { RectTileLayer } from './RectTileLayer';\n\nexport class CompositeRectTileLayer extends Container {\n constructor(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n super();\n this.initialize.apply(this, arguments);\n }\n\n updateTransform() {\n (this as any).displayObjectUpdateTransform();\n }\n\n z: number;\n zIndex: number;\n modificationMarker = 0;\n shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);\n _globalMat: Matrix = null;\n _lastLayer: RectTileLayer = null;\n\n texPerChild: number;\n\n initialize(zIndex?: number, bitmaps?: Array, texPerChild?: number) {\n if (texPerChild as any === true) {\n //old format, ignore it!\n texPerChild = 0;\n }\n this.z = this.zIndex = zIndex;\n this.texPerChild = texPerChild || Constant.boundCountPerBuffer * Constant.maxTextures;\n if (bitmaps) {\n this.setBitmaps(bitmaps);\n }\n }\n\n setBitmaps(bitmaps: Array) {\n for (let i=0;i 5.2.1, it does not exist there.`);\n }\n }\n let texPerChild = this.texPerChild;\n let len1 = this.children.length;\n let len2 = Math.ceil(bitmaps.length / texPerChild);\n let i: number;\n for (i = 0; i < len1; i++) {\n (this.children[i] as RectTileLayer).textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);\n }\n for (i = len1; i < len2; i++) {\n let layer = new RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild));\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n this.addChild(layer);\n }\n }\n\n clear() {\n for (let i = 0; i < this.children.length; i++) {\n (this.children[i] as RectTileLayer).clear();\n }\n this.modificationMarker = 0;\n }\n\n addRect(textureIndex: number, u: number, v: number, x: number, y: number, tileWidth: number, tileHeight: number, animX?: number, animY?: number, rotate?: number, animWidth?: number, animHeight?: number): this {\n const childIndex: number = textureIndex / this.texPerChild >> 0;\n const textureId: number = textureIndex % this.texPerChild;\n\n if (this.children[childIndex] && (this.children[childIndex] as RectTileLayer).textures) {\n this._lastLayer = (this.children[childIndex] as RectTileLayer);\n this._lastLayer.addRect(textureId, u, v, x, y, tileWidth, tileHeight, animX, animY, rotate, animWidth, animHeight);\n } else {\n this._lastLayer = null;\n }\n\n return this;\n }\n\n tileRotate(rotate: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileRotate(rotate);\n }\n return this;\n }\n\n tileAnimX(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimX(offset, count);\n }\n return this;\n }\n\n tileAnimY(offset: number, count: number): this {\n if (this._lastLayer)\n {\n this._lastLayer.tileAnimY(offset, count);\n }\n return this;\n }\n\n addFrame(texture_: Texture | String | number, x: number, y: number, animX?: number, animY?: number, animWidth?: number, animHeight?: number): this {\n let texture: Texture;\n let layer: RectTileLayer = null;\n let ind: number = 0;\n let children = this.children;\n\n this._lastLayer = null;\n if (typeof texture_ === \"number\") {\n let childIndex = texture_ / this.texPerChild >> 0;\n layer = children[childIndex] as RectTileLayer;\n\n if (!layer) {\n layer = children[0] as RectTileLayer;\n if (!layer) {\n return this;\n }\n ind = 0;\n } else {\n ind = texture_ % this.texPerChild;\n }\n\n texture = layer.textures[ind];\n } else {\n if (typeof texture_ === \"string\") {\n texture = Texture.from(texture_);\n } else {\n texture = texture_ as Texture;\n }\n\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n let tex = child.textures;\n for (let j = 0; j < tex.length; j++) {\n if (tex[j].baseTexture === texture.baseTexture) {\n layer = child;\n ind = j;\n break;\n }\n }\n if (layer) {\n break;\n }\n }\n\n if (!layer) {\n for (let i = 0; i < children.length; i++) {\n let child = children[i] as RectTileLayer;\n if (child.textures.length < this.texPerChild) {\n layer = child;\n ind = child.textures.length;\n child.textures.push(texture);\n break;\n }\n }\n if (!layer) {\n layer = new RectTileLayer(this.zIndex, texture);\n layer.compositeParent = true;\n layer.offsetX = Constant.boundSize;\n layer.offsetY = Constant.boundSize;\n children.push(layer);\n ind = 0;\n }\n }\n }\n\n this._lastLayer = layer;\n layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.orig.width, texture.orig.height, animX, animY, texture.rotate, animWidth, animHeight);\n return this;\n }\n\n renderCanvas(renderer: any) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = renderer.plugins.tilemap;\n if (!plugin.dontUseTransform) {\n let wt = this.worldTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n }\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderCanvasCore(renderer);\n }\n }\n\n render(renderer: Renderer) {\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n return;\n }\n let plugin = (renderer.plugins as any)['tilemap'];\n let shader = plugin.getShader();\n renderer.batch.setObjectRenderer(plugin);\n //TODO: dont create new array, please\n this._globalMat = shader.uniforms.projTransMatrix;\n renderer.globalUniforms.uniforms.projectionMatrix.copyTo(this._globalMat).append(this.worldTransform);\n shader.uniforms.shadowColor = this.shadowColor;\n shader.uniforms.animationFrame = plugin.tileAnim;\n renderer.shader.bind(shader, false);\n let layers = this.children;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).renderWebGLCore(renderer, plugin);\n }\n }\n\n isModified(anim: boolean) {\n let layers = this.children;\n if (this.modificationMarker !== layers.length) {\n return true;\n }\n for (let i = 0; i < layers.length; i++) {\n if ((layers[i] as RectTileLayer).isModified(anim)) {\n return true;\n }\n }\n return false;\n }\n\n clearModify() {\n let layers = this.children;\n this.modificationMarker = layers.length;\n for (let i = 0; i < layers.length; i++) {\n (layers[i] as RectTileLayer).clearModify();\n }\n }\n}","/// \n\nimport { Matrix } from '@pixi/math';\nimport { Graphics } from '@pixi/graphics';\n\nexport class GraphicsLayer extends Graphics {\n constructor(zIndex: number) {\n super();\n this.zIndex = zIndex;\n }\n\n renderCanvas(renderer: any) {\n let wt: Matrix = null;\n if (renderer.plugins.tilemap.dontUseTransform) {\n wt = this.transform.worldTransform;\n this.transform.worldTransform = Matrix.IDENTITY;\n }\n renderer.plugins.graphics.render(this);\n if (renderer.plugins.tilemap.dontUseTransform) {\n this.transform.worldTransform = wt;\n }\n renderer.context.globalAlpha = 1.0;\n }\n\n // renderWebGL(renderer: PIXI.Renderer) {\n // if (!this._webGL[renderer.CONTEXT_UID])\n // this.dirty++;\n // super.renderWebGL(renderer)\n // }\n\n isModified(anim: boolean): boolean {\n return false;\n }\n\n clearModify() {\n }\n}\n","/// \n\nimport { ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, Renderer, Texture, GLTexture, resources } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Constant } from './Constant';\n\nexport interface IMultiTextureOptions {\n\tboundCountPerBuffer: number;\n\tboundSize: number;\n\tbufferSize: number;\n\tDO_CLEAR?: boolean;\n}\n\nexport class MultiTextureResource extends resources.Resource {\n\tconstructor(options: IMultiTextureOptions) {\n\t\tsuper(options.bufferSize, options.bufferSize);\n\n\t\tconst bounds = this.boundSprites;\n\t\tconst dirties = this.dirties;\n\t\tthis.boundSize = options.boundSize;\n\t\tfor (let j = 0; j < options.boundCountPerBuffer; j++) {\n\t\t\tconst spr = new Sprite();\n\t\t\tspr.position.x = options.boundSize * (j & 1);\n\t\t\tspr.position.y = options.boundSize * (j >> 1);\n\t\t\tbounds.push(spr);\n\t\t\tdirties.push(0);\n\t\t}\n\t\tthis.DO_CLEAR = !!options.DO_CLEAR;\n\t}\n\n\tDO_CLEAR = false;\n\tboundSize: number = 0;\n\t_clearBuffer: Uint8Array = null;\n\n\tbind(baseTexture: BaseTexture) {\n\t\tif (this.baseTex) {\n\t\t\tthrow new Error('Only one baseTexture is allowed for this resource!')\n\t\t}\n\t\tthis.baseTex = baseTexture;\n\t\tsuper.bind(baseTexture);\n\t}\n\n\tbaseTex: BaseTexture = null;\n\tboundSprites: Array = [];\n\tdirties: Array = [];\n\n\tsetTexture(ind: number, texture: Texture) {\n\t\tconst spr = this.boundSprites[ind];\n\t\tif (spr.texture.baseTexture === texture.baseTexture) {\n\t\t\treturn;\n\t\t}\n\t\tspr.texture = texture;\n\t\tthis.baseTex.update();\n\t\tthis.dirties[ind] = (this.baseTex as any).dirtyId;\n\t}\n\n\tupload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture) {\n\t\tconst { gl } = renderer as any;\n\n\t\tconst {width, height} = this;\n\t\tgl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.alphaMode === undefined ||\n\t\t\ttexture.alphaMode === ALPHA_MODES.UNPACK);\n\n\t\tif (glTexture.dirtyId < 0) {\n\t\t\t(glTexture as any).width = width;\n\t\t\t(glTexture as any).height = height;\n\n\t\t\tgl.texImage2D(texture.target, 0,\n\t\t\t\ttexture.format,\n\t\t\t\twidth,\n\t\t\t\theight,\n\t\t\t\t0,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tnull);\n\t\t}\n\n\t\tconst doClear = this.DO_CLEAR;\n\t\tif (doClear && !this._clearBuffer) {\n\t\t\tthis._clearBuffer = new Uint8Array(Constant.boundSize * Constant.boundSize * 4);\n\t\t}\n\n\t\tconst bounds = this.boundSprites;\n\t\tfor (let i = 0; i < bounds.length; i++) {\n\t\t\tconst spr = bounds[i];\n\t\t\tconst tex = spr.texture.baseTexture;\n\t\t\tif (glTexture.dirtyId >= this.dirties[i]) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst res = tex.resource as any;\n\t\t\tif (!tex.valid || !res || !res.source) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (doClear && (tex.width < this.boundSize || tex.height < this.boundSize))\n\t\t\t{\n\t\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\t\tspr.position.x,\n\t\t\t\t\tspr.position.y,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\tthis.boundSize,\n\t\t\t\t\ttexture.format,\n\t\t\t\t\ttexture.type,\n\t\t\t\t\tthis._clearBuffer);\n\t\t\t}\n\t\t\tgl.texSubImage2D(texture.target, 0,\n\t\t\t\tspr.position.x,\n\t\t\t\tspr.position.y,\n\t\t\t\ttexture.format,\n\t\t\t\ttexture.type,\n\t\t\t\tres.source);\n\t\t}\n\n\t\treturn true;\n\t}\n}\n","import { Constant } from './Constant';\n\nimport type { TilemapShader } from './RectTileShader';\n\n\nexport function fillSamplers(shader: TilemapShader, maxTextures: number) {\n let sampleValues: Array = [];\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n shader.uniforms.uSamplers = sampleValues;\n\n let samplerSize: Array = [];\n for (let i = 0; i < maxTextures; i++) {\n samplerSize.push(1.0 / Constant.bufferSize);\n samplerSize.push(1.0 / Constant.bufferSize);\n }\n shader.uniforms.uSamplerSize = samplerSize;\n}\n\nexport function generateFragmentSrc(maxTextures: number, fragmentSrc: string) {\n return fragmentSrc.replace(/%count%/gi, maxTextures + \"\")\n .replace(/%forloop%/gi, generateSampleSrc(maxTextures));\n}\n\nexport function generateSampleSrc(maxTextures: number) {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n src += 'if(vTextureId <= -1.0) {';\n src += '\\n\\tcolor = shadowColor;';\n src += '\\n}';\n\n for (let i = 0; i < maxTextures; i++)\n {\n src += '\\nelse ';\n\n if(i < maxTextures-1)\n {\n src += 'if(textureId == ' + i + '.0)';\n }\n\n src += '\\n{';\n src += '\\n\\tcolor = texture2D(uSamplers['+i+'], textureCoord * uSamplerSize['+i+']);';\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n}\n","/// \n\nimport * as shaderGenerator from './shaderGenerator';\n\nimport { Buffer, Geometry, Shader } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nlet rectShaderFrag = `\nvarying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n`;\nlet rectShaderVert = `\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projTransMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projTransMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 animCount = floor((aAnim + 0.5) / 2048.0);\n vec2 animFrameOffset = aAnim - animCount * 2048.0;\n vec2 animOffset = animFrameOffset * floor(mod(animationFrame + 0.5, animCount));\n\n vTextureCoord = aTextureCoord + animOffset;\n vFrame = aFrame + vec4(animOffset, animOffset);\n vTextureId = aTextureId;\n}\n`;\n\nexport abstract class TilemapShader extends Shader {\n\tmaxTextures = 0;\n\n\tconstructor(maxTextures: number, shaderVert: string, shaderFrag: string) {\n\t\tsuper(\n\t\t\tnew PIXI.Program(\n\t\t\t\tshaderVert,\n\t\t\t\tshaderFrag),\n\t\t\t{\n\t\t\t\tanimationFrame: new Float32Array(2),\n\t\t\t\tuSamplers: [],\n\t\t\t\tuSamplerSize: [],\n\t\t\t\tprojTransMatrix: new Matrix()\n\t\t\t}\n\t\t);\n\t\tthis.maxTextures = maxTextures;\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileShader extends TilemapShader {\n\tconstructor(maxTextures: number) {\n\t\tsuper(\n\t\t\tmaxTextures,\n\t\t\trectShaderVert,\n\t\t\tshaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)\n\t\t);\n\t\tshaderGenerator.fillSamplers(this, this.maxTextures);\n\t}\n}\n\nexport class RectTileGeom extends Geometry {\n\tvertSize = 11;\n\tvertPerQuad = 4;\n\tstride = this.vertSize * 4;\n\tlastTimeAccess = 0;\n\n\tconstructor() {\n\t\tsuper();\n\t\tconst buf = this.buf = new Buffer(new Float32Array(2), true, false);\n\t\tthis.addAttribute('aVertexPosition', buf, 0, false, 0, this.stride, 0)\n\t\t\t.addAttribute('aTextureCoord', buf, 0, false, 0, this.stride, 2 * 4)\n\t\t\t.addAttribute('aFrame', buf, 0, false, 0, this.stride, 4 * 4)\n\t\t\t.addAttribute('aAnim', buf, 0, false, 0, this.stride, 8 * 4)\n\t\t\t.addAttribute('aTextureId', buf, 0, false, 0, this.stride, 10 * 4);\n\t}\n\n\tbuf: PIXI.Buffer;\n}","import { WRAP_MODES } from '@pixi/constants';\nimport { BaseTexture, Buffer, resources, ObjectRenderer, Texture, Renderer } from '@pixi/core';\nimport { Constant } from './Constant';\nimport { RectTileGeom, RectTileShader } from './RectTileShader';\nimport { MultiTextureResource } from './MultiTextureResource';\n\nimport type { TilemapShader } from './RectTileShader';\n\n/**\n * Renderer for rectangle tiles.\n */\nexport class TileRenderer extends ObjectRenderer {\n\trenderer: Renderer;\n\tgl: WebGLRenderingContext;\n\tsn: number = -1;\n\tindexBuffer: PIXI.Buffer = null;\n\tibLen: number = 0;\n\ttileAnim = [0, 0];\n\ttexLoc: Array = [];\n\n\trectShader: RectTileShader;\n\ttexResources: Array = [];\n\n\tconstructor(renderer: Renderer) {\n\t\tsuper(renderer);\n\t\tthis.rectShader = new RectTileShader(Constant.maxTextures);\n\t\tthis.indexBuffer = new Buffer(undefined, true, true);\n\t\tthis.checkIndexBuffer(2000);\n\t\tthis.initBounds();\n\t}\n\n\tinitBounds() {\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tfor (let i = 0; i < maxTextures; i++) {\n\t\t\tconst resource = new MultiTextureResource(Constant);\n\t\t\tconst baseTex = new BaseTexture(resource);\n\t\t\tbaseTex.scaleMode = Constant.SCALE_MODE;\n\t\t\tbaseTex.wrapMode = WRAP_MODES.CLAMP;\n\t\t\tthis.texResources.push(resource);\n\t\t}\n\t}\n\n\tbindTexturesWithoutRT(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tlet samplerSize: Array = (shader as any).uniforms.uSamplerSize;\n\t\tthis.texLoc.length = 0;\n\t\tfor (let i = 0; i < textures.length; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\trenderer.texture.bind(textures[i], i);\n\t\t\t//TODO: add resolution here\n\t\t\tsamplerSize[i * 2] = 1.0 / textures[i].baseTexture.width;\n\t\t\tsamplerSize[i * 2 + 1] = 1.0 / textures[i].baseTexture.height;\n\t\t}\n\t\t(shader as any).uniforms.uSamplerSize = samplerSize;\n\t}\n\n\tbindTextures(renderer: Renderer, shader: TilemapShader, textures: Array) {\n\t\tconst len = textures.length;\n\t\tconst maxTextures = Constant.maxTextures;\n\t\tif (len > Constant.boundCountPerBuffer * maxTextures) {\n\t\t\treturn;\n\t\t}\n\t\tif (Constant.boundCountPerBuffer <= 1) {\n\t\t\tthis.bindTexturesWithoutRT(renderer, shader, textures);\n\t\t\treturn;\n\t\t}\n\n\t\tlet i = 0;\n\t\tfor (; i < len; i++) {\n\t\t\tconst texture = textures[i];\n\t\t\tif (!texture || !texture.valid) continue;\n\t\t\tconst multi = this.texResources[i >> 2];\n\t\t\tmulti.setTexture(i & 3, texture);\n\t\t}\n\n\t\tlet gltsUsed = (i + 3) >> 2;\n\t\tfor (i = 0; i < gltsUsed; i++) {\n\t\t\t//remove \"i, true\" after resolving a bug\n\t\t\trenderer.texture.bind(this.texResources[i].baseTex, i);\n\t\t}\n\t}\n\n\tstart() {\n\t\t//sorry, nothing\n\t}\n\n\tcreateVb() {\n\t\tconst geom = new RectTileGeom();\n\t\tgeom.addIndex(this.indexBuffer);\n\t\tgeom.lastTimeAccess = Date.now();\n\t\treturn geom;\n\t}\n\n\tcheckIndexBuffer(size: number, vb: RectTileGeom = null) {\n\t\tconst totalIndices = size * 6;\n\n\t\tif (totalIndices <= this.ibLen) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet len = totalIndices;\n\t\twhile (len < totalIndices) {\n\t\t\tlen <<= 1;\n\t\t}\n\n\t\tthis.ibLen = totalIndices;\n\t\tthis.indexBuffer.update((PIXI as any).utils.createIndicesForQuads(size,\n\t\t\tConstant.use32bitIndex ? new Uint32Array(size * 6) : undefined));\n\n\t\t// \tTODO: create new index buffer instead?\n\t\t// if (vb) {\n\t\t// \tconst curIndex = vb.getIndex();\n\t\t// \tif (curIndex !== this.indexBuffer && (curIndex.data as any).length < totalIndices) {\n\t\t// \t\tthis.swapIndex(vb, this.indexBuffer);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t// swapIndex(geom: PIXI.Geometry, indexBuf: PIXI.Buffer) {\n\t\t// let buffers = (geom as any).buffers;\n\t\t// const oldIndex = geom.getIndex();\n\t\t// let ind = buffers.indexOf(oldIndex);\n\t\t// if (ind >= 0) {\n\t\t// \tbuffers.splice(ind, 1);\n\t\t// }\n\t\t// geom.addIndex(indexBuf);\n\t// }\n\n\tgetShader(): TilemapShader {\n\t\treturn this.rectShader;\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\t// this.rectShader.destroy();\n\t\tthis.rectShader = null;\n\t}\n}\n\nRenderer.registerPlugin('tilemap', TileRenderer as any);\n","/// \n\nimport { Container } from '@pixi/display';\n\nimport type { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport type { Matrix } from '@pixi/math';\n\nexport class ZLayer extends Container {\n\n constructor(tilemap: Container, zIndex: number) {\n super();\n this.tilemap = tilemap;\n this.z = zIndex;\n }\n\n tilemap: any;\n z: number;\n zIndex: number;\n _previousLayers: number;\n canvasBuffer: HTMLCanvasElement;\n _tempRender: any;\n _lastAnimationFrame: number = -1;\n layerTransform: Matrix;\n\n clear() {\n let layers = this.children as Array;\n for (let i = 0; i < layers.length; i++)\n layers[i].clear();\n this._previousLayers = 0;\n }\n\n cacheIfDirty() {\n let tilemap: any = this.tilemap;\n let layers = this.children as Array;\n let modified = this._previousLayers !== layers.length;\n this._previousLayers = layers.length;\n let buf = this.canvasBuffer;\n let tempRender = this._tempRender;\n if (!buf) {\n buf = this.canvasBuffer = document.createElement('canvas');\n tempRender = this._tempRender = new (PIXI as any).CanvasRenderer(100, 100, {view: buf});\n tempRender.context = tempRender.rootContext;\n tempRender.plugins.tilemap.dontUseTransform = true;\n }\n if (buf.width !== tilemap._layerWidth ||\n buf.height !== tilemap._layerHeight) {\n buf.width = tilemap._layerWidth;\n buf.height = tilemap._layerHeight;\n modified = true;\n }\n let i: number;\n if (!modified) {\n for (i = 0; i < layers.length; i++) {\n if (layers[i].isModified(this._lastAnimationFrame !== tilemap.animationFrame)) {\n modified = true;\n break;\n }\n }\n }\n this._lastAnimationFrame = tilemap.animationFrame;\n if (modified) {\n if (tilemap._hackRenderer) {\n tilemap._hackRenderer(tempRender);\n }\n tempRender.context.clearRect(0, 0, buf.width, buf.height);\n for (i = 0; i < layers.length; i++) {\n layers[i].clearModify();\n layers[i].renderCanvas(tempRender);\n }\n }\n this.layerTransform = this.worldTransform;\n for (i = 0; i < layers.length; i++) {\n this.layerTransform = layers[i].worldTransform;\n break;\n }\n }\n\n renderCanvas(renderer: any) {\n this.cacheIfDirty();\n let wt = this.layerTransform;\n renderer.context.setTransform(\n wt.a,\n wt.b,\n wt.c,\n wt.d,\n wt.tx * renderer.resolution,\n wt.ty * renderer.resolution\n );\n let tilemap = this.tilemap;\n renderer.context.drawImage(this.canvasBuffer, 0, 0);\n }\n}\n","/// \n\nnamespace pixi_tilemap {\n (PIXI as any).tilemap = pixi_tilemap;\n}\n\n// This makes exporter.ts a module!\nexport default {}\n","import { CanvasTileRenderer } from './CanvasTileRenderer';\nimport { CompositeRectTileLayer } from './CompositeRectTileLayer';\nimport { Constant } from './Constant';\nimport { GraphicsLayer } from './GraphicsLayer';\nimport { MultiTextureResource } from './MultiTextureResource';\nimport { RectTileLayer } from './RectTileLayer';\nimport { TilemapShader, RectTileShader, RectTileGeom } from './RectTileShader';\nimport { TileRenderer } from './TileRenderer';\nimport { ZLayer } from './ZLayer';\n\nexport const pixi_tilemap = {\n CanvasTileRenderer,\n CompositeRectTileLayer,\n Constant,\n GraphicsLayer,\n MultiTextureResource,\n RectTileLayer,\n TilemapShader,\n RectTileShader,\n RectTileGeom,\n TileRenderer,\n ZLayer,\n};\n\nexport * from './CanvasTileRenderer';\nexport * from './CompositeRectTileLayer';\nexport * from './Constant';\nexport * from './exporter';\nexport * from './GraphicsLayer';\nexport * from './MultiTextureResource';\nexport * from './RectTileLayer';\nexport * from './RectTileShader';\nexport * from './shaderGenerator';\nexport * from './TileRenderer';\nexport * from './ZLayer';"],"names":["shaderGenerator.fillSamplers","shaderGenerator.generateFragmentSrc","pixi_tilemap"],"mappings":";;;;;;;;;;;;;;;;;;;IASI,4BAAY,QAAkB;QAH9B,aAAQ,GAAG,CAAC,C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AC3B,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;KACvD;IACL,aAAC;AAAD,CApFA,CAA4B,SAAS;;ACLrC,IAAU,YAAY,CAErB;AAFD,WAAU,YAAY;IACjB,IAAY,CAAC,OAAO,GAAG,YAAY,CAAC;AACzC,CAAC,EAFS,YAAY,KAAZ,YAAY;;ICQTE,cAAY,GAAG;IACxB,kBAAkB,oBAAA;IAClB,sBAAsB,wBAAA;IACtB,QAAQ,UAAA;IACR,aAAa,eAAA;IACb,oBAAoB,sBAAA;IACpB,aAAa,eAAA;IACb,aAAa,eAAA;IACb,cAAc,gBAAA;IACd,YAAY,cAAA;IACZ,YAAY,cAAA;IACZ,MAAM,QAAA;;;;;"} \ No newline at end of file diff --git a/src/shaderGenerator.ts b/src/shaderGenerator.ts index 7349b49b..00d9d4e6 100644 --- a/src/shaderGenerator.ts +++ b/src/shaderGenerator.ts @@ -21,7 +21,7 @@ export function fillSamplers(shader: TilemapShader, maxTextures: number) { export function generateFragmentSrc(maxTextures: number, fragmentSrc: string) { return fragmentSrc.replace(/%count%/gi, maxTextures + "") - .replace(/%forloop%/gi, this.generateSampleSrc(maxTextures)); + .replace(/%forloop%/gi, generateSampleSrc(maxTextures)); } export function generateSampleSrc(maxTextures: number) {