@codexo/exojs-tilemap 0.18.0 → 0.19.1

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.
Files changed (75) hide show
  1. package/README.md +56 -34
  2. package/dist/esm/ChunkStreamer.d.ts.map +1 -1
  3. package/dist/esm/ChunkStreamer.js +28 -6
  4. package/dist/esm/ChunkStreamer.js.map +1 -1
  5. package/dist/esm/ImageLayer.d.ts +1 -1
  6. package/dist/esm/ImageLayer.d.ts.map +1 -1
  7. package/dist/esm/ImageLayerNode.d.ts.map +1 -1
  8. package/dist/esm/MapObject.d.ts +2 -2
  9. package/dist/esm/MapObject.d.ts.map +1 -1
  10. package/dist/esm/MapObject.js.map +1 -1
  11. package/dist/esm/MapObjectSpawner.d.ts.map +1 -1
  12. package/dist/esm/MapSpawnSession.d.ts.map +1 -1
  13. package/dist/esm/MapWorld.d.ts +8 -8
  14. package/dist/esm/MapWorld.d.ts.map +1 -1
  15. package/dist/esm/MapWorldRuntime.d.ts.map +1 -1
  16. package/dist/esm/ObjectLayer.d.ts +26 -10
  17. package/dist/esm/ObjectLayer.d.ts.map +1 -1
  18. package/dist/esm/ObjectLayer.js +28 -0
  19. package/dist/esm/ObjectLayer.js.map +1 -1
  20. package/dist/esm/SampledChunkSource.d.ts.map +1 -1
  21. package/dist/esm/TileAnimator.d.ts.map +1 -1
  22. package/dist/esm/TileChunk.d.ts.map +1 -1
  23. package/dist/esm/TileChunkNode.js +47 -10
  24. package/dist/esm/TileChunkNode.js.map +1 -1
  25. package/dist/esm/TileLayer.d.ts +11 -2
  26. package/dist/esm/TileLayer.d.ts.map +1 -1
  27. package/dist/esm/TileLayer.js +20 -10
  28. package/dist/esm/TileLayer.js.map +1 -1
  29. package/dist/esm/TileLayerNode.d.ts +6 -4
  30. package/dist/esm/TileLayerNode.d.ts.map +1 -1
  31. package/dist/esm/TileLayerNode.js +36 -21
  32. package/dist/esm/TileLayerNode.js.map +1 -1
  33. package/dist/esm/TileMap.d.ts +6 -2
  34. package/dist/esm/TileMap.d.ts.map +1 -1
  35. package/dist/esm/TileMap.js +13 -12
  36. package/dist/esm/TileMap.js.map +1 -1
  37. package/dist/esm/TileMapBand.d.ts.map +1 -1
  38. package/dist/esm/TileMapNode.d.ts.map +1 -1
  39. package/dist/esm/TileMapNode.js +4 -1
  40. package/dist/esm/TileMapNode.js.map +1 -1
  41. package/dist/esm/TileMapView.d.ts.map +1 -1
  42. package/dist/esm/TileProjection.d.ts +59 -0
  43. package/dist/esm/TileProjection.d.ts.map +1 -0
  44. package/dist/esm/TileProjection.js +106 -0
  45. package/dist/esm/TileProjection.js.map +1 -0
  46. package/dist/esm/TileSet.d.ts.map +1 -1
  47. package/dist/esm/WangSet.d.ts.map +1 -1
  48. package/dist/esm/WorkerSampledChunkSource.d.ts.map +1 -1
  49. package/dist/esm/autoTile.d.ts.map +1 -1
  50. package/dist/esm/chunkGeometry.js +78 -50
  51. package/dist/esm/chunkGeometry.js.map +1 -1
  52. package/dist/esm/index.js +2 -1
  53. package/dist/esm/projectObject.d.ts +4 -0
  54. package/dist/esm/projectObject.d.ts.map +1 -0
  55. package/dist/esm/projectObject.js +87 -0
  56. package/dist/esm/projectObject.js.map +1 -0
  57. package/dist/esm/public.d.ts +1 -0
  58. package/dist/esm/public.d.ts.map +1 -1
  59. package/dist/esm/tileCollision.d.ts +2 -2
  60. package/dist/esm/tileCollision.d.ts.map +1 -1
  61. package/dist/esm/tileCollision.js +48 -16
  62. package/dist/esm/tileCollision.js.map +1 -1
  63. package/dist/esm/tilemapSerializers.js +1 -1
  64. package/dist/esm/tilemapSerializers.js.map +1 -1
  65. package/dist/esm/types.d.ts +3 -3
  66. package/dist/esm/types.d.ts.map +1 -1
  67. package/dist/esm/webgl2/WebGl2TileChunkRenderer.js +5 -4
  68. package/dist/esm/webgl2/WebGl2TileChunkRenderer.js.map +1 -1
  69. package/dist/esm/webgl2/shaders/tile-chunk.vert.js +1 -1
  70. package/dist/esm/webgl2/shaders/tile-chunk.vert.js.map +1 -1
  71. package/dist/esm/webgpu/WebGpuTileChunkRenderer.js +63 -27
  72. package/dist/esm/webgpu/WebGpuTileChunkRenderer.js.map +1 -1
  73. package/dist/esm/webgpu/shaders/tile-chunk.wgsl.js +1 -1
  74. package/dist/esm/webgpu/shaders/tile-chunk.wgsl.js.map +1 -1
  75. package/package.json +4 -4
