@industry-theme/repository-composition-panels 0.2.58 → 0.2.59
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/dist/{BufferResource-CwFhjYqu.js → BufferResource-BCBfCsT6.js} +5 -80
- package/dist/BufferResource-BCBfCsT6.js.map +1 -0
- package/dist/{CanvasRenderer-D_uyJXq7.js → CanvasRenderer-2yEMbusr.js} +3 -339
- package/dist/CanvasRenderer-2yEMbusr.js.map +1 -0
- package/dist/{Filter-BL3R0vO2.js → Filter-CdzQNTtc.js} +2 -2
- package/dist/{Filter-BL3R0vO2.js.map → Filter-CdzQNTtc.js.map} +1 -1
- package/dist/{RenderTargetSystem-CUdkCVfb.js → RenderTargetSystem-CvocGhAO.js} +3 -3
- package/dist/{RenderTargetSystem-CUdkCVfb.js.map → RenderTargetSystem-CvocGhAO.js.map} +1 -1
- package/dist/{WebGLRenderer-CxHdzexZ.js → WebGLRenderer-CsAZzI7W.js} +4 -4
- package/dist/{WebGLRenderer-CxHdzexZ.js.map → WebGLRenderer-CsAZzI7W.js.map} +1 -1
- package/dist/{WebGPURenderer-XZ3X-iy6.js → WebGPURenderer-D2GRpSb3.js} +4 -4
- package/dist/{WebGPURenderer-XZ3X-iy6.js.map → WebGPURenderer-D2GRpSb3.js.map} +1 -1
- package/dist/{browserAll-7cTZp3vq.js → browserAll-BG2Mm9Lt.js} +3 -3
- package/dist/{browserAll-7cTZp3vq.js.map → browserAll-BG2Mm9Lt.js.map} +1 -1
- package/dist/{index-Cd5eYs9k.js → index-L48T6UlC.js} +1910 -385
- package/dist/index-L48T6UlC.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/{init-D_6tdjww.js → init-DWPvbIZ9.js} +3 -3
- package/dist/{init-D_6tdjww.js.map → init-DWPvbIZ9.js.map} +1 -1
- package/dist/panels/CollectionMapPanel.d.ts +3 -0
- package/dist/panels/CollectionMapPanel.d.ts.map +1 -1
- package/dist/panels/GitProjectsMapPanel.d.ts +3 -0
- package/dist/panels/GitProjectsMapPanel.d.ts.map +1 -1
- package/dist/panels/overworld-map/OverworldMapPanel.d.ts +3 -0
- package/dist/panels/overworld-map/OverworldMapPanel.d.ts.map +1 -1
- package/dist/panels/overworld-map/dataConverter.d.ts +2 -0
- package/dist/panels/overworld-map/dataConverter.d.ts.map +1 -1
- package/dist/panels/overworld-map/genericMapper.d.ts +12 -0
- package/dist/panels/overworld-map/genericMapper.d.ts.map +1 -1
- package/dist/panels/overworld-map/spriteGenerator.d.ts +4 -0
- package/dist/panels/overworld-map/spriteGenerator.d.ts.map +1 -1
- package/dist/panels.bundle.js +35 -39
- package/dist/webworkerAll-MEZKzuuk.js +3 -0
- package/dist/webworkerAll-MEZKzuuk.js.map +1 -0
- package/package.json +1 -1
- package/dist/BufferResource-CwFhjYqu.js.map +0 -1
- package/dist/CanvasRenderer-D_uyJXq7.js.map +0 -1
- package/dist/index-Cd5eYs9k.js.map +0 -1
- package/dist/webworkerAll-CNZapS1-.js +0 -3
- package/dist/webworkerAll-CNZapS1-.js.map +0 -1
|
@@ -6715,18 +6715,18 @@ function ZoomEvent(type2, {
|
|
|
6715
6715
|
_: { value: dispatch2 }
|
|
6716
6716
|
});
|
|
6717
6717
|
}
|
|
6718
|
-
function Transform(k2, x2, y2) {
|
|
6718
|
+
function Transform$1(k2, x2, y2) {
|
|
6719
6719
|
this.k = k2;
|
|
6720
6720
|
this.x = x2;
|
|
6721
6721
|
this.y = y2;
|
|
6722
6722
|
}
|
|
6723
|
-
Transform.prototype = {
|
|
6724
|
-
constructor: Transform,
|
|
6723
|
+
Transform$1.prototype = {
|
|
6724
|
+
constructor: Transform$1,
|
|
6725
6725
|
scale: function(k2) {
|
|
6726
|
-
return k2 === 1 ? this : new Transform(this.k * k2, this.x, this.y);
|
|
6726
|
+
return k2 === 1 ? this : new Transform$1(this.k * k2, this.x, this.y);
|
|
6727
6727
|
},
|
|
6728
6728
|
translate: function(x2, y2) {
|
|
6729
|
-
return x2 === 0 & y2 === 0 ? this : new Transform(this.k, this.x + this.k * x2, this.y + this.k * y2);
|
|
6729
|
+
return x2 === 0 & y2 === 0 ? this : new Transform$1(this.k, this.x + this.k * x2, this.y + this.k * y2);
|
|
6730
6730
|
},
|
|
6731
6731
|
apply: function(point) {
|
|
6732
6732
|
return [point[0] * this.k + this.x, point[1] * this.k + this.y];
|
|
@@ -6756,8 +6756,8 @@ Transform.prototype = {
|
|
|
6756
6756
|
return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
|
|
6757
6757
|
}
|
|
6758
6758
|
};
|
|
6759
|
-
var identity$1 = new Transform(1, 0, 0);
|
|
6760
|
-
transform.prototype = Transform.prototype;
|
|
6759
|
+
var identity$1 = new Transform$1(1, 0, 0);
|
|
6760
|
+
transform.prototype = Transform$1.prototype;
|
|
6761
6761
|
function transform(node) {
|
|
6762
6762
|
while (!node.__zoom) if (!(node = node.parentNode)) return identity$1;
|
|
6763
6763
|
return node.__zoom;
|
|
@@ -6847,11 +6847,11 @@ function zoom() {
|
|
|
6847
6847
|
};
|
|
6848
6848
|
function scale(transform2, k2) {
|
|
6849
6849
|
k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k2));
|
|
6850
|
-
return k2 === transform2.k ? transform2 : new Transform(k2, transform2.x, transform2.y);
|
|
6850
|
+
return k2 === transform2.k ? transform2 : new Transform$1(k2, transform2.x, transform2.y);
|
|
6851
6851
|
}
|
|
6852
6852
|
function translate(transform2, p0, p1) {
|
|
6853
6853
|
var x2 = p0[0] - p1[0] * transform2.k, y2 = p0[1] - p1[1] * transform2.k;
|
|
6854
|
-
return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform(transform2.k, x2, y2);
|
|
6854
|
+
return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform$1(transform2.k, x2, y2);
|
|
6855
6855
|
}
|
|
6856
6856
|
function centroid(extent2) {
|
|
6857
6857
|
return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
|
|
@@ -6867,7 +6867,7 @@ function zoom() {
|
|
|
6867
6867
|
if (t2 === 1) t2 = b2;
|
|
6868
6868
|
else {
|
|
6869
6869
|
var l2 = i2(t2), k2 = w2 / l2[2];
|
|
6870
|
-
t2 = new Transform(k2, p2[0] - l2[0] * k2, p2[1] - l2[1] * k2);
|
|
6870
|
+
t2 = new Transform$1(k2, p2[0] - l2[0] * k2, p2[1] - l2[1] * k2);
|
|
6871
6871
|
}
|
|
6872
6872
|
g2.zoom(null, t2);
|
|
6873
6873
|
};
|
|
@@ -60179,7 +60179,7 @@ const browserExt = {
|
|
|
60179
60179
|
},
|
|
60180
60180
|
test: () => true,
|
|
60181
60181
|
load: async () => {
|
|
60182
|
-
await import("./browserAll-
|
|
60182
|
+
await import("./browserAll-BG2Mm9Lt.js");
|
|
60183
60183
|
}
|
|
60184
60184
|
};
|
|
60185
60185
|
const webworkerExt = {
|
|
@@ -60190,7 +60190,7 @@ const webworkerExt = {
|
|
|
60190
60190
|
},
|
|
60191
60191
|
test: () => typeof self !== "undefined" && self.WorkerGlobalScope !== void 0,
|
|
60192
60192
|
load: async () => {
|
|
60193
|
-
await import("./webworkerAll-
|
|
60193
|
+
await import("./webworkerAll-MEZKzuuk.js");
|
|
60194
60194
|
}
|
|
60195
60195
|
};
|
|
60196
60196
|
class ObservablePoint {
|
|
@@ -71179,19 +71179,19 @@ class Shader extends EventEmitter {
|
|
|
71179
71179
|
this._ownedBindGroups = [];
|
|
71180
71180
|
this._destroyed = false;
|
|
71181
71181
|
let {
|
|
71182
|
-
gpuProgram,
|
|
71183
|
-
glProgram,
|
|
71182
|
+
gpuProgram: gpuProgram2,
|
|
71183
|
+
glProgram: glProgram2,
|
|
71184
71184
|
groups,
|
|
71185
71185
|
resources,
|
|
71186
71186
|
compatibleRenderers,
|
|
71187
71187
|
groupMap
|
|
71188
71188
|
} = options;
|
|
71189
|
-
this.gpuProgram =
|
|
71190
|
-
this.glProgram =
|
|
71189
|
+
this.gpuProgram = gpuProgram2;
|
|
71190
|
+
this.glProgram = glProgram2;
|
|
71191
71191
|
if (compatibleRenderers === void 0) {
|
|
71192
71192
|
compatibleRenderers = 0;
|
|
71193
|
-
if (
|
|
71194
|
-
if (
|
|
71193
|
+
if (gpuProgram2) compatibleRenderers |= RendererType.WEBGPU;
|
|
71194
|
+
if (glProgram2) compatibleRenderers |= RendererType.WEBGL;
|
|
71195
71195
|
}
|
|
71196
71196
|
this.compatibleRenderers = compatibleRenderers;
|
|
71197
71197
|
const nameHash = {};
|
|
@@ -71200,9 +71200,9 @@ class Shader extends EventEmitter {
|
|
|
71200
71200
|
}
|
|
71201
71201
|
if (resources && groups) {
|
|
71202
71202
|
throw new Error("[Shader] Cannot have both resources and groups");
|
|
71203
|
-
} else if (!
|
|
71203
|
+
} else if (!gpuProgram2 && groups && !groupMap) {
|
|
71204
71204
|
throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");
|
|
71205
|
-
} else if (!
|
|
71205
|
+
} else if (!gpuProgram2 && groups && groupMap) {
|
|
71206
71206
|
for (const i2 in groupMap) {
|
|
71207
71207
|
for (const j2 in groupMap[i2]) {
|
|
71208
71208
|
const uniformName = groupMap[i2][j2];
|
|
@@ -71213,8 +71213,8 @@ class Shader extends EventEmitter {
|
|
|
71213
71213
|
};
|
|
71214
71214
|
}
|
|
71215
71215
|
}
|
|
71216
|
-
} else if (
|
|
71217
|
-
const groupData =
|
|
71216
|
+
} else if (gpuProgram2 && groups && !groupMap) {
|
|
71217
|
+
const groupData = gpuProgram2.structsAndGroups.groups;
|
|
71218
71218
|
groupMap = {};
|
|
71219
71219
|
groupData.forEach((data) => {
|
|
71220
71220
|
groupMap[data.group] = groupMap[data.group] || {};
|
|
@@ -71224,8 +71224,8 @@ class Shader extends EventEmitter {
|
|
|
71224
71224
|
} else if (resources) {
|
|
71225
71225
|
groups = {};
|
|
71226
71226
|
groupMap = {};
|
|
71227
|
-
if (
|
|
71228
|
-
const groupData =
|
|
71227
|
+
if (gpuProgram2) {
|
|
71228
|
+
const groupData = gpuProgram2.structsAndGroups.groups;
|
|
71229
71229
|
groupData.forEach((data) => {
|
|
71230
71230
|
groupMap[data.group] = groupMap[data.group] || {};
|
|
71231
71231
|
groupMap[data.group][data.binding] = data.name;
|
|
@@ -71323,17 +71323,17 @@ class Shader extends EventEmitter {
|
|
|
71323
71323
|
}
|
|
71324
71324
|
static from(options) {
|
|
71325
71325
|
const { gpu, gl, ...rest } = options;
|
|
71326
|
-
let
|
|
71327
|
-
let
|
|
71326
|
+
let gpuProgram2;
|
|
71327
|
+
let glProgram2;
|
|
71328
71328
|
if (gpu) {
|
|
71329
|
-
|
|
71329
|
+
gpuProgram2 = GpuProgram.from(gpu);
|
|
71330
71330
|
}
|
|
71331
71331
|
if (gl) {
|
|
71332
|
-
|
|
71332
|
+
glProgram2 = GlProgram.from(gl);
|
|
71333
71333
|
}
|
|
71334
71334
|
return new Shader({
|
|
71335
|
-
gpuProgram,
|
|
71336
|
-
glProgram,
|
|
71335
|
+
gpuProgram: gpuProgram2,
|
|
71336
|
+
glProgram: glProgram2,
|
|
71337
71337
|
...rest
|
|
71338
71338
|
});
|
|
71339
71339
|
}
|
|
@@ -72433,19 +72433,19 @@ async function autoDetectRenderer(options) {
|
|
|
72433
72433
|
for (let i2 = 0; i2 < preferredOrder.length; i2++) {
|
|
72434
72434
|
const rendererType = preferredOrder[i2];
|
|
72435
72435
|
if (rendererType === "webgpu" && await isWebGPUSupported()) {
|
|
72436
|
-
const { WebGPURenderer } = await import("./WebGPURenderer-
|
|
72436
|
+
const { WebGPURenderer } = await import("./WebGPURenderer-D2GRpSb3.js");
|
|
72437
72437
|
RendererClass = WebGPURenderer;
|
|
72438
72438
|
finalOptions = { ...options, ...options.webgpu };
|
|
72439
72439
|
break;
|
|
72440
72440
|
} else if (rendererType === "webgl" && isWebGLSupported(
|
|
72441
72441
|
options.failIfMajorPerformanceCaveat ?? AbstractRenderer.defaultOptions.failIfMajorPerformanceCaveat
|
|
72442
72442
|
)) {
|
|
72443
|
-
const { WebGLRenderer } = await import("./WebGLRenderer-
|
|
72443
|
+
const { WebGLRenderer } = await import("./WebGLRenderer-CsAZzI7W.js");
|
|
72444
72444
|
RendererClass = WebGLRenderer;
|
|
72445
72445
|
finalOptions = { ...options, ...options.webgl };
|
|
72446
72446
|
break;
|
|
72447
72447
|
} else if (rendererType === "canvas") {
|
|
72448
|
-
const { CanvasRenderer } = await import("./CanvasRenderer-
|
|
72448
|
+
const { CanvasRenderer } = await import("./CanvasRenderer-2yEMbusr.js");
|
|
72449
72449
|
RendererClass = CanvasRenderer;
|
|
72450
72450
|
finalOptions = { ...options, ...options.canvasOptions };
|
|
72451
72451
|
break;
|
|
@@ -75554,7 +75554,7 @@ function getBatchSamplersUniformGroup(maxTextures) {
|
|
|
75554
75554
|
}
|
|
75555
75555
|
class DefaultShader extends Shader {
|
|
75556
75556
|
constructor(maxTextures) {
|
|
75557
|
-
const
|
|
75557
|
+
const glProgram2 = compileHighShaderGlProgram({
|
|
75558
75558
|
name: "batch",
|
|
75559
75559
|
bits: [
|
|
75560
75560
|
colorBitGl,
|
|
@@ -75562,7 +75562,7 @@ class DefaultShader extends Shader {
|
|
|
75562
75562
|
roundPixelsBitGl
|
|
75563
75563
|
]
|
|
75564
75564
|
});
|
|
75565
|
-
const
|
|
75565
|
+
const gpuProgram2 = compileHighShaderGpuProgram({
|
|
75566
75566
|
name: "batch",
|
|
75567
75567
|
bits: [
|
|
75568
75568
|
colorBit,
|
|
@@ -75571,8 +75571,8 @@ class DefaultShader extends Shader {
|
|
|
75571
75571
|
]
|
|
75572
75572
|
});
|
|
75573
75573
|
super({
|
|
75574
|
-
glProgram,
|
|
75575
|
-
gpuProgram,
|
|
75574
|
+
glProgram: glProgram2,
|
|
75575
|
+
gpuProgram: gpuProgram2,
|
|
75576
75576
|
resources: {
|
|
75577
75577
|
batchSamplers: getBatchSamplersUniformGroup(maxTextures)
|
|
75578
75578
|
}
|
|
@@ -80961,6 +80961,1646 @@ class Graphics extends ViewContainer {
|
|
|
80961
80961
|
return this._callContextMethod("star", args);
|
|
80962
80962
|
}
|
|
80963
80963
|
}
|
|
80964
|
+
const _MeshGeometry = class _MeshGeometry2 extends Geometry {
|
|
80965
|
+
constructor(...args) {
|
|
80966
|
+
let options = args[0] ?? {};
|
|
80967
|
+
if (options instanceof Float32Array) {
|
|
80968
|
+
deprecation(v8_0_0, "use new MeshGeometry({ positions, uvs, indices }) instead");
|
|
80969
|
+
options = {
|
|
80970
|
+
positions: options,
|
|
80971
|
+
uvs: args[1],
|
|
80972
|
+
indices: args[2]
|
|
80973
|
+
};
|
|
80974
|
+
}
|
|
80975
|
+
options = { ..._MeshGeometry2.defaultOptions, ...options };
|
|
80976
|
+
const positions = options.positions || new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]);
|
|
80977
|
+
let uvs = options.uvs;
|
|
80978
|
+
if (!uvs) {
|
|
80979
|
+
if (options.positions) {
|
|
80980
|
+
uvs = new Float32Array(positions.length);
|
|
80981
|
+
} else {
|
|
80982
|
+
uvs = new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]);
|
|
80983
|
+
}
|
|
80984
|
+
}
|
|
80985
|
+
const indices = options.indices || new Uint32Array([0, 1, 2, 0, 2, 3]);
|
|
80986
|
+
const shrinkToFit = options.shrinkBuffersToFit;
|
|
80987
|
+
const positionBuffer = new Buffer({
|
|
80988
|
+
data: positions,
|
|
80989
|
+
label: "attribute-mesh-positions",
|
|
80990
|
+
shrinkToFit,
|
|
80991
|
+
usage: BufferUsage.VERTEX | BufferUsage.COPY_DST
|
|
80992
|
+
});
|
|
80993
|
+
const uvBuffer = new Buffer({
|
|
80994
|
+
data: uvs,
|
|
80995
|
+
label: "attribute-mesh-uvs",
|
|
80996
|
+
shrinkToFit,
|
|
80997
|
+
usage: BufferUsage.VERTEX | BufferUsage.COPY_DST
|
|
80998
|
+
});
|
|
80999
|
+
const indexBuffer = new Buffer({
|
|
81000
|
+
data: indices,
|
|
81001
|
+
label: "index-mesh-buffer",
|
|
81002
|
+
shrinkToFit,
|
|
81003
|
+
usage: BufferUsage.INDEX | BufferUsage.COPY_DST
|
|
81004
|
+
});
|
|
81005
|
+
super({
|
|
81006
|
+
attributes: {
|
|
81007
|
+
aPosition: {
|
|
81008
|
+
buffer: positionBuffer,
|
|
81009
|
+
format: "float32x2",
|
|
81010
|
+
stride: 2 * 4,
|
|
81011
|
+
offset: 0
|
|
81012
|
+
},
|
|
81013
|
+
aUV: {
|
|
81014
|
+
buffer: uvBuffer,
|
|
81015
|
+
format: "float32x2",
|
|
81016
|
+
stride: 2 * 4,
|
|
81017
|
+
offset: 0
|
|
81018
|
+
}
|
|
81019
|
+
},
|
|
81020
|
+
indexBuffer,
|
|
81021
|
+
topology: options.topology
|
|
81022
|
+
});
|
|
81023
|
+
this.batchMode = "auto";
|
|
81024
|
+
}
|
|
81025
|
+
/** The positions of the mesh. */
|
|
81026
|
+
get positions() {
|
|
81027
|
+
return this.attributes.aPosition.buffer.data;
|
|
81028
|
+
}
|
|
81029
|
+
/**
|
|
81030
|
+
* Set the positions of the mesh.
|
|
81031
|
+
* When setting the positions, its important that the uvs array is at least as long as the positions array.
|
|
81032
|
+
* otherwise the geometry will not be valid.
|
|
81033
|
+
* @param {Float32Array} value - The positions of the mesh.
|
|
81034
|
+
*/
|
|
81035
|
+
set positions(value) {
|
|
81036
|
+
this.attributes.aPosition.buffer.data = value;
|
|
81037
|
+
}
|
|
81038
|
+
/** The UVs of the mesh. */
|
|
81039
|
+
get uvs() {
|
|
81040
|
+
return this.attributes.aUV.buffer.data;
|
|
81041
|
+
}
|
|
81042
|
+
/**
|
|
81043
|
+
* Set the UVs of the mesh.
|
|
81044
|
+
* Its important that the uvs array you set is at least as long as the positions array.
|
|
81045
|
+
* otherwise the geometry will not be valid.
|
|
81046
|
+
* @param {Float32Array} value - The UVs of the mesh.
|
|
81047
|
+
*/
|
|
81048
|
+
set uvs(value) {
|
|
81049
|
+
this.attributes.aUV.buffer.data = value;
|
|
81050
|
+
}
|
|
81051
|
+
/** The indices of the mesh. */
|
|
81052
|
+
get indices() {
|
|
81053
|
+
return this.indexBuffer.data;
|
|
81054
|
+
}
|
|
81055
|
+
set indices(value) {
|
|
81056
|
+
this.indexBuffer.data = value;
|
|
81057
|
+
}
|
|
81058
|
+
};
|
|
81059
|
+
_MeshGeometry.defaultOptions = {
|
|
81060
|
+
topology: "triangle-list",
|
|
81061
|
+
shrinkBuffersToFit: false
|
|
81062
|
+
};
|
|
81063
|
+
let MeshGeometry = _MeshGeometry;
|
|
81064
|
+
class BatchableMesh {
|
|
81065
|
+
constructor() {
|
|
81066
|
+
this.batcherName = "default";
|
|
81067
|
+
this.packAsQuad = false;
|
|
81068
|
+
this.indexOffset = 0;
|
|
81069
|
+
this.attributeOffset = 0;
|
|
81070
|
+
this.roundPixels = 0;
|
|
81071
|
+
this._batcher = null;
|
|
81072
|
+
this._batch = null;
|
|
81073
|
+
this._textureMatrixUpdateId = -1;
|
|
81074
|
+
this._uvUpdateId = -1;
|
|
81075
|
+
}
|
|
81076
|
+
get blendMode() {
|
|
81077
|
+
return this.renderable.groupBlendMode;
|
|
81078
|
+
}
|
|
81079
|
+
get topology() {
|
|
81080
|
+
return this._topology || this.geometry.topology;
|
|
81081
|
+
}
|
|
81082
|
+
set topology(value) {
|
|
81083
|
+
this._topology = value;
|
|
81084
|
+
}
|
|
81085
|
+
reset() {
|
|
81086
|
+
this.renderable = null;
|
|
81087
|
+
this.texture = null;
|
|
81088
|
+
this._batcher = null;
|
|
81089
|
+
this._batch = null;
|
|
81090
|
+
this.geometry = null;
|
|
81091
|
+
this._uvUpdateId = -1;
|
|
81092
|
+
this._textureMatrixUpdateId = -1;
|
|
81093
|
+
}
|
|
81094
|
+
/**
|
|
81095
|
+
* Sets the texture for the batchable mesh.
|
|
81096
|
+
* As it does so, it resets the texture matrix update ID.
|
|
81097
|
+
* this is to ensure that the texture matrix is recalculated when the uvs are referenced
|
|
81098
|
+
* @param value - The texture to set.
|
|
81099
|
+
*/
|
|
81100
|
+
setTexture(value) {
|
|
81101
|
+
if (this.texture === value) return;
|
|
81102
|
+
this.texture = value;
|
|
81103
|
+
this._textureMatrixUpdateId = -1;
|
|
81104
|
+
}
|
|
81105
|
+
get uvs() {
|
|
81106
|
+
const geometry = this.geometry;
|
|
81107
|
+
const uvBuffer = geometry.getBuffer("aUV");
|
|
81108
|
+
const uvs = uvBuffer.data;
|
|
81109
|
+
let transformedUvs = uvs;
|
|
81110
|
+
const textureMatrix = this.texture.textureMatrix;
|
|
81111
|
+
if (!textureMatrix.isSimple) {
|
|
81112
|
+
transformedUvs = this._transformedUvs;
|
|
81113
|
+
if (this._textureMatrixUpdateId !== textureMatrix._updateID || this._uvUpdateId !== uvBuffer._updateID) {
|
|
81114
|
+
if (!transformedUvs || transformedUvs.length < uvs.length) {
|
|
81115
|
+
transformedUvs = this._transformedUvs = new Float32Array(uvs.length);
|
|
81116
|
+
}
|
|
81117
|
+
this._textureMatrixUpdateId = textureMatrix._updateID;
|
|
81118
|
+
this._uvUpdateId = uvBuffer._updateID;
|
|
81119
|
+
textureMatrix.multiplyUvs(uvs, transformedUvs);
|
|
81120
|
+
}
|
|
81121
|
+
}
|
|
81122
|
+
return transformedUvs;
|
|
81123
|
+
}
|
|
81124
|
+
get positions() {
|
|
81125
|
+
return this.geometry.positions;
|
|
81126
|
+
}
|
|
81127
|
+
get indices() {
|
|
81128
|
+
return this.geometry.indices;
|
|
81129
|
+
}
|
|
81130
|
+
get color() {
|
|
81131
|
+
return this.renderable.groupColorAlpha;
|
|
81132
|
+
}
|
|
81133
|
+
get groupTransform() {
|
|
81134
|
+
return this.renderable.groupTransform;
|
|
81135
|
+
}
|
|
81136
|
+
get attributeSize() {
|
|
81137
|
+
return this.geometry.positions.length / 2;
|
|
81138
|
+
}
|
|
81139
|
+
get indexSize() {
|
|
81140
|
+
return this.geometry.indices.length;
|
|
81141
|
+
}
|
|
81142
|
+
}
|
|
81143
|
+
class Transform {
|
|
81144
|
+
/**
|
|
81145
|
+
* @param options - Options for the transform.
|
|
81146
|
+
* @param options.matrix - The matrix to use.
|
|
81147
|
+
* @param options.observer - The observer to use.
|
|
81148
|
+
*/
|
|
81149
|
+
constructor({ matrix, observer } = {}) {
|
|
81150
|
+
this.dirty = true;
|
|
81151
|
+
this._matrix = matrix ?? new Matrix();
|
|
81152
|
+
this.observer = observer;
|
|
81153
|
+
this.position = new ObservablePoint(this, 0, 0);
|
|
81154
|
+
this.scale = new ObservablePoint(this, 1, 1);
|
|
81155
|
+
this.pivot = new ObservablePoint(this, 0, 0);
|
|
81156
|
+
this.skew = new ObservablePoint(this, 0, 0);
|
|
81157
|
+
this._rotation = 0;
|
|
81158
|
+
this._cx = 1;
|
|
81159
|
+
this._sx = 0;
|
|
81160
|
+
this._cy = 0;
|
|
81161
|
+
this._sy = 1;
|
|
81162
|
+
}
|
|
81163
|
+
/**
|
|
81164
|
+
* The transformation matrix computed from the transform's properties.
|
|
81165
|
+
* Combines position, scale, rotation, skew, and pivot into a single matrix.
|
|
81166
|
+
* @example
|
|
81167
|
+
* ```ts
|
|
81168
|
+
* // Get current matrix
|
|
81169
|
+
* const matrix = transform.matrix;
|
|
81170
|
+
* console.log(matrix.toString());
|
|
81171
|
+
* ```
|
|
81172
|
+
* @readonly
|
|
81173
|
+
* @see {@link Matrix} For matrix operations
|
|
81174
|
+
* @see {@link Transform.setFromMatrix} For setting transform from matrix
|
|
81175
|
+
*/
|
|
81176
|
+
get matrix() {
|
|
81177
|
+
const lt2 = this._matrix;
|
|
81178
|
+
if (!this.dirty) return lt2;
|
|
81179
|
+
lt2.a = this._cx * this.scale.x;
|
|
81180
|
+
lt2.b = this._sx * this.scale.x;
|
|
81181
|
+
lt2.c = this._cy * this.scale.y;
|
|
81182
|
+
lt2.d = this._sy * this.scale.y;
|
|
81183
|
+
lt2.tx = this.position.x - (this.pivot.x * lt2.a + this.pivot.y * lt2.c);
|
|
81184
|
+
lt2.ty = this.position.y - (this.pivot.x * lt2.b + this.pivot.y * lt2.d);
|
|
81185
|
+
this.dirty = false;
|
|
81186
|
+
return lt2;
|
|
81187
|
+
}
|
|
81188
|
+
/**
|
|
81189
|
+
* Called when a value changes.
|
|
81190
|
+
* @param point
|
|
81191
|
+
* @internal
|
|
81192
|
+
*/
|
|
81193
|
+
_onUpdate(point) {
|
|
81194
|
+
var _a;
|
|
81195
|
+
this.dirty = true;
|
|
81196
|
+
if (point === this.skew) {
|
|
81197
|
+
this.updateSkew();
|
|
81198
|
+
}
|
|
81199
|
+
(_a = this.observer) == null ? void 0 : _a._onUpdate(this);
|
|
81200
|
+
}
|
|
81201
|
+
/** Called when the skew or the rotation changes. */
|
|
81202
|
+
updateSkew() {
|
|
81203
|
+
this._cx = Math.cos(this._rotation + this.skew.y);
|
|
81204
|
+
this._sx = Math.sin(this._rotation + this.skew.y);
|
|
81205
|
+
this._cy = -Math.sin(this._rotation - this.skew.x);
|
|
81206
|
+
this._sy = Math.cos(this._rotation - this.skew.x);
|
|
81207
|
+
this.dirty = true;
|
|
81208
|
+
}
|
|
81209
|
+
toString() {
|
|
81210
|
+
return `[pixi.js/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`;
|
|
81211
|
+
}
|
|
81212
|
+
/**
|
|
81213
|
+
* Decomposes a matrix and sets the transforms properties based on it.
|
|
81214
|
+
* @example
|
|
81215
|
+
* ```ts
|
|
81216
|
+
* // Basic matrix decomposition
|
|
81217
|
+
* const transform = new Transform();
|
|
81218
|
+
* const matrix = new Matrix()
|
|
81219
|
+
* .translate(100, 100)
|
|
81220
|
+
* .rotate(Math.PI / 4)
|
|
81221
|
+
* .scale(2, 2);
|
|
81222
|
+
*
|
|
81223
|
+
* transform.setFromMatrix(matrix);
|
|
81224
|
+
* console.log(transform.position.x); // 100
|
|
81225
|
+
* console.log(transform.rotation); // ~0.785 (π/4)
|
|
81226
|
+
* ```
|
|
81227
|
+
* @param matrix - The matrix to decompose
|
|
81228
|
+
* @see {@link Matrix#decompose} For the decomposition logic
|
|
81229
|
+
* @see {@link Transform#matrix} For getting the current matrix
|
|
81230
|
+
*/
|
|
81231
|
+
setFromMatrix(matrix) {
|
|
81232
|
+
matrix.decompose(this);
|
|
81233
|
+
this.dirty = true;
|
|
81234
|
+
}
|
|
81235
|
+
/**
|
|
81236
|
+
* The rotation of the object in radians.
|
|
81237
|
+
* @example
|
|
81238
|
+
* ```ts
|
|
81239
|
+
* // Basic rotation
|
|
81240
|
+
* transform.rotation = Math.PI / 4; // 45 degrees
|
|
81241
|
+
*
|
|
81242
|
+
* // Rotate around pivot point
|
|
81243
|
+
* transform.pivot.set(50, 50);
|
|
81244
|
+
* transform.rotation = Math.PI; // 180 degrees around pivot
|
|
81245
|
+
*
|
|
81246
|
+
* // Animate rotation
|
|
81247
|
+
* app.ticker.add(() => {
|
|
81248
|
+
* transform.rotation += 0.1;
|
|
81249
|
+
* });
|
|
81250
|
+
* ```
|
|
81251
|
+
* @see {@link Transform#pivot} For rotation point
|
|
81252
|
+
* @see {@link Transform#skew} For skew effects
|
|
81253
|
+
*/
|
|
81254
|
+
get rotation() {
|
|
81255
|
+
return this._rotation;
|
|
81256
|
+
}
|
|
81257
|
+
set rotation(value) {
|
|
81258
|
+
if (this._rotation !== value) {
|
|
81259
|
+
this._rotation = value;
|
|
81260
|
+
this._onUpdate(this.skew);
|
|
81261
|
+
}
|
|
81262
|
+
}
|
|
81263
|
+
}
|
|
81264
|
+
let canUseNewCanvasBlendModesValue;
|
|
81265
|
+
function createColoredCanvas(color2) {
|
|
81266
|
+
const canvas = DOMAdapter.get().createCanvas(6, 1);
|
|
81267
|
+
const context2 = canvas.getContext("2d");
|
|
81268
|
+
context2.fillStyle = color2;
|
|
81269
|
+
context2.fillRect(0, 0, 6, 1);
|
|
81270
|
+
return canvas;
|
|
81271
|
+
}
|
|
81272
|
+
function canUseNewCanvasBlendModes() {
|
|
81273
|
+
if (canUseNewCanvasBlendModesValue !== void 0) {
|
|
81274
|
+
return canUseNewCanvasBlendModesValue;
|
|
81275
|
+
}
|
|
81276
|
+
try {
|
|
81277
|
+
const magenta = createColoredCanvas("#ff00ff");
|
|
81278
|
+
const yellow = createColoredCanvas("#ffff00");
|
|
81279
|
+
const canvas = DOMAdapter.get().createCanvas(6, 1);
|
|
81280
|
+
const context2 = canvas.getContext("2d");
|
|
81281
|
+
context2.globalCompositeOperation = "multiply";
|
|
81282
|
+
context2.drawImage(magenta, 0, 0);
|
|
81283
|
+
context2.drawImage(yellow, 2, 0);
|
|
81284
|
+
const imageData = context2.getImageData(2, 0, 1, 1);
|
|
81285
|
+
if (!imageData) {
|
|
81286
|
+
canUseNewCanvasBlendModesValue = false;
|
|
81287
|
+
} else {
|
|
81288
|
+
const data = imageData.data;
|
|
81289
|
+
canUseNewCanvasBlendModesValue = data[0] === 255 && data[1] === 0 && data[2] === 0;
|
|
81290
|
+
}
|
|
81291
|
+
} catch (_error) {
|
|
81292
|
+
canUseNewCanvasBlendModesValue = false;
|
|
81293
|
+
}
|
|
81294
|
+
return canUseNewCanvasBlendModesValue;
|
|
81295
|
+
}
|
|
81296
|
+
const canvasUtils = {
|
|
81297
|
+
canvas: null,
|
|
81298
|
+
convertTintToImage: false,
|
|
81299
|
+
cacheStepsPerColorChannel: 8,
|
|
81300
|
+
canUseMultiply: canUseNewCanvasBlendModes(),
|
|
81301
|
+
tintMethod: null,
|
|
81302
|
+
_canvasSourceCache: /* @__PURE__ */ new WeakMap(),
|
|
81303
|
+
_unpremultipliedCache: /* @__PURE__ */ new WeakMap(),
|
|
81304
|
+
getCanvasSource: (texture) => {
|
|
81305
|
+
const source = texture.source;
|
|
81306
|
+
const resource = source == null ? void 0 : source.resource;
|
|
81307
|
+
if (!resource) {
|
|
81308
|
+
return null;
|
|
81309
|
+
}
|
|
81310
|
+
const isPMA = source.alphaMode === "premultiplied-alpha";
|
|
81311
|
+
const resourceWidth = source.resourceWidth ?? source.pixelWidth;
|
|
81312
|
+
const resourceHeight = source.resourceHeight ?? source.pixelHeight;
|
|
81313
|
+
const needsResize = resourceWidth !== source.pixelWidth || resourceHeight !== source.pixelHeight;
|
|
81314
|
+
if (isPMA) {
|
|
81315
|
+
if (resource instanceof HTMLCanvasElement || typeof OffscreenCanvas !== "undefined" && resource instanceof OffscreenCanvas) {
|
|
81316
|
+
if (!needsResize) {
|
|
81317
|
+
return resource;
|
|
81318
|
+
}
|
|
81319
|
+
}
|
|
81320
|
+
const cached = canvasUtils._unpremultipliedCache.get(source);
|
|
81321
|
+
if ((cached == null ? void 0 : cached.resourceId) === source._resourceId) {
|
|
81322
|
+
return cached.canvas;
|
|
81323
|
+
}
|
|
81324
|
+
}
|
|
81325
|
+
if (resource instanceof Uint8Array || resource instanceof Uint8ClampedArray || resource instanceof Int8Array || resource instanceof Uint16Array || resource instanceof Int16Array || resource instanceof Uint32Array || resource instanceof Int32Array || resource instanceof Float32Array || resource instanceof ArrayBuffer) {
|
|
81326
|
+
const cached = canvasUtils._canvasSourceCache.get(source);
|
|
81327
|
+
if ((cached == null ? void 0 : cached.resourceId) === source._resourceId) {
|
|
81328
|
+
return cached.canvas;
|
|
81329
|
+
}
|
|
81330
|
+
const canvas = DOMAdapter.get().createCanvas(source.pixelWidth, source.pixelHeight);
|
|
81331
|
+
const context2 = canvas.getContext("2d");
|
|
81332
|
+
const imageData = context2.createImageData(source.pixelWidth, source.pixelHeight);
|
|
81333
|
+
const data = imageData.data;
|
|
81334
|
+
const bytes = resource instanceof ArrayBuffer ? new Uint8Array(resource) : new Uint8Array(resource.buffer, resource.byteOffset, resource.byteLength);
|
|
81335
|
+
if (source.format === "bgra8unorm") {
|
|
81336
|
+
for (let i2 = 0; i2 < data.length && i2 + 3 < bytes.length; i2 += 4) {
|
|
81337
|
+
data[i2] = bytes[i2 + 2];
|
|
81338
|
+
data[i2 + 1] = bytes[i2 + 1];
|
|
81339
|
+
data[i2 + 2] = bytes[i2];
|
|
81340
|
+
data[i2 + 3] = bytes[i2 + 3];
|
|
81341
|
+
}
|
|
81342
|
+
} else {
|
|
81343
|
+
data.set(bytes.subarray(0, data.length));
|
|
81344
|
+
}
|
|
81345
|
+
context2.putImageData(imageData, 0, 0);
|
|
81346
|
+
canvasUtils._canvasSourceCache.set(source, { canvas, resourceId: source._resourceId });
|
|
81347
|
+
return canvas;
|
|
81348
|
+
}
|
|
81349
|
+
if (isPMA) {
|
|
81350
|
+
const canvas = DOMAdapter.get().createCanvas(source.pixelWidth, source.pixelHeight);
|
|
81351
|
+
const context2 = canvas.getContext("2d", { willReadFrequently: true });
|
|
81352
|
+
canvas.width = source.pixelWidth;
|
|
81353
|
+
canvas.height = source.pixelHeight;
|
|
81354
|
+
context2.drawImage(resource, 0, 0);
|
|
81355
|
+
const imageData = context2.getImageData(0, 0, canvas.width, canvas.height);
|
|
81356
|
+
const data = imageData.data;
|
|
81357
|
+
for (let i2 = 0; i2 < data.length; i2 += 4) {
|
|
81358
|
+
const a2 = data[i2 + 3];
|
|
81359
|
+
if (a2 > 0) {
|
|
81360
|
+
const alphaInv = 255 / a2;
|
|
81361
|
+
data[i2] = Math.min(255, data[i2] * alphaInv + 0.5);
|
|
81362
|
+
data[i2 + 1] = Math.min(255, data[i2 + 1] * alphaInv + 0.5);
|
|
81363
|
+
data[i2 + 2] = Math.min(255, data[i2 + 2] * alphaInv + 0.5);
|
|
81364
|
+
}
|
|
81365
|
+
}
|
|
81366
|
+
context2.putImageData(imageData, 0, 0);
|
|
81367
|
+
canvasUtils._unpremultipliedCache.set(source, { canvas, resourceId: source._resourceId });
|
|
81368
|
+
return canvas;
|
|
81369
|
+
}
|
|
81370
|
+
if (needsResize) {
|
|
81371
|
+
const cached = canvasUtils._canvasSourceCache.get(source);
|
|
81372
|
+
if ((cached == null ? void 0 : cached.resourceId) === source._resourceId) {
|
|
81373
|
+
return cached.canvas;
|
|
81374
|
+
}
|
|
81375
|
+
const canvas = DOMAdapter.get().createCanvas(source.pixelWidth, source.pixelHeight);
|
|
81376
|
+
const context2 = canvas.getContext("2d");
|
|
81377
|
+
canvas.width = source.pixelWidth;
|
|
81378
|
+
canvas.height = source.pixelHeight;
|
|
81379
|
+
context2.drawImage(resource, 0, 0);
|
|
81380
|
+
canvasUtils._canvasSourceCache.set(source, { canvas, resourceId: source._resourceId });
|
|
81381
|
+
return canvas;
|
|
81382
|
+
}
|
|
81383
|
+
return resource;
|
|
81384
|
+
},
|
|
81385
|
+
getTintedCanvas: (sprite, color2) => {
|
|
81386
|
+
const texture = sprite.texture;
|
|
81387
|
+
const stringColor = Color.shared.setValue(color2).toHex();
|
|
81388
|
+
const cache = texture.tintCache || (texture.tintCache = {});
|
|
81389
|
+
const cachedCanvas = cache[stringColor];
|
|
81390
|
+
const resourceId = texture.source._resourceId;
|
|
81391
|
+
if ((cachedCanvas == null ? void 0 : cachedCanvas.tintId) === resourceId) {
|
|
81392
|
+
return cachedCanvas;
|
|
81393
|
+
}
|
|
81394
|
+
const canvas = cachedCanvas && "getContext" in cachedCanvas ? cachedCanvas : DOMAdapter.get().createCanvas();
|
|
81395
|
+
canvasUtils.tintMethod(texture, color2, canvas);
|
|
81396
|
+
canvas.tintId = resourceId;
|
|
81397
|
+
{
|
|
81398
|
+
cache[stringColor] = canvas;
|
|
81399
|
+
}
|
|
81400
|
+
return cache[stringColor];
|
|
81401
|
+
},
|
|
81402
|
+
getTintedPattern: (texture, color2) => {
|
|
81403
|
+
const stringColor = Color.shared.setValue(color2).toHex();
|
|
81404
|
+
const cache = texture.patternCache || (texture.patternCache = {});
|
|
81405
|
+
const resourceId = texture.source._resourceId;
|
|
81406
|
+
let pattern = cache[stringColor];
|
|
81407
|
+
if ((pattern == null ? void 0 : pattern.tintId) === resourceId) {
|
|
81408
|
+
return pattern;
|
|
81409
|
+
}
|
|
81410
|
+
if (!canvasUtils.canvas) {
|
|
81411
|
+
canvasUtils.canvas = DOMAdapter.get().createCanvas();
|
|
81412
|
+
}
|
|
81413
|
+
canvasUtils.tintMethod(texture, color2, canvasUtils.canvas);
|
|
81414
|
+
const context2 = canvasUtils.canvas.getContext("2d");
|
|
81415
|
+
pattern = context2.createPattern(canvasUtils.canvas, "repeat");
|
|
81416
|
+
pattern.tintId = resourceId;
|
|
81417
|
+
cache[stringColor] = pattern;
|
|
81418
|
+
return pattern;
|
|
81419
|
+
},
|
|
81420
|
+
/**
|
|
81421
|
+
* Applies a transform to a CanvasPattern.
|
|
81422
|
+
* @param pattern - The pattern to apply the transform to.
|
|
81423
|
+
* @param matrix - The matrix to apply.
|
|
81424
|
+
* @param matrix.a
|
|
81425
|
+
* @param matrix.b
|
|
81426
|
+
* @param matrix.c
|
|
81427
|
+
* @param matrix.d
|
|
81428
|
+
* @param matrix.tx
|
|
81429
|
+
* @param matrix.ty
|
|
81430
|
+
* @param invert
|
|
81431
|
+
*/
|
|
81432
|
+
applyPatternTransform: (pattern, matrix, invert = true) => {
|
|
81433
|
+
if (!matrix) return;
|
|
81434
|
+
const patternAny = pattern;
|
|
81435
|
+
if (!patternAny.setTransform) return;
|
|
81436
|
+
const DOMMatrixCtor = globalThis.DOMMatrix;
|
|
81437
|
+
if (!DOMMatrixCtor) return;
|
|
81438
|
+
const domMatrix = new DOMMatrixCtor([matrix.a, matrix.b, matrix.c, matrix.d, matrix.tx, matrix.ty]);
|
|
81439
|
+
patternAny.setTransform(invert ? domMatrix.inverse() : domMatrix);
|
|
81440
|
+
},
|
|
81441
|
+
tintWithMultiply: (texture, color2, canvas) => {
|
|
81442
|
+
const context2 = canvas.getContext("2d");
|
|
81443
|
+
const crop = texture.frame.clone();
|
|
81444
|
+
const resolution = texture.source._resolution ?? texture.source.resolution ?? 1;
|
|
81445
|
+
const rotate = texture.rotate;
|
|
81446
|
+
crop.x *= resolution;
|
|
81447
|
+
crop.y *= resolution;
|
|
81448
|
+
crop.width *= resolution;
|
|
81449
|
+
crop.height *= resolution;
|
|
81450
|
+
const isVertical = groupD8.isVertical(rotate);
|
|
81451
|
+
const outWidth = isVertical ? crop.height : crop.width;
|
|
81452
|
+
const outHeight = isVertical ? crop.width : crop.height;
|
|
81453
|
+
canvas.width = Math.ceil(outWidth);
|
|
81454
|
+
canvas.height = Math.ceil(outHeight);
|
|
81455
|
+
context2.save();
|
|
81456
|
+
context2.fillStyle = Color.shared.setValue(color2).toHex();
|
|
81457
|
+
context2.fillRect(0, 0, outWidth, outHeight);
|
|
81458
|
+
context2.globalCompositeOperation = "multiply";
|
|
81459
|
+
const source = canvasUtils.getCanvasSource(texture);
|
|
81460
|
+
if (!source) {
|
|
81461
|
+
context2.restore();
|
|
81462
|
+
return;
|
|
81463
|
+
}
|
|
81464
|
+
if (rotate) {
|
|
81465
|
+
canvasUtils._applyInverseRotation(context2, rotate, crop.width, crop.height);
|
|
81466
|
+
}
|
|
81467
|
+
context2.drawImage(
|
|
81468
|
+
source,
|
|
81469
|
+
crop.x,
|
|
81470
|
+
crop.y,
|
|
81471
|
+
crop.width,
|
|
81472
|
+
crop.height,
|
|
81473
|
+
0,
|
|
81474
|
+
0,
|
|
81475
|
+
crop.width,
|
|
81476
|
+
crop.height
|
|
81477
|
+
);
|
|
81478
|
+
context2.globalCompositeOperation = "destination-atop";
|
|
81479
|
+
context2.drawImage(
|
|
81480
|
+
source,
|
|
81481
|
+
crop.x,
|
|
81482
|
+
crop.y,
|
|
81483
|
+
crop.width,
|
|
81484
|
+
crop.height,
|
|
81485
|
+
0,
|
|
81486
|
+
0,
|
|
81487
|
+
crop.width,
|
|
81488
|
+
crop.height
|
|
81489
|
+
);
|
|
81490
|
+
context2.restore();
|
|
81491
|
+
},
|
|
81492
|
+
tintWithOverlay: (texture, color2, canvas) => {
|
|
81493
|
+
const context2 = canvas.getContext("2d");
|
|
81494
|
+
const crop = texture.frame.clone();
|
|
81495
|
+
const resolution = texture.source._resolution ?? texture.source.resolution ?? 1;
|
|
81496
|
+
const rotate = texture.rotate;
|
|
81497
|
+
crop.x *= resolution;
|
|
81498
|
+
crop.y *= resolution;
|
|
81499
|
+
crop.width *= resolution;
|
|
81500
|
+
crop.height *= resolution;
|
|
81501
|
+
const isVertical = groupD8.isVertical(rotate);
|
|
81502
|
+
const outWidth = isVertical ? crop.height : crop.width;
|
|
81503
|
+
const outHeight = isVertical ? crop.width : crop.height;
|
|
81504
|
+
canvas.width = Math.ceil(outWidth);
|
|
81505
|
+
canvas.height = Math.ceil(outHeight);
|
|
81506
|
+
context2.save();
|
|
81507
|
+
context2.globalCompositeOperation = "copy";
|
|
81508
|
+
context2.fillStyle = Color.shared.setValue(color2).toHex();
|
|
81509
|
+
context2.fillRect(0, 0, outWidth, outHeight);
|
|
81510
|
+
context2.globalCompositeOperation = "destination-atop";
|
|
81511
|
+
const source = canvasUtils.getCanvasSource(texture);
|
|
81512
|
+
if (!source) {
|
|
81513
|
+
context2.restore();
|
|
81514
|
+
return;
|
|
81515
|
+
}
|
|
81516
|
+
if (rotate) {
|
|
81517
|
+
canvasUtils._applyInverseRotation(context2, rotate, crop.width, crop.height);
|
|
81518
|
+
}
|
|
81519
|
+
context2.drawImage(
|
|
81520
|
+
source,
|
|
81521
|
+
crop.x,
|
|
81522
|
+
crop.y,
|
|
81523
|
+
crop.width,
|
|
81524
|
+
crop.height,
|
|
81525
|
+
0,
|
|
81526
|
+
0,
|
|
81527
|
+
crop.width,
|
|
81528
|
+
crop.height
|
|
81529
|
+
);
|
|
81530
|
+
context2.restore();
|
|
81531
|
+
},
|
|
81532
|
+
tintWithPerPixel: (texture, color2, canvas) => {
|
|
81533
|
+
const context2 = canvas.getContext("2d");
|
|
81534
|
+
const crop = texture.frame.clone();
|
|
81535
|
+
const resolution = texture.source._resolution ?? texture.source.resolution ?? 1;
|
|
81536
|
+
const rotate = texture.rotate;
|
|
81537
|
+
crop.x *= resolution;
|
|
81538
|
+
crop.y *= resolution;
|
|
81539
|
+
crop.width *= resolution;
|
|
81540
|
+
crop.height *= resolution;
|
|
81541
|
+
const isVertical = groupD8.isVertical(rotate);
|
|
81542
|
+
const outWidth = isVertical ? crop.height : crop.width;
|
|
81543
|
+
const outHeight = isVertical ? crop.width : crop.height;
|
|
81544
|
+
canvas.width = Math.ceil(outWidth);
|
|
81545
|
+
canvas.height = Math.ceil(outHeight);
|
|
81546
|
+
context2.save();
|
|
81547
|
+
context2.globalCompositeOperation = "copy";
|
|
81548
|
+
const source = canvasUtils.getCanvasSource(texture);
|
|
81549
|
+
if (!source) {
|
|
81550
|
+
context2.restore();
|
|
81551
|
+
return;
|
|
81552
|
+
}
|
|
81553
|
+
if (rotate) {
|
|
81554
|
+
canvasUtils._applyInverseRotation(context2, rotate, crop.width, crop.height);
|
|
81555
|
+
}
|
|
81556
|
+
context2.drawImage(
|
|
81557
|
+
source,
|
|
81558
|
+
crop.x,
|
|
81559
|
+
crop.y,
|
|
81560
|
+
crop.width,
|
|
81561
|
+
crop.height,
|
|
81562
|
+
0,
|
|
81563
|
+
0,
|
|
81564
|
+
crop.width,
|
|
81565
|
+
crop.height
|
|
81566
|
+
);
|
|
81567
|
+
context2.restore();
|
|
81568
|
+
const r2 = color2 >> 16 & 255;
|
|
81569
|
+
const g2 = color2 >> 8 & 255;
|
|
81570
|
+
const b2 = color2 & 255;
|
|
81571
|
+
const imageData = context2.getImageData(0, 0, outWidth, outHeight);
|
|
81572
|
+
const data = imageData.data;
|
|
81573
|
+
for (let i2 = 0; i2 < data.length; i2 += 4) {
|
|
81574
|
+
data[i2] = data[i2] * r2 / 255;
|
|
81575
|
+
data[i2 + 1] = data[i2 + 1] * g2 / 255;
|
|
81576
|
+
data[i2 + 2] = data[i2 + 2] * b2 / 255;
|
|
81577
|
+
}
|
|
81578
|
+
context2.putImageData(imageData, 0, 0);
|
|
81579
|
+
},
|
|
81580
|
+
/**
|
|
81581
|
+
* Applies inverse rotation transform to context for texture packer rotation compensation.
|
|
81582
|
+
* Supports all 16 groupD8 symmetries (rotations and reflections).
|
|
81583
|
+
* @param context - Canvas 2D context
|
|
81584
|
+
* @param rotate - The groupD8 rotation value
|
|
81585
|
+
* @param srcWidth - Source crop width (before rotation)
|
|
81586
|
+
* @param srcHeight - Source crop height (before rotation)
|
|
81587
|
+
*/
|
|
81588
|
+
_applyInverseRotation: (context2, rotate, srcWidth, srcHeight) => {
|
|
81589
|
+
const inv = groupD8.inv(rotate);
|
|
81590
|
+
const a2 = groupD8.uX(inv);
|
|
81591
|
+
const b2 = groupD8.uY(inv);
|
|
81592
|
+
const c2 = groupD8.vX(inv);
|
|
81593
|
+
const d2 = groupD8.vY(inv);
|
|
81594
|
+
const tx = -Math.min(0, a2 * srcWidth, c2 * srcHeight, a2 * srcWidth + c2 * srcHeight);
|
|
81595
|
+
const ty = -Math.min(0, b2 * srcWidth, d2 * srcHeight, b2 * srcWidth + d2 * srcHeight);
|
|
81596
|
+
context2.transform(a2, b2, c2, d2, tx, ty);
|
|
81597
|
+
}
|
|
81598
|
+
};
|
|
81599
|
+
canvasUtils.tintMethod = canvasUtils.canUseMultiply ? canvasUtils.tintWithMultiply : canvasUtils.tintWithPerPixel;
|
|
81600
|
+
const worldMatrix = new Matrix();
|
|
81601
|
+
const patternMatrix = new Matrix();
|
|
81602
|
+
const patternRect = [new Point(), new Point(), new Point(), new Point()];
|
|
81603
|
+
class CanvasTilingSpritePipe {
|
|
81604
|
+
constructor(renderer) {
|
|
81605
|
+
this._renderer = renderer;
|
|
81606
|
+
}
|
|
81607
|
+
validateRenderable(_renderable) {
|
|
81608
|
+
return false;
|
|
81609
|
+
}
|
|
81610
|
+
addRenderable(tilingSprite, instructionSet) {
|
|
81611
|
+
this._renderer.renderPipes.batch.break(instructionSet);
|
|
81612
|
+
instructionSet.add(tilingSprite);
|
|
81613
|
+
}
|
|
81614
|
+
updateRenderable(_tilingSprite) {
|
|
81615
|
+
}
|
|
81616
|
+
execute(tilingSprite) {
|
|
81617
|
+
var _a, _b;
|
|
81618
|
+
const renderer = this._renderer;
|
|
81619
|
+
const contextSystem = renderer.canvasContext;
|
|
81620
|
+
const context2 = contextSystem.activeContext;
|
|
81621
|
+
context2.save();
|
|
81622
|
+
contextSystem.setBlendMode(tilingSprite.groupBlendMode);
|
|
81623
|
+
const globalColor = ((_a = renderer.globalUniforms.globalUniformData) == null ? void 0 : _a.worldColor) ?? 4294967295;
|
|
81624
|
+
const groupColorAlpha = tilingSprite.groupColorAlpha;
|
|
81625
|
+
const globalAlpha = (globalColor >>> 24 & 255) / 255;
|
|
81626
|
+
const groupAlphaValue = (groupColorAlpha >>> 24 & 255) / 255;
|
|
81627
|
+
const filterAlpha = ((_b = renderer.filter) == null ? void 0 : _b.alphaMultiplier) ?? 1;
|
|
81628
|
+
const alpha = globalAlpha * groupAlphaValue * filterAlpha;
|
|
81629
|
+
if (alpha <= 0) {
|
|
81630
|
+
context2.restore();
|
|
81631
|
+
return;
|
|
81632
|
+
}
|
|
81633
|
+
context2.globalAlpha = alpha;
|
|
81634
|
+
const globalTint = globalColor & 16777215;
|
|
81635
|
+
const groupTintBGR = groupColorAlpha & 16777215;
|
|
81636
|
+
const tint = bgr2rgb(multiplyHexColors(groupTintBGR, globalTint));
|
|
81637
|
+
const texture = tilingSprite.texture;
|
|
81638
|
+
const pattern = canvasUtils.getTintedPattern(texture, tint);
|
|
81639
|
+
const width = tilingSprite.width;
|
|
81640
|
+
const height = tilingSprite.height;
|
|
81641
|
+
const transform2 = tilingSprite.groupTransform;
|
|
81642
|
+
const resolution = texture.source._resolution ?? texture.source.resolution ?? 1;
|
|
81643
|
+
patternMatrix.copyFrom(tilingSprite._tileTransform.matrix);
|
|
81644
|
+
if (!tilingSprite.applyAnchorToTexture) {
|
|
81645
|
+
patternMatrix.translate(-tilingSprite.anchor.x * width, -tilingSprite.anchor.y * height);
|
|
81646
|
+
}
|
|
81647
|
+
patternMatrix.scale(1 / resolution, 1 / resolution);
|
|
81648
|
+
worldMatrix.identity();
|
|
81649
|
+
worldMatrix.prepend(patternMatrix);
|
|
81650
|
+
worldMatrix.prepend(transform2);
|
|
81651
|
+
const roundPixels = renderer._roundPixels | tilingSprite._roundPixels;
|
|
81652
|
+
contextSystem.setContextTransform(worldMatrix, roundPixels === 1);
|
|
81653
|
+
context2.fillStyle = pattern;
|
|
81654
|
+
const lx = tilingSprite.anchor.x * -width;
|
|
81655
|
+
const ly = tilingSprite.anchor.y * -height;
|
|
81656
|
+
patternRect[0].set(lx, ly);
|
|
81657
|
+
patternRect[1].set(lx + width, ly);
|
|
81658
|
+
patternRect[2].set(lx + width, ly + height);
|
|
81659
|
+
patternRect[3].set(lx, ly + height);
|
|
81660
|
+
for (let i2 = 0; i2 < 4; i2++) {
|
|
81661
|
+
patternMatrix.applyInverse(patternRect[i2], patternRect[i2]);
|
|
81662
|
+
}
|
|
81663
|
+
context2.beginPath();
|
|
81664
|
+
context2.moveTo(patternRect[0].x, patternRect[0].y);
|
|
81665
|
+
for (let i2 = 1; i2 < 4; i2++) {
|
|
81666
|
+
context2.lineTo(patternRect[i2].x, patternRect[i2].y);
|
|
81667
|
+
}
|
|
81668
|
+
context2.closePath();
|
|
81669
|
+
context2.fill();
|
|
81670
|
+
context2.restore();
|
|
81671
|
+
}
|
|
81672
|
+
destroy() {
|
|
81673
|
+
this._renderer = null;
|
|
81674
|
+
}
|
|
81675
|
+
}
|
|
81676
|
+
CanvasTilingSpritePipe.extension = {
|
|
81677
|
+
type: [
|
|
81678
|
+
ExtensionType.CanvasPipes
|
|
81679
|
+
],
|
|
81680
|
+
name: "tilingSprite"
|
|
81681
|
+
};
|
|
81682
|
+
const localUniformBit = {
|
|
81683
|
+
name: "local-uniform-bit",
|
|
81684
|
+
vertex: {
|
|
81685
|
+
header: (
|
|
81686
|
+
/* wgsl */
|
|
81687
|
+
`
|
|
81688
|
+
|
|
81689
|
+
struct LocalUniforms {
|
|
81690
|
+
uTransformMatrix:mat3x3<f32>,
|
|
81691
|
+
uColor:vec4<f32>,
|
|
81692
|
+
uRound:f32,
|
|
81693
|
+
}
|
|
81694
|
+
|
|
81695
|
+
@group(1) @binding(0) var<uniform> localUniforms : LocalUniforms;
|
|
81696
|
+
`
|
|
81697
|
+
),
|
|
81698
|
+
main: (
|
|
81699
|
+
/* wgsl */
|
|
81700
|
+
`
|
|
81701
|
+
vColor *= localUniforms.uColor;
|
|
81702
|
+
modelMatrix *= localUniforms.uTransformMatrix;
|
|
81703
|
+
`
|
|
81704
|
+
),
|
|
81705
|
+
end: (
|
|
81706
|
+
/* wgsl */
|
|
81707
|
+
`
|
|
81708
|
+
if(localUniforms.uRound == 1)
|
|
81709
|
+
{
|
|
81710
|
+
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
|
|
81711
|
+
}
|
|
81712
|
+
`
|
|
81713
|
+
)
|
|
81714
|
+
}
|
|
81715
|
+
};
|
|
81716
|
+
const localUniformBitGroup2 = {
|
|
81717
|
+
...localUniformBit,
|
|
81718
|
+
vertex: {
|
|
81719
|
+
...localUniformBit.vertex,
|
|
81720
|
+
// replace the group!
|
|
81721
|
+
header: localUniformBit.vertex.header.replace("group(1)", "group(2)")
|
|
81722
|
+
}
|
|
81723
|
+
};
|
|
81724
|
+
const localUniformBitGl = {
|
|
81725
|
+
name: "local-uniform-bit",
|
|
81726
|
+
vertex: {
|
|
81727
|
+
header: (
|
|
81728
|
+
/* glsl */
|
|
81729
|
+
`
|
|
81730
|
+
|
|
81731
|
+
uniform mat3 uTransformMatrix;
|
|
81732
|
+
uniform vec4 uColor;
|
|
81733
|
+
uniform float uRound;
|
|
81734
|
+
`
|
|
81735
|
+
),
|
|
81736
|
+
main: (
|
|
81737
|
+
/* glsl */
|
|
81738
|
+
`
|
|
81739
|
+
vColor *= uColor;
|
|
81740
|
+
modelMatrix = uTransformMatrix;
|
|
81741
|
+
`
|
|
81742
|
+
),
|
|
81743
|
+
end: (
|
|
81744
|
+
/* glsl */
|
|
81745
|
+
`
|
|
81746
|
+
if(uRound == 1.)
|
|
81747
|
+
{
|
|
81748
|
+
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
81749
|
+
}
|
|
81750
|
+
`
|
|
81751
|
+
)
|
|
81752
|
+
}
|
|
81753
|
+
};
|
|
81754
|
+
const tilingBit = {
|
|
81755
|
+
name: "tiling-bit",
|
|
81756
|
+
vertex: {
|
|
81757
|
+
header: (
|
|
81758
|
+
/* wgsl */
|
|
81759
|
+
`
|
|
81760
|
+
struct TilingUniforms {
|
|
81761
|
+
uMapCoord:mat3x3<f32>,
|
|
81762
|
+
uClampFrame:vec4<f32>,
|
|
81763
|
+
uClampOffset:vec2<f32>,
|
|
81764
|
+
uTextureTransform:mat3x3<f32>,
|
|
81765
|
+
uSizeAnchor:vec4<f32>
|
|
81766
|
+
};
|
|
81767
|
+
|
|
81768
|
+
@group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
|
|
81769
|
+
@group(2) @binding(1) var uTexture: texture_2d<f32>;
|
|
81770
|
+
@group(2) @binding(2) var uSampler: sampler;
|
|
81771
|
+
`
|
|
81772
|
+
),
|
|
81773
|
+
main: (
|
|
81774
|
+
/* wgsl */
|
|
81775
|
+
`
|
|
81776
|
+
uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy;
|
|
81777
|
+
|
|
81778
|
+
position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy;
|
|
81779
|
+
`
|
|
81780
|
+
)
|
|
81781
|
+
},
|
|
81782
|
+
fragment: {
|
|
81783
|
+
header: (
|
|
81784
|
+
/* wgsl */
|
|
81785
|
+
`
|
|
81786
|
+
struct TilingUniforms {
|
|
81787
|
+
uMapCoord:mat3x3<f32>,
|
|
81788
|
+
uClampFrame:vec4<f32>,
|
|
81789
|
+
uClampOffset:vec2<f32>,
|
|
81790
|
+
uTextureTransform:mat3x3<f32>,
|
|
81791
|
+
uSizeAnchor:vec4<f32>
|
|
81792
|
+
};
|
|
81793
|
+
|
|
81794
|
+
@group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
|
|
81795
|
+
@group(2) @binding(1) var uTexture: texture_2d<f32>;
|
|
81796
|
+
@group(2) @binding(2) var uSampler: sampler;
|
|
81797
|
+
`
|
|
81798
|
+
),
|
|
81799
|
+
main: (
|
|
81800
|
+
/* wgsl */
|
|
81801
|
+
`
|
|
81802
|
+
|
|
81803
|
+
var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV);
|
|
81804
|
+
coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy;
|
|
81805
|
+
var unclamped = coord;
|
|
81806
|
+
coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw);
|
|
81807
|
+
|
|
81808
|
+
var bias = 0.;
|
|
81809
|
+
|
|
81810
|
+
if(unclamped.x == coord.x && unclamped.y == coord.y)
|
|
81811
|
+
{
|
|
81812
|
+
bias = -32.;
|
|
81813
|
+
}
|
|
81814
|
+
|
|
81815
|
+
outColor = textureSampleBias(uTexture, uSampler, coord, bias);
|
|
81816
|
+
`
|
|
81817
|
+
)
|
|
81818
|
+
}
|
|
81819
|
+
};
|
|
81820
|
+
const tilingBitGl = {
|
|
81821
|
+
name: "tiling-bit",
|
|
81822
|
+
vertex: {
|
|
81823
|
+
header: (
|
|
81824
|
+
/* glsl */
|
|
81825
|
+
`
|
|
81826
|
+
uniform mat3 uTextureTransform;
|
|
81827
|
+
uniform vec4 uSizeAnchor;
|
|
81828
|
+
|
|
81829
|
+
`
|
|
81830
|
+
),
|
|
81831
|
+
main: (
|
|
81832
|
+
/* glsl */
|
|
81833
|
+
`
|
|
81834
|
+
uv = (uTextureTransform * vec3(aUV, 1.0)).xy;
|
|
81835
|
+
|
|
81836
|
+
position = (position - uSizeAnchor.zw) * uSizeAnchor.xy;
|
|
81837
|
+
`
|
|
81838
|
+
)
|
|
81839
|
+
},
|
|
81840
|
+
fragment: {
|
|
81841
|
+
header: (
|
|
81842
|
+
/* glsl */
|
|
81843
|
+
`
|
|
81844
|
+
uniform sampler2D uTexture;
|
|
81845
|
+
uniform mat3 uMapCoord;
|
|
81846
|
+
uniform vec4 uClampFrame;
|
|
81847
|
+
uniform vec2 uClampOffset;
|
|
81848
|
+
`
|
|
81849
|
+
),
|
|
81850
|
+
main: (
|
|
81851
|
+
/* glsl */
|
|
81852
|
+
`
|
|
81853
|
+
|
|
81854
|
+
vec2 coord = vUV + ceil(uClampOffset - vUV);
|
|
81855
|
+
coord = (uMapCoord * vec3(coord, 1.0)).xy;
|
|
81856
|
+
vec2 unclamped = coord;
|
|
81857
|
+
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
|
|
81858
|
+
|
|
81859
|
+
outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
|
|
81860
|
+
|
|
81861
|
+
`
|
|
81862
|
+
)
|
|
81863
|
+
}
|
|
81864
|
+
};
|
|
81865
|
+
let gpuProgram;
|
|
81866
|
+
let glProgram;
|
|
81867
|
+
class TilingSpriteShader extends Shader {
|
|
81868
|
+
constructor() {
|
|
81869
|
+
gpuProgram ?? (gpuProgram = compileHighShaderGpuProgram({
|
|
81870
|
+
name: "tiling-sprite-shader",
|
|
81871
|
+
bits: [
|
|
81872
|
+
localUniformBit,
|
|
81873
|
+
tilingBit,
|
|
81874
|
+
roundPixelsBit
|
|
81875
|
+
]
|
|
81876
|
+
}));
|
|
81877
|
+
glProgram ?? (glProgram = compileHighShaderGlProgram({
|
|
81878
|
+
name: "tiling-sprite-shader",
|
|
81879
|
+
bits: [
|
|
81880
|
+
localUniformBitGl,
|
|
81881
|
+
tilingBitGl,
|
|
81882
|
+
roundPixelsBitGl
|
|
81883
|
+
]
|
|
81884
|
+
}));
|
|
81885
|
+
const tilingUniforms = new UniformGroup({
|
|
81886
|
+
uMapCoord: { value: new Matrix(), type: "mat3x3<f32>" },
|
|
81887
|
+
uClampFrame: { value: new Float32Array([0, 0, 1, 1]), type: "vec4<f32>" },
|
|
81888
|
+
uClampOffset: { value: new Float32Array([0, 0]), type: "vec2<f32>" },
|
|
81889
|
+
uTextureTransform: { value: new Matrix(), type: "mat3x3<f32>" },
|
|
81890
|
+
uSizeAnchor: { value: new Float32Array([100, 100, 0.5, 0.5]), type: "vec4<f32>" }
|
|
81891
|
+
});
|
|
81892
|
+
super({
|
|
81893
|
+
glProgram,
|
|
81894
|
+
gpuProgram,
|
|
81895
|
+
resources: {
|
|
81896
|
+
localUniforms: new UniformGroup({
|
|
81897
|
+
uTransformMatrix: { value: new Matrix(), type: "mat3x3<f32>" },
|
|
81898
|
+
uColor: { value: new Float32Array([1, 1, 1, 1]), type: "vec4<f32>" },
|
|
81899
|
+
uRound: { value: 0, type: "f32" }
|
|
81900
|
+
}),
|
|
81901
|
+
tilingUniforms,
|
|
81902
|
+
uTexture: Texture.EMPTY.source,
|
|
81903
|
+
uSampler: Texture.EMPTY.source.style
|
|
81904
|
+
}
|
|
81905
|
+
});
|
|
81906
|
+
}
|
|
81907
|
+
updateUniforms(width, height, matrix, anchorX, anchorY, texture) {
|
|
81908
|
+
const tilingUniforms = this.resources.tilingUniforms;
|
|
81909
|
+
const textureWidth = texture.width;
|
|
81910
|
+
const textureHeight = texture.height;
|
|
81911
|
+
const textureMatrix = texture.textureMatrix;
|
|
81912
|
+
const uTextureTransform = tilingUniforms.uniforms.uTextureTransform;
|
|
81913
|
+
uTextureTransform.set(
|
|
81914
|
+
matrix.a * textureWidth / width,
|
|
81915
|
+
matrix.b * textureWidth / height,
|
|
81916
|
+
matrix.c * textureHeight / width,
|
|
81917
|
+
matrix.d * textureHeight / height,
|
|
81918
|
+
matrix.tx / width,
|
|
81919
|
+
matrix.ty / height
|
|
81920
|
+
);
|
|
81921
|
+
uTextureTransform.invert();
|
|
81922
|
+
tilingUniforms.uniforms.uMapCoord = textureMatrix.mapCoord;
|
|
81923
|
+
tilingUniforms.uniforms.uClampFrame = textureMatrix.uClampFrame;
|
|
81924
|
+
tilingUniforms.uniforms.uClampOffset = textureMatrix.uClampOffset;
|
|
81925
|
+
tilingUniforms.uniforms.uTextureTransform = uTextureTransform;
|
|
81926
|
+
tilingUniforms.uniforms.uSizeAnchor[0] = width;
|
|
81927
|
+
tilingUniforms.uniforms.uSizeAnchor[1] = height;
|
|
81928
|
+
tilingUniforms.uniforms.uSizeAnchor[2] = anchorX;
|
|
81929
|
+
tilingUniforms.uniforms.uSizeAnchor[3] = anchorY;
|
|
81930
|
+
if (texture) {
|
|
81931
|
+
this.resources.uTexture = texture.source;
|
|
81932
|
+
this.resources.uSampler = texture.source.style;
|
|
81933
|
+
}
|
|
81934
|
+
}
|
|
81935
|
+
}
|
|
81936
|
+
class QuadGeometry extends MeshGeometry {
|
|
81937
|
+
constructor() {
|
|
81938
|
+
super({
|
|
81939
|
+
positions: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),
|
|
81940
|
+
uvs: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),
|
|
81941
|
+
indices: new Uint32Array([0, 1, 2, 0, 2, 3])
|
|
81942
|
+
});
|
|
81943
|
+
}
|
|
81944
|
+
}
|
|
81945
|
+
function setPositions(tilingSprite, positions) {
|
|
81946
|
+
const anchorX = tilingSprite.anchor.x;
|
|
81947
|
+
const anchorY = tilingSprite.anchor.y;
|
|
81948
|
+
positions[0] = -anchorX * tilingSprite.width;
|
|
81949
|
+
positions[1] = -anchorY * tilingSprite.height;
|
|
81950
|
+
positions[2] = (1 - anchorX) * tilingSprite.width;
|
|
81951
|
+
positions[3] = -anchorY * tilingSprite.height;
|
|
81952
|
+
positions[4] = (1 - anchorX) * tilingSprite.width;
|
|
81953
|
+
positions[5] = (1 - anchorY) * tilingSprite.height;
|
|
81954
|
+
positions[6] = -anchorX * tilingSprite.width;
|
|
81955
|
+
positions[7] = (1 - anchorY) * tilingSprite.height;
|
|
81956
|
+
}
|
|
81957
|
+
function applyMatrix(array2, stride, offset, matrix) {
|
|
81958
|
+
let index2 = 0;
|
|
81959
|
+
const size = array2.length / stride;
|
|
81960
|
+
const a2 = matrix.a;
|
|
81961
|
+
const b2 = matrix.b;
|
|
81962
|
+
const c2 = matrix.c;
|
|
81963
|
+
const d2 = matrix.d;
|
|
81964
|
+
const tx = matrix.tx;
|
|
81965
|
+
const ty = matrix.ty;
|
|
81966
|
+
offset *= stride;
|
|
81967
|
+
while (index2 < size) {
|
|
81968
|
+
const x2 = array2[offset];
|
|
81969
|
+
const y2 = array2[offset + 1];
|
|
81970
|
+
array2[offset] = a2 * x2 + c2 * y2 + tx;
|
|
81971
|
+
array2[offset + 1] = b2 * x2 + d2 * y2 + ty;
|
|
81972
|
+
offset += stride;
|
|
81973
|
+
index2++;
|
|
81974
|
+
}
|
|
81975
|
+
}
|
|
81976
|
+
function setUvs(tilingSprite, uvs) {
|
|
81977
|
+
const texture = tilingSprite.texture;
|
|
81978
|
+
const width = texture.frame.width;
|
|
81979
|
+
const height = texture.frame.height;
|
|
81980
|
+
let anchorX = 0;
|
|
81981
|
+
let anchorY = 0;
|
|
81982
|
+
if (tilingSprite.applyAnchorToTexture) {
|
|
81983
|
+
anchorX = tilingSprite.anchor.x;
|
|
81984
|
+
anchorY = tilingSprite.anchor.y;
|
|
81985
|
+
}
|
|
81986
|
+
uvs[0] = uvs[6] = -anchorX;
|
|
81987
|
+
uvs[2] = uvs[4] = 1 - anchorX;
|
|
81988
|
+
uvs[1] = uvs[3] = -anchorY;
|
|
81989
|
+
uvs[5] = uvs[7] = 1 - anchorY;
|
|
81990
|
+
const textureMatrix = Matrix.shared;
|
|
81991
|
+
textureMatrix.copyFrom(tilingSprite._tileTransform.matrix);
|
|
81992
|
+
textureMatrix.tx /= tilingSprite.width;
|
|
81993
|
+
textureMatrix.ty /= tilingSprite.height;
|
|
81994
|
+
textureMatrix.invert();
|
|
81995
|
+
textureMatrix.scale(tilingSprite.width / width, tilingSprite.height / height);
|
|
81996
|
+
applyMatrix(uvs, 2, 0, textureMatrix);
|
|
81997
|
+
}
|
|
81998
|
+
const sharedQuad = new QuadGeometry();
|
|
81999
|
+
class TilingSpriteGpuData {
|
|
82000
|
+
constructor() {
|
|
82001
|
+
this.canBatch = true;
|
|
82002
|
+
this.geometry = new MeshGeometry({
|
|
82003
|
+
indices: sharedQuad.indices.slice(),
|
|
82004
|
+
positions: sharedQuad.positions.slice(),
|
|
82005
|
+
uvs: sharedQuad.uvs.slice()
|
|
82006
|
+
});
|
|
82007
|
+
}
|
|
82008
|
+
destroy() {
|
|
82009
|
+
var _a;
|
|
82010
|
+
this.geometry.destroy();
|
|
82011
|
+
(_a = this.shader) == null ? void 0 : _a.destroy();
|
|
82012
|
+
}
|
|
82013
|
+
}
|
|
82014
|
+
class TilingSpritePipe {
|
|
82015
|
+
constructor(renderer) {
|
|
82016
|
+
this._state = State.default2d;
|
|
82017
|
+
this._renderer = renderer;
|
|
82018
|
+
this._managedTilingSprites = new GCManagedHash({ renderer, type: "renderable", name: "tilingSprite" });
|
|
82019
|
+
}
|
|
82020
|
+
validateRenderable(renderable) {
|
|
82021
|
+
const tilingSpriteData = this._getTilingSpriteData(renderable);
|
|
82022
|
+
const couldBatch = tilingSpriteData.canBatch;
|
|
82023
|
+
this._updateCanBatch(renderable);
|
|
82024
|
+
const canBatch = tilingSpriteData.canBatch;
|
|
82025
|
+
if (canBatch && canBatch === couldBatch) {
|
|
82026
|
+
const { batchableMesh } = tilingSpriteData;
|
|
82027
|
+
return !batchableMesh._batcher.checkAndUpdateTexture(
|
|
82028
|
+
batchableMesh,
|
|
82029
|
+
renderable.texture
|
|
82030
|
+
);
|
|
82031
|
+
}
|
|
82032
|
+
return couldBatch !== canBatch;
|
|
82033
|
+
}
|
|
82034
|
+
addRenderable(tilingSprite, instructionSet) {
|
|
82035
|
+
const batcher = this._renderer.renderPipes.batch;
|
|
82036
|
+
this._updateCanBatch(tilingSprite);
|
|
82037
|
+
const tilingSpriteData = this._getTilingSpriteData(tilingSprite);
|
|
82038
|
+
const { geometry, canBatch } = tilingSpriteData;
|
|
82039
|
+
if (canBatch) {
|
|
82040
|
+
tilingSpriteData.batchableMesh || (tilingSpriteData.batchableMesh = new BatchableMesh());
|
|
82041
|
+
const batchableMesh = tilingSpriteData.batchableMesh;
|
|
82042
|
+
if (tilingSprite.didViewUpdate) {
|
|
82043
|
+
this._updateBatchableMesh(tilingSprite);
|
|
82044
|
+
batchableMesh.geometry = geometry;
|
|
82045
|
+
batchableMesh.renderable = tilingSprite;
|
|
82046
|
+
batchableMesh.transform = tilingSprite.groupTransform;
|
|
82047
|
+
batchableMesh.setTexture(tilingSprite._texture);
|
|
82048
|
+
}
|
|
82049
|
+
batchableMesh.roundPixels = this._renderer._roundPixels | tilingSprite._roundPixels;
|
|
82050
|
+
batcher.addToBatch(batchableMesh, instructionSet);
|
|
82051
|
+
} else {
|
|
82052
|
+
batcher.break(instructionSet);
|
|
82053
|
+
tilingSpriteData.shader || (tilingSpriteData.shader = new TilingSpriteShader());
|
|
82054
|
+
this.updateRenderable(tilingSprite);
|
|
82055
|
+
instructionSet.add(tilingSprite);
|
|
82056
|
+
}
|
|
82057
|
+
}
|
|
82058
|
+
execute(tilingSprite) {
|
|
82059
|
+
const renderer = this._renderer;
|
|
82060
|
+
const { shader } = this._getTilingSpriteData(tilingSprite);
|
|
82061
|
+
shader.groups[0] = renderer.globalUniforms.bindGroup;
|
|
82062
|
+
const localUniforms = shader.resources.localUniforms.uniforms;
|
|
82063
|
+
localUniforms.uTransformMatrix = tilingSprite.groupTransform;
|
|
82064
|
+
localUniforms.uRound = renderer._roundPixels | tilingSprite._roundPixels;
|
|
82065
|
+
color32BitToUniform(
|
|
82066
|
+
tilingSprite.groupColorAlpha,
|
|
82067
|
+
localUniforms.uColor,
|
|
82068
|
+
0
|
|
82069
|
+
);
|
|
82070
|
+
this._state.blendMode = getAdjustedBlendModeBlend(tilingSprite.groupBlendMode, tilingSprite.texture._source);
|
|
82071
|
+
renderer.encoder.draw({
|
|
82072
|
+
geometry: sharedQuad,
|
|
82073
|
+
shader,
|
|
82074
|
+
state: this._state
|
|
82075
|
+
});
|
|
82076
|
+
}
|
|
82077
|
+
updateRenderable(tilingSprite) {
|
|
82078
|
+
const tilingSpriteData = this._getTilingSpriteData(tilingSprite);
|
|
82079
|
+
const { canBatch } = tilingSpriteData;
|
|
82080
|
+
if (canBatch) {
|
|
82081
|
+
const { batchableMesh } = tilingSpriteData;
|
|
82082
|
+
if (tilingSprite.didViewUpdate) this._updateBatchableMesh(tilingSprite);
|
|
82083
|
+
batchableMesh._batcher.updateElement(batchableMesh);
|
|
82084
|
+
} else if (tilingSprite.didViewUpdate) {
|
|
82085
|
+
const { shader } = tilingSpriteData;
|
|
82086
|
+
shader.updateUniforms(
|
|
82087
|
+
tilingSprite.width,
|
|
82088
|
+
tilingSprite.height,
|
|
82089
|
+
tilingSprite._tileTransform.matrix,
|
|
82090
|
+
tilingSprite.anchor.x,
|
|
82091
|
+
tilingSprite.anchor.y,
|
|
82092
|
+
tilingSprite.texture
|
|
82093
|
+
);
|
|
82094
|
+
}
|
|
82095
|
+
}
|
|
82096
|
+
_getTilingSpriteData(renderable) {
|
|
82097
|
+
return renderable._gpuData[this._renderer.uid] || this._initTilingSpriteData(renderable);
|
|
82098
|
+
}
|
|
82099
|
+
_initTilingSpriteData(tilingSprite) {
|
|
82100
|
+
const gpuData = new TilingSpriteGpuData();
|
|
82101
|
+
gpuData.renderable = tilingSprite;
|
|
82102
|
+
tilingSprite._gpuData[this._renderer.uid] = gpuData;
|
|
82103
|
+
this._managedTilingSprites.add(tilingSprite);
|
|
82104
|
+
return gpuData;
|
|
82105
|
+
}
|
|
82106
|
+
_updateBatchableMesh(tilingSprite) {
|
|
82107
|
+
const renderableData = this._getTilingSpriteData(tilingSprite);
|
|
82108
|
+
const { geometry } = renderableData;
|
|
82109
|
+
const style2 = tilingSprite.texture.source.style;
|
|
82110
|
+
if (style2.addressMode !== "repeat") {
|
|
82111
|
+
style2.addressMode = "repeat";
|
|
82112
|
+
style2.update();
|
|
82113
|
+
}
|
|
82114
|
+
setUvs(tilingSprite, geometry.uvs);
|
|
82115
|
+
setPositions(tilingSprite, geometry.positions);
|
|
82116
|
+
}
|
|
82117
|
+
destroy() {
|
|
82118
|
+
this._managedTilingSprites.destroy();
|
|
82119
|
+
this._renderer = null;
|
|
82120
|
+
}
|
|
82121
|
+
_updateCanBatch(tilingSprite) {
|
|
82122
|
+
const renderableData = this._getTilingSpriteData(tilingSprite);
|
|
82123
|
+
const texture = tilingSprite.texture;
|
|
82124
|
+
let _nonPowOf2wrapping = true;
|
|
82125
|
+
if (this._renderer.type === RendererType.WEBGL) {
|
|
82126
|
+
_nonPowOf2wrapping = this._renderer.context.supports.nonPowOf2wrapping;
|
|
82127
|
+
}
|
|
82128
|
+
renderableData.canBatch = texture.textureMatrix.isSimple && (_nonPowOf2wrapping || texture.source.isPowerOfTwo);
|
|
82129
|
+
return renderableData.canBatch;
|
|
82130
|
+
}
|
|
82131
|
+
}
|
|
82132
|
+
TilingSpritePipe.extension = {
|
|
82133
|
+
type: [
|
|
82134
|
+
ExtensionType.WebGLPipes,
|
|
82135
|
+
ExtensionType.WebGPUPipes
|
|
82136
|
+
],
|
|
82137
|
+
name: "tilingSprite"
|
|
82138
|
+
};
|
|
82139
|
+
extensions.add(CanvasTilingSpritePipe);
|
|
82140
|
+
extensions.add(TilingSpritePipe);
|
|
82141
|
+
const _TilingSprite = class _TilingSprite2 extends ViewContainer {
|
|
82142
|
+
constructor(...args) {
|
|
82143
|
+
let options = args[0] || {};
|
|
82144
|
+
if (options instanceof Texture) {
|
|
82145
|
+
options = { texture: options };
|
|
82146
|
+
}
|
|
82147
|
+
if (args.length > 1) {
|
|
82148
|
+
deprecation(v8_0_0, "use new TilingSprite({ texture, width:100, height:100 }) instead");
|
|
82149
|
+
options.width = args[1];
|
|
82150
|
+
options.height = args[2];
|
|
82151
|
+
}
|
|
82152
|
+
options = { ..._TilingSprite2.defaultOptions, ...options };
|
|
82153
|
+
const {
|
|
82154
|
+
texture,
|
|
82155
|
+
anchor,
|
|
82156
|
+
tilePosition,
|
|
82157
|
+
tileScale,
|
|
82158
|
+
tileRotation,
|
|
82159
|
+
width,
|
|
82160
|
+
height,
|
|
82161
|
+
applyAnchorToTexture,
|
|
82162
|
+
roundPixels,
|
|
82163
|
+
...rest
|
|
82164
|
+
} = options ?? {};
|
|
82165
|
+
super({
|
|
82166
|
+
label: "TilingSprite",
|
|
82167
|
+
...rest
|
|
82168
|
+
});
|
|
82169
|
+
this.renderPipeId = "tilingSprite";
|
|
82170
|
+
this.batched = true;
|
|
82171
|
+
this.allowChildren = false;
|
|
82172
|
+
this._anchor = new ObservablePoint(
|
|
82173
|
+
{
|
|
82174
|
+
_onUpdate: () => {
|
|
82175
|
+
this.onViewUpdate();
|
|
82176
|
+
}
|
|
82177
|
+
}
|
|
82178
|
+
);
|
|
82179
|
+
this.applyAnchorToTexture = applyAnchorToTexture;
|
|
82180
|
+
this.texture = texture;
|
|
82181
|
+
this._width = width ?? texture.width;
|
|
82182
|
+
this._height = height ?? texture.height;
|
|
82183
|
+
this._tileTransform = new Transform({
|
|
82184
|
+
observer: {
|
|
82185
|
+
_onUpdate: () => this.onViewUpdate()
|
|
82186
|
+
}
|
|
82187
|
+
});
|
|
82188
|
+
if (anchor) this.anchor = anchor;
|
|
82189
|
+
this.tilePosition = tilePosition;
|
|
82190
|
+
this.tileScale = tileScale;
|
|
82191
|
+
this.tileRotation = tileRotation;
|
|
82192
|
+
this.roundPixels = roundPixels ?? false;
|
|
82193
|
+
}
|
|
82194
|
+
/**
|
|
82195
|
+
* Creates a new tiling sprite based on a source texture or image path.
|
|
82196
|
+
* This is a convenience method that automatically creates and manages textures.
|
|
82197
|
+
* @example
|
|
82198
|
+
* ```ts
|
|
82199
|
+
* // Create a new tiling sprite from an image path
|
|
82200
|
+
* const pattern = TilingSprite.from('pattern.png');
|
|
82201
|
+
* pattern.width = 300; // Set the width of the tiling area
|
|
82202
|
+
* pattern.height = 200; // Set the height of the tiling area
|
|
82203
|
+
*
|
|
82204
|
+
* // Create from options
|
|
82205
|
+
* const texture = Texture.from('pattern.png');
|
|
82206
|
+
* const pattern = TilingSprite.from(texture, {
|
|
82207
|
+
* width: 300,
|
|
82208
|
+
* height: 200,
|
|
82209
|
+
* tileScale: { x: 0.5, y: 0.5 }
|
|
82210
|
+
* });
|
|
82211
|
+
* ```
|
|
82212
|
+
* @param source - The source to create the sprite from. Can be a path to an image or a texture
|
|
82213
|
+
* @param options - Additional options for the tiling sprite
|
|
82214
|
+
* @returns A new tiling sprite based on the source
|
|
82215
|
+
* @see {@link Texture.from} For texture creation details
|
|
82216
|
+
* @see {@link Assets} For asset loading and management
|
|
82217
|
+
*/
|
|
82218
|
+
static from(source, options = {}) {
|
|
82219
|
+
if (typeof source === "string") {
|
|
82220
|
+
return new _TilingSprite2({
|
|
82221
|
+
texture: Cache.get(source),
|
|
82222
|
+
...options
|
|
82223
|
+
});
|
|
82224
|
+
}
|
|
82225
|
+
return new _TilingSprite2({
|
|
82226
|
+
texture: source,
|
|
82227
|
+
...options
|
|
82228
|
+
});
|
|
82229
|
+
}
|
|
82230
|
+
/**
|
|
82231
|
+
* @see {@link TilingSpriteOptions.applyAnchorToTexture}
|
|
82232
|
+
* @deprecated since 8.0.0
|
|
82233
|
+
* @advanced
|
|
82234
|
+
*/
|
|
82235
|
+
get uvRespectAnchor() {
|
|
82236
|
+
deprecation(v8_0_0, "uvRespectAnchor is deprecated, please use applyAnchorToTexture instead");
|
|
82237
|
+
return this.applyAnchorToTexture;
|
|
82238
|
+
}
|
|
82239
|
+
/** @advanced */
|
|
82240
|
+
set uvRespectAnchor(value) {
|
|
82241
|
+
deprecation(v8_0_0, "uvRespectAnchor is deprecated, please use applyAnchorToTexture instead");
|
|
82242
|
+
this.applyAnchorToTexture = value;
|
|
82243
|
+
}
|
|
82244
|
+
/**
|
|
82245
|
+
* Changes frame clamping in corresponding textureMatrix
|
|
82246
|
+
* Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas
|
|
82247
|
+
* @default 0.5
|
|
82248
|
+
* @type {number}
|
|
82249
|
+
* @advanced
|
|
82250
|
+
*/
|
|
82251
|
+
get clampMargin() {
|
|
82252
|
+
return this._texture.textureMatrix.clampMargin;
|
|
82253
|
+
}
|
|
82254
|
+
/** @advanced */
|
|
82255
|
+
set clampMargin(value) {
|
|
82256
|
+
this._texture.textureMatrix.clampMargin = value;
|
|
82257
|
+
}
|
|
82258
|
+
/**
|
|
82259
|
+
* The anchor sets the origin point of the sprite. The default value is taken from the {@link Texture}
|
|
82260
|
+
* and passed to the constructor.
|
|
82261
|
+
*
|
|
82262
|
+
* - The default is `(0,0)`, this means the sprite's origin is the top left.
|
|
82263
|
+
* - Setting the anchor to `(0.5,0.5)` means the sprite's origin is centered.
|
|
82264
|
+
* - Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner.
|
|
82265
|
+
*
|
|
82266
|
+
* If you pass only single parameter, it will set both x and y to the same value as shown in the example below.
|
|
82267
|
+
* @example
|
|
82268
|
+
* ```ts
|
|
82269
|
+
* // Center the anchor point
|
|
82270
|
+
* sprite.anchor = 0.5; // Sets both x and y to 0.5
|
|
82271
|
+
* sprite.position.set(400, 300); // Sprite will be centered at this position
|
|
82272
|
+
*
|
|
82273
|
+
* // Set specific x/y anchor points
|
|
82274
|
+
* sprite.anchor = {
|
|
82275
|
+
* x: 1, // Right edge
|
|
82276
|
+
* y: 0 // Top edge
|
|
82277
|
+
* };
|
|
82278
|
+
*
|
|
82279
|
+
* // Using individual coordinates
|
|
82280
|
+
* sprite.anchor.set(0.5, 1); // Center-bottom
|
|
82281
|
+
*
|
|
82282
|
+
* // For rotation around center
|
|
82283
|
+
* sprite.anchor.set(0.5);
|
|
82284
|
+
* sprite.rotation = Math.PI / 4; // 45 degrees around center
|
|
82285
|
+
*
|
|
82286
|
+
* // For scaling from center
|
|
82287
|
+
* sprite.anchor.set(0.5);
|
|
82288
|
+
* sprite.scale.set(2); // Scales from center point
|
|
82289
|
+
* ```
|
|
82290
|
+
*/
|
|
82291
|
+
get anchor() {
|
|
82292
|
+
return this._anchor;
|
|
82293
|
+
}
|
|
82294
|
+
set anchor(value) {
|
|
82295
|
+
typeof value === "number" ? this._anchor.set(value) : this._anchor.copyFrom(value);
|
|
82296
|
+
}
|
|
82297
|
+
/**
|
|
82298
|
+
* The offset of the tiling texture.
|
|
82299
|
+
* Used to scroll or position the repeated pattern.
|
|
82300
|
+
* @example
|
|
82301
|
+
* ```ts
|
|
82302
|
+
* // Offset the tiling pattern by 100 pixels in both x and y directions
|
|
82303
|
+
* tilingSprite.tilePosition = { x: 100, y: 100 };
|
|
82304
|
+
* ```
|
|
82305
|
+
* @default {x: 0, y: 0}
|
|
82306
|
+
*/
|
|
82307
|
+
get tilePosition() {
|
|
82308
|
+
return this._tileTransform.position;
|
|
82309
|
+
}
|
|
82310
|
+
set tilePosition(value) {
|
|
82311
|
+
this._tileTransform.position.copyFrom(value);
|
|
82312
|
+
}
|
|
82313
|
+
/**
|
|
82314
|
+
* Scale of the tiling texture.
|
|
82315
|
+
* Affects the size of each repeated instance of the texture.
|
|
82316
|
+
* @example
|
|
82317
|
+
* ```ts
|
|
82318
|
+
* // Scale the texture by 1.5 in both x and y directions
|
|
82319
|
+
* tilingSprite.tileScale = { x: 1.5, y: 1.5 };
|
|
82320
|
+
* ```
|
|
82321
|
+
* @default {x: 1, y: 1}
|
|
82322
|
+
*/
|
|
82323
|
+
get tileScale() {
|
|
82324
|
+
return this._tileTransform.scale;
|
|
82325
|
+
}
|
|
82326
|
+
set tileScale(value) {
|
|
82327
|
+
typeof value === "number" ? this._tileTransform.scale.set(value) : this._tileTransform.scale.copyFrom(value);
|
|
82328
|
+
}
|
|
82329
|
+
set tileRotation(value) {
|
|
82330
|
+
this._tileTransform.rotation = value;
|
|
82331
|
+
}
|
|
82332
|
+
/**
|
|
82333
|
+
* Rotation of the tiling texture in radians.
|
|
82334
|
+
* This controls the rotation applied to the texture before tiling.
|
|
82335
|
+
* @example
|
|
82336
|
+
* ```ts
|
|
82337
|
+
* // Rotate the texture by 45 degrees (in radians)
|
|
82338
|
+
* tilingSprite.tileRotation = Math.PI / 4; // 45 degrees
|
|
82339
|
+
* ```
|
|
82340
|
+
* @default 0
|
|
82341
|
+
*/
|
|
82342
|
+
get tileRotation() {
|
|
82343
|
+
return this._tileTransform.rotation;
|
|
82344
|
+
}
|
|
82345
|
+
/**
|
|
82346
|
+
* The transform object that controls the tiling texture's position, scale, and rotation.
|
|
82347
|
+
* This transform is independent of the sprite's own transform properties.
|
|
82348
|
+
* @example
|
|
82349
|
+
* ```ts
|
|
82350
|
+
* // Access transform properties directly
|
|
82351
|
+
* sprite.tileTransform.position.set(100, 50);
|
|
82352
|
+
* sprite.tileTransform.scale.set(2);
|
|
82353
|
+
* sprite.tileTransform.rotation = Math.PI / 4;
|
|
82354
|
+
*
|
|
82355
|
+
* // Create smooth scrolling animation
|
|
82356
|
+
* app.ticker.add(() => {
|
|
82357
|
+
* sprite.tileTransform.position.x += 1;
|
|
82358
|
+
* sprite.tileTransform.rotation += 0.01;
|
|
82359
|
+
* });
|
|
82360
|
+
*
|
|
82361
|
+
* // Reset transform
|
|
82362
|
+
* sprite.tileTransform.position.set(0);
|
|
82363
|
+
* sprite.tileTransform.scale.set(1);
|
|
82364
|
+
* sprite.tileTransform.rotation = 0;
|
|
82365
|
+
* ```
|
|
82366
|
+
* @returns {Transform} The transform object for the tiling texture
|
|
82367
|
+
* @see {@link Transform} For transform operations
|
|
82368
|
+
* @see {@link TilingSprite#tilePosition} For position control
|
|
82369
|
+
* @see {@link TilingSprite#tileScale} For scale control
|
|
82370
|
+
* @see {@link TilingSprite#tileRotation} For rotation control
|
|
82371
|
+
* @advanced
|
|
82372
|
+
*/
|
|
82373
|
+
get tileTransform() {
|
|
82374
|
+
return this._tileTransform;
|
|
82375
|
+
}
|
|
82376
|
+
set texture(value) {
|
|
82377
|
+
value || (value = Texture.EMPTY);
|
|
82378
|
+
const currentTexture = this._texture;
|
|
82379
|
+
if (currentTexture === value) return;
|
|
82380
|
+
if (currentTexture && currentTexture.dynamic) currentTexture.off("update", this.onViewUpdate, this);
|
|
82381
|
+
if (value.dynamic) value.on("update", this.onViewUpdate, this);
|
|
82382
|
+
this._texture = value;
|
|
82383
|
+
this.onViewUpdate();
|
|
82384
|
+
}
|
|
82385
|
+
/**
|
|
82386
|
+
* The texture to use for tiling.
|
|
82387
|
+
* This is the image that will be repeated across the sprite.
|
|
82388
|
+
* @example
|
|
82389
|
+
* ```ts
|
|
82390
|
+
* // Use a texture from the asset cache
|
|
82391
|
+
* tilingSprite.texture = Texture.from('assets/pattern.png');
|
|
82392
|
+
* ```
|
|
82393
|
+
* @default Texture.WHITE
|
|
82394
|
+
*/
|
|
82395
|
+
get texture() {
|
|
82396
|
+
return this._texture;
|
|
82397
|
+
}
|
|
82398
|
+
/**
|
|
82399
|
+
* The width of the tiling area. This defines how wide the area is that the texture will be tiled across.
|
|
82400
|
+
* @example
|
|
82401
|
+
* ```ts
|
|
82402
|
+
* // Create a tiling sprite
|
|
82403
|
+
* const sprite = new TilingSprite({
|
|
82404
|
+
* texture: Texture.from('pattern.png'),
|
|
82405
|
+
* width: 500,
|
|
82406
|
+
* height: 300
|
|
82407
|
+
* });
|
|
82408
|
+
*
|
|
82409
|
+
* // Adjust width dynamically
|
|
82410
|
+
* sprite.width = 800; // Expands tiling area
|
|
82411
|
+
*
|
|
82412
|
+
* // Update on resize
|
|
82413
|
+
* window.addEventListener('resize', () => {
|
|
82414
|
+
* sprite.width = app.screen.width;
|
|
82415
|
+
* });
|
|
82416
|
+
* ```
|
|
82417
|
+
* @see {@link TilingSprite#setSize} For setting both width and height efficiently
|
|
82418
|
+
* @see {@link TilingSprite#height} For setting height
|
|
82419
|
+
*/
|
|
82420
|
+
set width(value) {
|
|
82421
|
+
this._width = value;
|
|
82422
|
+
this.onViewUpdate();
|
|
82423
|
+
}
|
|
82424
|
+
get width() {
|
|
82425
|
+
return this._width;
|
|
82426
|
+
}
|
|
82427
|
+
set height(value) {
|
|
82428
|
+
this._height = value;
|
|
82429
|
+
this.onViewUpdate();
|
|
82430
|
+
}
|
|
82431
|
+
/**
|
|
82432
|
+
* The height of the tiling area. This defines how tall the area is that the texture will be tiled across.
|
|
82433
|
+
* @example
|
|
82434
|
+
* ```ts
|
|
82435
|
+
* // Create a tiling sprite
|
|
82436
|
+
* const sprite = new TilingSprite({
|
|
82437
|
+
* texture: Texture.from('pattern.png'),
|
|
82438
|
+
* width: 500,
|
|
82439
|
+
* height: 300
|
|
82440
|
+
* });
|
|
82441
|
+
*
|
|
82442
|
+
* // Adjust width dynamically
|
|
82443
|
+
* sprite.height = 800; // Expands tiling area
|
|
82444
|
+
*
|
|
82445
|
+
* // Update on resize
|
|
82446
|
+
* window.addEventListener('resize', () => {
|
|
82447
|
+
* sprite.height = app.screen.height;
|
|
82448
|
+
* });
|
|
82449
|
+
* ```
|
|
82450
|
+
* @see {@link TilingSprite#setSize} For setting both width and height efficiently
|
|
82451
|
+
* @see {@link TilingSprite#width} For setting width
|
|
82452
|
+
*/
|
|
82453
|
+
get height() {
|
|
82454
|
+
return this._height;
|
|
82455
|
+
}
|
|
82456
|
+
/**
|
|
82457
|
+
* Sets the size of the TilingSprite to the specified width and height.
|
|
82458
|
+
* This is faster than setting width and height separately as it only triggers one update.
|
|
82459
|
+
* @example
|
|
82460
|
+
* ```ts
|
|
82461
|
+
* // Set specific dimensions
|
|
82462
|
+
* sprite.setSize(300, 200); // Width: 300, Height: 200
|
|
82463
|
+
*
|
|
82464
|
+
* // Set uniform size (square)
|
|
82465
|
+
* sprite.setSize(400); // Width: 400, Height: 400
|
|
82466
|
+
*
|
|
82467
|
+
* // Set size using object
|
|
82468
|
+
* sprite.setSize({
|
|
82469
|
+
* width: 500,
|
|
82470
|
+
* height: 300
|
|
82471
|
+
* });
|
|
82472
|
+
* ```
|
|
82473
|
+
* @param value - This can be either a number for uniform sizing or a Size object with width/height properties
|
|
82474
|
+
* @param height - The height to set. Defaults to the value of `width` if not provided
|
|
82475
|
+
* @see {@link TilingSprite#width} For setting width only
|
|
82476
|
+
* @see {@link TilingSprite#height} For setting height only
|
|
82477
|
+
*/
|
|
82478
|
+
setSize(value, height) {
|
|
82479
|
+
if (typeof value === "object") {
|
|
82480
|
+
height = value.height ?? value.width;
|
|
82481
|
+
value = value.width;
|
|
82482
|
+
}
|
|
82483
|
+
this._width = value;
|
|
82484
|
+
this._height = height ?? value;
|
|
82485
|
+
this.onViewUpdate();
|
|
82486
|
+
}
|
|
82487
|
+
/**
|
|
82488
|
+
* Retrieves the size of the TilingSprite as a {@link Size} object.
|
|
82489
|
+
* This method is more efficient than getting width and height separately as it only allocates one object.
|
|
82490
|
+
* @example
|
|
82491
|
+
* ```ts
|
|
82492
|
+
* // Get basic size
|
|
82493
|
+
* const size = sprite.getSize();
|
|
82494
|
+
* console.log(`Size: ${size.width}x${size.height}`);
|
|
82495
|
+
*
|
|
82496
|
+
* // Reuse existing size object
|
|
82497
|
+
* const reuseSize = { width: 0, height: 0 };
|
|
82498
|
+
* sprite.getSize(reuseSize);
|
|
82499
|
+
* ```
|
|
82500
|
+
* @param out - Optional object to store the size in, to avoid allocating a new object
|
|
82501
|
+
* @returns The size of the TilingSprite
|
|
82502
|
+
* @see {@link TilingSprite#width} For getting just the width
|
|
82503
|
+
* @see {@link TilingSprite#height} For getting just the height
|
|
82504
|
+
* @see {@link TilingSprite#setSize} For setting both width and height efficiently
|
|
82505
|
+
*/
|
|
82506
|
+
getSize(out2) {
|
|
82507
|
+
out2 || (out2 = {});
|
|
82508
|
+
out2.width = this._width;
|
|
82509
|
+
out2.height = this._height;
|
|
82510
|
+
return out2;
|
|
82511
|
+
}
|
|
82512
|
+
/** @private */
|
|
82513
|
+
updateBounds() {
|
|
82514
|
+
const bounds = this._bounds;
|
|
82515
|
+
const anchor = this._anchor;
|
|
82516
|
+
const width = this._width;
|
|
82517
|
+
const height = this._height;
|
|
82518
|
+
bounds.minX = -anchor._x * width;
|
|
82519
|
+
bounds.maxX = bounds.minX + width;
|
|
82520
|
+
bounds.minY = -anchor._y * height;
|
|
82521
|
+
bounds.maxY = bounds.minY + height;
|
|
82522
|
+
}
|
|
82523
|
+
/**
|
|
82524
|
+
* Checks if the object contains the given point in local coordinates.
|
|
82525
|
+
* Takes into account the anchor offset when determining boundaries.
|
|
82526
|
+
* @example
|
|
82527
|
+
* ```ts
|
|
82528
|
+
* // Create a tiling sprite
|
|
82529
|
+
* const sprite = new TilingSprite({
|
|
82530
|
+
* texture: Texture.from('pattern.png'),
|
|
82531
|
+
* width: 200,
|
|
82532
|
+
* height: 100,
|
|
82533
|
+
* anchor: 0.5 // Center anchor
|
|
82534
|
+
* });
|
|
82535
|
+
*
|
|
82536
|
+
* // Basic point check
|
|
82537
|
+
* const contains = sprite.containsPoint({ x: 50, y: 25 });
|
|
82538
|
+
* console.log('Point is inside:', contains);
|
|
82539
|
+
*
|
|
82540
|
+
* // Check with different anchors
|
|
82541
|
+
* sprite.anchor.set(0); // Top-left anchor
|
|
82542
|
+
* console.log('Contains point:', sprite.containsPoint({ x: 150, y: 75 }));
|
|
82543
|
+
* ```
|
|
82544
|
+
* @param point - The point to check in local coordinates
|
|
82545
|
+
* @returns True if the point is within the sprite's bounds
|
|
82546
|
+
* @see {@link TilingSprite#toLocal} For converting global coordinates to local
|
|
82547
|
+
* @see {@link TilingSprite#anchor} For understanding boundary calculations
|
|
82548
|
+
*/
|
|
82549
|
+
containsPoint(point) {
|
|
82550
|
+
const width = this._width;
|
|
82551
|
+
const height = this._height;
|
|
82552
|
+
const x1 = -width * this._anchor._x;
|
|
82553
|
+
let y1 = 0;
|
|
82554
|
+
if (point.x >= x1 && point.x <= x1 + width) {
|
|
82555
|
+
y1 = -height * this._anchor._y;
|
|
82556
|
+
if (point.y >= y1 && point.y <= y1 + height) return true;
|
|
82557
|
+
}
|
|
82558
|
+
return false;
|
|
82559
|
+
}
|
|
82560
|
+
/**
|
|
82561
|
+
* Destroys this sprite renderable and optionally its texture.
|
|
82562
|
+
* @param options - Options parameter. A boolean will act as if all options
|
|
82563
|
+
* have been set to that value
|
|
82564
|
+
* @example
|
|
82565
|
+
* tilingSprite.destroy();
|
|
82566
|
+
* tilingSprite.destroy(true);
|
|
82567
|
+
* tilingSprite.destroy({ texture: true, textureSource: true });
|
|
82568
|
+
*/
|
|
82569
|
+
destroy(options = false) {
|
|
82570
|
+
super.destroy(options);
|
|
82571
|
+
this._anchor = null;
|
|
82572
|
+
this._tileTransform = null;
|
|
82573
|
+
this._bounds = null;
|
|
82574
|
+
const destroyTexture = typeof options === "boolean" ? options : options == null ? void 0 : options.texture;
|
|
82575
|
+
if (destroyTexture) {
|
|
82576
|
+
const destroyTextureSource = typeof options === "boolean" ? options : options == null ? void 0 : options.textureSource;
|
|
82577
|
+
this._texture.destroy(destroyTextureSource);
|
|
82578
|
+
}
|
|
82579
|
+
this._texture = null;
|
|
82580
|
+
}
|
|
82581
|
+
};
|
|
82582
|
+
_TilingSprite.defaultOptions = {
|
|
82583
|
+
/** The texture to use for the sprite. */
|
|
82584
|
+
texture: Texture.EMPTY,
|
|
82585
|
+
/** The anchor point of the sprite */
|
|
82586
|
+
anchor: { x: 0, y: 0 },
|
|
82587
|
+
/** The offset of the image that is being tiled. */
|
|
82588
|
+
tilePosition: { x: 0, y: 0 },
|
|
82589
|
+
/** Scaling of the image that is being tiled. */
|
|
82590
|
+
tileScale: { x: 1, y: 1 },
|
|
82591
|
+
/** The rotation of the image that is being tiled. */
|
|
82592
|
+
tileRotation: 0,
|
|
82593
|
+
/**
|
|
82594
|
+
* Flags whether the tiling pattern should originate from the origin instead of the top-left corner in
|
|
82595
|
+
* local space.
|
|
82596
|
+
*
|
|
82597
|
+
* This will make the texture coordinates assigned to each vertex dependent on the value of the anchor. Without
|
|
82598
|
+
* this, the top-left corner always gets the (0, 0) texture coordinate.
|
|
82599
|
+
* @default false
|
|
82600
|
+
*/
|
|
82601
|
+
applyAnchorToTexture: false
|
|
82602
|
+
};
|
|
82603
|
+
let TilingSprite = _TilingSprite;
|
|
80964
82604
|
class AbstractText extends ViewContainer {
|
|
80965
82605
|
constructor(options, styleClass) {
|
|
80966
82606
|
const { text, resolution, style: style2, anchor, width, height, roundPixels, ...rest } = options;
|
|
@@ -84393,7 +86033,7 @@ function layoutNodes(nodes) {
|
|
|
84393
86033
|
});
|
|
84394
86034
|
return positions;
|
|
84395
86035
|
}
|
|
84396
|
-
function generateTerrain(width, height, nodes, paths,
|
|
86036
|
+
function generateTerrain(width, height, nodes, paths, verticalBridgeXPositions = [], horizontalBridgeYPositions = []) {
|
|
84397
86037
|
const tiles = [];
|
|
84398
86038
|
for (let y2 = 0; y2 < height; y2++) {
|
|
84399
86039
|
for (let x2 = 0; x2 < width; x2++) {
|
|
@@ -84406,9 +86046,9 @@ function generateTerrain(width, height, nodes, paths, regionBoundaries = []) {
|
|
|
84406
86046
|
});
|
|
84407
86047
|
}
|
|
84408
86048
|
}
|
|
84409
|
-
for (const
|
|
84410
|
-
const bridgeStartX =
|
|
84411
|
-
const bridgeEndX =
|
|
86049
|
+
for (const bridgeX of verticalBridgeXPositions) {
|
|
86050
|
+
const bridgeStartX = bridgeX - 1;
|
|
86051
|
+
const bridgeEndX = bridgeX + 1;
|
|
84412
86052
|
for (let y2 = 0; y2 < height; y2++) {
|
|
84413
86053
|
for (let x2 = bridgeStartX; x2 <= bridgeEndX; x2++) {
|
|
84414
86054
|
if (x2 >= 0 && x2 < width) {
|
|
@@ -84421,6 +86061,21 @@ function generateTerrain(width, height, nodes, paths, regionBoundaries = []) {
|
|
|
84421
86061
|
}
|
|
84422
86062
|
}
|
|
84423
86063
|
}
|
|
86064
|
+
for (const bridgeY of horizontalBridgeYPositions) {
|
|
86065
|
+
const bridgeStartY = bridgeY - 1;
|
|
86066
|
+
const bridgeEndY = bridgeY + 1;
|
|
86067
|
+
for (let x2 = 0; x2 < width; x2++) {
|
|
86068
|
+
for (let y2 = bridgeStartY; y2 <= bridgeEndY; y2++) {
|
|
86069
|
+
if (y2 >= 0 && y2 < height) {
|
|
86070
|
+
const tileIndex = y2 * width + x2;
|
|
86071
|
+
if (tileIndex >= 0 && tileIndex < tiles.length) {
|
|
86072
|
+
tiles[tileIndex].type = "water";
|
|
86073
|
+
tiles[tileIndex].biome = "water";
|
|
86074
|
+
}
|
|
86075
|
+
}
|
|
86076
|
+
}
|
|
86077
|
+
}
|
|
86078
|
+
}
|
|
84424
86079
|
for (const path2 of paths) {
|
|
84425
86080
|
for (const point of path2.points) {
|
|
84426
86081
|
const x2 = Math.round(point.gridX);
|
|
@@ -84631,14 +86286,35 @@ function nodesToUnifiedOverworldMap(nodes, options = {}) {
|
|
|
84631
86286
|
const regionMaps = nodeGroups.map((group) => nodesToOverworldMap(group, options));
|
|
84632
86287
|
const maxRegionSize = Math.max(...regionMaps.map((rm) => Math.max(rm.width, rm.height)));
|
|
84633
86288
|
const REGION_SIZE = Math.ceil(maxRegionSize);
|
|
86289
|
+
const regionLayout = options.regionLayout || {
|
|
86290
|
+
columns: nodeGroups.length,
|
|
86291
|
+
rows: 1,
|
|
86292
|
+
fillDirection: "row-major"
|
|
86293
|
+
};
|
|
84634
86294
|
const allNodes = [];
|
|
84635
86295
|
const allPaths = [];
|
|
84636
86296
|
const regions = [];
|
|
84637
|
-
const
|
|
84638
|
-
|
|
86297
|
+
const horizontalBridges = [];
|
|
86298
|
+
const verticalBridges = [];
|
|
86299
|
+
const gridPositions = [];
|
|
86300
|
+
const fillDirection = regionLayout.fillDirection || "row-major";
|
|
86301
|
+
for (let i2 = 0; i2 < regionMaps.length; i2++) {
|
|
86302
|
+
if (fillDirection === "row-major") {
|
|
86303
|
+
const row = Math.floor(i2 / regionLayout.columns);
|
|
86304
|
+
const col = i2 % regionLayout.columns;
|
|
86305
|
+
gridPositions.push({ row, col });
|
|
86306
|
+
} else {
|
|
86307
|
+
const col = Math.floor(i2 / regionLayout.rows);
|
|
86308
|
+
const row = i2 % regionLayout.rows;
|
|
86309
|
+
gridPositions.push({ row, col });
|
|
86310
|
+
}
|
|
86311
|
+
}
|
|
84639
86312
|
regionMaps.forEach((regionMap, index2) => {
|
|
84640
|
-
const
|
|
84641
|
-
const
|
|
86313
|
+
const gridPos = gridPositions[index2];
|
|
86314
|
+
const regionX = gridPos.col * (REGION_SIZE + REGION_SPACING);
|
|
86315
|
+
const regionY = gridPos.row * (REGION_SIZE + REGION_SPACING);
|
|
86316
|
+
const xOffset = regionX + Math.floor((REGION_SIZE - regionMap.width) / 2);
|
|
86317
|
+
const yOffset = regionY + Math.floor((REGION_SIZE - regionMap.height) / 2);
|
|
84642
86318
|
const offsetNodes = regionMap.nodes.map((node) => ({
|
|
84643
86319
|
...node,
|
|
84644
86320
|
gridX: node.gridX + xOffset,
|
|
@@ -84657,26 +86333,39 @@ function nodesToUnifiedOverworldMap(nodes, options = {}) {
|
|
|
84657
86333
|
id: `region-${index2}`,
|
|
84658
86334
|
name: `Region ${index2 + 1}`,
|
|
84659
86335
|
description: `Contains ${offsetNodes.length} nodes`,
|
|
86336
|
+
gridPosition: gridPos,
|
|
84660
86337
|
bounds: {
|
|
84661
|
-
x:
|
|
84662
|
-
y:
|
|
86338
|
+
x: regionX,
|
|
86339
|
+
y: regionY,
|
|
84663
86340
|
width: REGION_SIZE,
|
|
84664
86341
|
height: REGION_SIZE
|
|
84665
86342
|
},
|
|
84666
|
-
centerX:
|
|
84667
|
-
centerY: REGION_SIZE / 2,
|
|
86343
|
+
centerX: regionX + REGION_SIZE / 2,
|
|
86344
|
+
centerY: regionY + REGION_SIZE / 2,
|
|
84668
86345
|
nodeIds: offsetNodes.map((n2) => n2.id)
|
|
84669
86346
|
});
|
|
84670
|
-
|
|
84671
|
-
|
|
84672
|
-
|
|
84673
|
-
|
|
86347
|
+
if (gridPos.col < regionLayout.columns - 1) {
|
|
86348
|
+
const nextRegionExists = gridPositions.some(
|
|
86349
|
+
(p2) => p2.row === gridPos.row && p2.col === gridPos.col + 1
|
|
86350
|
+
);
|
|
86351
|
+
if (nextRegionExists) {
|
|
86352
|
+
const bridgeX = regionX + REGION_SIZE + Math.floor(REGION_SPACING / 2);
|
|
86353
|
+
horizontalBridges.push(bridgeX);
|
|
86354
|
+
}
|
|
86355
|
+
}
|
|
86356
|
+
if (gridPos.row < regionLayout.rows - 1) {
|
|
86357
|
+
const belowRegionExists = gridPositions.some(
|
|
86358
|
+
(p2) => p2.row === gridPos.row + 1 && p2.col === gridPos.col
|
|
86359
|
+
);
|
|
86360
|
+
if (belowRegionExists) {
|
|
86361
|
+
const bridgeY = regionY + REGION_SIZE + Math.floor(REGION_SPACING / 2);
|
|
86362
|
+
verticalBridges.push(bridgeY);
|
|
86363
|
+
}
|
|
84674
86364
|
}
|
|
84675
|
-
currentX += REGION_SPACING;
|
|
84676
86365
|
});
|
|
84677
|
-
const totalWidth =
|
|
84678
|
-
const totalHeight = REGION_SIZE;
|
|
84679
|
-
const tiles = generateTerrain(totalWidth, totalHeight, allNodes, allPaths,
|
|
86366
|
+
const totalWidth = regionLayout.columns * REGION_SIZE + (regionLayout.columns - 1) * REGION_SPACING;
|
|
86367
|
+
const totalHeight = regionLayout.rows * REGION_SIZE + (regionLayout.rows - 1) * REGION_SPACING;
|
|
86368
|
+
const tiles = generateTerrain(totalWidth, totalHeight, allNodes, allPaths, horizontalBridges, verticalBridges);
|
|
84680
86369
|
return {
|
|
84681
86370
|
width: totalWidth,
|
|
84682
86371
|
height: totalHeight,
|
|
@@ -84786,7 +86475,8 @@ function packagesToUnifiedOverworldMap(packages, options = {}) {
|
|
|
84786
86475
|
);
|
|
84787
86476
|
const map2 = nodesToUnifiedOverworldMap(genericNodes, {
|
|
84788
86477
|
includeDevDependencies: options.includeDevDependencies,
|
|
84789
|
-
mapPadding: options.mapPadding
|
|
86478
|
+
mapPadding: options.mapPadding,
|
|
86479
|
+
regionLayout: options.regionLayout
|
|
84790
86480
|
});
|
|
84791
86481
|
return {
|
|
84792
86482
|
...map2,
|
|
@@ -84876,6 +86566,28 @@ function createCanvas(width, height) {
|
|
|
84876
86566
|
canvas.height = height;
|
|
84877
86567
|
return canvas;
|
|
84878
86568
|
}
|
|
86569
|
+
function generateGrassBackgroundTile() {
|
|
86570
|
+
const size = 32;
|
|
86571
|
+
const canvas = createCanvas(size, size);
|
|
86572
|
+
const ctx = canvas.getContext("2d");
|
|
86573
|
+
ctx.fillStyle = "#3d5a27";
|
|
86574
|
+
ctx.fillRect(0, 0, size, size);
|
|
86575
|
+
const bladeColor = "#4a6b2f";
|
|
86576
|
+
const darkBladeColor = "#2f4520";
|
|
86577
|
+
for (let i2 = 0; i2 < 20; i2++) {
|
|
86578
|
+
const x2 = Math.floor(Math.random() * size);
|
|
86579
|
+
const y2 = Math.floor(Math.random() * size);
|
|
86580
|
+
ctx.fillStyle = Math.random() > 0.5 ? bladeColor : darkBladeColor;
|
|
86581
|
+
ctx.fillRect(x2, y2, 1, 1);
|
|
86582
|
+
}
|
|
86583
|
+
for (let i2 = 0; i2 < 8; i2++) {
|
|
86584
|
+
const x2 = Math.floor(Math.random() * size);
|
|
86585
|
+
const y2 = Math.floor(Math.random() * (size - 1));
|
|
86586
|
+
ctx.fillStyle = bladeColor;
|
|
86587
|
+
ctx.fillRect(x2, y2, 1, 2);
|
|
86588
|
+
}
|
|
86589
|
+
return canvas;
|
|
86590
|
+
}
|
|
84879
86591
|
function generateGrassTile(theme = "grass") {
|
|
84880
86592
|
const canvas = createCanvas(ISO_TILE_WIDTH, ISO_TILE_HEIGHT);
|
|
84881
86593
|
const ctx = canvas.getContext("2d");
|
|
@@ -85196,6 +86908,7 @@ function generateDecorativeSprite(type2) {
|
|
|
85196
86908
|
}
|
|
85197
86909
|
function generateSpriteAtlas() {
|
|
85198
86910
|
const atlas = {};
|
|
86911
|
+
atlas["bg-grass"] = generateGrassBackgroundTile();
|
|
85199
86912
|
for (const biome of Object.keys(BIOME_COLORS)) {
|
|
85200
86913
|
atlas[`tile-grass-${biome}`] = generateGrassTile(biome);
|
|
85201
86914
|
}
|
|
@@ -85219,6 +86932,7 @@ const OverworldMapPanelContent = ({
|
|
|
85219
86932
|
packages,
|
|
85220
86933
|
includeDevDependencies = true,
|
|
85221
86934
|
includePeerDependencies = false,
|
|
86935
|
+
regionLayout,
|
|
85222
86936
|
width,
|
|
85223
86937
|
height,
|
|
85224
86938
|
isLoading = false
|
|
@@ -85233,12 +86947,14 @@ const OverworldMapPanelContent = ({
|
|
|
85233
86947
|
const [isAnimating, setIsAnimating] = useState(false);
|
|
85234
86948
|
const animationRef = useRef(null);
|
|
85235
86949
|
const hasInitializedCamera = useRef(false);
|
|
86950
|
+
const skipNextAnimation = useRef(false);
|
|
85236
86951
|
const mapData = useMemo(() => {
|
|
85237
86952
|
return packagesToUnifiedOverworldMap(packages, {
|
|
85238
86953
|
includeDevDependencies,
|
|
85239
|
-
includePeerDependencies
|
|
86954
|
+
includePeerDependencies,
|
|
86955
|
+
regionLayout
|
|
85240
86956
|
});
|
|
85241
|
-
}, [packages, includeDevDependencies, includePeerDependencies]);
|
|
86957
|
+
}, [packages, includeDevDependencies, includePeerDependencies, regionLayout]);
|
|
85242
86958
|
const currentRegion = mapData.regions[currentRegionIndex] || mapData.regions[0];
|
|
85243
86959
|
useEffect(() => {
|
|
85244
86960
|
if (!canvasRef.current) return;
|
|
@@ -85253,8 +86969,8 @@ const OverworldMapPanelContent = ({
|
|
|
85253
86969
|
await app.init({
|
|
85254
86970
|
width: containerWidth,
|
|
85255
86971
|
height: containerHeight,
|
|
85256
|
-
backgroundColor:
|
|
85257
|
-
//
|
|
86972
|
+
backgroundColor: 4020775,
|
|
86973
|
+
// Dark grass green (matches background texture)
|
|
85258
86974
|
antialias: false
|
|
85259
86975
|
// Pixel-perfect rendering
|
|
85260
86976
|
});
|
|
@@ -85272,6 +86988,37 @@ const OverworldMapPanelContent = ({
|
|
|
85272
86988
|
const worldContainer = new Container();
|
|
85273
86989
|
app.stage.addChild(worldContainer);
|
|
85274
86990
|
worldContainerRef.current = worldContainer;
|
|
86991
|
+
const bgTexture = textures["bg-grass"];
|
|
86992
|
+
if (bgTexture) {
|
|
86993
|
+
const backgroundTiling = new TilingSprite({
|
|
86994
|
+
texture: bgTexture,
|
|
86995
|
+
width: mapData.width * ISO_TILE_WIDTH * 2,
|
|
86996
|
+
// Make background larger than map
|
|
86997
|
+
height: mapData.height * ISO_TILE_HEIGHT * 2
|
|
86998
|
+
});
|
|
86999
|
+
backgroundTiling.x = -(mapData.width * ISO_TILE_WIDTH * 2) / 4;
|
|
87000
|
+
backgroundTiling.y = -(mapData.height * ISO_TILE_HEIGHT * 2) / 4;
|
|
87001
|
+
worldContainer.addChild(backgroundTiling);
|
|
87002
|
+
}
|
|
87003
|
+
const updateCurrentRegion = () => {
|
|
87004
|
+
if (mapData.regions.length <= 1) return;
|
|
87005
|
+
const viewportCenterX = dimensionsRef.current.width / 2;
|
|
87006
|
+
const viewportCenterY = dimensionsRef.current.height / 2;
|
|
87007
|
+
const worldX = viewportCenterX - worldContainer.x;
|
|
87008
|
+
const worldY = viewportCenterY - worldContainer.y;
|
|
87009
|
+
const gridPos = screenToGrid(worldX, worldY);
|
|
87010
|
+
for (let i2 = 0; i2 < mapData.regions.length; i2++) {
|
|
87011
|
+
const region = mapData.regions[i2];
|
|
87012
|
+
const { x: x2, y: y2, width: width2, height: height2 } = region.bounds;
|
|
87013
|
+
if (gridPos.gridX >= x2 && gridPos.gridX < x2 + width2 && gridPos.gridY >= y2 && gridPos.gridY < y2 + height2) {
|
|
87014
|
+
if (currentRegionIndex !== i2) {
|
|
87015
|
+
skipNextAnimation.current = true;
|
|
87016
|
+
setCurrentRegionIndex(i2);
|
|
87017
|
+
}
|
|
87018
|
+
return;
|
|
87019
|
+
}
|
|
87020
|
+
}
|
|
87021
|
+
};
|
|
85275
87022
|
let isDragging = false;
|
|
85276
87023
|
let dragStart = { x: 0, y: 0 };
|
|
85277
87024
|
let worldStart = { x: 0, y: 0 };
|
|
@@ -85290,6 +87037,7 @@ const OverworldMapPanelContent = ({
|
|
|
85290
87037
|
const dy = event.globalY - dragStart.y;
|
|
85291
87038
|
worldContainer.x = worldStart.x + dx;
|
|
85292
87039
|
worldContainer.y = worldStart.y + dy;
|
|
87040
|
+
updateCurrentRegion();
|
|
85293
87041
|
}
|
|
85294
87042
|
});
|
|
85295
87043
|
app.stage.on("pointerup", () => {
|
|
@@ -85685,6 +87433,10 @@ const OverworldMapPanelContent = ({
|
|
|
85685
87433
|
hasInitializedCamera.current = true;
|
|
85686
87434
|
return;
|
|
85687
87435
|
}
|
|
87436
|
+
if (skipNextAnimation.current) {
|
|
87437
|
+
skipNextAnimation.current = false;
|
|
87438
|
+
return;
|
|
87439
|
+
}
|
|
85688
87440
|
setIsAnimating(true);
|
|
85689
87441
|
animationRef.current = {
|
|
85690
87442
|
startTime: performance.now(),
|
|
@@ -85837,42 +87589,9 @@ const OverworldMapPanelContent = ({
|
|
|
85837
87589
|
)
|
|
85838
87590
|
] });
|
|
85839
87591
|
};
|
|
85840
|
-
const OverworldMapPanelPreview = () => {
|
|
85841
|
-
return /* @__PURE__ */ jsx(
|
|
85842
|
-
"div",
|
|
85843
|
-
{
|
|
85844
|
-
style: {
|
|
85845
|
-
width: "100%",
|
|
85846
|
-
height: "100%",
|
|
85847
|
-
display: "flex",
|
|
85848
|
-
alignItems: "center",
|
|
85849
|
-
justifyContent: "center",
|
|
85850
|
-
backgroundColor: "#87ceeb",
|
|
85851
|
-
fontFamily: "monospace",
|
|
85852
|
-
fontSize: 14,
|
|
85853
|
-
color: "#ffffff"
|
|
85854
|
-
},
|
|
85855
|
-
children: "8-bit Overworld Map"
|
|
85856
|
-
}
|
|
85857
|
-
);
|
|
85858
|
-
};
|
|
85859
|
-
const OverworldMapPanel = ({ context: context2 }) => {
|
|
85860
|
-
var _a;
|
|
85861
|
-
const packagesSlice = context2.getSlice("packages");
|
|
85862
|
-
const packages = ((_a = packagesSlice == null ? void 0 : packagesSlice.data) == null ? void 0 : _a.packages) ?? [];
|
|
85863
|
-
const isLoading = (packagesSlice == null ? void 0 : packagesSlice.loading) || false;
|
|
85864
|
-
return /* @__PURE__ */ jsx(
|
|
85865
|
-
OverworldMapPanelContent,
|
|
85866
|
-
{
|
|
85867
|
-
packages,
|
|
85868
|
-
isLoading,
|
|
85869
|
-
includeDevDependencies: true,
|
|
85870
|
-
includePeerDependencies: false
|
|
85871
|
-
}
|
|
85872
|
-
);
|
|
85873
|
-
};
|
|
85874
87592
|
const GitProjectsMapPanelContent = ({
|
|
85875
87593
|
projects,
|
|
87594
|
+
regionLayout,
|
|
85876
87595
|
width,
|
|
85877
87596
|
height,
|
|
85878
87597
|
isLoading = false
|
|
@@ -85923,6 +87642,7 @@ const GitProjectsMapPanelContent = ({
|
|
|
85923
87642
|
OverworldMapPanelContent,
|
|
85924
87643
|
{
|
|
85925
87644
|
packages,
|
|
87645
|
+
regionLayout,
|
|
85926
87646
|
width,
|
|
85927
87647
|
height,
|
|
85928
87648
|
isLoading,
|
|
@@ -85931,165 +87651,12 @@ const GitProjectsMapPanelContent = ({
|
|
|
85931
87651
|
}
|
|
85932
87652
|
);
|
|
85933
87653
|
};
|
|
85934
|
-
const GitProjectsMapPanelPreview = () => {
|
|
85935
|
-
return /* @__PURE__ */ jsx(
|
|
85936
|
-
"div",
|
|
85937
|
-
{
|
|
85938
|
-
style: {
|
|
85939
|
-
width: "100%",
|
|
85940
|
-
height: "100%",
|
|
85941
|
-
display: "flex",
|
|
85942
|
-
alignItems: "center",
|
|
85943
|
-
justifyContent: "center",
|
|
85944
|
-
backgroundColor: "#87ceeb",
|
|
85945
|
-
fontFamily: "monospace",
|
|
85946
|
-
fontSize: 14,
|
|
85947
|
-
color: "#ffffff"
|
|
85948
|
-
},
|
|
85949
|
-
children: "Git Projects Map"
|
|
85950
|
-
}
|
|
85951
|
-
);
|
|
85952
|
-
};
|
|
85953
|
-
const GitProjectsMapPanel = ({ context: context2 }) => {
|
|
85954
|
-
const projects = useMemo(() => {
|
|
85955
|
-
return [
|
|
85956
|
-
{
|
|
85957
|
-
id: "web-ade",
|
|
85958
|
-
name: "Web ADE",
|
|
85959
|
-
path: "/projects/web-ade",
|
|
85960
|
-
category: "frontend",
|
|
85961
|
-
importance: 90,
|
|
85962
|
-
isRoot: true,
|
|
85963
|
-
dependencies: ["shared-ui", "api-client"]
|
|
85964
|
-
},
|
|
85965
|
-
{
|
|
85966
|
-
id: "shared-ui",
|
|
85967
|
-
name: "Shared UI",
|
|
85968
|
-
path: "/projects/shared-ui",
|
|
85969
|
-
category: "library",
|
|
85970
|
-
importance: 70,
|
|
85971
|
-
dependencies: []
|
|
85972
|
-
},
|
|
85973
|
-
{
|
|
85974
|
-
id: "api-client",
|
|
85975
|
-
name: "API Client",
|
|
85976
|
-
path: "/projects/api-client",
|
|
85977
|
-
category: "library",
|
|
85978
|
-
importance: 80,
|
|
85979
|
-
dependencies: ["shared-types"]
|
|
85980
|
-
},
|
|
85981
|
-
{
|
|
85982
|
-
id: "shared-types",
|
|
85983
|
-
name: "Shared Types",
|
|
85984
|
-
path: "/projects/shared-types",
|
|
85985
|
-
category: "library",
|
|
85986
|
-
importance: 60,
|
|
85987
|
-
dependencies: []
|
|
85988
|
-
},
|
|
85989
|
-
{
|
|
85990
|
-
id: "backend-api",
|
|
85991
|
-
name: "Backend API",
|
|
85992
|
-
path: "/projects/backend-api",
|
|
85993
|
-
category: "backend",
|
|
85994
|
-
importance: 95,
|
|
85995
|
-
isRoot: true,
|
|
85996
|
-
dependencies: ["database", "shared-types"]
|
|
85997
|
-
},
|
|
85998
|
-
{
|
|
85999
|
-
id: "database",
|
|
86000
|
-
name: "Database",
|
|
86001
|
-
path: "/projects/database",
|
|
86002
|
-
category: "backend",
|
|
86003
|
-
importance: 85,
|
|
86004
|
-
dependencies: []
|
|
86005
|
-
},
|
|
86006
|
-
{
|
|
86007
|
-
id: "cli-tool",
|
|
86008
|
-
name: "CLI Tool",
|
|
86009
|
-
path: "/projects/cli-tool",
|
|
86010
|
-
category: "tool",
|
|
86011
|
-
importance: 65,
|
|
86012
|
-
dependencies: ["api-client"]
|
|
86013
|
-
},
|
|
86014
|
-
{
|
|
86015
|
-
id: "docs-site",
|
|
86016
|
-
name: "Documentation",
|
|
86017
|
-
path: "/projects/docs-site",
|
|
86018
|
-
category: "frontend",
|
|
86019
|
-
importance: 50,
|
|
86020
|
-
dependencies: []
|
|
86021
|
-
},
|
|
86022
|
-
{
|
|
86023
|
-
id: "mobile-app",
|
|
86024
|
-
name: "Mobile App",
|
|
86025
|
-
path: "/projects/mobile-app",
|
|
86026
|
-
category: "frontend",
|
|
86027
|
-
importance: 85,
|
|
86028
|
-
dependencies: ["api-client", "shared-ui"]
|
|
86029
|
-
},
|
|
86030
|
-
{
|
|
86031
|
-
id: "auth-service",
|
|
86032
|
-
name: "Auth Service",
|
|
86033
|
-
path: "/projects/auth-service",
|
|
86034
|
-
category: "backend",
|
|
86035
|
-
importance: 90,
|
|
86036
|
-
dependencies: ["database"]
|
|
86037
|
-
},
|
|
86038
|
-
{
|
|
86039
|
-
id: "notification-service",
|
|
86040
|
-
name: "Notifications",
|
|
86041
|
-
path: "/projects/notification-service",
|
|
86042
|
-
category: "backend",
|
|
86043
|
-
importance: 70,
|
|
86044
|
-
dependencies: ["database", "shared-types"]
|
|
86045
|
-
},
|
|
86046
|
-
{
|
|
86047
|
-
id: "analytics",
|
|
86048
|
-
name: "Analytics",
|
|
86049
|
-
path: "/projects/analytics",
|
|
86050
|
-
category: "backend",
|
|
86051
|
-
importance: 75,
|
|
86052
|
-
dependencies: ["database"]
|
|
86053
|
-
},
|
|
86054
|
-
{
|
|
86055
|
-
id: "testing-utils",
|
|
86056
|
-
name: "Testing Utils",
|
|
86057
|
-
path: "/projects/testing-utils",
|
|
86058
|
-
category: "tool",
|
|
86059
|
-
importance: 60,
|
|
86060
|
-
dependencies: []
|
|
86061
|
-
},
|
|
86062
|
-
{
|
|
86063
|
-
id: "design-system",
|
|
86064
|
-
name: "Design System",
|
|
86065
|
-
path: "/projects/design-system",
|
|
86066
|
-
category: "library",
|
|
86067
|
-
importance: 80,
|
|
86068
|
-
dependencies: []
|
|
86069
|
-
},
|
|
86070
|
-
{
|
|
86071
|
-
id: "admin-panel",
|
|
86072
|
-
name: "Admin Panel",
|
|
86073
|
-
path: "/projects/admin-panel",
|
|
86074
|
-
category: "frontend",
|
|
86075
|
-
importance: 75,
|
|
86076
|
-
dependencies: ["api-client", "shared-ui", "design-system"]
|
|
86077
|
-
}
|
|
86078
|
-
];
|
|
86079
|
-
}, []);
|
|
86080
|
-
return /* @__PURE__ */ jsx("div", { style: { width: "100%", height: "100%", overflow: "hidden" }, children: /* @__PURE__ */ jsx(
|
|
86081
|
-
GitProjectsMapPanelContent,
|
|
86082
|
-
{
|
|
86083
|
-
projects,
|
|
86084
|
-
isLoading: false
|
|
86085
|
-
}
|
|
86086
|
-
) });
|
|
86087
|
-
};
|
|
86088
87654
|
const CollectionMapPanelContent = ({
|
|
86089
87655
|
collection,
|
|
86090
87656
|
memberships,
|
|
86091
87657
|
repositories,
|
|
86092
87658
|
dependencies = {},
|
|
87659
|
+
regionLayout,
|
|
86093
87660
|
width,
|
|
86094
87661
|
height,
|
|
86095
87662
|
isLoading = false,
|
|
@@ -86107,11 +87674,6 @@ const CollectionMapPanelContent = ({
|
|
|
86107
87674
|
return repoId === membership.repositoryId;
|
|
86108
87675
|
});
|
|
86109
87676
|
if (!repo) {
|
|
86110
|
-
console.warn("[CollectionMapPanel] No repo found for membership:", membership.repositoryId);
|
|
86111
|
-
console.log("[CollectionMapPanel] Sample repo IDs:", repositories.slice(0, 3).map((r2) => {
|
|
86112
|
-
var _a2;
|
|
86113
|
-
return ((_a2 = r2.github) == null ? void 0 : _a2.id) || r2.name;
|
|
86114
|
-
}));
|
|
86115
87677
|
return null;
|
|
86116
87678
|
}
|
|
86117
87679
|
let category;
|
|
@@ -86162,6 +87724,7 @@ const CollectionMapPanelContent = ({
|
|
|
86162
87724
|
GitProjectsMapPanelContent,
|
|
86163
87725
|
{
|
|
86164
87726
|
projects,
|
|
87727
|
+
regionLayout,
|
|
86165
87728
|
width,
|
|
86166
87729
|
height,
|
|
86167
87730
|
isLoading
|
|
@@ -87091,45 +88654,6 @@ const panels = [
|
|
|
87091
88654
|
console.log("Dependency Graph Panel unmounting");
|
|
87092
88655
|
}
|
|
87093
88656
|
},
|
|
87094
|
-
{
|
|
87095
|
-
metadata: {
|
|
87096
|
-
id: "industry-theme.overworld-map",
|
|
87097
|
-
name: "Overworld Map",
|
|
87098
|
-
icon: "Map",
|
|
87099
|
-
version: "0.1.0",
|
|
87100
|
-
author: "Industry Theme",
|
|
87101
|
-
description: "8-bit Mario-style overworld map for package dependencies",
|
|
87102
|
-
slices: ["packages"]
|
|
87103
|
-
},
|
|
87104
|
-
component: OverworldMapPanel,
|
|
87105
|
-
onMount: async (context2) => {
|
|
87106
|
-
console.log("Overworld Map Panel mounted");
|
|
87107
|
-
if (context2.hasSlice("packages") && !context2.isSliceLoading("packages")) {
|
|
87108
|
-
await context2.refresh("repository", "packages");
|
|
87109
|
-
}
|
|
87110
|
-
},
|
|
87111
|
-
onUnmount: async (_context) => {
|
|
87112
|
-
console.log("Overworld Map Panel unmounting");
|
|
87113
|
-
}
|
|
87114
|
-
},
|
|
87115
|
-
{
|
|
87116
|
-
metadata: {
|
|
87117
|
-
id: "industry-theme.git-projects-map",
|
|
87118
|
-
name: "Git Projects Map",
|
|
87119
|
-
icon: "Map",
|
|
87120
|
-
version: "0.1.0",
|
|
87121
|
-
author: "Industry Theme",
|
|
87122
|
-
description: "Visualize multiple git projects as regions on an 8-bit overworld map",
|
|
87123
|
-
slices: []
|
|
87124
|
-
},
|
|
87125
|
-
component: GitProjectsMapPanel,
|
|
87126
|
-
onMount: async (context2) => {
|
|
87127
|
-
console.log("Git Projects Map Panel mounted");
|
|
87128
|
-
},
|
|
87129
|
-
onUnmount: async (_context) => {
|
|
87130
|
-
console.log("Git Projects Map Panel unmounting");
|
|
87131
|
-
}
|
|
87132
|
-
},
|
|
87133
88657
|
{
|
|
87134
88658
|
metadata: {
|
|
87135
88659
|
id: "industry-theme.collection-map",
|
|
@@ -87180,7 +88704,7 @@ const onPackageUnload = async () => {
|
|
|
87180
88704
|
console.log("Repository Composition Panels package unloading");
|
|
87181
88705
|
};
|
|
87182
88706
|
export {
|
|
87183
|
-
|
|
88707
|
+
roundPixelsBit as $,
|
|
87184
88708
|
AbstractRenderer as A,
|
|
87185
88709
|
BindGroup as B,
|
|
87186
88710
|
Color as C,
|
|
@@ -87188,90 +88712,91 @@ export {
|
|
|
87188
88712
|
ExtensionType as E,
|
|
87189
88713
|
FillGradient as F,
|
|
87190
88714
|
GpuProgram as G,
|
|
87191
|
-
|
|
87192
|
-
|
|
87193
|
-
|
|
87194
|
-
|
|
87195
|
-
|
|
88715
|
+
UPDATE_PRIORITY as H,
|
|
88716
|
+
removeItems as I,
|
|
88717
|
+
Container as J,
|
|
88718
|
+
getTextureBatchBindGroup as K,
|
|
88719
|
+
GCManagedHash as L,
|
|
87196
88720
|
Matrix as M,
|
|
87197
|
-
|
|
87198
|
-
|
|
88721
|
+
fastCopy as N,
|
|
88722
|
+
createIdFromString as O,
|
|
87199
88723
|
Point as P,
|
|
87200
|
-
|
|
88724
|
+
CLEAR as Q,
|
|
87201
88725
|
RendererType as R,
|
|
87202
88726
|
Shader as S,
|
|
87203
88727
|
TexturePool as T,
|
|
87204
88728
|
UniformGroup as U,
|
|
87205
|
-
|
|
87206
|
-
|
|
87207
|
-
|
|
87208
|
-
|
|
87209
|
-
|
|
87210
|
-
|
|
88729
|
+
TextureSource as V,
|
|
88730
|
+
CanvasPool as W,
|
|
88731
|
+
compileHighShaderGpuProgram as X,
|
|
88732
|
+
colorBit as Y,
|
|
88733
|
+
generateTextureBatchBit as Z,
|
|
88734
|
+
localUniformBitGroup2 as _,
|
|
87211
88735
|
State as a,
|
|
87212
|
-
|
|
87213
|
-
|
|
87214
|
-
|
|
87215
|
-
|
|
87216
|
-
|
|
87217
|
-
|
|
87218
|
-
|
|
87219
|
-
|
|
87220
|
-
|
|
87221
|
-
|
|
87222
|
-
|
|
87223
|
-
|
|
87224
|
-
|
|
87225
|
-
|
|
87226
|
-
|
|
87227
|
-
|
|
87228
|
-
|
|
87229
|
-
|
|
87230
|
-
|
|
87231
|
-
|
|
87232
|
-
|
|
87233
|
-
|
|
87234
|
-
|
|
87235
|
-
|
|
87236
|
-
|
|
87237
|
-
|
|
87238
|
-
|
|
87239
|
-
|
|
87240
|
-
|
|
87241
|
-
|
|
87242
|
-
|
|
87243
|
-
|
|
87244
|
-
|
|
87245
|
-
|
|
87246
|
-
|
|
87247
|
-
|
|
87248
|
-
|
|
87249
|
-
|
|
87250
|
-
|
|
87251
|
-
|
|
87252
|
-
|
|
87253
|
-
|
|
87254
|
-
|
|
87255
|
-
|
|
87256
|
-
|
|
87257
|
-
|
|
87258
|
-
|
|
87259
|
-
|
|
87260
|
-
|
|
87261
|
-
|
|
87262
|
-
|
|
87263
|
-
|
|
87264
|
-
|
|
87265
|
-
|
|
87266
|
-
|
|
87267
|
-
|
|
87268
|
-
|
|
87269
|
-
|
|
87270
|
-
|
|
87271
|
-
|
|
87272
|
-
|
|
87273
|
-
|
|
87274
|
-
|
|
88736
|
+
CollectionMapPanelContent as a$,
|
|
88737
|
+
localUniformBit as a0,
|
|
88738
|
+
TextureMatrix as a1,
|
|
88739
|
+
DefaultBatcher as a2,
|
|
88740
|
+
BigPool as a3,
|
|
88741
|
+
getGlobalBounds as a4,
|
|
88742
|
+
FilterEffect as a5,
|
|
88743
|
+
Sprite as a6,
|
|
88744
|
+
BatchableSprite as a7,
|
|
88745
|
+
RenderGroup as a8,
|
|
88746
|
+
multiplyColors as a9,
|
|
88747
|
+
PackageCompositionPanel as aA,
|
|
88748
|
+
PackageCompositionPanelContent as aB,
|
|
88749
|
+
PackageCompositionPanelPreview as aC,
|
|
88750
|
+
SearchPanel as aD,
|
|
88751
|
+
SearchPanelContent as aE,
|
|
88752
|
+
SearchPanelPreview as aF,
|
|
88753
|
+
DependencyGraphPanel as aG,
|
|
88754
|
+
DependencyGraphPanelContent as aH,
|
|
88755
|
+
DependencyGraphPanelPreview as aI,
|
|
88756
|
+
dependencyTreeToCanvas as aJ,
|
|
88757
|
+
applyForceLayout as aK,
|
|
88758
|
+
applySugiyamaLayout as aL,
|
|
88759
|
+
OverworldMapPanelContent as aM,
|
|
88760
|
+
packagesToOverworldMap as aN,
|
|
88761
|
+
packagesToUnifiedOverworldMap as aO,
|
|
88762
|
+
packagesToOverworldMapCollection as aP,
|
|
88763
|
+
nodesToOverworldMap as aQ,
|
|
88764
|
+
nodesToUnifiedOverworldMap as aR,
|
|
88765
|
+
nodesToOverworldMapCollection as aS,
|
|
88766
|
+
gridToScreen as aT,
|
|
88767
|
+
screenToGrid as aU,
|
|
88768
|
+
MAX_NODES_PER_MAP as aV,
|
|
88769
|
+
TelemetryCoveragePanel as aW,
|
|
88770
|
+
TelemetryCoveragePanelContent as aX,
|
|
88771
|
+
TelemetryCoveragePanelPreview as aY,
|
|
88772
|
+
GitProjectsMapPanelContent as aZ,
|
|
88773
|
+
CollectionMapPanel as a_,
|
|
88774
|
+
UPDATE_VISIBLE as aa,
|
|
88775
|
+
UPDATE_COLOR as ab,
|
|
88776
|
+
UPDATE_BLEND as ac,
|
|
88777
|
+
TextureStyle as ad,
|
|
88778
|
+
Rectangle as ae,
|
|
88779
|
+
getLocalBounds as af,
|
|
88780
|
+
color32BitToUniform as ag,
|
|
88781
|
+
VERSION as ah,
|
|
88782
|
+
deprecation as ai,
|
|
88783
|
+
GlobalResourceRegistry as aj,
|
|
88784
|
+
v8_0_0 as ak,
|
|
88785
|
+
RendererInitHook as al,
|
|
88786
|
+
SystemRunner as am,
|
|
88787
|
+
checkMaxIfStatementsInShader as an,
|
|
88788
|
+
compileHighShaderGlProgram as ao,
|
|
88789
|
+
colorBitGl as ap,
|
|
88790
|
+
generateTextureBatchBitGl as aq,
|
|
88791
|
+
localUniformBitGl as ar,
|
|
88792
|
+
roundPixelsBitGl as as,
|
|
88793
|
+
getBatchSamplersUniformGroup as at,
|
|
88794
|
+
panels as au,
|
|
88795
|
+
onPackageLoad as av,
|
|
88796
|
+
onPackageUnload as aw,
|
|
88797
|
+
GitChangesPanel as ax,
|
|
88798
|
+
GitChangesPanelContent as ay,
|
|
88799
|
+
GitChangesPanelPreview as az,
|
|
87275
88800
|
GlProgram as b,
|
|
87276
88801
|
Texture as c,
|
|
87277
88802
|
Geometry as d,
|
|
@@ -87283,19 +88808,19 @@ export {
|
|
|
87283
88808
|
BufferUsage as j,
|
|
87284
88809
|
EventEmitter as k,
|
|
87285
88810
|
uid as l,
|
|
87286
|
-
|
|
87287
|
-
|
|
87288
|
-
|
|
87289
|
-
|
|
87290
|
-
|
|
87291
|
-
|
|
87292
|
-
|
|
87293
|
-
|
|
88811
|
+
canvasUtils as m,
|
|
88812
|
+
groupD8 as n,
|
|
88813
|
+
bgr2rgb as o,
|
|
88814
|
+
multiplyHexColors as p,
|
|
88815
|
+
Graphics as q,
|
|
88816
|
+
canUseNewCanvasBlendModes as r,
|
|
88817
|
+
generateTextureMatrix as s,
|
|
88818
|
+
shapeBuilders as t,
|
|
87294
88819
|
unsafeEvalSupported as u,
|
|
87295
|
-
|
|
88820
|
+
buildLine as v,
|
|
87296
88821
|
warn as w,
|
|
87297
|
-
|
|
87298
|
-
|
|
87299
|
-
|
|
88822
|
+
FillPattern as x,
|
|
88823
|
+
CanvasSource as y,
|
|
88824
|
+
Ticker as z
|
|
87300
88825
|
};
|
|
87301
|
-
//# sourceMappingURL=index-
|
|
88826
|
+
//# sourceMappingURL=index-L48T6UlC.js.map
|