@micjanic/recursive-grid 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{CanvasPool-BvJplAOp.js → CanvasPool-D2Uot4VE.js} +16 -15
- package/dist/CanvasPool-D2Uot4VE.js.map +1 -0
- package/dist/{PixiApp-D4xu0PT4.js → PixiApp-BHmY2ZMg.js} +8806 -8672
- package/dist/PixiApp-BHmY2ZMg.js.map +1 -0
- package/dist/{SharedSystems-CZFehVPl.js → SharedSystems-D2AiAlOX.js} +246 -221
- package/dist/SharedSystems-D2AiAlOX.js.map +1 -0
- package/dist/{WebGLRenderer-BYTBSbn-.js → WebGLRenderer-olc8u2PI.js} +95 -93
- package/dist/WebGLRenderer-olc8u2PI.js.map +1 -0
- package/dist/{WebGPURenderer-fP-CMMNL.js → WebGPURenderer-CVyBksYf.js} +12 -11
- package/dist/WebGPURenderer-CVyBksYf.js.map +1 -0
- package/dist/{browserAll-qgahyZIY.js → browserAll-BuBdO9TO.js} +74 -58
- package/dist/browserAll-BuBdO9TO.js.map +1 -0
- package/dist/recursive-grid.es.js +1 -1
- package/dist/recursive-grid.umd.js +276 -181
- package/dist/recursive-grid.umd.js.map +1 -1
- package/dist/{webworkerAll-CI8_Z7rX.js → webworkerAll-pikqGfAy.js} +1277 -742
- package/dist/webworkerAll-pikqGfAy.js.map +1 -0
- package/package.json +6 -4
- package/dist/CanvasPool-BvJplAOp.js.map +0 -1
- package/dist/PixiApp-D4xu0PT4.js.map +0 -1
- package/dist/SharedSystems-CZFehVPl.js.map +0 -1
- package/dist/WebGLRenderer-BYTBSbn-.js.map +0 -1
- package/dist/WebGPURenderer-fP-CMMNL.js.map +0 -1
- package/dist/browserAll-qgahyZIY.js.map +0 -1
- package/dist/webworkerAll-CI8_Z7rX.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as n, n as c } from "./PixiApp-
|
|
1
|
+
import { D as n, n as c, G as r } from "./PixiApp-BHmY2ZMg.js";
|
|
2
2
|
class l {
|
|
3
3
|
constructor(a) {
|
|
4
4
|
this._canvasPool = /* @__PURE__ */ Object.create(null), this.canvasOptions = a || {}, this.enableFullScreen = !1;
|
|
@@ -8,11 +8,11 @@ class l {
|
|
|
8
8
|
* @param pixelWidth - Width of texture in pixels.
|
|
9
9
|
* @param pixelHeight - Height of texture in pixels.
|
|
10
10
|
*/
|
|
11
|
-
_createCanvasAndContext(a,
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
const e =
|
|
15
|
-
return { canvas:
|
|
11
|
+
_createCanvasAndContext(a, s) {
|
|
12
|
+
const t = n.get().createCanvas();
|
|
13
|
+
t.width = a, t.height = s;
|
|
14
|
+
const e = t.getContext("2d");
|
|
15
|
+
return { canvas: t, context: e };
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* Gets a Power-of-Two render texture or fullScreen texture
|
|
@@ -21,27 +21,28 @@ class l {
|
|
|
21
21
|
* @param resolution - The resolution of the render texture.
|
|
22
22
|
* @returns The new render texture.
|
|
23
23
|
*/
|
|
24
|
-
getOptimalCanvasAndContext(a,
|
|
25
|
-
a = Math.ceil(a *
|
|
26
|
-
const e = (a << 17) + (
|
|
24
|
+
getOptimalCanvasAndContext(a, s, t = 1) {
|
|
25
|
+
a = Math.ceil(a * t - 1e-6), s = Math.ceil(s * t - 1e-6), a = c(a), s = c(s);
|
|
26
|
+
const e = (a << 17) + (s << 1);
|
|
27
27
|
this._canvasPool[e] || (this._canvasPool[e] = []);
|
|
28
28
|
let o = this._canvasPool[e].pop();
|
|
29
|
-
return o || (o = this._createCanvasAndContext(a,
|
|
29
|
+
return o || (o = this._createCanvasAndContext(a, s)), o;
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
* Place a render texture back into the pool.
|
|
33
33
|
* @param canvasAndContext
|
|
34
34
|
*/
|
|
35
35
|
returnCanvasAndContext(a) {
|
|
36
|
-
const
|
|
37
|
-
a.context.resetTransform(), a.context.clearRect(0, 0,
|
|
36
|
+
const s = a.canvas, { width: t, height: e } = s, o = (t << 17) + (e << 1);
|
|
37
|
+
a.context.resetTransform(), a.context.clearRect(0, 0, t, e), this._canvasPool[o].push(a);
|
|
38
38
|
}
|
|
39
39
|
clear() {
|
|
40
40
|
this._canvasPool = {};
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
const
|
|
43
|
+
const v = new l();
|
|
44
|
+
r.register(v);
|
|
44
45
|
export {
|
|
45
|
-
C
|
|
46
|
+
v as C
|
|
46
47
|
};
|
|
47
|
-
//# sourceMappingURL=CanvasPool-
|
|
48
|
+
//# sourceMappingURL=CanvasPool-D2Uot4VE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CanvasPool-D2Uot4VE.js","sources":["../node_modules/pixi.js/lib/rendering/renderers/shared/texture/CanvasPool.mjs"],"sourcesContent":["import { DOMAdapter } from '../../../../environment/adapter.mjs';\nimport { nextPow2 } from '../../../../maths/misc/pow2.mjs';\nimport { GlobalResourceRegistry } from '../../../../utils/pool/GlobalResourceRegistry.mjs';\n\n\"use strict\";\nclass CanvasPoolClass {\n constructor(canvasOptions) {\n this._canvasPool = /* @__PURE__ */ Object.create(null);\n this.canvasOptions = canvasOptions || {};\n this.enableFullScreen = false;\n }\n /**\n * Creates texture with params that were specified in pool constructor.\n * @param pixelWidth - Width of texture in pixels.\n * @param pixelHeight - Height of texture in pixels.\n */\n _createCanvasAndContext(pixelWidth, pixelHeight) {\n const canvas = DOMAdapter.get().createCanvas();\n canvas.width = pixelWidth;\n canvas.height = pixelHeight;\n const context = canvas.getContext(\"2d\");\n return { canvas, context };\n }\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n * @param minWidth - The minimum width of the render texture.\n * @param minHeight - The minimum height of the render texture.\n * @param resolution - The resolution of the render texture.\n * @returns The new render texture.\n */\n getOptimalCanvasAndContext(minWidth, minHeight, resolution = 1) {\n minWidth = Math.ceil(minWidth * resolution - 1e-6);\n minHeight = Math.ceil(minHeight * resolution - 1e-6);\n minWidth = nextPow2(minWidth);\n minHeight = nextPow2(minHeight);\n const key = (minWidth << 17) + (minHeight << 1);\n if (!this._canvasPool[key]) {\n this._canvasPool[key] = [];\n }\n let canvasAndContext = this._canvasPool[key].pop();\n if (!canvasAndContext) {\n canvasAndContext = this._createCanvasAndContext(minWidth, minHeight);\n }\n return canvasAndContext;\n }\n /**\n * Place a render texture back into the pool.\n * @param canvasAndContext\n */\n returnCanvasAndContext(canvasAndContext) {\n const canvas = canvasAndContext.canvas;\n const { width, height } = canvas;\n const key = (width << 17) + (height << 1);\n canvasAndContext.context.resetTransform();\n canvasAndContext.context.clearRect(0, 0, width, height);\n this._canvasPool[key].push(canvasAndContext);\n }\n clear() {\n this._canvasPool = {};\n }\n}\nconst CanvasPool = new CanvasPoolClass();\nGlobalResourceRegistry.register(CanvasPool);\n\nexport { CanvasPool, CanvasPoolClass };\n//# sourceMappingURL=CanvasPool.mjs.map\n"],"names":["CanvasPoolClass","canvasOptions","pixelWidth","pixelHeight","canvas","DOMAdapter","context","minWidth","minHeight","resolution","nextPow2","key","canvasAndContext","width","height","CanvasPool","GlobalResourceRegistry"],"mappings":";AAKA,MAAMA,EAAgB;AAAA,EACpB,YAAYC,GAAe;AACzB,SAAK,cAA8B,uBAAO,OAAO,IAAI,GACrD,KAAK,gBAAgBA,KAAiB,CAAA,GACtC,KAAK,mBAAmB;AAAA,EAC1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,wBAAwBC,GAAYC,GAAa;AAC/C,UAAMC,IAASC,EAAW,IAAG,EAAG,aAAY;AAC5C,IAAAD,EAAO,QAAQF,GACfE,EAAO,SAASD;AAChB,UAAMG,IAAUF,EAAO,WAAW,IAAI;AACtC,WAAO,EAAE,QAAAA,GAAQ,SAAAE,EAAO;AAAA,EAC1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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