@@ -0,0 +1,59 @@
1
+ import type { TileMapObject } from './ObjectLayer';
2
+ /** Immutable grid geometry shared by a map and its independently usable layers. */
3
+ export interface TileProjectionOptions {
4
+ /** Orthogonal is the default. Isometric cells are diamonds with the given pixel dimensions. */
5
+ readonly orientation?: 'orthogonal' | 'isometric';
6
+ readonly tileWidth: number;
7
+ readonly tileHeight: number;
8
+ /** Display position of grid vertex (0, 0). Defaults to zero. */
9
+ readonly originX?: number;
10
+ readonly originY?: number;
11
+ }
12
+ /**
13
+ * Converts between grid vertices, display pixels and unprojected logical pixels.
14
+ * Isometric logical cells are squares of side `tileHeight`; orthogonal logical
15
+ * coordinates are display coordinates before the origin translation.
16
+ */
17
+ export declare class TileProjection {
18
+ readonly orientation: 'orthogonal' | 'isometric';
19
+ readonly tileWidth: number;
20
+ readonly tileHeight: number;
21
+ readonly originX: number;
22
+ readonly originY: number;
23
+ constructor(options: TileProjectionOptions);
24
+ /** Width of a cell in the unprojected simulation space. */
25
+ get logicalTileWidth(): number;
26
+ get logicalTileHeight(): number;
27
+ /** Maps a grid vertex, including fractional coordinates, to display pixels. */
28
+ tileToPixel(tx: number, ty: number): {
29
+ x: number;
30
+ y: number;
31
+ };
32
+ /** Picks the half-open cell containing a display point; negative cells are valid. */
33
+ pixelToTile(x: number, y: number): {
34
+ tx: number;
35
+ ty: number;
36
+ };
37
+ /** Projects a logical position; layer offsets and scene transforms are separate. */
38
+ logicalToPixel(x: number, y: number): {
39
+ x: number;
40
+ y: number;
41
+ };
42
+ /** Inverts display projection without quantizing to a cell. */
43
+ pixelToLogical(x: number, y: number): {
44
+ x: number;
45
+ y: number;
46
+ };
47
+ /** Display AABB of a cell region, excluding artwork overhang and layer offsets. */
48
+ getBounds(tx: number, ty: number, width: number, height: number): {
49
+ x: number;
50
+ y: number;
51
+ width: number;
52
+ height: number;
53
+ };
54
+ /** Projects logical object geometry; image and text dimensions stay in display pixels. */
55
+ projectObject(object: TileMapObject): TileMapObject;
56
+ /** Inverts object geometry into logical space; affine ellipses remain exact. */
57
+ unprojectObject(object: TileMapObject): TileMapObject;
58
+ }
59
+ //# sourceMappingURL=TileProjection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TileProjection.d.ts","sourceRoot":"","sources":["../../src/TileProjection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAInD,mFAAmF;AACnF,MAAM,WAAW,qBAAqB;IACpC,+FAA+F;IAC/F,QAAQ,CAAC,WAAW,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC;IAClD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,gEAAgE;IAChE,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;GAIG;AACH,qBAAa,cAAc;IACzB,SAAgB,WAAW,EAAE,YAAY,GAAG,WAAW,CAAC;IACxD,SAAgB,SAAS,EAAE,MAAM,CAAC;IAClC,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,SAAgB,OAAO,EAAE,MAAM,CAAC;IAChC,SAAgB,OAAO,EAAE,MAAM,CAAC;IAEhC,YAAmB,OAAO,EAAE,qBAAqB,EAWhD;IAED,2DAA2D;IAC3D,IAAW,gBAAgB,IAAI,MAAM,CAEpC;IAED,IAAW,iBAAiB,IAAI,MAAM,CAErC;IAED,+EAA+E;IACxE,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAInE;IAED,qFAAqF;IAC9E,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAGnE;IAED,oFAAoF;IAC7E,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAEpE;IAED,+DAA+D;IACxD,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAMpE;IAED,mFAAmF;IAC5E,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAW/H;IAED,0FAA0F;IACnF,aAAa,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,CAQzD;IAED,gFAAgF;IACzE,eAAe,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa,CAQ3D;CACF"}
@@ -0,0 +1,106 @@
1
+ import { validatePositiveInteger } from "./types.js";
2
+ import { projectObject } from "./projectObject.js";
3
+
4
+ //#region src/TileProjection.ts
5
+ /**
6
+ * Converts between grid vertices, display pixels and unprojected logical pixels.
7
+ * Isometric logical cells are squares of side `tileHeight`; orthogonal logical
8
+ * coordinates are display coordinates before the origin translation.
9
+ */
10
+ var TileProjection = class {
11
+ orientation;
12
+ tileWidth;
13
+ tileHeight;
14
+ originX;
15
+ originY;
16
+ constructor(options) {
17
+ validatePositiveInteger(options.tileWidth, "projection.tileWidth");
18
+ validatePositiveInteger(options.tileHeight, "projection.tileHeight");
19
+ this.orientation = options.orientation ?? "orthogonal";
20
+ this.tileWidth = options.tileWidth;
21
+ this.tileHeight = options.tileHeight;
22
+ this.originX = options.originX ?? 0;
23
+ this.originY = options.originY ?? 0;
24
+ if (!Number.isFinite(this.originX) || !Number.isFinite(this.originY)) throw new Error("TileProjection origin must be finite.");
25
+ }
26
+ /** Width of a cell in the unprojected simulation space. */
27
+ get logicalTileWidth() {
28
+ return this.orientation === "isometric" ? this.tileHeight : this.tileWidth;
29
+ }
30
+ get logicalTileHeight() {
31
+ return this.tileHeight;
32
+ }
33
+ /** Maps a grid vertex, including fractional coordinates, to display pixels. */
34
+ tileToPixel(tx, ty) {
35
+ return this.orientation === "isometric" ? {
36
+ x: this.originX + (tx - ty) * this.tileWidth / 2,
37
+ y: this.originY + (tx + ty) * this.tileHeight / 2
38
+ } : {
39
+ x: this.originX + tx * this.tileWidth,
40
+ y: this.originY + ty * this.tileHeight
41
+ };
42
+ }
43
+ /** Picks the half-open cell containing a display point; negative cells are valid. */
44
+ pixelToTile(x, y) {
45
+ const logical = this.pixelToLogical(x, y);
46
+ return {
47
+ tx: Math.floor(logical.x / this.logicalTileWidth),
48
+ ty: Math.floor(logical.y / this.logicalTileHeight)
49
+ };
50
+ }
51
+ /** Projects a logical position; layer offsets and scene transforms are separate. */
52
+ logicalToPixel(x, y) {
53
+ return this.tileToPixel(x / this.logicalTileWidth, y / this.logicalTileHeight);
54
+ }
55
+ /** Inverts display projection without quantizing to a cell. */
56
+ pixelToLogical(x, y) {
57
+ const dx = x - this.originX;
58
+ const dy = y - this.originY;
59
+ return this.orientation === "isometric" ? {
60
+ x: dy + dx * this.tileHeight / this.tileWidth,
61
+ y: dy - dx * this.tileHeight / this.tileWidth
62
+ } : {
63
+ x: dx,
64
+ y: dy
65
+ };
66
+ }
67
+ /** Display AABB of a cell region, excluding artwork overhang and layer offsets. */
68
+ getBounds(tx, ty, width, height) {
69
+ const top = this.tileToPixel(tx, ty);
70
+ if (this.orientation === "orthogonal") return {
71
+ ...top,
72
+ width: width * this.tileWidth,
73
+ height: height * this.tileHeight
74
+ };
75
+ return {
76
+ x: top.x - height * this.tileWidth / 2,
77
+ y: top.y,
78
+ width: (width + height) * this.tileWidth / 2,
79
+ height: (width + height) * this.tileHeight / 2
80
+ };
81
+ }
82
+ /** Projects logical object geometry; image and text dimensions stay in display pixels. */
83
+ projectObject(object) {
84
+ if (this.orientation === "orthogonal") return object.kind === "tile" ? projectObject(object, 1, 0, 0, 1, this.originX, this.originY) : {
85
+ ...object,
86
+ x: object.x + this.originX,
87
+ y: object.y + this.originY
88
+ };
89
+ const ratio = this.tileWidth / (2 * this.tileHeight);
90
+ return projectObject(object, ratio, .5, -ratio, .5, this.originX, this.originY);
91
+ }
92
+ /** Inverts object geometry into logical space; affine ellipses remain exact. */
93
+ unprojectObject(object) {
94
+ if (this.orientation === "orthogonal") return object.kind === "tile" ? projectObject(object, 1, 0, 0, 1, -this.originX, -this.originY) : {
95
+ ...object,
96
+ x: object.x - this.originX,
97
+ y: object.y - this.originY
98
+ };
99
+ const ratio = this.tileHeight / this.tileWidth;
100
+ return projectObject(object, ratio, -ratio, 1, 1, -this.originY - this.originX * ratio, -this.originY + this.originX * ratio);
101
+ }
102
+ };
103
+
104
+ //#endregion
105
+ export { TileProjection };
106
+ //# sourceMappingURL=TileProjection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TileProjection.js","names":[],"sources":["../../src/TileProjection.ts"],"sourcesContent":["import type { TileMapObject } from './ObjectLayer';\nimport { projectObject } from './projectObject';\nimport { validatePositiveInteger } from './types';\n\n/** Immutable grid geometry shared by a map and its independently usable layers. */\nexport interface TileProjectionOptions {\n /** Orthogonal is the default. Isometric cells are diamonds with the given pixel dimensions. */\n readonly orientation?: 'orthogonal' | 'isometric';\n readonly tileWidth: number;\n readonly tileHeight: number;\n /** Display position of grid vertex (0, 0). Defaults to zero. */\n readonly originX?: number;\n readonly originY?: number;\n}\n\n/**\n * Converts between grid vertices, display pixels and unprojected logical pixels.\n * Isometric logical cells are squares of side `tileHeight`; orthogonal logical\n * coordinates are display coordinates before the origin translation.\n */\nexport class TileProjection {\n public readonly orientation: 'orthogonal' | 'isometric';\n public readonly tileWidth: number;\n public readonly tileHeight: number;\n public readonly originX: number;\n public readonly originY: number;\n\n public constructor(options: TileProjectionOptions) {\n validatePositiveInteger(options.tileWidth, 'projection.tileWidth');\n validatePositiveInteger(options.tileHeight, 'projection.tileHeight');\n this.orientation = options.orientation ?? 'orthogonal';\n this.tileWidth = options.tileWidth;\n this.tileHeight = options.tileHeight;\n this.originX = options.originX ?? 0;\n this.originY = options.originY ?? 0;\n if (!Number.isFinite(this.originX) || !Number.isFinite(this.originY)) {\n throw new Error('TileProjection origin must be finite.');\n }\n }\n\n /** Width of a cell in the unprojected simulation space. */\n public get logicalTileWidth(): number {\n return this.orientation === 'isometric' ? this.tileHeight : this.tileWidth;\n }\n\n public get logicalTileHeight(): number {\n return this.tileHeight;\n }\n\n /** Maps a grid vertex, including fractional coordinates, to display pixels. */\n public tileToPixel(tx: number, ty: number): { x: number; y: number } {\n return this.orientation === 'isometric'\n ? { x: this.originX + ((tx - ty) * this.tileWidth) / 2, y: this.originY + ((tx + ty) * this.tileHeight) / 2 }\n : { x: this.originX + tx * this.tileWidth, y: this.originY + ty * this.tileHeight };\n }\n\n /** Picks the half-open cell containing a display point; negative cells are valid. */\n public pixelToTile(x: number, y: number): { tx: number; ty: number } {\n const logical = this.pixelToLogical(x, y);\n return { tx: Math.floor(logical.x / this.logicalTileWidth), ty: Math.floor(logical.y / this.logicalTileHeight) };\n }\n\n /** Projects a logical position; layer offsets and scene transforms are separate. */\n public logicalToPixel(x: number, y: number): { x: number; y: number } {\n return this.tileToPixel(x / this.logicalTileWidth, y / this.logicalTileHeight);\n }\n\n /** Inverts display projection without quantizing to a cell. */\n public pixelToLogical(x: number, y: number): { x: number; y: number } {\n const dx = x - this.originX;\n const dy = y - this.originY;\n return this.orientation === 'isometric'\n ? { x: dy + (dx * this.tileHeight) / this.tileWidth, y: dy - (dx * this.tileHeight) / this.tileWidth }\n : { x: dx, y: dy };\n }\n\n /** Display AABB of a cell region, excluding artwork overhang and layer offsets. */\n public getBounds(tx: number, ty: number, width: number, height: number): { x: number; y: number; width: number; height: number } {\n const top = this.tileToPixel(tx, ty);\n if (this.orientation === 'orthogonal') {\n return { ...top, width: width * this.tileWidth, height: height * this.tileHeight };\n }\n return {\n x: top.x - (height * this.tileWidth) / 2,\n y: top.y,\n width: ((width + height) * this.tileWidth) / 2,\n height: ((width + height) * this.tileHeight) / 2,\n };\n }\n\n /** Projects logical object geometry; image and text dimensions stay in display pixels. */\n public projectObject(object: TileMapObject): TileMapObject {\n if (this.orientation === 'orthogonal') {\n return object.kind === 'tile'\n ? projectObject(object, 1, 0, 0, 1, this.originX, this.originY)\n : { ...object, x: object.x + this.originX, y: object.y + this.originY };\n }\n const ratio = this.tileWidth / (2 * this.tileHeight);\n return projectObject(object, ratio, 0.5, -ratio, 0.5, this.originX, this.originY);\n }\n\n /** Inverts object geometry into logical space; affine ellipses remain exact. */\n public unprojectObject(object: TileMapObject): TileMapObject {\n if (this.orientation === 'orthogonal') {\n return object.kind === 'tile'\n ? projectObject(object, 1, 0, 0, 1, -this.originX, -this.originY)\n : { ...object, x: object.x - this.originX, y: object.y - this.originY };\n }\n const ratio = this.tileHeight / this.tileWidth;\n return projectObject(object, ratio, -ratio, 1, 1, -this.originY - this.originX * ratio, -this.originY + this.originX * ratio);\n }\n}\n"],"mappings":";;;;;;;;;AAoBA,IAAa,iBAAb,MAA4B;CAC1B,AAAgB;CAChB,AAAgB;CAChB,AAAgB;CAChB,AAAgB;CAChB,AAAgB;CAEhB,AAAO,YAAY,SAAgC;EACjD,wBAAwB,QAAQ,WAAW,sBAAsB;EACjE,wBAAwB,QAAQ,YAA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EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEjD;IAED;;;;;OAKG;IACI,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAE5C;IAED,4DAA4D;IAC5D,IAAW,OAAO,IAAI,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAEhD;IAED,wEAAwE;IACxE,IAAW,OAAO,IAAI,WAAW,CAAC,MAAM,CAAC,CAExC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"WorkerSampledChunkSource.d.ts","sourceRoot":"","sources":["../../src/WorkerSampledChunkSource.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5C;;;GAGG;AACH,MAAM,WAAW,+BAA+B;IAC9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;;;OAOG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAAC;CAC5E;AAiCD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,8BAA8B,GAAI,OAAO,SAAS,EAAE,SAAS,+BAA+B,KAAG,WAAW,GAAG;IAAE,OAAO,IAAI,IAAI,CAAA;CA0F1I,CAAC"}
1
+ {"version":3,"file":"WorkerSampledChunkSource.d.ts","sourceRoot":"","sources":["../../src/WorkerSampledChunkSource.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,C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AAG,MAAM,EAAE,GAAG,MAAM,EAAE,SAAS,OAAO,EAAE,UAAU,eAAe,KAAG,IA0BjH,CAAC"}
1
+ {"version":3,"file":"autoTile.d.ts","sourceRoot":"","sources":["../../src/autoTile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;IACvF;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AA0ED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,QAAQ,UAAW,SAAS,WAAW,OAAO,YAAY,eAAe,KAAG,IAuDxF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,WAAW,UAAW,SAAS,KAAK,MAAM,KAAK,MAAM,WAAW,OAAO,YAAY,eAAe,KAAG,IA0BjH,CAAC"}
@@ -4,10 +4,46 @@ import { unpackTile } from "./types.js";
4
4
  /** Pack a {@link TileTransform} into a 3-bit orientation code. @internal */
5
5
  const orientCode = (transform) => (transform.flipX ? 1 : 0) | (transform.flipY ? 2 : 0) | (transform.diagonal ? 4 : 0);
6
6
  let tileGeometryRebuildCount = 0;
7
+ const drawableTileset = (tilesets, tilesetIndex, localTileId) => {
8
+ const tileset = tilesets[tilesetIndex];
9
+ if (tileset === void 0 || localTileId >= tileset.tileCount) return void 0;
10
+ const texture = tileset.texture.texture;
11
+ if (texture.width <= 0 || texture.height <= 0) return void 0;
12
+ return tileset;
13
+ };
14
+ const pageQuads = (tileset, isometric, buckets, ordered) => {
15
+ let bucket;
16
+ if (isometric) {
17
+ const previous = ordered[ordered.length - 1];
18
+ if (previous?.tileset === tileset) bucket = previous.quads;
19
+ } else bucket = buckets.get(tileset);
20
+ if (bucket === void 0) {
21
+ bucket = [];
22
+ buckets.set(tileset, bucket);
23
+ if (isometric) ordered.push({
24
+ tileset,
25
+ texture: tileset.texture.texture,
26
+ quads: bucket
27
+ });
28
+ }
29
+ return bucket;
30
+ };
31
+ const tilesetPages = (tilesets, buckets) => {
32
+ const pages = [];
33
+ for (const tileset of tilesets) {
34
+ const quads = buckets.get(tileset);
35
+ if (quads !== void 0 && quads.length > 0) pages.push({
36
+ tileset,
37
+ texture: tileset.texture.texture,
38
+ quads
39
+ });
40
+ }
41
+ return pages;
42
+ };
7
43
  /**
8
44
  * Build per-tileset page geometry for a single chunk.
9
45
  *
10
- * Iterates the chunk's packed cells in deterministic row-major order, skipping
46
+ * Iterates packed cells in row-major or isometric diagonal order, skipping
11
47
  * empties, out-of-range tilesets, and out-of-range local tile ids (all treated
12
48
  * as empty - this is the renderer's half of the G-GID contract). Each surviving
13
49
  * cell is resolved to its source UV rect (from `tileset.getTileRect` + the
@@ -25,62 +61,54 @@ let tileGeometryRebuildCount = 0;
25
61
  * @param tileHeight Map/layer tile cell height in pixels.
26
62
  * @internal
27
63
  */
28
- const buildChunkPages = (chunk, tilesets, tileWidth, tileHeight) => {
64
+ const buildChunkPages = (chunk, tilesets, tileWidth, tileHeight, projection, diagonal, geometryX = 0, geometryY = 0) => {
29
65
  tileGeometryRebuildCount++;
30
66
  if (chunk.empty) return [];
31
67
  const buckets = /* @__PURE__ */ new Map();
68
+ const ordered = [];
69
+ const isometric = projection?.orientation === "isometric";
32
70
  const width = chunk.width;
33
71
  const height = chunk.height;
34
- for (let ly = 0; ly < height; ly++) for (let lx = 0; lx < width; lx++) {
35
- const packed = chunk.getRawAt(lx, ly);
36
- if (packed === 0) continue;
37
- const decoded = unpackTile(packed);
38
- if (decoded === null) continue;
39
- const tileset = tilesets[decoded.tilesetIndex];
40
- if (tileset === void 0 || decoded.localTileId >= tileset.tileCount) continue;
41
- const region = tileset.texture;
42
- const texture = region.texture;
43
- const textureWidth = texture.width;
44
- const textureHeight = texture.height;
45
- if (textureWidth <= 0 || textureHeight <= 0) continue;
46
- const rect = tileset.getTileRect(decoded.localTileId);
47
- const sx = region.x + rect.x;
48
- const sy = region.y + rect.y;
49
- const u0 = sx / textureWidth;
50
- const v0 = sy / textureHeight;
51
- const u1 = (sx + rect.width) / textureWidth;
52
- const v1 = (sy + rect.height) / textureHeight;
53
- const x0 = lx * tileWidth + tileset.offsetX;
54
- const y0 = ly * tileHeight + tileHeight - rect.height + tileset.offsetY;
55
- const x1 = x0 + rect.width;
56
- const y1 = y0 + rect.height;
57
- let bucket = buckets.get(tileset);
58
- if (bucket === void 0) {
59
- bucket = [];
60
- buckets.set(tileset, bucket);
72
+ for (let row = 0; row < (isometric ? width + height - 1 : height); row++) {
73
+ if (diagonal !== void 0 && row !== diagonal) continue;
74
+ for (let lx = 0; lx < width; lx++) {
75
+ const ly = isometric ? row - lx : row;
76
+ if (ly < 0 || ly >= height) continue;
77
+ const packed = chunk.getRawAt(lx, ly);
78
+ if (packed === 0) continue;
79
+ const decoded = unpackTile(packed);
80
+ if (decoded === null) continue;
81
+ const tileset = drawableTileset(tilesets, decoded.tilesetIndex, decoded.localTileId);
82
+ if (tileset === void 0) continue;
83
+ const region = tileset.texture;
84
+ const texture = region.texture;
85
+ const textureWidth = texture.width;
86
+ const textureHeight = texture.height;
87
+ const rect = tileset.getTileRect(decoded.localTileId);
88
+ const sx = region.x + rect.x;
89
+ const sy = region.y + rect.y;
90
+ const u0 = sx / textureWidth;
91
+ const v0 = sy / textureHeight;
92
+ const u1 = (sx + rect.width) / textureWidth;
93
+ const v1 = (sy + rect.height) / textureHeight;
94
+ const x0 = geometryX + (isometric ? (lx - ly) * tileWidth / 2 - tileWidth / 2 : lx * tileWidth) + tileset.offsetX;
95
+ const y0 = geometryY + (isometric ? (lx + ly) * tileHeight / 2 : ly * tileHeight) + tileHeight - rect.height + tileset.offsetY;
96
+ const x1 = x0 + rect.width;
97
+ const y1 = y0 + rect.height;
98
+ pageQuads(tileset, isometric, buckets, ordered).push({
99
+ x0,
100
+ y0,
101
+ x1,
102
+ y1,
103
+ u0,
104
+ v0,
105
+ u1,
106
+ v1,
107
+ orient: orientCode(decoded.transform)
108
+ });
61
109
  }
62
- bucket.push({
63
- x0,
64
- y0,
65
- x1,
66
- y1,
67
- u0,
68
- v0,
69
- u1,
70
- v1,
71
- orient: orientCode(decoded.transform)
72
- });
73
- }
74
- const pages = [];
75
- for (const tileset of tilesets) {
76
- const quads = buckets.get(tileset);
77
- if (quads !== void 0 && quads.length > 0) pages.push({
78
- tileset,
79
- texture: tileset.texture.texture,
80
- quads
81
- });
82
110
  }
83
- return pages;
111
+ return isometric ? ordered : tilesetPages(tilesets, buckets);
84
112
  };
85
113
 
86
114
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"chunkGeometry.js","names":[],"sources":["../../src/chunkGeometry.ts"],"sourcesContent":["import type { Texture } from '@codexo/exojs';\n\nimport type { ReadonlyTileChunk } from './TileChunk';\nimport type { TileSet } from './TileSet';\nimport type { TileTransform } from './types';\nimport { unpackTile } from './types';\n\n/**\n * One textured tile quad in chunk-local pixel space.\n *\n * `u0/v0/u1/v1` are the raw (min/max) source UV bounds of the tile within its\n * tileset texture - flip/orientation is **not** baked here; it travels in\n * {@link TileQuad.orient} and is applied by the per-backend renderer (flipX/Y\n * via UV-corner swap, diagonal via an axis swap in the shader). Keeping the\n * geometry orientation-neutral lets both backends share one CPU builder.\n * @internal\n */\nexport interface TileQuad {\n /** Local destination rect, left/top (chunk-local pixels). */\n readonly x0: number;\n readonly y0: number;\n /** Local destination rect, right/bottom (chunk-local pixels). */\n readonly x1: number;\n readonly y1: number;\n /** Normalised source UV bounds (always min ≤ max). */\n readonly u0: number;\n readonly v0: number;\n readonly u1: number;\n readonly v1: number;\n /** Orientation code: bit0 = flipX, bit1 = flipY, bit2 = diagonal. */\n readonly orient: number;\n}\n\n/**\n * Geometry for one tileset \"page\" within a chunk: every tile in the chunk that\n * draws from a single tileset texture, grouped so the renderer can batch by\n * `(shader, texture)`.\n * @internal\n */\nexport interface ChunkPage {\n /** The tileset all quads in this page draw from. */\n readonly tileset: TileSet;\n /** The underlying GPU texture (the tileset's atlas), bound once per page. */\n readonly texture: Texture;\n /** The tile quads for this page, in deterministic row-major order. */\n readonly quads: readonly TileQuad[];\n}\n\n/** Pack a {@link TileTransform} into a 3-bit orientation code. @internal */\nexport const orientCode = (transform: TileTransform): number => (transform.flipX ? 1 : 0) | (transform.flipY ? 2 : 0) | (transform.diagonal ? 4 : 0);\n\n// Test/perf-only instrumentation: counts CPU chunk-geometry rebuilds. A rebuild\n// happens once per {@link buildChunkPages} call - i.e. when a chunk node sees a\n// changed `chunk.revision`. Lets benchmarks/regression tests assert that a camera\n// pan rebuilds nothing and a single tile mutation rebuilds exactly one chunk.\n// Near-zero cost (one integer increment on the already-expensive rebuild path).\nlet tileGeometryRebuildCount = 0;\n\n/** Read the cumulative chunk-geometry rebuild count. @internal */\nexport const getTileGeometryRebuildCount = (): number => tileGeometryRebuildCount;\n\n/** Reset the chunk-geometry rebuild counter (call before a measured frame). @internal */\nexport const resetTileGeometryRebuildCount = (): void => {\n tileGeometryRebuildCount = 0;\n};\n\n/**\n * Build per-tileset page geometry for a single chunk.\n *\n * Iterates the chunk's packed cells in deterministic row-major order, skipping\n * empties, out-of-range tilesets, and out-of-range local tile ids (all treated\n * as empty - this is the renderer's half of the G-GID contract). Each surviving\n * cell is resolved to its source UV rect (from `tileset.getTileRect` + the\n * tileset `TextureRegion`) and a chunk-local destination rect (bottom-left\n * aligned per Tiled orthogonal semantics, so tilesets whose tiles are taller\n * than the map grid extend upward).\n *\n * Allocation happens here only - the result is cached on the owning\n * {@link import('./TileChunkNode').TileChunkNode} keyed by `chunk.revision`, so\n * unchanged chunks never rebuild and the per-frame path stays allocation-free.\n *\n * @param chunk The readonly chunk view to build from.\n * @param tilesets The layer's tileset array (packed `tilesetIndex` selects one).\n * @param tileWidth Map/layer tile cell width in pixels.\n * @param tileHeight Map/layer tile cell height in pixels.\n * @internal\n */\nexport const buildChunkPages = (chunk: ReadonlyTileChunk, tilesets: readonly TileSet[], tileWidth: number, tileHeight: number): ChunkPage[] => {\n tileGeometryRebuildCount++;\n\n if (chunk.empty) {\n return [];\n }\n\n const buckets = new Map<TileSet, TileQuad[]>();\n const width = chunk.width;\n const height = chunk.height;\n\n for (let ly = 0; ly < height; ly++) {\n for (let lx = 0; lx < width; lx++) {\n const packed = chunk.getRawAt(lx, ly);\n\n if (packed === 0) {\n continue;\n }\n\n const decoded = unpackTile(packed);\n\n if (decoded === null) {\n continue;\n }\n\n const tileset = tilesets[decoded.tilesetIndex];\n\n // Out-of-range tileset or local id → treat as empty (G-GID). getTileRect\n // throws on an out-of-range id, so the bounds check must precede it.\n if (tileset === undefined || decoded.localTileId >= tileset.tileCount) {\n continue;\n }\n\n const region = tileset.texture;\n const texture = region.texture;\n const textureWidth = texture.width;\n const textureHeight = texture.height;\n\n if (textureWidth <= 0 || textureHeight <= 0) {\n continue;\n }\n\n const rect = tileset.getTileRect(decoded.localTileId);\n\n // Absolute source pixel rect = tileset-region offset + in-atlas tile rect.\n const sx = region.x + rect.x;\n const sy = region.y + rect.y;\n // Exact tile UVs, no half-texel inset. This assumes NEAREST filtering on\n // the tileset atlas (the typical pixel-art case). Under LINEAR/mipmap\n // filtering an atlas WITHOUT extrusion padding can bleed neighbouring\n // tiles at the edges; author tilesets with extruded margins for linear\n // sampling. (Extrusion-aware tilemap UV insetting - already done on the\n // NineSlice/RepeatingSprite geometry paths - is a v0.14 follow-up.)\n const u0 = sx / textureWidth;\n const v0 = sy / textureHeight;\n const u1 = (sx + rect.width) / textureWidth;\n const v1 = (sy + rect.height) / textureHeight;\n\n // Bottom-left aligned destination (Tiled orthogonal). Uniform tiles\n // (rect.height === tileHeight) collapse to a plain cell rect. The\n // tileset's visual draw offset (Tiled `tileoffset`) shifts every tile.\n const x0 = lx * tileWidth + tileset.offsetX;\n const y0 = ly * tileHeight + tileHeight - rect.height + tileset.offsetY;\n const x1 = x0 + rect.width;\n const y1 = y0 + rect.height;\n\n let bucket = buckets.get(tileset);\n\n if (bucket === undefined) {\n bucket = [];\n buckets.set(tileset, bucket);\n }\n\n bucket.push({ x0, y0, x1, y1, u0, v0, u1, v1, orient: orientCode(decoded.transform) });\n }\n }\n\n // Emit pages in tileset-array order for deterministic, reproducible builds.\n const pages: ChunkPage[] = [];\n\n for (const tileset of tilesets) {\n const quads = buckets.get(tileset);\n\n if (quads !== undefined && quads.length > 0) {\n pages.push({ tileset, texture: tileset.texture.texture, quads });\n }\n }\n\n return pages;\n};\n"],"mappings":";;;;AAiDA,MAAa,cAAc,eAAsC,UAAU,QAAQ,IAAI,MAAM,UAAU,QAAQ,IAAI,MAAM,UAAU,WAAW,IAAI;AAOlJ,IAAI,2BAA2B;;;;;;;;;;;;;;;;;;;;;;AA+B/B,MAAa,mBAAmB,OAA0B,UAA8B,WAAmB,eAAoC;CAC7I;CAEA,IAAI,MAAM,OACR,OAAO,CAAC;CAGV,MAAM,0BAAU,IAAI,IAAyB;CAC7C,MAAM,QAAQ,MAAM;CACpB,MAAM,SAAS,MAAM;CAErB,KAAK,IAAI,KAAK,GAAG,KAAK,QAAQ,MAC5B,KAAK,IAAI,KAAK,GAAG,KAAK,OAAO,MAAM;EACjC,MAAM,SAAS,MAAM,SAAS,IAAI,EAAE;EAEpC,IAAI,WAAW,GACb;EAGF,MAAM,UAAU,WAAW,MAAM;EAEjC,IAAI,YAAY,MACd;EAGF,MAAM,UAAU,SAAS,QAAQ;EAIjC,IAAI,YAAY,UAAa,QAAQ,eAAe,QAAQ,WAC1D;EAGF,MAAM,SAAS,QAAQ;EACvB,MAAM,UAAU,OAAO;EACvB,MAAM,eAAe,QAAQ;EAC7B,MAAM,gBAAgB,QAAQ;EAE9B,IAAI,gBAAgB,KAAK,iBAAiB,GACxC;EAGF,MAAM,OAAO,QAAQ,YAAY,QAAQ,WAAW;EAGpD,MAAM,KAAK,OAAO,IAAI,KAAK;EAC3B,MAAM,KAAK,OAAO,IAAI,KAAK;EAO3B,MAAM,KAAK,KAAK;EAChB,MAAM,KAAK,KAAK;EAChB,MAAM,MAAM,KAAK,KAAK,SAAS;EAC/B,MAAM,MAAM,KAAK,KAAK,UAAU;EAKhC,MAAM,KAAK,KAAK,YAAY,QAAQ;EACpC,MAAM,KAAK,KAAK,aAAa,aAAa,KAAK,SAAS,QAAQ;EAChE,MAAM,KAAK,KAAK,KAAK;EACrB,MAAM,KAAK,KAAK,KAAK;EAErB,IAAI,SAAS,QAAQ,IAAI,OAAO;EAEhC,IAAI,WAAW,QAAW;GACxB,SAAS,CAAC;GACV,QAAQ,IAAI,SAAS,MAAM;EAC7B;EAEA,OAAO,KAAK;GAAE;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI;GAAI,QAAQ,WAAW,QAAQ,SAAS;EAAE,CAAC;CACvF;CAIF,MAAM,QAAqB,CAAC;CAE5B,KAAK,MAAM,WAAW,UAAU;EAC9B,MAAM,QAAQ,QAAQ,IAAI,OAAO;EAEjC,IAAI,UAAU,UAAa,MAAM,SAAS,GACxC,MAAM,KAAK;GAAE;GAAS,SAAS,QAAQ,QAAQ;GAAS;EAAM,CAAC;CAEnE;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"chunkGeometry.js","names":[],"sources":["../../src/chunkGeometry.ts"],"sourcesContent":["import type { Texture } from '@codexo/exojs';\n\nimport type { ReadonlyTileChunk } from './TileChunk';\nimport type { TileProjection } from './TileProjection';\nimport type { TileSet } from './TileSet';\nimport type { TileTransform } from './types';\nimport { unpackTile } from './types';\n\n/**\n * One textured tile quad in chunk-local pixel space.\n *\n * `u0/v0/u1/v1` are the raw (min/max) source UV bounds of the tile within its\n * tileset texture - flip/orientation is **not** baked here; it travels in\n * {@link TileQuad.orient} and is applied by the per-backend renderer (flipX/Y\n * via UV-corner swap, diagonal via an axis swap in the shader). Keeping the\n * geometry orientation-neutral lets both backends share one CPU builder.\n * @internal\n */\nexport interface TileQuad {\n /** Local destination rect, left/top (chunk-local pixels). */\n readonly x0: number;\n readonly y0: number;\n /** Local destination rect, right/bottom (chunk-local pixels). */\n readonly x1: number;\n readonly y1: number;\n /** Normalised source UV bounds (always min ≤ max). */\n readonly u0: number;\n readonly v0: number;\n readonly u1: number;\n readonly v1: number;\n /** Orientation code: bit0 = flipX, bit1 = flipY, bit2 = diagonal. */\n readonly orient: number;\n}\n\n/**\n * Geometry sharing one tileset texture. Orthogonal chunks group tiles by\n * tileset; isometric chunks keep consecutive runs to preserve painter order.\n * @internal\n */\nexport interface ChunkPage {\n /** The tileset all quads in this page draw from. */\n readonly tileset: TileSet;\n /** The underlying GPU texture (the tileset's atlas), bound once per page. */\n readonly texture: Texture;\n /** The tile quads in deterministic projection-specific draw order. */\n readonly quads: readonly TileQuad[];\n}\n\n/** Pack a {@link TileTransform} into a 3-bit orientation code. @internal */\nexport const orientCode = (transform: TileTransform): number => (transform.flipX ? 1 : 0) | (transform.flipY ? 2 : 0) | (transform.diagonal ? 4 : 0);\n\n// Test/perf-only instrumentation: counts CPU chunk-geometry rebuilds. A rebuild\n// happens once per {@link buildChunkPages} call - i.e. when a chunk node sees a\n// changed `chunk.revision`. Lets benchmarks/regression tests assert that a camera\n// pan rebuilds nothing and a single tile mutation rebuilds exactly one chunk.\n// Near-zero cost (one integer increment on the already-expensive rebuild path).\nlet tileGeometryRebuildCount = 0;\n\n/** Read the cumulative chunk-geometry rebuild count. @internal */\nexport const getTileGeometryRebuildCount = (): number => tileGeometryRebuildCount;\n\n/** Reset the chunk-geometry rebuild counter (call before a measured frame). @internal */\nexport const resetTileGeometryRebuildCount = (): void => {\n tileGeometryRebuildCount = 0;\n};\n\nconst drawableTileset = (tilesets: readonly TileSet[], tilesetIndex: number, localTileId: number): TileSet | undefined => {\n const tileset = tilesets[tilesetIndex];\n\n // getTileRect throws for an invalid id; malformed cells must remain empty.\n if (tileset === undefined || localTileId >= tileset.tileCount) return undefined;\n const texture = tileset.texture.texture;\n if (texture.width <= 0 || texture.height <= 0) return undefined;\n return tileset;\n};\n\nconst pageQuads = (tileset: TileSet, isometric: boolean, buckets: Map<TileSet, TileQuad[]>, ordered: ChunkPage[]): TileQuad[] => {\n let bucket: TileQuad[] | undefined;\n if (isometric) {\n const previous = ordered[ordered.length - 1];\n if (previous?.tileset === tileset) bucket = previous.quads as TileQuad[];\n } else {\n bucket = buckets.get(tileset);\n }\n\n if (bucket === undefined) {\n bucket = [];\n buckets.set(tileset, bucket);\n if (isometric) ordered.push({ tileset, texture: tileset.texture.texture, quads: bucket });\n }\n return bucket;\n};\n\nconst tilesetPages = (tilesets: readonly TileSet[], buckets: ReadonlyMap<TileSet, TileQuad[]>): ChunkPage[] => {\n const pages: ChunkPage[] = [];\n for (const tileset of tilesets) {\n const quads = buckets.get(tileset);\n if (quads !== undefined && quads.length > 0) {\n pages.push({ tileset, texture: tileset.texture.texture, quads });\n }\n }\n return pages;\n};\n\n/**\n * Build per-tileset page geometry for a single chunk.\n *\n * Iterates packed cells in row-major or isometric diagonal order, skipping\n * empties, out-of-range tilesets, and out-of-range local tile ids (all treated\n * as empty - this is the renderer's half of the G-GID contract). Each surviving\n * cell is resolved to its source UV rect (from `tileset.getTileRect` + the\n * tileset `TextureRegion`) and a chunk-local destination rect (bottom-left\n * aligned per Tiled orthogonal semantics, so tilesets whose tiles are taller\n * than the map grid extend upward).\n *\n * Allocation happens here only - the result is cached on the owning\n * {@link import('./TileChunkNode').TileChunkNode} keyed by `chunk.revision`, so\n * unchanged chunks never rebuild and the per-frame path stays allocation-free.\n *\n * @param chunk The readonly chunk view to build from.\n * @param tilesets The layer's tileset array (packed `tilesetIndex` selects one).\n * @param tileWidth Map/layer tile cell width in pixels.\n * @param tileHeight Map/layer tile cell height in pixels.\n * @internal\n */\nexport const buildChunkPages = (\n chunk: ReadonlyTileChunk,\n tilesets: readonly TileSet[],\n tileWidth: number,\n tileHeight: number,\n projection?: TileProjection,\n diagonal?: number,\n geometryX = 0,\n geometryY = 0,\n): ChunkPage[] => {\n tileGeometryRebuildCount++;\n\n if (chunk.empty) {\n return [];\n }\n\n const buckets = new Map<TileSet, TileQuad[]>();\n const ordered: ChunkPage[] = [];\n const isometric = projection?.orientation === 'isometric';\n const width = chunk.width;\n const height = chunk.height;\n\n for (let row = 0; row < (isometric ? width + height - 1 : height); row++) {\n if (diagonal !== undefined && row !== diagonal) continue;\n for (let lx = 0; lx < width; lx++) {\n const ly = isometric ? row - lx : row;\n if (ly < 0 || ly >= height) continue;\n const packed = chunk.getRawAt(lx, ly);\n\n if (packed === 0) {\n continue;\n }\n\n const decoded = unpackTile(packed);\n\n if (decoded === null) {\n continue;\n }\n\n const tileset = drawableTileset(tilesets, decoded.tilesetIndex, decoded.localTileId);\n if (tileset === undefined) {\n continue;\n }\n\n const region = tileset.texture;\n const texture = region.texture;\n const textureWidth = texture.width;\n const textureHeight = texture.height;\n\n const rect = tileset.getTileRect(decoded.localTileId);\n\n // Absolute source pixel rect = tileset-region offset + in-atlas tile rect.\n const sx = region.x + rect.x;\n const sy = region.y + rect.y;\n // Exact tile UVs, no half-texel inset. This assumes NEAREST filtering on\n // the tileset atlas (the typical pixel-art case). Under LINEAR/mipmap\n // filtering an atlas WITHOUT extrusion padding can bleed neighbouring\n // tiles at the edges; author tilesets with extruded margins for linear\n // sampling. (Extrusion-aware tilemap UV insetting - already done on the\n // NineSlice/RepeatingSprite geometry paths - is a v0.14 follow-up.)\n const u0 = sx / textureWidth;\n const v0 = sy / textureHeight;\n const u1 = (sx + rect.width) / textureWidth;\n const v1 = (sy + rect.height) / textureHeight;\n\n // Isometric cells start at their top vertex; artwork is bottom-aligned\n // with the cell base before applying the tileset's display offset.\n const x0 = geometryX + (isometric ? ((lx - ly) * tileWidth) / 2 - tileWidth / 2 : lx * tileWidth) + tileset.offsetX;\n const y0 = geometryY + (isometric ? ((lx + ly) * tileHeight) / 2 : ly * tileHeight) + tileHeight - rect.height + tileset.offsetY;\n const x1 = x0 + rect.width;\n const y1 = y0 + rect.height;\n\n const bucket = pageQuads(tileset, isometric, buckets, ordered);\n bucket.push({ x0, y0, x1, y1, u0, v0, u1, v1, orient: orientCode(decoded.transform) });\n }\n }\n\n return isometric ? ordered : tilesetPages(tilesets, buckets);\n};\n"],"mappings":";;;;AAiDA,MAAa,cAAc,eAAsC,UAAU,QAAQ,IAAI,MAAM,UAAU,QAAQ,IAAI,MAAM,UAAU,WAAW,IAAI;AAOlJ,IAAI,2BAA2B;AAU/B,MAAM,mBAAmB,UAA8B,cAAsB,gBAA6C;CACxH,MAAM,UAAU,SAAS;CAGzB,IAAI,YAAY,UAAa,eAAe,QAAQ,WAAW,OAAO;CACtE,MAAM,UAAU,QAAQ,QAAQ;CAChC,IAAI,QAAQ,SAAS,KAAK,QAAQ,UAAU,GAAG,OAAO;CACtD,OAAO;AACT;AAEA,MAAM,aAAa,SAAkB,WAAoB,SAAmC,YAAqC;CAC/H,IAAI;CACJ,IAAI,WAAW;EACb,MAAM,WAAW,QAAQ,QAAQ,SAAS;EAC1C,IAAI,UAAU,YAAY,SAAS,SAAS,SAAS;CACvD,OACE,SAAS,QAAQ,IAAI,OAAO;CAG9B,IAAI,WAAW,QAAW;EACxB,SAAS,CAAC;EACV,QAAQ,IAAI,SAAS,MAAM;EAC3B,IAAI,WAAW,QAAQ,KAAK;GAAE;GAAS,SAAS,QAAQ,QAAQ;GAAS,OAAO;EAAO,CAAC;CAC1F;CACA,OAAO;AACT;AAEA,MAAM,gBAAgB,UAA8B,YAA2D;CAC7G,MAAM,QAAqB,CAAC;CAC5B,KAAK,MAAM,WAAW,UAAU;EAC9B,MAAM,QAAQ,QAAQ,IAAI,OAAO;EACjC,IAAI,UAAU,UAAa,MAAM,SAAS,GACxC,MAAM,KAAK;GAAE;GAAS,SAAS,QAAQ,QAAQ;GAAS;EAAM,CAAC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K,cAAc,aAAa,KAAK,SAAS,QAAQ;GACzH,MAAM,KAAK,KAAK,KAAK;GACrB,MAAM,KAAK,KAAK,KAAK;GAGrB,AADe,UAAU,SAAS,WAAW,SAAS,OACjD,CAAC,CAAC,KAAK;IAAE;IAAI;IAAI;IAAI;IAAI;IAAI;IAAI;IAAI;IAAI,QAAQ,WAAW,QAAQ,SAAS;GAAE,CAAC;EACvF;CACF;CAEA,OAAO,YAAY,UAAU,aAAa,UAAU,OAAO;AAC7D"}
package/dist/esm/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { TILE_TRANSFORM_IDENTITY, TilePropertyKind, packTile, tileToChunkCoord, tileToLocalInChunk, unpackTile } from "./types.js";
2
+ import { TileProjection } from "./TileProjection.js";
2
3
  import { ImageLayer } from "./ImageLayer.js";
3
4
  import { ImageLayerNode } from "./ImageLayerNode.js";
4
5
  import { TileLayerNode } from "./TileLayerNode.js";
@@ -23,4 +24,4 @@ import { createWorkerSampledChunkSource } from "./WorkerSampledChunkSource.js";
23
24
  import { autoTile, refreshCell } from "./autoTile.js";
24
25
  import { WangSet } from "./WangSet.js";
25
26
 
26
- export { ChunkStreamer, ImageLayer, ImageLayerNode, MapLevelRuntime, MapLevelSide, MapObjectSpawner, MapSpawnError, MapSpawnSession, MapWorld, MapWorldRuntime, ObjectKind, ObjectLayer, TILE_TRANSFORM_IDENTITY, TileAnimator, TileLayer, TileLayerNode, TileMap, TileMapBand, TileMapNode, TileMapView, TilePropertyKind, TileSet, WangSet, autoTile, buildTileCollisionGeometry, createSampledChunkSource, createWorkerSampledChunkSource, mapObjectDescriptor, mapObjectDescriptors, packTile, refreshCell, tileToChunkCoord, tileToLocalInChunk, tilemapExtension, unpackTile };
27
+ export { ChunkStreamer, ImageLayer, ImageLayerNode, MapLevelRuntime, MapLevelSide, MapObjectSpawner, MapSpawnError, MapSpawnSession, MapWorld, MapWorldRuntime, ObjectKind, ObjectLayer, TILE_TRANSFORM_IDENTITY, TileAnimator, TileLayer, TileLayerNode, TileMap, TileMapBand, TileMapNode, TileMapView, TileProjection, TilePropertyKind, TileSet, WangSet, autoTile, buildTileCollisionGeometry, createSampledChunkSource, createWorkerSampledChunkSource, mapObjectDescriptor, mapObjectDescriptors, packTile, refreshCell, tileToChunkCoord, tileToLocalInChunk, tilemapExtension, unpackTile };
@@ -0,0 +1,4 @@
1
+ import type { TileMapObject } from './ObjectLayer';
2
+ /** Affine object geometry mapping; tile images and text keep their display dimensions. */
3
+ export declare const projectObject: (object: TileMapObject, a: number, b: number, c: number, d: number, offsetX: number, offsetY: number) => TileMapObject;
4
+ //# sourceMappingURL=projectObject.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projectObject.d.ts","sourceRoot":"","sources":["../../src/projectObject.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,0FAA0F;AAC1F,eAAO,MAAM,aAAa,WAAY,aAAa,KAAK,MAAM,KAAK,MAAM,KAAK,MAAM,KAAK,MAAM,WAAW,MAAM,WAAW,MAAM,KAAG,aAmDnI,CAAC"}
@@ -0,0 +1,87 @@
1
+ //#region src/projectObject.ts
2
+ /** Affine object geometry mapping; tile images and text keep their display dimensions. */
3
+ const projectObject = (object, a, b, c, d, offsetX, offsetY) => {
4
+ const x = a * object.x + c * object.y + offsetX;
5
+ const y = b * object.x + d * object.y + offsetY;
6
+ const base = {
7
+ ...object,
8
+ x,
9
+ y
10
+ };
11
+ if (object.kind === "tile" && object.rotationOrigin) {
12
+ const pivot = object.rotationOrigin;
13
+ return {
14
+ ...object,
15
+ x,
16
+ y,
17
+ rotationOrigin: {
18
+ x: a * pivot.x + c * pivot.y + offsetX,
19
+ y: b * pivot.x + d * pivot.y + offsetY
20
+ }
21
+ };
22
+ }
23
+ if (object.kind === "point" || object.kind === "tile" || object.kind === "text") return base;
24
+ const angle = object.rotation * Math.PI / 180;
25
+ const cos = Math.cos(angle);
26
+ const sin = Math.sin(angle);
27
+ const ax = a * cos + c * sin;
28
+ const ay = b * cos + d * sin;
29
+ const bx = c * cos - a * sin;
30
+ const by = d * cos - b * sin;
31
+ if (object.kind === "ellipse") {
32
+ const rx = object.width / 2;
33
+ const ry = object.height / 2;
34
+ const xx = (ax * rx) ** 2 + (bx * ry) ** 2;
35
+ const yy = (ay * rx) ** 2 + (by * ry) ** 2;
36
+ const xy = ax * ay * rx * rx + bx * by * ry * ry;
37
+ const spread = Math.hypot(xx - yy, 2 * xy);
38
+ const major = Math.sqrt(Math.max(0, (xx + yy + spread) / 2));
39
+ const minor = Math.sqrt(Math.max(0, (xx + yy - spread) / 2));
40
+ const rotation = Math.atan2(2 * xy, xx - yy) / 2;
41
+ const u = Math.cos(rotation);
42
+ const v = Math.sin(rotation);
43
+ return {
44
+ ...base,
45
+ kind: "ellipse",
46
+ x: x + ax * rx + bx * ry - u * major + v * minor,
47
+ y: y + ay * rx + by * ry - v * major - u * minor,
48
+ width: major * 2,
49
+ height: minor * 2,
50
+ rotation: rotation * 180 / Math.PI
51
+ };
52
+ }
53
+ const points = (object.kind === "rectangle" ? [
54
+ {
55
+ x: 0,
56
+ y: 0
57
+ },
58
+ {
59
+ x: object.width,
60
+ y: 0
61
+ },
62
+ {
63
+ x: object.width,
64
+ y: object.height
65
+ },
66
+ {
67
+ x: 0,
68
+ y: object.height
69
+ }
70
+ ] : object.points).map((point) => ({
71
+ x: ax * point.x + bx * point.y,
72
+ y: ay * point.x + by * point.y
73
+ }));
74
+ if (a * d - b * c < 0) points.reverse();
75
+ return {
76
+ ...base,
77
+ kind: object.kind === "polyline" ? "polyline" : "polygon",
78
+ width: 0,
79
+ height: 0,
80
+ rotation: 0,
81
+ points
82
+ };
83
+ };
84
+
85
+ //#endregion
86
+ export { projectObject };
87
+ //# sourceMappingURL=projectObject.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projectObject.js","names":[],"sources":["../../src/projectObject.ts"],"sourcesContent":["import type { TileMapObject } from './ObjectLayer';\n\n/** Affine object geometry mapping; tile images and text keep their display dimensions. */\nexport const projectObject = (object: TileMapObject, a: number, b: number, c: number, d: number, offsetX: number, offsetY: number): TileMapObject => {\n const x = a * object.x + c * object.y + offsetX;\n const y = b * object.x + d * object.y + offsetY;\n const base = { ...object, x, y };\n if (object.kind === 'tile' && object.rotationOrigin) {\n const pivot = object.rotationOrigin;\n return { ...object, x, y, rotationOrigin: { x: a * pivot.x + c * pivot.y + offsetX, y: b * pivot.x + d * pivot.y + offsetY } };\n }\n if (object.kind === 'point' || object.kind === 'tile' || object.kind === 'text') return base;\n\n const angle = (object.rotation * Math.PI) / 180;\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n const ax = a * cos + c * sin;\n const ay = b * cos + d * sin;\n const bx = c * cos - a * sin;\n const by = d * cos - b * sin;\n if (object.kind === 'ellipse') {\n const rx = object.width / 2;\n const ry = object.height / 2;\n const xx = (ax * rx) ** 2 + (bx * ry) ** 2;\n const yy = (ay * rx) ** 2 + (by * ry) ** 2;\n const xy = ax * ay * rx * rx + bx * by * ry * ry;\n const spread = Math.hypot(xx - yy, 2 * xy);\n const major = Math.sqrt(Math.max(0, (xx + yy + spread) / 2));\n const minor = Math.sqrt(Math.max(0, (xx + yy - spread) / 2));\n const rotation = Math.atan2(2 * xy, xx - yy) / 2;\n const u = Math.cos(rotation);\n const v = Math.sin(rotation);\n return {\n ...base,\n kind: 'ellipse',\n x: x + ax * rx + bx * ry - u * major + v * minor,\n y: y + ay * rx + by * ry - v * major - u * minor,\n width: major * 2,\n height: minor * 2,\n rotation: (rotation * 180) / Math.PI,\n };\n }\n const source =\n object.kind === 'rectangle'\n ? [\n { x: 0, y: 0 },\n { x: object.width, y: 0 },\n { x: object.width, y: object.height },\n { x: 0, y: object.height },\n ]\n : object.points;\n const points = source.map(point => ({ x: ax * point.x + bx * point.y, y: ay * point.x + by * point.y }));\n if (a * d - b * c < 0) points.reverse();\n return { ...base, kind: object.kind === 'polyline' ? 'polyline' : 'polygon', width: 0, height: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AQ,KAAK,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,UAAU,CAAC,CAAC;EAC3D,MAAM,WAAW,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,IAAI;EAC/C,MAAM,IAAI,KAAK,IAAI,QAAQ;EAC3B,MAAM,IAAI,KAAK,IAAI,QAAQ;EAC3B,OAAO;GACL,GAAG;GACH,MAAM;GACN,GAAG,IAAI,KAAK,KAAK,KAAK,KAAK,IAAI,QAAQ,IAAI;GAC3C,GAAG,IAAI,KAAK,KAAK,KAAK,KAAK,IAAI,QAAQ,IAAI;GAC3C,OAAO,QAAQ;GACf,QAAQ,QAAQ;GAChB,UAAW,WAAW,MAAO,KAAK;EACpC;CACF;CAUA,MAAM,UARJ,OAAO,SAAS,cACZ;EACE;GAAE,GAAG;GAAG,GAAG;EAAE;EACb;GAAE,GAAG,OAAO;GAAO,GAAG;EAAE;EACxB;GAAE,GAAG,OAAO;GAAO,GAAG,OAAO;EAAO;EACpC;GAAE,GAAG;GAAG,GAAG,OAAO;EAAO;CAC3B,IACA,OAAO,OACQ,CAAC,KAAI,WAAU;EAAE,GAAG,KAAK,MAAM,IAAI,KAAK,MAAM;EAAG,GAAG,KAAK,MAAM,IAAI,KAAK,MAAM;CAAE,EAAE;CACvG,IAAI,IAAI,IAAI,IAAI,IAAI,GAAG,OAAO,QAAQ;CACtC,OAAO;EAAE,GAAG;EAAM,MAAM,OAAO,SAAS,aAAa,aAAa;EAAW,OAAO;EAAG,QAAQ;EAAG,UAAU;EAAG;CAAO;AACxH"}
@@ -42,6 +42,7 @@ export type { WorkerSampledChunkSourceOptions } from './WorkerSampledChunkSource
42
42
  export { createWorkerSampledChunkSource } from './WorkerSampledChunkSource';
43
43
  export type { AutoTileOptions } from './autoTile';
44
44
  export { autoTile, refreshCell } from './autoTile';
45
+ export { TileProjection, type TileProjectionOptions } from './TileProjection';
45
46
  export type { WangSetOptions } from './WangSet';
46
47
  export { WangSet } from './WangSet';
47
48
  //# sourceMappingURL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MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
@@ -28,7 +28,7 @@ export interface TileRegion {
28
28
  readonly height: number;
29
29
  }
30
30
  /**
31
- * An axis-aligned collision rectangle in tile-layer pixel space (+Y down),
31
+ * An axis-aligned collision rectangle in logical tile-layer pixel space (+Y down),
32
32
  * covering one or more whole tile cells.
33
33
  *
34
34
  * Rectangles are synthesized geometry, not source objects: a merged run has no
@@ -51,7 +51,7 @@ export interface TileCollisionRect {
51
51
  readonly type: string;
52
52
  }
53
53
  /**
54
- * A per-tile collision shape placed in tile-layer pixel space (+Y down).
54
+ * A per-tile collision shape placed in logical tile-layer pixel space (+Y down).
55
55
  *
56
56
  * Emitted for every collision shape that does not exactly cover a whole tile
57
57
  * cell: partial boxes, ellipses, polygons, polylines, points, and rotated
@@ -1 +1 @@
1
- {"version":3,"file":"tileCollision.d.ts","sourceRoot":"","sources":["../../src/tileCollision.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAI7C;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAChC,OAAO,UAAU,CAAC,SAAS,GAAG,OAAO,UAAU,CAAC,OAAO,GAAG,OAAO,UAAU,CAAC,OAAO,GAAG,OAAO,UAAU,CAAC,QAAQ,GAAG,OAAO,UAAU,CAAC,KAAK,CAAC;AAE7I;;;;;;;;GAQG;AACH,MAAM,WAAW,UAAU;IACzB,wCAAwC;IACxC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,QAAQ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