@codexo/exojs-tilemap 0.13.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/LICENSE +21 -0
- package/README.md +187 -0
- package/dist/esm/TileChunk.d.ts +136 -0
- package/dist/esm/TileChunk.js +192 -0
- package/dist/esm/TileChunk.js.map +1 -0
- package/dist/esm/TileChunkNode.d.ts +59 -0
- package/dist/esm/TileChunkNode.js +89 -0
- package/dist/esm/TileChunkNode.js.map +1 -0
- package/dist/esm/TileLayer.d.ts +229 -0
- package/dist/esm/TileLayer.js +450 -0
- package/dist/esm/TileLayer.js.map +1 -0
- package/dist/esm/TileLayerNode.d.ts +81 -0
- package/dist/esm/TileLayerNode.js +142 -0
- package/dist/esm/TileLayerNode.js.map +1 -0
- package/dist/esm/TileMap.d.ts +178 -0
- package/dist/esm/TileMap.js +262 -0
- package/dist/esm/TileMap.js.map +1 -0
- package/dist/esm/TileMapBand.d.ts +97 -0
- package/dist/esm/TileMapBand.js +161 -0
- package/dist/esm/TileMapBand.js.map +1 -0
- package/dist/esm/TileMapNode.d.ts +71 -0
- package/dist/esm/TileMapNode.js +113 -0
- package/dist/esm/TileMapNode.js.map +1 -0
- package/dist/esm/TileMapView.d.ts +182 -0
- package/dist/esm/TileMapView.js +342 -0
- package/dist/esm/TileMapView.js.map +1 -0
- package/dist/esm/TileSet.d.ts +99 -0
- package/dist/esm/TileSet.js +157 -0
- package/dist/esm/TileSet.js.map +1 -0
- package/dist/esm/chunkGeometry.d.ts +71 -0
- package/dist/esm/chunkGeometry.js +98 -0
- package/dist/esm/chunkGeometry.js.map +1 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +10 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/pixelSnap.d.ts +12 -0
- package/dist/esm/pixelSnap.js +19 -0
- package/dist/esm/pixelSnap.js.map +1 -0
- package/dist/esm/public.d.ts +18 -0
- package/dist/esm/register.d.ts +1 -0
- package/dist/esm/register.js +20 -0
- package/dist/esm/register.js.map +1 -0
- package/dist/esm/tilemapExtension.d.ts +18 -0
- package/dist/esm/tilemapExtension.js +52 -0
- package/dist/esm/tilemapExtension.js.map +1 -0
- package/dist/esm/types.d.ts +139 -0
- package/dist/esm/types.js +121 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/webgl2/WebGl2TileChunkRenderer.d.ts +39 -0
- package/dist/esm/webgl2/WebGl2TileChunkRenderer.js +339 -0
- package/dist/esm/webgl2/WebGl2TileChunkRenderer.js.map +1 -0
- package/dist/esm/webgpu/WebGpuTileChunkRenderer.d.ts +42 -0
- package/dist/esm/webgpu/WebGpuTileChunkRenderer.js +390 -0
- package/dist/esm/webgpu/WebGpuTileChunkRenderer.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Drawable } from '@codexo/exojs/rendering';
|
|
2
|
+
import { buildChunkPages } from './chunkGeometry.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A single renderable tile chunk. One `TileChunkNode` is a {@link Drawable}
|
|
6
|
+
* that owns the batched quad geometry for exactly one {@link ReadonlyTileChunk}
|
|
7
|
+
* of one {@link import('./TileLayer').TileLayer}, positioned at the chunk's
|
|
8
|
+
* pixel origin within the owning {@link TileLayerNode}.
|
|
9
|
+
*
|
|
10
|
+
* Geometry is built lazily and cached against the source chunk's `revision`:
|
|
11
|
+
* the renderer reads {@link TileChunkNode.pages} on each visible frame, but a
|
|
12
|
+
* rebuild only happens when the underlying chunk actually changed. Off-screen
|
|
13
|
+
* chunks are culled by their accurate {@link getLocalBounds} before `render`
|
|
14
|
+
* is ever called, so a camera pan rebuilds nothing.
|
|
15
|
+
*
|
|
16
|
+
* The node references — but never owns — the runtime chunk, tilesets, and
|
|
17
|
+
* tileset textures. Destroying it releases only its cached CPU geometry; the
|
|
18
|
+
* `TileMap`/`TileLayer` data and Loader-owned textures are untouched.
|
|
19
|
+
*
|
|
20
|
+
* @internal Package-internal render node; the renderer is registered for this
|
|
21
|
+
* class. Applications use {@link TileMapNode} / {@link TileLayerNode}.
|
|
22
|
+
*/
|
|
23
|
+
class TileChunkNode extends Drawable {
|
|
24
|
+
_chunk;
|
|
25
|
+
_tilesets;
|
|
26
|
+
_tileWidth;
|
|
27
|
+
_tileHeight;
|
|
28
|
+
_pixelWidth;
|
|
29
|
+
_pixelHeight;
|
|
30
|
+
_pages = [];
|
|
31
|
+
_builtRevision = -1;
|
|
32
|
+
/**
|
|
33
|
+
* @param chunk The readonly chunk this node renders.
|
|
34
|
+
* @param tilesets The owning layer's tileset array.
|
|
35
|
+
* @param tileWidth Map/layer tile cell width in pixels.
|
|
36
|
+
* @param tileHeight Map/layer tile cell height in pixels.
|
|
37
|
+
* @param chunkWidthTiles The layer's (unclamped) chunk width in tiles, used
|
|
38
|
+
* to compute the chunk's pixel origin. Edge chunks
|
|
39
|
+
* report a smaller `chunk.width`, but always start at
|
|
40
|
+
* `cx * chunkWidthTiles`.
|
|
41
|
+
* @param chunkHeightTiles The layer's (unclamped) chunk height in tiles.
|
|
42
|
+
*/
|
|
43
|
+
constructor(chunk, tilesets, tileWidth, tileHeight, chunkWidthTiles, chunkHeightTiles) {
|
|
44
|
+
super();
|
|
45
|
+
this._chunk = chunk;
|
|
46
|
+
this._tilesets = tilesets;
|
|
47
|
+
this._tileWidth = tileWidth;
|
|
48
|
+
this._tileHeight = tileHeight;
|
|
49
|
+
this._pixelWidth = chunk.width * tileWidth;
|
|
50
|
+
this._pixelHeight = chunk.height * tileHeight;
|
|
51
|
+
this.setPosition(chunk.cx * chunkWidthTiles * tileWidth, chunk.cy * chunkHeightTiles * tileHeight);
|
|
52
|
+
}
|
|
53
|
+
/** The signed chunk coordinates this node renders. */
|
|
54
|
+
get chunkX() {
|
|
55
|
+
return this._chunk.cx;
|
|
56
|
+
}
|
|
57
|
+
get chunkY() {
|
|
58
|
+
return this._chunk.cy;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The revision-cached per-tileset page geometry. Rebuilt only when the source
|
|
62
|
+
* chunk's `revision` advances; otherwise the same arrays are returned.
|
|
63
|
+
* @internal Read by the per-backend tile chunk renderer.
|
|
64
|
+
*/
|
|
65
|
+
get pages() {
|
|
66
|
+
if (this._builtRevision !== this._chunk.revision) {
|
|
67
|
+
this._pages = buildChunkPages(this._chunk, this._tilesets, this._tileWidth, this._tileHeight);
|
|
68
|
+
this._builtRevision = this._chunk.revision;
|
|
69
|
+
}
|
|
70
|
+
return this._pages;
|
|
71
|
+
}
|
|
72
|
+
/** `true` when the chunk has no drawable tiles (no geometry, no draw calls). */
|
|
73
|
+
get isEmpty() {
|
|
74
|
+
return this.pages.length === 0;
|
|
75
|
+
}
|
|
76
|
+
getLocalBounds() {
|
|
77
|
+
const bounds = super.getLocalBounds();
|
|
78
|
+
bounds.set(0, 0, this._pixelWidth, this._pixelHeight);
|
|
79
|
+
return bounds;
|
|
80
|
+
}
|
|
81
|
+
destroy() {
|
|
82
|
+
this._pages = [];
|
|
83
|
+
this._builtRevision = -1;
|
|
84
|
+
super.destroy();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export { TileChunkNode };
|
|
89
|
+
//# sourceMappingURL=TileChunkNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TileChunkNode.js","sources":["../../../src/TileChunkNode.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAQA;;;;;;;;;;;;;;;;;;AAkBG;AACG,MAAO,aAAc,SAAQ,QAAQ,CAAA;AACxB,IAAA,MAAM;AACN,IAAA,SAAS;AACT,IAAA,UAAU;AACV,IAAA,WAAW;AACX,IAAA,WAAW;AACX,IAAA,YAAY;IAErB,MAAM,GAAgB,EAAE;IACxB,cAAc,GAAG,EAAE;AAE3B;;;;;;;;;;AAUG;IACH,WAAA,CACE,KAAwB,EACxB,QAA4B,EAC5B,SAAiB,EACjB,UAAkB,EAClB,eAAuB,EACvB,gBAAwB,EAAA;AAExB,QAAA,KAAK,EAAE;AAEP,QAAA,IAAI,CAAC,MAAM,GAAG,KAAK;AACnB,QAAA,IAAI,CAAC,SAAS,GAAG,QAAQ;AACzB,QAAA,IAAI,CAAC,UAAU,GAAG,SAAS;AAC3B,QAAA,IAAI,CAAC,WAAW,GAAG,UAAU;QAC7B,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC,KAAK,GAAG,SAAS;QAC1C,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,MAAM,GAAG,UAAU;AAE7C,QAAA,IAAI,CAAC,WAAW,CACd,KAAK,CAAC,EAAE,GAAG,eAAe,GAAG,SAAS,EACtC,KAAK,CAAC,EAAE,GAAG,gBAAgB,GAAG,UAAU,CACzC;IACH;;AAGA,IAAA,IAAW,MAAM,GAAA;AACf,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE;IACvB;AAEA,IAAA,IAAW,MAAM,GAAA;AACf,QAAA,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE;IACvB;AAEA;;;;AAIG;AACH,IAAA,IAAW,KAAK,GAAA;QACd,IAAI,IAAI,CAAC,cAAc,KAAK,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE;YAChD,IAAI,CAAC,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC;YAC7F,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ;QAC5C;QAEA,OAAO,IAAI,CAAC,MAAM;IACpB;;AAGA,IAAA,IAAW,OAAO,GAAA;AAChB,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;IAChC;IAEgB,cAAc,GAAA;AAC5B,QAAA,MAAM,MAAM,GAAG,KAAK,CAAC,cAAc,EAAE;AAErC,QAAA,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC;AAErD,QAAA,OAAO,MAAM;IACf;IAEgB,OAAO,GAAA;AACrB,QAAA,IAAI,CAAC,MAAM,GAAG,EAAE;AAChB,QAAA,IAAI,CAAC,cAAc,GAAG,EAAE;QAExB,KAAK,CAAC,OAAO,EAAE;IACjB;AACD;;;;"}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import type { ReadonlyTileChunk } from './TileChunk';
|
|
2
|
+
import { TileChunk } from './TileChunk';
|
|
3
|
+
import type { TileSet } from './TileSet';
|
|
4
|
+
import type { TileProperties } from './types';
|
|
5
|
+
import type { PackedTile, ResolvedTile } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* Options for constructing a {@link TileLayer}.
|
|
8
|
+
* @advanced
|
|
9
|
+
*/
|
|
10
|
+
export interface TileLayerOptions {
|
|
11
|
+
/** Stable layer ID (unique within the map). */
|
|
12
|
+
readonly id: number;
|
|
13
|
+
/** Display name (need not be unique). */
|
|
14
|
+
readonly name: string;
|
|
15
|
+
/** Layer width in tiles. */
|
|
16
|
+
readonly width: number;
|
|
17
|
+
/** Layer height in tiles. */
|
|
18
|
+
readonly height: number;
|
|
19
|
+
/** Chunk width in tiles (default 32). */
|
|
20
|
+
readonly chunkWidth?: number;
|
|
21
|
+
/** Chunk height in tiles (default 32). */
|
|
22
|
+
readonly chunkHeight?: number;
|
|
23
|
+
/** Tilesets available to this layer (shared with the map). */
|
|
24
|
+
readonly tilesets: readonly TileSet[];
|
|
25
|
+
/** Tile width in pixels (for coordinate conversion). */
|
|
26
|
+
readonly tileWidth: number;
|
|
27
|
+
/** Tile height in pixels (for coordinate conversion). */
|
|
28
|
+
readonly tileHeight: number;
|
|
29
|
+
/** Initial visibility. Default true. */
|
|
30
|
+
readonly visible?: boolean;
|
|
31
|
+
/** Opacity 0..1. Default 1. */
|
|
32
|
+
readonly opacity?: number;
|
|
33
|
+
/** Layer pixel offset X. Default 0. */
|
|
34
|
+
readonly offsetX?: number;
|
|
35
|
+
/** Layer pixel offset Y. Default 0. */
|
|
36
|
+
readonly offsetY?: number;
|
|
37
|
+
/** Layer properties (copied and frozen). */
|
|
38
|
+
readonly properties?: TileProperties;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A generic, format-independent tile layer with chunk-first storage.
|
|
42
|
+
*
|
|
43
|
+
* Tile data is stored in fixed-size {@link TileChunk}s indexed by signed
|
|
44
|
+
* chunk coordinates. For finite maps, only chunks that intersect the layer
|
|
45
|
+
* bounds exist.
|
|
46
|
+
*
|
|
47
|
+
* **Mutation must go through the layer's public APIs only.**
|
|
48
|
+
* `setTileAt` / `clearTileAt` validate coordinates, tileset references,
|
|
49
|
+
* and increment revision counters only when the stored value actually
|
|
50
|
+
* changes. Direct chunk mutation is not supported — the layer owns chunk
|
|
51
|
+
* storage and exposes only a {@link ReadonlyTileChunk} view.
|
|
52
|
+
*
|
|
53
|
+
* The layer is NOT a SceneNode — that integration lives in the future
|
|
54
|
+
* renderer slice.
|
|
55
|
+
*
|
|
56
|
+
* @advanced
|
|
57
|
+
*/
|
|
58
|
+
export declare class TileLayer {
|
|
59
|
+
/** Stable unique ID within the map. */
|
|
60
|
+
readonly id: number;
|
|
61
|
+
/** Display name (may not be unique). */
|
|
62
|
+
readonly name: string;
|
|
63
|
+
/** Width in tiles. */
|
|
64
|
+
readonly width: number;
|
|
65
|
+
/** Height in tiles. */
|
|
66
|
+
readonly height: number;
|
|
67
|
+
/** Chunk width (tiles). */
|
|
68
|
+
readonly chunkWidth: number;
|
|
69
|
+
/** Chunk height (tiles). */
|
|
70
|
+
readonly chunkHeight: number;
|
|
71
|
+
/** Tile width in pixels. */
|
|
72
|
+
readonly tileWidth: number;
|
|
73
|
+
/** Tile height in pixels. */
|
|
74
|
+
readonly tileHeight: number;
|
|
75
|
+
/** Pixel width. */
|
|
76
|
+
get pixelWidth(): number;
|
|
77
|
+
/** Pixel height. */
|
|
78
|
+
get pixelHeight(): number;
|
|
79
|
+
/** Visibility flag (mutable). */
|
|
80
|
+
visible: boolean;
|
|
81
|
+
/** Opacity 0..1 (mutable). */
|
|
82
|
+
opacity: number;
|
|
83
|
+
/** Horizontal pixel offset (mutable). */
|
|
84
|
+
offsetX: number;
|
|
85
|
+
/** Vertical pixel offset (mutable). */
|
|
86
|
+
offsetY: number;
|
|
87
|
+
/** Immutable layer properties. */
|
|
88
|
+
readonly properties: TileProperties;
|
|
89
|
+
/** The tilesets available to this layer (shared array reference). */
|
|
90
|
+
readonly tilesets: readonly TileSet[];
|
|
91
|
+
/** Chunk storage: chunkKey → mutable TileChunk (internal). */
|
|
92
|
+
private readonly _chunks;
|
|
93
|
+
/**
|
|
94
|
+
* Monotonic layer revision counter.
|
|
95
|
+
* Increments on every cell mutation that actually changes a stored value.
|
|
96
|
+
* Does NOT increment on no-op writes or failed mutations.
|
|
97
|
+
*/
|
|
98
|
+
private _revision;
|
|
99
|
+
/** Whether the layer has been destroyed. */
|
|
100
|
+
private _destroyed;
|
|
101
|
+
/**
|
|
102
|
+
* @throws When dimensions, chunk size, or other options are invalid.
|
|
103
|
+
*/
|
|
104
|
+
constructor(options: TileLayerOptions);
|
|
105
|
+
/**
|
|
106
|
+
* Check whether a tile coordinate lies within the layer bounds.
|
|
107
|
+
* @advanced
|
|
108
|
+
*/
|
|
109
|
+
inBounds(tx: number, ty: number): boolean;
|
|
110
|
+
/** Compute the range of chunk coordinates that intersect this layer. */
|
|
111
|
+
chunkRange(): {
|
|
112
|
+
minCx: number;
|
|
113
|
+
minCy: number;
|
|
114
|
+
maxCx: number;
|
|
115
|
+
maxCy: number;
|
|
116
|
+
};
|
|
117
|
+
private _chunkKey;
|
|
118
|
+
/**
|
|
119
|
+
* Get a readonly view of a chunk by signed chunk coordinates,
|
|
120
|
+
* or undefined if it does not exist (never been touched).
|
|
121
|
+
* @advanced
|
|
122
|
+
*/
|
|
123
|
+
getChunk(cx: number, cy: number): ReadonlyTileChunk | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* Get or create a chunk at the given coordinates.
|
|
126
|
+
* For finite layers, creation is only allowed within the valid chunk range.
|
|
127
|
+
*
|
|
128
|
+
* @internal Package-private: used by {@link setTileAt}, {@link fillRect},
|
|
129
|
+
* and future adapter ingest. External users should not allocate
|
|
130
|
+
* chunks — use {@link setTileAt} to populate tiles.
|
|
131
|
+
*/
|
|
132
|
+
_ensureChunk(cx: number, cy: number): TileChunk;
|
|
133
|
+
/**
|
|
134
|
+
* Iterate over all loaded chunks in deterministic (cy, cx) ascending order.
|
|
135
|
+
* Returns readonly chunk views — callers cannot mutate storage.
|
|
136
|
+
* @advanced
|
|
137
|
+
*/
|
|
138
|
+
loadedChunks(): IterableIterator<ReadonlyTileChunk>;
|
|
139
|
+
/**
|
|
140
|
+
* Get the raw packed tile word at (tx, ty). Returns 0 for empty or out-of-bounds.
|
|
141
|
+
* @advanced
|
|
142
|
+
*/
|
|
143
|
+
getRawTileAt(tx: number, ty: number): PackedTile;
|
|
144
|
+
/**
|
|
145
|
+
* Query a resolved tile at (tx, ty). Returns null for empty or out-of-bounds.
|
|
146
|
+
* @advanced
|
|
147
|
+
*/
|
|
148
|
+
getTileAt(tx: number, ty: number): ResolvedTile | null;
|
|
149
|
+
/**
|
|
150
|
+
* Validate a tile reference against the layer's tilesets.
|
|
151
|
+
* Returns the packed form or throws.
|
|
152
|
+
*/
|
|
153
|
+
private _validateTileRef;
|
|
154
|
+
/**
|
|
155
|
+
* Set a tile at the given tile coordinates.
|
|
156
|
+
* No-op if the effective value is unchanged.
|
|
157
|
+
* @throws If coordinates are out of bounds or the tile reference is invalid.
|
|
158
|
+
* @advanced
|
|
159
|
+
*/
|
|
160
|
+
setTileAt(tx: number, ty: number, tile: ResolvedTile): void;
|
|
161
|
+
/**
|
|
162
|
+
* Clear (erase) the tile at the given coordinates.
|
|
163
|
+
* No-op if the cell is already empty.
|
|
164
|
+
* @throws If coordinates are out of bounds.
|
|
165
|
+
* @advanced
|
|
166
|
+
*/
|
|
167
|
+
clearTileAt(tx: number, ty: number): void;
|
|
168
|
+
/**
|
|
169
|
+
* Fill a rectangular region with a tile.
|
|
170
|
+
* @advanced
|
|
171
|
+
*/
|
|
172
|
+
fillRect(x: number, y: number, w: number, h: number, tile: ResolvedTile): void;
|
|
173
|
+
/**
|
|
174
|
+
* Clear a rectangular region.
|
|
175
|
+
* @advanced
|
|
176
|
+
*/
|
|
177
|
+
clearRect(x: number, y: number, w: number, h: number): void;
|
|
178
|
+
/**
|
|
179
|
+
* Iterate non-empty tiles within a rectangular region in row-major order.
|
|
180
|
+
* Yields (tx, ty, resolvedTile) tuples. Skips empty cells.
|
|
181
|
+
* @advanced
|
|
182
|
+
*/
|
|
183
|
+
tilesInRect(x: number, y: number, w: number, h: number): Generator<{
|
|
184
|
+
tx: number;
|
|
185
|
+
ty: number;
|
|
186
|
+
tile: ResolvedTile;
|
|
187
|
+
}>;
|
|
188
|
+
/**
|
|
189
|
+
* Convert a tile coordinate to the pixel position of its top-left corner
|
|
190
|
+
* in the layer's local space.
|
|
191
|
+
* @advanced
|
|
192
|
+
*/
|
|
193
|
+
tileToPixel(tx: number, ty: number): {
|
|
194
|
+
x: number;
|
|
195
|
+
y: number;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Convert a local pixel position to the tile coordinate that contains it.
|
|
199
|
+
* Uses `floor`, so a point exactly on a tile boundary maps to the tile.
|
|
200
|
+
* May return coordinates outside layer bounds.
|
|
201
|
+
* @advanced
|
|
202
|
+
*/
|
|
203
|
+
pixelToTile(px: number, py: number): {
|
|
204
|
+
tx: number;
|
|
205
|
+
ty: number;
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* Monotonic layer revision counter.
|
|
209
|
+
* Increments on every cell mutation that changes a stored value.
|
|
210
|
+
* No-op writes and failed mutations do NOT increment.
|
|
211
|
+
* @advanced
|
|
212
|
+
*/
|
|
213
|
+
get revision(): number;
|
|
214
|
+
/** Whether the layer has been destroyed. */
|
|
215
|
+
get destroyed(): boolean;
|
|
216
|
+
private _checkDestroyed;
|
|
217
|
+
/**
|
|
218
|
+
* Destroy this layer: clear chunk storage and mark destroyed.
|
|
219
|
+
* Does NOT destroy tileset textures or external resources.
|
|
220
|
+
* Idempotent.
|
|
221
|
+
*/
|
|
222
|
+
destroy(): void;
|
|
223
|
+
/**
|
|
224
|
+
* Total number of non-empty tiles across all chunks.
|
|
225
|
+
* Walk is cheap for dense layers; sparse layers benefit from empty-chunk fast path.
|
|
226
|
+
* @advanced
|
|
227
|
+
*/
|
|
228
|
+
countNonEmptyTiles(): number;
|
|
229
|
+
}
|