@codexo/exojs-tilemap 0.15.2 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -26
- package/dist/esm/ChunkSource.d.ts +33 -0
- package/dist/esm/ChunkSource.d.ts.map +1 -0
- package/dist/esm/ChunkStreamer.d.ts +98 -0
- package/dist/esm/ChunkStreamer.d.ts.map +1 -0
- package/dist/esm/ChunkStreamer.js +201 -0
- package/dist/esm/ChunkStreamer.js.map +1 -0
- package/dist/esm/ImageLayer.d.ts +11 -3
- package/dist/esm/ImageLayer.d.ts.map +1 -0
- package/dist/esm/ImageLayer.js +71 -64
- package/dist/esm/ImageLayer.js.map +1 -1
- package/dist/esm/ImageLayerNode.d.ts +89 -0
- package/dist/esm/ImageLayerNode.d.ts.map +1 -0
- package/dist/esm/ImageLayerNode.js +205 -0
- package/dist/esm/ImageLayerNode.js.map +1 -0
- package/dist/esm/MapObject.d.ts +70 -0
- package/dist/esm/MapObject.d.ts.map +1 -0
- package/dist/esm/MapObject.js +34 -0
- package/dist/esm/MapObject.js.map +1 -0
- package/dist/esm/MapObjectSpawner.d.ts +133 -0
- package/dist/esm/MapObjectSpawner.d.ts.map +1 -0
- package/dist/esm/MapObjectSpawner.js +147 -0
- package/dist/esm/MapObjectSpawner.js.map +1 -0
- package/dist/esm/MapSpawnSession.d.ts +53 -0
- package/dist/esm/MapSpawnSession.d.ts.map +1 -0
- package/dist/esm/MapSpawnSession.js +88 -0
- package/dist/esm/MapSpawnSession.js.map +1 -0
- package/dist/esm/MapWorld.d.ts +134 -0
- package/dist/esm/MapWorld.d.ts.map +1 -0
- package/dist/esm/MapWorld.js +150 -0
- package/dist/esm/MapWorld.js.map +1 -0
- package/dist/esm/MapWorldRuntime.d.ts +182 -0
- package/dist/esm/MapWorldRuntime.d.ts.map +1 -0
- package/dist/esm/MapWorldRuntime.js +261 -0
- package/dist/esm/MapWorldRuntime.js.map +1 -0
- package/dist/esm/ObjectLayer.d.ts +93 -7
- package/dist/esm/ObjectLayer.d.ts.map +1 -0
- package/dist/esm/ObjectLayer.js +184 -167
- package/dist/esm/ObjectLayer.js.map +1 -1
- package/dist/esm/SampledChunkSource.d.ts +43 -0
- package/dist/esm/SampledChunkSource.d.ts.map +1 -0
- package/dist/esm/SampledChunkSource.js +48 -0
- package/dist/esm/SampledChunkSource.js.map +1 -0
- package/dist/esm/TileAnimator.d.ts +12 -2
- package/dist/esm/TileAnimator.d.ts.map +1 -0
- package/dist/esm/TileAnimator.js +154 -165
- package/dist/esm/TileAnimator.js.map +1 -1
- package/dist/esm/TileChunk.d.ts +30 -5
- package/dist/esm/TileChunk.d.ts.map +1 -0
- package/dist/esm/TileChunk.js +190 -188
- package/dist/esm/TileChunk.js.map +1 -1
- package/dist/esm/TileChunkNode.d.ts +18 -3
- package/dist/esm/TileChunkNode.d.ts.map +1 -0
- package/dist/esm/TileChunkNode.js +104 -85
- package/dist/esm/TileChunkNode.js.map +1 -1
- package/dist/esm/TileLayer.d.ts +104 -24
- package/dist/esm/TileLayer.d.ts.map +1 -0
- package/dist/esm/TileLayer.js +511 -469
- package/dist/esm/TileLayer.js.map +1 -1
- package/dist/esm/TileLayerNode.d.ts +52 -11
- package/dist/esm/TileLayerNode.d.ts.map +1 -0
- package/dist/esm/TileLayerNode.js +224 -166
- package/dist/esm/TileLayerNode.js.map +1 -1
- package/dist/esm/TileMap.d.ts +96 -31
- package/dist/esm/TileMap.d.ts.map +1 -0
- package/dist/esm/TileMap.js +401 -357
- package/dist/esm/TileMap.js.map +1 -1
- package/dist/esm/TileMapBand.d.ts +42 -29
- package/dist/esm/TileMapBand.d.ts.map +1 -0
- package/dist/esm/TileMapBand.js +151 -158
- package/dist/esm/TileMapBand.js.map +1 -1
- package/dist/esm/TileMapNode.d.ts +34 -18
- package/dist/esm/TileMapNode.d.ts.map +1 -0
- package/dist/esm/TileMapNode.js +122 -109
- package/dist/esm/TileMapNode.js.map +1 -1
- package/dist/esm/TileMapView.d.ts +108 -47
- package/dist/esm/TileMapView.d.ts.map +1 -0
- package/dist/esm/TileMapView.js +385 -338
- package/dist/esm/TileMapView.js.map +1 -1
- package/dist/esm/TileSet.d.ts +15 -6
- package/dist/esm/TileSet.d.ts.map +1 -0
- package/dist/esm/TileSet.js +161 -181
- package/dist/esm/TileSet.js.map +1 -1
- package/dist/esm/WangSet.d.ts +5 -4
- package/dist/esm/WangSet.d.ts.map +1 -0
- package/dist/esm/WangSet.js +70 -78
- package/dist/esm/WangSet.js.map +1 -1
- package/dist/esm/WorkerSampledChunkSource.d.ts +95 -0
- package/dist/esm/WorkerSampledChunkSource.d.ts.map +1 -0
- package/dist/esm/WorkerSampledChunkSource.js +117 -0
- package/dist/esm/WorkerSampledChunkSource.js.map +1 -0
- package/dist/esm/autoTile.d.ts +10 -5
- package/dist/esm/autoTile.d.ts.map +1 -0
- package/dist/esm/autoTile.js +164 -205
- package/dist/esm/autoTile.js.map +1 -1
- package/dist/esm/chunkGeometry.d.ts +8 -7
- package/dist/esm/chunkGeometry.d.ts.map +1 -0
- package/dist/esm/chunkGeometry.js +83 -94
- package/dist/esm/chunkGeometry.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +26 -15
- package/dist/esm/nodeBounds.d.ts +20 -0
- package/dist/esm/nodeBounds.d.ts.map +1 -0
- package/dist/esm/nodeBounds.js +40 -0
- package/dist/esm/nodeBounds.js.map +1 -0
- package/dist/esm/pixelSnap.d.ts +4 -3
- package/dist/esm/pixelSnap.d.ts.map +1 -0
- package/dist/esm/pixelSnap.js +18 -16
- package/dist/esm/pixelSnap.js.map +1 -1
- package/dist/esm/public.d.ts +23 -3
- package/dist/esm/public.d.ts.map +1 -0
- package/dist/esm/tileCollision.d.ts +190 -0
- package/dist/esm/tileCollision.d.ts.map +1 -0
- package/dist/esm/tileCollision.js +367 -0
- package/dist/esm/tileCollision.js.map +1 -0
- package/dist/esm/tileWord.d.ts +12 -0
- package/dist/esm/tileWord.d.ts.map +1 -0
- package/dist/esm/tileWord.js +16 -0
- package/dist/esm/tileWord.js.map +1 -0
- package/dist/esm/tilemapExtension.d.ts +4 -3
- package/dist/esm/tilemapExtension.d.ts.map +1 -0
- package/dist/esm/tilemapExtension.js +47 -47
- package/dist/esm/tilemapExtension.js.map +1 -1
- package/dist/esm/tilemapSerializers.d.ts +5 -4
- package/dist/esm/tilemapSerializers.d.ts.map +1 -0
- package/dist/esm/tilemapSerializers.js +48 -41
- package/dist/esm/tilemapSerializers.js.map +1 -1
- package/dist/esm/types.d.ts +34 -18
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +111 -120
- package/dist/esm/types.js.map +1 -1
- package/dist/esm/webgl2/WebGl2TileChunkRenderer.d.ts +50 -2
- package/dist/esm/webgl2/WebGl2TileChunkRenderer.d.ts.map +1 -0
- package/dist/esm/webgl2/WebGl2TileChunkRenderer.js +366 -332
- package/dist/esm/webgl2/WebGl2TileChunkRenderer.js.map +1 -1
- package/dist/esm/webgl2/shaders/tile-chunk.frag.js +6 -0
- package/dist/esm/webgl2/shaders/tile-chunk.frag.js.map +1 -0
- package/dist/esm/webgl2/shaders/tile-chunk.vert.js +6 -0
- package/dist/esm/webgl2/shaders/tile-chunk.vert.js.map +1 -0
- package/dist/esm/webgpu/WebGpuTileChunkRenderer.d.ts +70 -4
- package/dist/esm/webgpu/WebGpuTileChunkRenderer.d.ts.map +1 -0
- package/dist/esm/webgpu/WebGpuTileChunkRenderer.js +496 -383
- package/dist/esm/webgpu/WebGpuTileChunkRenderer.js.map +1 -1
- package/dist/esm/webgpu/shaders/tile-chunk.wgsl.js +6 -0
- package/dist/esm/webgpu/shaders/tile-chunk.wgsl.js.map +1 -0
- package/package.json +8 -15
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/register.d.ts +0 -1
- package/dist/esm/register.js +0 -25
- package/dist/esm/register.js.map +0 -1
|
@@ -4,7 +4,7 @@ import type { Extension } from '@codexo/exojs/extensions';
|
|
|
4
4
|
*
|
|
5
5
|
* Registers the WebGL2/WebGPU tile chunk renderers (`renderers`) and the
|
|
6
6
|
* {@link TileMapNode} scene serializer (`serializers`); it carries no asset
|
|
7
|
-
* bindings
|
|
7
|
+
* bindings - there is no generic on-disk tilemap format in this slice, so format
|
|
8
8
|
* adapters (e.g. `@codexo/exojs-tiled`) own loading and depend on this
|
|
9
9
|
* descriptor to pull in rendering.
|
|
10
10
|
*
|
|
@@ -12,8 +12,9 @@ import type { Extension } from '@codexo/exojs/extensions';
|
|
|
12
12
|
* (`extensions: [tilemapExtension]` plus a `TileMap` built via the runtime), or
|
|
13
13
|
* receive it transitively through a format adapter's `dependencies`.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
* `
|
|
15
|
+
* Pass it to the application that should have it via
|
|
16
|
+
* `ApplicationOptions.extensions`.
|
|
17
17
|
* @advanced
|
|
18
18
|
*/
|
|
19
19
|
export declare const tilemapExtension: Extension;
|
|
20
|
+
//# sourceMappingURL=tilemapExtension.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tilemapExtension.d.ts","sourceRoot":"","sources":["../../src/tilemapExtension.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAmB,MAAM,0BAA0B,CAAC;AAoC3E;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAI7B,CAAC"}
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { TileChunkNode } from "./TileChunkNode.js";
|
|
2
|
+
import { TileMapNode } from "./TileMapNode.js";
|
|
3
|
+
import { tileMapNodeSerializer } from "./tilemapSerializers.js";
|
|
4
|
+
import { WebGl2TileChunkRenderer } from "./webgl2/WebGl2TileChunkRenderer.js";
|
|
5
|
+
import { WebGpuTileChunkRenderer } from "./webgpu/WebGpuTileChunkRenderer.js";
|
|
6
|
+
import { RenderBackendType } from "@codexo/exojs/renderer-sdk";
|
|
7
7
|
|
|
8
|
+
//#region src/tilemapExtension.ts
|
|
8
9
|
/** Per-tile instance batch size for the WebGL2 tile chunk renderer. */
|
|
9
10
|
const tileRendererBatchSize = 4096;
|
|
10
11
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return new WebGpuTileChunkRenderer();
|
|
27
|
-
}
|
|
28
|
-
throw new Error(`Unsupported render backend: ${String(backend.backendType)}`);
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
}
|
|
12
|
+
* Build the renderer binding that wires the per-backend
|
|
13
|
+
* {@link import('./TileChunkNode').TileChunkNode} renderers. The binding targets
|
|
14
|
+
* the internal chunk drawable; applications never construct it directly - they
|
|
15
|
+
* build {@link import('./TileMapNode').TileMapNode} /
|
|
16
|
+
* {@link import('./TileLayerNode').TileLayerNode}, whose chunk children resolve
|
|
17
|
+
* to this renderer through the registry prototype walk.
|
|
18
|
+
*/
|
|
19
|
+
const buildTileChunkRendererBinding = (batchSize) => ({
|
|
20
|
+
targets: [TileChunkNode],
|
|
21
|
+
create(backend) {
|
|
22
|
+
if (backend.backendType === RenderBackendType.WebGl2) return new WebGl2TileChunkRenderer(batchSize);
|
|
23
|
+
if (backend.backendType === RenderBackendType.WebGpu) return new WebGpuTileChunkRenderer();
|
|
24
|
+
throw new Error(`Unsupported render backend: ${String(backend.backendType)}`);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
32
27
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
28
|
+
* Default immutable tilemap extension descriptor.
|
|
29
|
+
*
|
|
30
|
+
* Registers the WebGL2/WebGPU tile chunk renderers (`renderers`) and the
|
|
31
|
+
* {@link TileMapNode} scene serializer (`serializers`); it carries no asset
|
|
32
|
+
* bindings - there is no generic on-disk tilemap format in this slice, so format
|
|
33
|
+
* adapters (e.g. `@codexo/exojs-tiled`) own loading and depend on this
|
|
34
|
+
* descriptor to pull in rendering.
|
|
35
|
+
*
|
|
36
|
+
* Install + register directly for procedural / hand-built maps
|
|
37
|
+
* (`extensions: [tilemapExtension]` plus a `TileMap` built via the runtime), or
|
|
38
|
+
* receive it transitively through a format adapter's `dependencies`.
|
|
39
|
+
*
|
|
40
|
+
* Pass it to the application that should have it via
|
|
41
|
+
* `ApplicationOptions.extensions`.
|
|
42
|
+
* @advanced
|
|
43
|
+
*/
|
|
49
44
|
const tilemapExtension = Object.freeze({
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
id: "@codexo/exojs-tilemap",
|
|
46
|
+
renderers: [buildTileChunkRendererBinding(tileRendererBatchSize)],
|
|
47
|
+
serializers: [{
|
|
48
|
+
typeName: "TileMapNode",
|
|
49
|
+
target: TileMapNode,
|
|
50
|
+
serializer: tileMapNodeSerializer
|
|
51
|
+
}]
|
|
53
52
|
});
|
|
54
53
|
|
|
54
|
+
//#endregion
|
|
55
55
|
export { tilemapExtension };
|
|
56
|
-
//# sourceMappingURL=tilemapExtension.js.map
|
|
56
|
+
//# sourceMappingURL=tilemapExtension.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tilemapExtension.js","sources":["
|
|
1
|
+
{"version":3,"file":"tilemapExtension.js","names":[],"sources":["../../src/tilemapExtension.ts"],"sourcesContent":["import type { Extension, RendererBinding } from '@codexo/exojs/extensions';\nimport type { RenderBackend } from '@codexo/exojs/renderer-sdk';\nimport { RenderBackendType } from '@codexo/exojs/renderer-sdk';\n\nimport { TileChunkNode } from './TileChunkNode';\nimport { TileMapNode } from './TileMapNode';\nimport { tileMapNodeSerializer } from './tilemapSerializers';\nimport { WebGl2TileChunkRenderer } from './webgl2/WebGl2TileChunkRenderer';\nimport { WebGpuTileChunkRenderer } from './webgpu/WebGpuTileChunkRenderer';\n\n/** Per-tile instance batch size for the WebGL2 tile chunk renderer. */\nconst tileRendererBatchSize = 4096;\n\n/**\n * Build the renderer binding that wires the per-backend\n * {@link import('./TileChunkNode').TileChunkNode} renderers. The binding targets\n * the internal chunk drawable; applications never construct it directly - they\n * build {@link import('./TileMapNode').TileMapNode} /\n * {@link import('./TileLayerNode').TileLayerNode}, whose chunk children resolve\n * to this renderer through the registry prototype walk.\n */\nconst buildTileChunkRendererBinding = (batchSize: number): RendererBinding => ({\n targets: [TileChunkNode],\n create(backend: RenderBackend) {\n if (backend.backendType === RenderBackendType.WebGl2) {\n return new WebGl2TileChunkRenderer(batchSize);\n }\n\n if (backend.backendType === RenderBackendType.WebGpu) {\n return new WebGpuTileChunkRenderer();\n }\n\n throw new Error(`Unsupported render backend: ${String(backend.backendType satisfies never)}`);\n },\n});\n\n/**\n * Default immutable tilemap extension descriptor.\n *\n * Registers the WebGL2/WebGPU tile chunk renderers (`renderers`) and the\n * {@link TileMapNode} scene serializer (`serializers`); it carries no asset\n * bindings - there is no generic on-disk tilemap format in this slice, so format\n * adapters (e.g. `@codexo/exojs-tiled`) own loading and depend on this\n * descriptor to pull in rendering.\n *\n * Install + register directly for procedural / hand-built maps\n * (`extensions: [tilemapExtension]` plus a `TileMap` built via the runtime), or\n * receive it transitively through a format adapter's `dependencies`.\n *\n * Pass it to the application that should have it via\n * `ApplicationOptions.extensions`.\n * @advanced\n */\nexport const tilemapExtension: Extension = Object.freeze({\n id: '@codexo/exojs-tilemap',\n renderers: [buildTileChunkRendererBinding(tileRendererBatchSize)],\n serializers: [{ typeName: 'TileMapNode', target: TileMapNode, serializer: tileMapNodeSerializer }],\n});\n"],"mappings":";;;;;;;;;AAWA,MAAM,wBAAwB;;;;;;;;;AAU9B,MAAM,iCAAiC,eAAwC;CAC7E,SAAS,CAAC,aAAa;CACvB,OAAO,SAAwB;EAC7B,IAAI,QAAQ,gBAAgB,kBAAkB,QAC5C,OAAO,IAAI,wBAAwB,SAAS;EAG9C,IAAI,QAAQ,gBAAgB,kBAAkB,QAC5C,OAAO,IAAI,wBAAwB;EAGrC,MAAM,IAAI,MAAM,+BAA+B,OAAO,QAAQ,WAA2B,GAAG;CAC9F;AACF;;;;;;;;;;;;;;;;;;AAmBA,MAAa,mBAA8B,OAAO,OAAO;CACvD,IAAI;CACJ,WAAW,CAAC,8BAA8B,qBAAqB,CAAC;CAChE,aAAa,CAAC;EAAE,UAAU;EAAe,QAAQ;EAAa,YAAY;CAAsB,CAAC;AACnG,CAAC"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import type { NodeSerializer } from '@codexo/exojs';
|
|
2
2
|
import { TileMapNode } from './TileMapNode';
|
|
3
3
|
/**
|
|
4
|
-
* Scene serializer for {@link TileMapNode}
|
|
4
|
+
* Scene serializer for {@link TileMapNode} - the convenience node that renders a
|
|
5
5
|
* whole {@link TileMap}.
|
|
6
6
|
*
|
|
7
7
|
* Captures the **map reference** (its Loader source key) plus the render-only
|
|
8
8
|
* `pixelSnapMode`; the per-layer / per-chunk nodes are derived from the map and
|
|
9
9
|
* rebuilt on construction, so they are never written. The referenced `TileMap`
|
|
10
|
-
* must be pre-loaded into the target Loader (e.g. `loader.load(
|
|
11
|
-
* before deserialize
|
|
10
|
+
* must be pre-loaded into the target Loader (e.g. `loader.load(Asset.type('tileMap', 'world.tmj'))`)
|
|
11
|
+
* before deserialize - procedurally-built maps have no source key and cannot be
|
|
12
12
|
* referenced.
|
|
13
13
|
*
|
|
14
14
|
* Standalone `TileLayerNode` / `TileMapBand` placement (the actor-interleaving
|
|
15
15
|
* cases) is not yet covered.
|
|
16
16
|
*
|
|
17
|
-
* @internal
|
|
17
|
+
* @internal - registered via {@link tilemapExtension}'s `serializers` binding.
|
|
18
18
|
*/
|
|
19
19
|
export declare const tileMapNodeSerializer: NodeSerializer<TileMapNode>;
|
|
20
|
+
//# sourceMappingURL=tilemapSerializers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tilemapSerializers.d.ts","sourceRoot":"","sources":["../../src/tilemapSerializers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAIpD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAgB5C;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,qBAAqB,EAAE,cAAc,CAAC,WAAW,CAkC7D,CAAC"}
|
|
@@ -1,47 +1,54 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { TileMapNode } from "./TileMapNode.js";
|
|
2
|
+
import { TileMap } from "./TileMap.js";
|
|
3
|
+
import { PixelSnapMode } from "@codexo/exojs/renderer-sdk";
|
|
3
4
|
|
|
5
|
+
//#region src/tilemapSerializers.ts
|
|
6
|
+
const pixelSnapModeNames = {
|
|
7
|
+
[PixelSnapMode.None]: "none",
|
|
8
|
+
[PixelSnapMode.Position]: "position",
|
|
9
|
+
[PixelSnapMode.Geometry]: "geometry"
|
|
10
|
+
};
|
|
11
|
+
const pixelSnapModeFromName = {
|
|
12
|
+
none: PixelSnapMode.None,
|
|
13
|
+
position: PixelSnapMode.Position,
|
|
14
|
+
geometry: PixelSnapMode.Geometry
|
|
15
|
+
};
|
|
4
16
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
* Scene serializer for {@link TileMapNode} - the convenience node that renders a
|
|
18
|
+
* whole {@link TileMap}.
|
|
19
|
+
*
|
|
20
|
+
* Captures the **map reference** (its Loader source key) plus the render-only
|
|
21
|
+
* `pixelSnapMode`; the per-layer / per-chunk nodes are derived from the map and
|
|
22
|
+
* rebuilt on construction, so they are never written. The referenced `TileMap`
|
|
23
|
+
* must be pre-loaded into the target Loader (e.g. `loader.load(Asset.type('tileMap', 'world.tmj'))`)
|
|
24
|
+
* before deserialize - procedurally-built maps have no source key and cannot be
|
|
25
|
+
* referenced.
|
|
26
|
+
*
|
|
27
|
+
* Standalone `TileLayerNode` / `TileMapBand` placement (the actor-interleaving
|
|
28
|
+
* cases) is not yet covered.
|
|
29
|
+
*
|
|
30
|
+
* @internal - registered via {@link tilemapExtension}'s `serializers` binding.
|
|
31
|
+
*/
|
|
20
32
|
const tileMapNodeSerializer = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// The TileMapNode setter validates the value (throws on an invalid mode).
|
|
39
|
-
if (typeof data.pixelSnapMode === 'string') {
|
|
40
|
-
node.pixelSnapMode = data.pixelSnapMode;
|
|
41
|
-
}
|
|
42
|
-
return node;
|
|
43
|
-
},
|
|
33
|
+
write(node, ctx) {
|
|
34
|
+
const out = {};
|
|
35
|
+
const source = ctx.keyFor(node.map);
|
|
36
|
+
if (source !== null) out.map = source;
|
|
37
|
+
if (node.pixelSnapMode !== PixelSnapMode.None) out.pixelSnapMode = pixelSnapModeNames[node.pixelSnapMode];
|
|
38
|
+
return out;
|
|
39
|
+
},
|
|
40
|
+
read(data, ctx) {
|
|
41
|
+
const map = ctx.resolveAsset(typeof data.map === "string" ? data.map : null, TileMap);
|
|
42
|
+
if (map === null) throw new Error("TileMapNode deserialize requires its TileMap to be pre-loaded into the Loader (procedural maps have no source key).");
|
|
43
|
+
const node = new TileMapNode(map);
|
|
44
|
+
if (typeof data.pixelSnapMode === "string") {
|
|
45
|
+
const mode = pixelSnapModeFromName[data.pixelSnapMode];
|
|
46
|
+
if (mode !== void 0) node.pixelSnapMode = mode;
|
|
47
|
+
}
|
|
48
|
+
return node;
|
|
49
|
+
}
|
|
44
50
|
};
|
|
45
51
|
|
|
52
|
+
//#endregion
|
|
46
53
|
export { tileMapNodeSerializer };
|
|
47
|
-
//# sourceMappingURL=tilemapSerializers.js.map
|
|
54
|
+
//# sourceMappingURL=tilemapSerializers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tilemapSerializers.js","sources":["
|
|
1
|
+
{"version":3,"file":"tilemapSerializers.js","names":[],"sources":["../../src/tilemapSerializers.ts"],"sourcesContent":["import type { NodeSerializer } from '@codexo/exojs';\nimport { PixelSnapMode } from '@codexo/exojs/renderer-sdk';\n\nimport { TileMap } from './TileMap';\nimport { TileMapNode } from './TileMapNode';\n\n// On-disk format: the mode is persisted as its NAME (readable JSON, robust\n// against enum renumbering), mapped to/from the numeric enum here.\nconst pixelSnapModeNames: Record<PixelSnapMode, string> = {\n [PixelSnapMode.None]: 'none',\n [PixelSnapMode.Position]: 'position',\n [PixelSnapMode.Geometry]: 'geometry',\n};\n\nconst pixelSnapModeFromName: Record<string, PixelSnapMode> = {\n none: PixelSnapMode.None,\n position: PixelSnapMode.Position,\n geometry: PixelSnapMode.Geometry,\n};\n\n/**\n * Scene serializer for {@link TileMapNode} - the convenience node that renders a\n * whole {@link TileMap}.\n *\n * Captures the **map reference** (its Loader source key) plus the render-only\n * `pixelSnapMode`; the per-layer / per-chunk nodes are derived from the map and\n * rebuilt on construction, so they are never written. The referenced `TileMap`\n * must be pre-loaded into the target Loader (e.g. `loader.load(Asset.type('tileMap', 'world.tmj'))`)\n * before deserialize - procedurally-built maps have no source key and cannot be\n * referenced.\n *\n * Standalone `TileLayerNode` / `TileMapBand` placement (the actor-interleaving\n * cases) is not yet covered.\n *\n * @internal - registered via {@link tilemapExtension}'s `serializers` binding.\n */\nexport const tileMapNodeSerializer: NodeSerializer<TileMapNode> = {\n write(node, ctx) {\n const out: Record<string, unknown> = {};\n const source = ctx.keyFor(node.map);\n\n if (source !== null) {\n out.map = source;\n }\n\n if (node.pixelSnapMode !== PixelSnapMode.None) {\n out.pixelSnapMode = pixelSnapModeNames[node.pixelSnapMode];\n }\n\n return out;\n },\n read(data, ctx) {\n const map = ctx.resolveAsset(typeof data.map === 'string' ? data.map : null, TileMap);\n\n if (map === null) {\n throw new Error('TileMapNode deserialize requires its TileMap to be pre-loaded into the Loader (procedural maps have no source key).');\n }\n\n const node = new TileMapNode(map);\n\n if (typeof data.pixelSnapMode === 'string') {\n const mode = pixelSnapModeFromName[data.pixelSnapMode];\n\n if (mode !== undefined) {\n node.pixelSnapMode = mode;\n }\n }\n\n return node;\n },\n};\n"],"mappings":";;;;;AAQA,MAAM,qBAAoD;EACvD,cAAc,OAAO;EACrB,cAAc,WAAW;EACzB,cAAc,WAAW;AAC5B;AAEA,MAAM,wBAAuD;CAC3D,MAAM,cAAc;CACpB,UAAU,cAAc;CACxB,UAAU,cAAc;AAC1B;;;;;;;;;;;;;;;;;AAkBA,MAAa,wBAAqD;CAChE,MAAM,MAAM,KAAK;EACf,MAAM,MAA+B,CAAC;EACtC,MAAM,SAAS,IAAI,OAAO,KAAK,GAAG;EAElC,IAAI,WAAW,MACb,IAAI,MAAM;EAGZ,IAAI,KAAK,kBAAkB,cAAc,MACvC,IAAI,gBAAgB,mBAAmB,KAAK;EAG9C,OAAO;CACT;CACA,KAAK,MAAM,KAAK;EACd,MAAM,MAAM,IAAI,aAAa,OAAO,KAAK,QAAQ,WAAW,KAAK,MAAM,MAAM,OAAO;EAEpF,IAAI,QAAQ,MACV,MAAM,IAAI,MAAM,qHAAqH;EAGvI,MAAM,OAAO,IAAI,YAAY,GAAG;EAEhC,IAAI,OAAO,KAAK,kBAAkB,UAAU;GAC1C,MAAM,OAAO,sBAAsB,KAAK;GAExC,IAAI,SAAS,QACX,KAAK,gBAAgB;EAEzB;EAEA,OAAO;CACT;AACF"}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export interface TilePropertyPoint {
|
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* A reference to another object/entity. `id` is the referenced object's
|
|
29
|
-
* identity
|
|
29
|
+
* identity - Tiled's numeric object id, or LDtk's `entityIid`. The extra
|
|
30
30
|
* fields are LDtk-only navigation context (`undefined` for Tiled-sourced
|
|
31
31
|
* refs) that lets a consumer resolve the reference without searching the
|
|
32
32
|
* whole level tree.
|
|
@@ -49,7 +49,7 @@ export interface TilePropertyTileRef {
|
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* Union of legal tile-property value types in the generic runtime.
|
|
52
|
-
* Format-neutral; adapters map their native property systems into this set
|
|
52
|
+
* Format-neutral; adapters map their native property systems into this set -
|
|
53
53
|
* including the structured {@link TilePropertyPoint}, {@link TilePropertyObjectRef},
|
|
54
54
|
* and {@link TilePropertyTileRef} variants, arrays of any of the above, and
|
|
55
55
|
* nested property bags (e.g. Tiled `class`-typed properties).
|
|
@@ -62,8 +62,8 @@ export type TilePropertyValue = null | boolean | number | string | TilePropertyP
|
|
|
62
62
|
* a caller-owned mutable object.
|
|
63
63
|
*
|
|
64
64
|
* Declared as an interface (not a `Record<...>` type alias) so it can
|
|
65
|
-
* mutually recurse with {@link TilePropertyValue}
|
|
66
|
-
* that union
|
|
65
|
+
* mutually recurse with {@link TilePropertyValue} - a nested-bag member of
|
|
66
|
+
* that union - without TypeScript's "circularly references itself" alias
|
|
67
67
|
* restriction; structurally it behaves exactly like
|
|
68
68
|
* `Readonly<Record<string, TilePropertyValue>>`.
|
|
69
69
|
* @advanced
|
|
@@ -95,16 +95,16 @@ export declare const TILE_TRANSFORM_IDENTITY: Readonly<TileTransform>;
|
|
|
95
95
|
* Returns one of the eight deterministic names, e.g. `"flipX"` or `"diag+flipX+flipY"`.
|
|
96
96
|
* @internal
|
|
97
97
|
*/
|
|
98
|
-
export declare
|
|
98
|
+
export declare const tileTransformLabel: (t: TileTransform) => string;
|
|
99
99
|
/**
|
|
100
100
|
* Opaque packed tile data stored in a {@link TileChunk}'s compact array.
|
|
101
101
|
* 0 means "empty cell". Any non-zero value encodes localTileId, tilesetIndex,
|
|
102
102
|
* and flip bits according to the bit-layout constants below.
|
|
103
103
|
*
|
|
104
|
-
* A `PackedTile` is **not** a source-format GID
|
|
104
|
+
* A `PackedTile` is **not** a source-format GID - it is a fully resolved
|
|
105
105
|
* internal compact representation. Use {@link packTile} / {@link unpackTile}
|
|
106
|
-
*
|
|
107
|
-
*
|
|
106
|
+
* to convert between packed form and a {@link ResolvedTile} if writing
|
|
107
|
+
* adapters.
|
|
108
108
|
*
|
|
109
109
|
* In public APIs, prefer {@link ResolvedTile} or null for queries.
|
|
110
110
|
* `PackedTile` is exposed as `@advanced` so `ReadonlyTileChunk.getRawAt()`
|
|
@@ -133,15 +133,19 @@ export declare const MAX_LOCAL_TILE_ID: number;
|
|
|
133
133
|
* cleanly represents an empty cell, while tile 0 from tileset 0 with identity
|
|
134
134
|
* transform is stored as 1 (non-zero).
|
|
135
135
|
* Returns 0 for an empty cell.
|
|
136
|
-
*
|
|
136
|
+
*
|
|
137
|
+
* Public so chunk-provider authors (e.g. a format adapter or procedural
|
|
138
|
+
* generator) can build a {@link ChunkPayload}'s `tiles` array without
|
|
139
|
+
* duplicating this encoding.
|
|
140
|
+
* @advanced
|
|
137
141
|
*/
|
|
138
|
-
export declare
|
|
142
|
+
export declare const packTile: (tilesetIndex: number, localTileId: number, transform: TileTransform) => PackedTile;
|
|
139
143
|
/**
|
|
140
144
|
* Decode a packed word into its components.
|
|
141
145
|
* Returns null for an empty cell (packed === 0).
|
|
142
|
-
* @
|
|
146
|
+
* @advanced
|
|
143
147
|
*/
|
|
144
|
-
export declare
|
|
148
|
+
export declare const unpackTile: (packed: PackedTile) => {
|
|
145
149
|
tilesetIndex: number;
|
|
146
150
|
localTileId: number;
|
|
147
151
|
transform: TileTransform;
|
|
@@ -172,7 +176,7 @@ export interface TileAnimationFrame {
|
|
|
172
176
|
readonly duration: number;
|
|
173
177
|
}
|
|
174
178
|
/**
|
|
175
|
-
* Optional per-tile metadata in a {@link TileSet}. Sparse
|
|
179
|
+
* Optional per-tile metadata in a {@link TileSet}. Sparse - only defined
|
|
176
180
|
* tiles carry a definition.
|
|
177
181
|
* @advanced
|
|
178
182
|
*/
|
|
@@ -200,9 +204,9 @@ export interface ChunkCoord {
|
|
|
200
204
|
readonly cy: number;
|
|
201
205
|
}
|
|
202
206
|
/** Convert tile coordinates to chunk coordinates given a chunk size. */
|
|
203
|
-
export declare
|
|
207
|
+
export declare const tileToChunkCoord: (tx: number, ty: number, chunkW: number, chunkH: number) => ChunkCoord;
|
|
204
208
|
/** Convert tile coordinates to local-in-chunk coordinates. */
|
|
205
|
-
export declare
|
|
209
|
+
export declare const tileToLocalInChunk: (tx: number, ty: number, chunkW: number, chunkH: number) => {
|
|
206
210
|
lx: number;
|
|
207
211
|
ly: number;
|
|
208
212
|
};
|
|
@@ -210,12 +214,24 @@ export declare function tileToLocalInChunk(tx: number, ty: number, chunkW: numbe
|
|
|
210
214
|
* Validate that a value is a finite, safe, positive integer.
|
|
211
215
|
* Used for dimensions, tile counts, chunk sizes.
|
|
212
216
|
*/
|
|
213
|
-
export declare
|
|
217
|
+
export declare const validatePositiveInteger: (value: number, label: string) => void;
|
|
214
218
|
/**
|
|
215
219
|
* Validate a non-negative finite integer.
|
|
216
220
|
*/
|
|
217
|
-
export declare
|
|
221
|
+
export declare const validateNonNegativeInteger: (value: number, label: string) => void;
|
|
218
222
|
/**
|
|
219
223
|
* Validate that a value is a finite integer (may be negative).
|
|
220
224
|
*/
|
|
221
|
-
export declare
|
|
225
|
+
export declare const validateInteger: (value: number, label: string) => void;
|
|
226
|
+
/**
|
|
227
|
+
* Validate a `width`/`height` pair that must be provided together (bounded)
|
|
228
|
+
* or omitted together (unbounded) - shared by {@link import('./TileLayer').TileLayer}
|
|
229
|
+
* and {@link import('./TileMap').TileMap}. When both are provided, each is
|
|
230
|
+
* validated as a positive integer via {@link validatePositiveInteger}.
|
|
231
|
+
*
|
|
232
|
+
* @param entityName Used in the paired-presence error message (e.g. `"TileLayer"`).
|
|
233
|
+
* @param fieldPrefix Used as the field-name prefix passed to {@link validatePositiveInteger} (e.g. `"layer"` for `"layer.width"`).
|
|
234
|
+
* @throws If exactly one of `width`/`height` is provided, or either is not a positive integer.
|
|
235
|
+
*/
|
|
236
|
+
export declare const validatePairedDimensions: (width: number | undefined, height: number | undefined, entityName: string, fieldPrefix: string) => void;
|
|
237
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB;;;;CAInB,CAAC;AAEX,mEAAmE;AACnE,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAExF,oEAAoE;AACpE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,OAAO,gBAAgB,CAAC,KAAK,CAAC;IAC7C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,OAAO,gBAAgB,CAAC,SAAS,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