@codexo/exojs-tilemap 0.16.1 → 0.17.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/dist/esm/ChunkStreamer.d.ts +6 -0
- package/dist/esm/ChunkStreamer.d.ts.map +1 -1
- package/dist/esm/ChunkStreamer.js +6 -0
- package/dist/esm/ChunkStreamer.js.map +1 -1
- package/dist/esm/ImageLayerNode.d.ts +1 -3
- package/dist/esm/ImageLayerNode.d.ts.map +1 -1
- package/dist/esm/MapSpawnSession.d.ts +0 -7
- package/dist/esm/MapSpawnSession.d.ts.map +1 -1
- package/dist/esm/MapWorldRuntime.d.ts +0 -2
- package/dist/esm/MapWorldRuntime.d.ts.map +1 -1
- package/dist/esm/TileChunk.d.ts +0 -58
- package/dist/esm/TileChunk.d.ts.map +1 -1
- package/dist/esm/TileChunkNode.d.ts +1 -73
- package/dist/esm/TileChunkNode.d.ts.map +1 -1
- package/dist/esm/TileChunkNode.js +1 -1
- package/dist/esm/TileChunkNode.js.map +1 -1
- package/dist/esm/TileLayer.d.ts +0 -63
- package/dist/esm/TileLayer.d.ts.map +1 -1
- package/dist/esm/TileLayerNode.d.ts +4 -11
- package/dist/esm/TileLayerNode.d.ts.map +1 -1
- package/dist/esm/TileLayerNode.js +11 -14
- package/dist/esm/TileLayerNode.js.map +1 -1
- package/dist/esm/TileMapBand.d.ts +0 -33
- package/dist/esm/TileMapBand.d.ts.map +1 -1
- package/dist/esm/TileMapNode.d.ts +1 -1
- package/dist/esm/TileMapNode.js +1 -1
- package/dist/esm/TileMapNode.js.map +1 -1
- package/dist/esm/TileSet.d.ts +6 -10
- package/dist/esm/TileSet.d.ts.map +1 -1
- package/dist/esm/TileSet.js +6 -4
- package/dist/esm/TileSet.js.map +1 -1
- package/dist/esm/WorkerSampledChunkSource.d.ts +6 -4
- package/dist/esm/WorkerSampledChunkSource.d.ts.map +1 -1
- package/dist/esm/WorkerSampledChunkSource.js +6 -4
- package/dist/esm/WorkerSampledChunkSource.js.map +1 -1
- package/dist/esm/chunkGeometry.d.ts +1 -71
- package/dist/esm/chunkGeometry.d.ts.map +1 -1
- package/dist/esm/nodeBounds.d.ts +1 -19
- package/dist/esm/nodeBounds.d.ts.map +1 -1
- package/dist/esm/pixelSnap.d.ts +1 -12
- package/dist/esm/pixelSnap.d.ts.map +1 -1
- package/dist/esm/tileWord.d.ts +1 -11
- package/dist/esm/tileWord.d.ts.map +1 -1
- package/dist/esm/tilemapExtension.d.ts.map +1 -1
- package/dist/esm/tilemapExtension.js +5 -8
- package/dist/esm/tilemapExtension.js.map +1 -1
- package/dist/esm/tilemapSerializers.d.ts +1 -19
- package/dist/esm/tilemapSerializers.d.ts.map +1 -1
- package/dist/esm/types.d.ts +0 -6
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/webgl2/WebGl2TileChunkRenderer.d.ts +1 -86
- package/dist/esm/webgl2/WebGl2TileChunkRenderer.d.ts.map +1 -1
- package/dist/esm/webgl2/WebGl2TileChunkRenderer.js +30 -28
- package/dist/esm/webgl2/WebGl2TileChunkRenderer.js.map +1 -1
- package/dist/esm/webgpu/WebGpuTileChunkRenderer.d.ts +1 -107
- package/dist/esm/webgpu/WebGpuTileChunkRenderer.d.ts.map +1 -1
- package/dist/esm/webgpu/WebGpuTileChunkRenderer.js +9 -9
- package/dist/esm/webgpu/WebGpuTileChunkRenderer.js.map +1 -1
- package/package.json +3 -3
|
@@ -79,6 +79,12 @@ export declare class ChunkStreamer {
|
|
|
79
79
|
* Evict every chunk this instance has loaded and stop responding to
|
|
80
80
|
* {@link update}. Does not affect chunks predating attachment or
|
|
81
81
|
* installed by another source. Idempotent.
|
|
82
|
+
*
|
|
83
|
+
* Does not destroy the {@link ChunkSource} passed to the constructor: this
|
|
84
|
+
* class only reads from it and never took ownership. A source with its own
|
|
85
|
+
* `destroy()` (e.g. {@link import('./WorkerSampledChunkSource').createWorkerSampledChunkSource}'s,
|
|
86
|
+
* which tears down a real `Worker`) must be destroyed separately by
|
|
87
|
+
* whoever created it.
|
|
82
88
|
*/
|
|
83
89
|
destroy(): void;
|
|
84
90
|
private _computeCoreRange;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChunkStreamer.d.ts","sourceRoot":"","sources":["../../src/ChunkStreamer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,IAAI,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,KAAK,EAAc,SAAS,EAAE,MAAM,aAAa,CAAC;AAGzD;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,qBAAqB,CAAC,EAAE,MAAM,CAAC;CACzC;AAWD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;IACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;IACtC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAO;IAC7B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAS;IAEhD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAmE;IAC7F,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA6B;IACvD,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,UAAU,CAAS;gBAER,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,oBAAoB;IAapG,0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aAAa,IAAI,MAAM,CAEjC;IAED;;;;;;;OAOG;IACI,MAAM,IAAI,IAAI;IA4CrB;;;;;;;;;;OAUG;IACI,OAAO,IAAI,IAAI;IAWtB,OAAO,CAAC,iBAAiB;IA6BzB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,OAAO;IASf,OAAO,CAAC,QAAQ;IAqChB;;;;;;;OAOG;IACH,OAAO,CAAC,WAAW;CAUpB"}
|
|
@@ -103,6 +103,12 @@ var ChunkStreamer = class {
|
|
|
103
103
|
* Evict every chunk this instance has loaded and stop responding to
|
|
104
104
|
* {@link update}. Does not affect chunks predating attachment or
|
|
105
105
|
* installed by another source. Idempotent.
|
|
106
|
+
*
|
|
107
|
+
* Does not destroy the {@link ChunkSource} passed to the constructor: this
|
|
108
|
+
* class only reads from it and never took ownership. A source with its own
|
|
109
|
+
* `destroy()` (e.g. {@link import('./WorkerSampledChunkSource').createWorkerSampledChunkSource}'s,
|
|
110
|
+
* which tears down a real `Worker`) must be destroyed separately by
|
|
111
|
+
* whoever created it.
|
|
106
112
|
*/
|
|
107
113
|
destroy() {
|
|
108
114
|
if (this._destroyed) return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChunkStreamer.js","names":[],"sources":["../../src/ChunkStreamer.ts"],"sourcesContent":["import { logger, type View } from '@codexo/exojs';\n\nimport type { ChunkPayload, ChunkSource } from './ChunkSource';\nimport type { ChunkRange, TileLayer } from './TileLayer';\nimport { tileToChunkCoord } from './types';\n\n/**\n * Options for a {@link ChunkStreamer}. All optional.\n * @advanced\n */\nexport interface ChunkStreamerOptions {\n /**\n * Chunks within this many chunk-units (Chebyshev distance to the visible\n * chunk range) of the view are loaded. Default `1`.\n */\n readonly loadRadius?: number;\n /**\n * Own-resident chunks beyond this many chunk-units of the view are\n * evicted. Must be `>= loadRadius` - the gap between the two is\n * deliberate hysteresis that prevents load/unload thrashing when the\n * view sits near a chunk boundary. Default `2`.\n */\n readonly unloadRadius?: number;\n /**\n * Maximum number of new chunk loads issued per {@link ChunkStreamer.update}\n * call, after the very first call (which loads the entire initial wanted\n * set unbudgeted, so the starting view never pops in). Default `8`.\n */\n readonly maxChunkLoadsPerFrame?: number;\n}\n\nconst DEFAULT_LOAD_RADIUS = 1;\nconst DEFAULT_UNLOAD_RADIUS = 2;\nconst DEFAULT_MAX_CHUNK_LOADS_PER_FRAME = 8;\n\nconst chunkKey = (cx: number, cy: number): string => `${cx},${cy}`;\n\nconst isThenable = (value: unknown): value is Promise<ChunkPayload | null> =>\n value !== null && typeof value === 'object' && typeof (value as { then?: unknown }).then === 'function';\n\n/**\n * Drives {@link TileLayer._adoptChunk}/{@link TileLayer._evictChunk} calls\n * from a {@link View}'s position: chunks near the view are requested from a\n * {@link ChunkSource} and installed; chunks that scroll far enough away are\n * evicted. Works on both unbounded and bounded layers (a bounded-but-large\n * layer still benefits from not keeping every chunk resident at once) - for\n * a bounded layer, the wanted range is clamped to {@link TileLayer.chunkRange}.\n *\n * Touches only the {@link TileLayer} data layer -\n * {@link import('./TileLayerNode').TileLayerNode} reacts to\n * `_adoptChunk`/`_evictChunk` on its own via a structural listener, so this\n * class has no rendering dependency and no reference to any scene node.\n *\n * Tracks its own resident set (chunks *this instance* has loaded), never\n * touching chunks that predate its attachment or were installed by another\n * source.\n *\n * Tick it from your update loop, like {@link import('./TileAnimator').TileAnimator}:\n *\n * ```ts\n * const streamer = new ChunkStreamer(layer, mySource, view);\n * scene.systems.add({ update: () => streamer.update() });\n * ```\n *\n * @advanced\n */\nexport class ChunkStreamer {\n private readonly _layer: TileLayer;\n private readonly _source: ChunkSource;\n private readonly _view: View;\n private readonly _loadRadius: number;\n private readonly _unloadRadius: number;\n private readonly _maxChunkLoadsPerFrame: number;\n\n private readonly _resident = new Map<string, { readonly cx: number; readonly cy: number }>();\n private readonly _inFlight = new Map<string, number>();\n private _requestCounter = 0;\n private _primed = false;\n private _destroyed = false;\n\n public constructor(layer: TileLayer, source: ChunkSource, view: View, options?: ChunkStreamerOptions) {\n this._layer = layer;\n this._source = source;\n this._view = view;\n this._loadRadius = options?.loadRadius ?? DEFAULT_LOAD_RADIUS;\n this._unloadRadius = options?.unloadRadius ?? DEFAULT_UNLOAD_RADIUS;\n this._maxChunkLoadsPerFrame = options?.maxChunkLoadsPerFrame ?? DEFAULT_MAX_CHUNK_LOADS_PER_FRAME;\n\n if (this._unloadRadius < this._loadRadius) {\n throw new Error(`ChunkStreamer unloadRadius (${this._unloadRadius}) must be >= loadRadius (${this._loadRadius}).`);\n }\n }\n\n /** Number of chunks this instance currently has resident in the layer. */\n public get residentCount(): number {\n return this._resident.size;\n }\n\n /**\n * Recompute the wanted chunk set from the view's current position; evict\n * own-resident chunks that fell outside `unloadRadius`, then request\n * chunks newly inside `loadRadius`. The very first call loads the entire\n * initial wanted set unbudgeted; every later call is capped at\n * {@link ChunkStreamerOptions.maxChunkLoadsPerFrame}. No-op once\n * {@link destroy}ed.\n */\n public update(): void {\n if (this._destroyed) return;\n\n const core = this._computeCoreRange();\n\n this._unload(core);\n\n const range = this._layer.chunkRange();\n let minCx = core.minCx - this._loadRadius;\n let minCy = core.minCy - this._loadRadius;\n let maxCx = core.maxCx + this._loadRadius;\n let maxCy = core.maxCy + this._loadRadius;\n if (range !== null) {\n minCx = Math.max(minCx, range.minCx);\n minCy = Math.max(minCy, range.minCy);\n maxCx = Math.min(maxCx, range.maxCx);\n maxCy = Math.min(maxCy, range.maxCy);\n }\n\n const toLoad: Array<{ cx: number; cy: number }> = [];\n for (let cy = minCy; cy <= maxCy; cy++) {\n for (let cx = minCx; cx <= maxCx; cx++) {\n const key = chunkKey(cx, cy);\n if (this._resident.has(key) || this._inFlight.has(key)) continue;\n toLoad.push({ cx, cy });\n }\n }\n\n if (!this._primed) {\n this._primed = true;\n for (const { cx, cy } of toLoad) {\n this._request(cx, cy);\n }\n return;\n }\n\n toLoad.sort((a, b) => this._rangeDistance(a.cx, a.cy, core) - this._rangeDistance(b.cx, b.cy, core));\n\n const budget = Math.min(this._maxChunkLoadsPerFrame, toLoad.length);\n for (const { cx, cy } of toLoad.slice(0, budget)) {\n this._request(cx, cy);\n }\n }\n\n /**\n * Evict every chunk this instance has loaded and stop responding to\n * {@link update}. Does not affect chunks predating attachment or\n * installed by another source. Idempotent.\n */\n public destroy(): void {\n if (this._destroyed) return;\n this._destroyed = true;\n\n for (const { cx, cy } of this._resident.values()) {\n this._layer._evictChunk(cx, cy);\n }\n this._resident.clear();\n this._inFlight.clear();\n }\n\n private _computeCoreRange(): ChunkRange {\n const layer = this._layer;\n const view = this._view;\n const bounds = view.getBounds();\n const centerX = view.center.x;\n const centerY = view.center.y;\n\n const shiftX = centerX * (1 - layer.parallaxX);\n const shiftY = centerY * (1 - layer.parallaxY);\n const scale = layer.parallaxScale;\n\n const layerLeft = layer.offsetX + (bounds.left - shiftX - layer.offsetX) / scale;\n const layerTop = layer.offsetY + (bounds.top - shiftY - layer.offsetY) / scale;\n const layerRight = layer.offsetX + (bounds.right - shiftX - layer.offsetX) / scale;\n const layerBottom = layer.offsetY + (bounds.bottom - shiftY - layer.offsetY) / scale;\n const topLeftTile = layer.pixelToTile(layerLeft, layerTop);\n const bottomRightTile = layer.pixelToTile(layerRight, layerBottom);\n\n const topLeftChunk = tileToChunkCoord(topLeftTile.tx, topLeftTile.ty, layer.chunkWidth, layer.chunkHeight);\n const bottomRightChunk = tileToChunkCoord(bottomRightTile.tx, bottomRightTile.ty, layer.chunkWidth, layer.chunkHeight);\n\n return {\n minCx: topLeftChunk.cx,\n minCy: topLeftChunk.cy,\n maxCx: bottomRightChunk.cx,\n maxCy: bottomRightChunk.cy,\n };\n }\n\n private _rangeDistance(cx: number, cy: number, range: ChunkRange): number {\n const dx = Math.max(range.minCx - cx, 0, cx - range.maxCx);\n const dy = Math.max(range.minCy - cy, 0, cy - range.maxCy);\n return Math.max(dx, dy);\n }\n\n private _unload(core: ChunkRange): void {\n for (const [key, { cx, cy }] of this._resident) {\n if (this._rangeDistance(cx, cy, core) > this._unloadRadius) {\n this._layer._evictChunk(cx, cy);\n this._resident.delete(key);\n }\n }\n }\n\n private _request(cx: number, cy: number): void {\n const key = chunkKey(cx, cy);\n const token = ++this._requestCounter;\n this._inFlight.set(key, token);\n\n let result: ChunkPayload | null | Promise<ChunkPayload | null>;\n try {\n result = this._source.getChunk(cx, cy);\n } catch (error) {\n this._inFlight.delete(key);\n logger.warn(`ChunkStreamer: source.getChunk(${cx}, ${cy}) threw synchronously.`, {\n source: 'ChunkStreamer',\n error: error instanceof Error ? error : new Error(String(error)),\n });\n\n return;\n }\n\n if (isThenable(result)) {\n result.then(\n payload => {\n this._onResolved(key, cx, cy, token, payload);\n },\n (error: unknown) => {\n this._inFlight.delete(key);\n logger.warn(`ChunkStreamer: source.getChunk(${cx}, ${cy}) rejected.`, {\n source: 'ChunkStreamer',\n error: error instanceof Error ? error : new Error(String(error)),\n });\n },\n );\n return;\n }\n\n this._onResolved(key, cx, cy, token, result);\n }\n\n /**\n * Ignore-on-resolve: only the `_destroyed` and in-flight-token checks\n * guard installation - a chunk that scrolled out of the wanted set while\n * its request was in flight is still installed if it resolves (installing\n * it is cheap and self-correcting: the next {@link update} call's unload\n * pass evicts it again if it's genuinely no longer wanted). There is no\n * edit-persistence to protect, so discarding is never destructive.\n */\n private _onResolved(key: string, cx: number, cy: number, token: number, payload: ChunkPayload | null): void {\n if (this._destroyed) return;\n if (this._inFlight.get(key) !== token) return;\n this._inFlight.delete(key);\n\n if (payload === null) return;\n\n this._layer._adoptChunk(cx, cy, payload);\n this._resident.set(key, { cx, cy });\n }\n}\n"],"mappings":";;;;AA+BA,MAAM,sBAAsB;AAC5B,MAAM,wBAAwB;AAC9B,MAAM,oCAAoC;AAE1C,MAAM,YAAY,IAAY,OAAuB,GAAG,GAAG,GAAG;AAE9D,MAAM,cAAc,UAClB,UAAU,QAAQ,OAAO,UAAU,YAAY,OAAQ,MAA6B,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4B/F,IAAa,gBAAb,MAA2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;EAEA,IAAI,WAAW,MAAM,GAAG;GACtB,OAAO,MACL,YAAW;IACT,KAAK,YAAY,KAAK,IAAI,IAAI,OAAO,OAAO;GAC9C,IACC,UAAmB;IAClB,KAAK,UAAU,OAAO,GAAG;IACzB,OAAO,KAAK,kCAAkC,GAAG,IAAI,GAAG,cAAc;KACpE,QAAQ;KACR,OAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,KAAK,CAAC;IACjE,CAAC;GACH,CACF;GACA;EACF;EAEA,KAAK,YAAY,KAAK,IAAI,IAAI,OAAO,MAAM;CAC7C;;;;;;;;;CAUA,AAAQ,YAAY,KAAa,IAAY,IAAY,OAAe,SAAoC;EAC1G,IAAI,KAAK,YAAY;EACrB,IAAI,KAAK,UAAU,IAAI,GAAG,MAAM,OAAO;EACvC,KAAK,UAAU,OAAO,GAAG;EAEzB,IAAI,YAAY,MAAM;EAEtB,KAAK,OAAO,YAAY,IAAI,IAAI,OAAO;EACvC,KAAK,UAAU,IAAI,KAAK;GAAE;GAAI;EAAG,CAAC;CACpC;AACF"}
|
|
1
|
+
{"version":3,"file":"ChunkStreamer.js","names":[],"sources":["../../src/ChunkStreamer.ts"],"sourcesContent":["import { logger, type View } from '@codexo/exojs';\n\nimport type { ChunkPayload, ChunkSource } from './ChunkSource';\nimport type { ChunkRange, TileLayer } from './TileLayer';\nimport { tileToChunkCoord } from './types';\n\n/**\n * Options for a {@link ChunkStreamer}. All optional.\n * @advanced\n */\nexport interface ChunkStreamerOptions {\n /**\n * Chunks within this many chunk-units (Chebyshev distance to the visible\n * chunk range) of the view are loaded. Default `1`.\n */\n readonly loadRadius?: number;\n /**\n * Own-resident chunks beyond this many chunk-units of the view are\n * evicted. Must be `>= loadRadius` - the gap between the two is\n * deliberate hysteresis that prevents load/unload thrashing when the\n * view sits near a chunk boundary. Default `2`.\n */\n readonly unloadRadius?: number;\n /**\n * Maximum number of new chunk loads issued per {@link ChunkStreamer.update}\n * call, after the very first call (which loads the entire initial wanted\n * set unbudgeted, so the starting view never pops in). Default `8`.\n */\n readonly maxChunkLoadsPerFrame?: number;\n}\n\nconst DEFAULT_LOAD_RADIUS = 1;\nconst DEFAULT_UNLOAD_RADIUS = 2;\nconst DEFAULT_MAX_CHUNK_LOADS_PER_FRAME = 8;\n\nconst chunkKey = (cx: number, cy: number): string => `${cx},${cy}`;\n\nconst isThenable = (value: unknown): value is Promise<ChunkPayload | null> =>\n value !== null && typeof value === 'object' && typeof (value as { then?: unknown }).then === 'function';\n\n/**\n * Drives {@link TileLayer._adoptChunk}/{@link TileLayer._evictChunk} calls\n * from a {@link View}'s position: chunks near the view are requested from a\n * {@link ChunkSource} and installed; chunks that scroll far enough away are\n * evicted. Works on both unbounded and bounded layers (a bounded-but-large\n * layer still benefits from not keeping every chunk resident at once) - for\n * a bounded layer, the wanted range is clamped to {@link TileLayer.chunkRange}.\n *\n * Touches only the {@link TileLayer} data layer -\n * {@link import('./TileLayerNode').TileLayerNode} reacts to\n * `_adoptChunk`/`_evictChunk` on its own via a structural listener, so this\n * class has no rendering dependency and no reference to any scene node.\n *\n * Tracks its own resident set (chunks *this instance* has loaded), never\n * touching chunks that predate its attachment or were installed by another\n * source.\n *\n * Tick it from your update loop, like {@link import('./TileAnimator').TileAnimator}:\n *\n * ```ts\n * const streamer = new ChunkStreamer(layer, mySource, view);\n * scene.systems.add({ update: () => streamer.update() });\n * ```\n *\n * @advanced\n */\nexport class ChunkStreamer {\n private readonly _layer: TileLayer;\n private readonly _source: ChunkSource;\n private readonly _view: View;\n private readonly _loadRadius: number;\n private readonly _unloadRadius: number;\n private readonly _maxChunkLoadsPerFrame: number;\n\n private readonly _resident = new Map<string, { readonly cx: number; readonly cy: number }>();\n private readonly _inFlight = new Map<string, number>();\n private _requestCounter = 0;\n private _primed = false;\n private _destroyed = false;\n\n public constructor(layer: TileLayer, source: ChunkSource, view: View, options?: ChunkStreamerOptions) {\n this._layer = layer;\n this._source = source;\n this._view = view;\n this._loadRadius = options?.loadRadius ?? DEFAULT_LOAD_RADIUS;\n this._unloadRadius = options?.unloadRadius ?? DEFAULT_UNLOAD_RADIUS;\n this._maxChunkLoadsPerFrame = options?.maxChunkLoadsPerFrame ?? DEFAULT_MAX_CHUNK_LOADS_PER_FRAME;\n\n if (this._unloadRadius < this._loadRadius) {\n throw new Error(`ChunkStreamer unloadRadius (${this._unloadRadius}) must be >= loadRadius (${this._loadRadius}).`);\n }\n }\n\n /** Number of chunks this instance currently has resident in the layer. */\n public get residentCount(): number {\n return this._resident.size;\n }\n\n /**\n * Recompute the wanted chunk set from the view's current position; evict\n * own-resident chunks that fell outside `unloadRadius`, then request\n * chunks newly inside `loadRadius`. The very first call loads the entire\n * initial wanted set unbudgeted; every later call is capped at\n * {@link ChunkStreamerOptions.maxChunkLoadsPerFrame}. No-op once\n * {@link destroy}ed.\n */\n public update(): void {\n if (this._destroyed) return;\n\n const core = this._computeCoreRange();\n\n this._unload(core);\n\n const range = this._layer.chunkRange();\n let minCx = core.minCx - this._loadRadius;\n let minCy = core.minCy - this._loadRadius;\n let maxCx = core.maxCx + this._loadRadius;\n let maxCy = core.maxCy + this._loadRadius;\n if (range !== null) {\n minCx = Math.max(minCx, range.minCx);\n minCy = Math.max(minCy, range.minCy);\n maxCx = Math.min(maxCx, range.maxCx);\n maxCy = Math.min(maxCy, range.maxCy);\n }\n\n const toLoad: Array<{ cx: number; cy: number }> = [];\n for (let cy = minCy; cy <= maxCy; cy++) {\n for (let cx = minCx; cx <= maxCx; cx++) {\n const key = chunkKey(cx, cy);\n if (this._resident.has(key) || this._inFlight.has(key)) continue;\n toLoad.push({ cx, cy });\n }\n }\n\n if (!this._primed) {\n this._primed = true;\n for (const { cx, cy } of toLoad) {\n this._request(cx, cy);\n }\n return;\n }\n\n toLoad.sort((a, b) => this._rangeDistance(a.cx, a.cy, core) - this._rangeDistance(b.cx, b.cy, core));\n\n const budget = Math.min(this._maxChunkLoadsPerFrame, toLoad.length);\n for (const { cx, cy } of toLoad.slice(0, budget)) {\n this._request(cx, cy);\n }\n }\n\n /**\n * Evict every chunk this instance has loaded and stop responding to\n * {@link update}. Does not affect chunks predating attachment or\n * installed by another source. Idempotent.\n *\n * Does not destroy the {@link ChunkSource} passed to the constructor: this\n * class only reads from it and never took ownership. A source with its own\n * `destroy()` (e.g. {@link import('./WorkerSampledChunkSource').createWorkerSampledChunkSource}'s,\n * which tears down a real `Worker`) must be destroyed separately by\n * whoever created it.\n */\n public destroy(): void {\n if (this._destroyed) return;\n this._destroyed = true;\n\n for (const { cx, cy } of this._resident.values()) {\n this._layer._evictChunk(cx, cy);\n }\n this._resident.clear();\n this._inFlight.clear();\n }\n\n private _computeCoreRange(): ChunkRange {\n const layer = this._layer;\n const view = this._view;\n const bounds = view.getBounds();\n const centerX = view.center.x;\n const centerY = view.center.y;\n\n const shiftX = centerX * (1 - layer.parallaxX);\n const shiftY = centerY * (1 - layer.parallaxY);\n const scale = layer.parallaxScale;\n\n const layerLeft = layer.offsetX + (bounds.left - shiftX - layer.offsetX) / scale;\n const layerTop = layer.offsetY + (bounds.top - shiftY - layer.offsetY) / scale;\n const layerRight = layer.offsetX + (bounds.right - shiftX - layer.offsetX) / scale;\n const layerBottom = layer.offsetY + (bounds.bottom - shiftY - layer.offsetY) / scale;\n const topLeftTile = layer.pixelToTile(layerLeft, layerTop);\n const bottomRightTile = layer.pixelToTile(layerRight, layerBottom);\n\n const topLeftChunk = tileToChunkCoord(topLeftTile.tx, topLeftTile.ty, layer.chunkWidth, layer.chunkHeight);\n const bottomRightChunk = tileToChunkCoord(bottomRightTile.tx, bottomRightTile.ty, layer.chunkWidth, layer.chunkHeight);\n\n return {\n minCx: topLeftChunk.cx,\n minCy: topLeftChunk.cy,\n maxCx: bottomRightChunk.cx,\n maxCy: bottomRightChunk.cy,\n };\n }\n\n private _rangeDistance(cx: number, cy: number, range: ChunkRange): number {\n const dx = Math.max(range.minCx - cx, 0, cx - range.maxCx);\n const dy = Math.max(range.minCy - cy, 0, cy - range.maxCy);\n return Math.max(dx, dy);\n }\n\n private _unload(core: ChunkRange): void {\n for (const [key, { cx, cy }] of this._resident) {\n if (this._rangeDistance(cx, cy, core) > this._unloadRadius) {\n this._layer._evictChunk(cx, cy);\n this._resident.delete(key);\n }\n }\n }\n\n private _request(cx: number, cy: number): void {\n const key = chunkKey(cx, cy);\n const token = ++this._requestCounter;\n this._inFlight.set(key, token);\n\n let result: ChunkPayload | null | Promise<ChunkPayload | null>;\n try {\n result = this._source.getChunk(cx, cy);\n } catch (error) {\n this._inFlight.delete(key);\n logger.warn(`ChunkStreamer: source.getChunk(${cx}, ${cy}) threw synchronously.`, {\n source: 'ChunkStreamer',\n error: error instanceof Error ? error : new Error(String(error)),\n });\n\n return;\n }\n\n if (isThenable(result)) {\n result.then(\n payload => {\n this._onResolved(key, cx, cy, token, payload);\n },\n (error: unknown) => {\n this._inFlight.delete(key);\n logger.warn(`ChunkStreamer: source.getChunk(${cx}, ${cy}) rejected.`, {\n source: 'ChunkStreamer',\n error: error instanceof Error ? error : new Error(String(error)),\n });\n },\n );\n return;\n }\n\n this._onResolved(key, cx, cy, token, result);\n }\n\n /**\n * Ignore-on-resolve: only the `_destroyed` and in-flight-token checks\n * guard installation - a chunk that scrolled out of the wanted set while\n * its request was in flight is still installed if it resolves (installing\n * it is cheap and self-correcting: the next {@link update} call's unload\n * pass evicts it again if it's genuinely no longer wanted). There is no\n * edit-persistence to protect, so discarding is never destructive.\n */\n private _onResolved(key: string, cx: number, cy: number, token: number, payload: ChunkPayload | null): void {\n if (this._destroyed) return;\n if (this._inFlight.get(key) !== token) return;\n this._inFlight.delete(key);\n\n if (payload === null) return;\n\n this._layer._adoptChunk(cx, cy, payload);\n this._resident.set(key, { cx, cy });\n }\n}\n"],"mappings":";;;;AA+BA,MAAM,sBAAsB;AAC5B,MAAM,wBAAwB;AAC9B,MAAM,oCAAoC;AAE1C,MAAM,YAAY,IAAY,OAAuB,GAAG,GAAG,GAAG;AAE9D,MAAM,cAAc,UAClB,UAAU,QAAQ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AAyB;IAC/E,QAAQ;IACR,OAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,KAAK,CAAC;GACjE,CAAC;GAED;EACF;EAEA,IAAI,WAAW,MAAM,GAAG;GACtB,OAAO,MACL,YAAW;IACT,KAAK,YAAY,KAAK,IAAI,IAAI,OAAO,OAAO;GAC9C,IACC,UAAmB;IAClB,KAAK,UAAU,OAAO,GAAG;IACzB,OAAO,KAAK,kCAAkC,GAAG,IAAI,GAAG,cAAc;KACpE,QAAQ;KACR,OAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,KAAK,CAAC;IACjE,CAAC;GACH,CACF;GACA;EACF;EAEA,KAAK,YAAY,KAAK,IAAI,IAAI,OAAO,MAAM;CAC7C;;;;;;;;;CAUA,AAAQ,YAAY,KAAa,IAAY,IAAY,OAAe,SAAoC;EAC1G,IAAI,KAAK,YAAY;EACrB,IAAI,KAAK,UAAU,IAAI,GAAG,MAAM,OAAO;EACvC,KAAK,UAAU,OAAO,GAAG;EAEzB,IAAI,YAAY,MAAM;EAEtB,KAAK,OAAO,YAAY,IAAI,IAAI,OAAO;EACvC,KAAK,UAAU,IAAI,KAAK;GAAE;GAAI;EAAG,CAAC;CACpC;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Container } from '@codexo/exojs';
|
|
2
|
-
import { PixelSnapMode
|
|
2
|
+
import { PixelSnapMode } from '@codexo/exojs/renderer-sdk';
|
|
3
3
|
import type { ImageLayer } from './ImageLayer';
|
|
4
4
|
/**
|
|
5
5
|
* A scene node that renders one Tiled {@link ImageLayer} as a single
|
|
@@ -73,8 +73,6 @@ export declare class ImageLayerNode extends Container {
|
|
|
73
73
|
*/
|
|
74
74
|
get pixelSnapMode(): PixelSnapMode;
|
|
75
75
|
set pixelSnapMode(mode: PixelSnapMode);
|
|
76
|
-
/** @internal */
|
|
77
|
-
protected _collectContent(builder: RenderPlanBuilder): void;
|
|
78
76
|
destroy(): void;
|
|
79
77
|
/**
|
|
80
78
|
* Grow the wrapped sprite along each repeating axis so it covers the visible
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImageLayerNode.d.ts","sourceRoot":"","sources":["../../src/ImageLayerNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"ImageLayerNode.d.ts","sourceRoot":"","sources":["../../src/ImageLayerNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAmB,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,aAAa,EAA0B,MAAM,4BAA4B,CAAC;AAEnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,qBAAa,cAAe,SAAQ,SAAS;IAC3C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;IACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;IACjD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,cAAc,CAAqC;IAI3D,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,aAAa,CAAc;IACnC,OAAO,CAAC,cAAc,CAAc;IACpC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,WAAW,CAAc;gBAEd,KAAK,EAAE,UAAU;IAgDpC,2CAA2C;IAC3C,IAAW,KAAK,IAAI,UAAU,CAE7B;IAED;;;;;;;;;;;;;OAaG;IACH,IAAW,aAAa,IAAI,aAAa,CAExC;IAED,IAAW,aAAa,CAAC,IAAI,EAAE,aAAa,EAW3C;IAiDe,OAAO,IAAI,IAAI;IAQ/B;;;;;;;OAOG;IACH,OAAO,CAAC,qBAAqB;CA4D9B"}
|
|
@@ -19,13 +19,6 @@ export declare class MapSpawnSession<Result extends Destroyable> implements Dest
|
|
|
19
19
|
readonly objects: readonly Result[];
|
|
20
20
|
private readonly _byId;
|
|
21
21
|
private _destroyed;
|
|
22
|
-
/**
|
|
23
|
-
* Sessions are produced by
|
|
24
|
-
* {@link import('./MapObjectSpawner').MapObjectSpawner.spawn}, not
|
|
25
|
-
* constructed directly.
|
|
26
|
-
* @internal
|
|
27
|
-
*/
|
|
28
|
-
constructor(entries: ReadonlyArray<readonly [id: string, result: Result]>);
|
|
29
22
|
/** Whether {@link destroy} has run. */
|
|
30
23
|
get destroyed(): boolean;
|
|
31
24
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapSpawnSession.d.ts","sourceRoot":"","sources":["../../src/MapSpawnSession.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD;;;;;;;;;;;GAWG;AACH,qBAAa,eAAe,CAAC,MAAM,SAAS,WAAW,CAAE,YAAW,WAAW;IAC7E;;;OAGG;IACH,SAAgB,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAE3C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA8B;IACpD,OAAO,CAAC,UAAU,CAAS;
|
|
1
|
+
{"version":3,"file":"MapSpawnSession.d.ts","sourceRoot":"","sources":["../../src/MapSpawnSession.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD;;;;;;;;;;;GAWG;AACH,qBAAa,eAAe,CAAC,MAAM,SAAS,WAAW,CAAE,YAAW,WAAW;IAC7E;;;OAGG;IACH,SAAgB,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAE3C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA8B;IACpD,OAAO,CAAC,UAAU,CAAS;IAqB3B,uCAAuC;IACvC,IAAW,SAAS,IAAI,OAAO,CAE9B;IAED;;;;;;;OAOG;IACI,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIhD,+DAA+D;IACxD,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIrC;;;;;;;;OAQG;IACI,OAAO,IAAI,IAAI;CAqBvB"}
|
|
@@ -88,8 +88,6 @@ export declare class MapLevelRuntime<Result extends Destroyable = Destroyable> i
|
|
|
88
88
|
readonly spawns: MapSpawnSession<Result> | null;
|
|
89
89
|
private readonly _onDestroy;
|
|
90
90
|
private _destroyed;
|
|
91
|
-
/** Level runtimes are produced by {@link MapWorldRuntime.loadLevel}. @internal */
|
|
92
|
-
constructor(level: MapLevel, scope: LoaderScope, map: TileMap, spawns: MapSpawnSession<Result> | null, onDestroy: (runtime: MapLevelRuntime) => void);
|
|
93
91
|
/** Whether this level has been unloaded. */
|
|
94
92
|
get destroyed(): boolean;
|
|
95
93
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MapWorldRuntime.d.ts","sourceRoot":"","sources":["../../src/MapWorldRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,mEAAmE;AACnE,MAAM,WAAW,mBAAmB;IAClC,0CAA0C;IAC1C,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB;;;;;;;;;OASG;IACH,QAAQ,CAAC,KA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AsB;IAMlD,uCAAuC;IACvC,IAAW,SAAS,IAAI,OAAO,CAE9B;IAED;;;;OAIG;IACH,IAAW,MAAM,IAAI,SAAS,eAAe,EAAE,CAE9C;IAED,2EAA2E;IACpE,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAIxD,oFAAoF;IAC7E,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAIpC,0DAA0D;IACnD,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAI9B,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC;IAChF,SAAS,CAAC,OAAO,EAAE,MAAM,SAAS,WAAW,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAwElJ;;;;;;;OAOG;IACI,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAsBvC;;;;;;OAMG;IACI,OAAO,IAAI,IAAI;YAsBR,QAAQ;CAqCvB"}
|
package/dist/esm/TileChunk.d.ts
CHANGED
|
@@ -98,64 +98,6 @@ export declare class TileChunk implements ReadonlyTileChunk {
|
|
|
98
98
|
get revision(): number;
|
|
99
99
|
/** @inheritdoc */
|
|
100
100
|
cloneTiles(): Uint32Array;
|
|
101
|
-
/**
|
|
102
|
-
* Package-internal access to the underlying tile storage.
|
|
103
|
-
* Returns the actual mutable `Uint32Array` - DO NOT USE publicly.
|
|
104
|
-
*
|
|
105
|
-
* Provided for the future tilemap renderer (same package) so it can
|
|
106
|
-
* read chunk data efficiently without a full `cloneTiles()` copy per frame.
|
|
107
|
-
*
|
|
108
|
-
* External consumers and other packages MUST NOT call this.
|
|
109
|
-
* @internal
|
|
110
|
-
*/
|
|
111
|
-
_getRawStorage(): Uint32Array;
|
|
112
|
-
/**
|
|
113
|
-
* Validate a packed tile value before storing.
|
|
114
|
-
* Accepts any finite integer - `Uint32Array` stores via unsigned 32-bit
|
|
115
|
-
* truncation (`ToUint32`). Negative values produced by JavaScript's
|
|
116
|
-
* signed bitwise ops (e.g. when the transform bits set bit 31) are valid.
|
|
117
|
-
* @throws If the value is NaN, Infinity, or non-integer.
|
|
118
|
-
* @internal
|
|
119
|
-
*/
|
|
120
|
-
private _validatePacked;
|
|
121
|
-
/**
|
|
122
|
-
* Write a packed tile word at local-in-chunk coordinates.
|
|
123
|
-
* Returns true if the stored value actually changed.
|
|
124
|
-
*
|
|
125
|
-
* Package-internal: only {@link TileLayer} may call this.
|
|
126
|
-
* @internal
|
|
127
|
-
*/
|
|
128
|
-
_setRawAt(lx: number, ly: number, packed: PackedTile): boolean;
|
|
129
|
-
/**
|
|
130
|
-
* Mark the chunk as needing a GPU rebuild.
|
|
131
|
-
* Invalidates the empty cache and increments revision.
|
|
132
|
-
*
|
|
133
|
-
* Package-internal: for future renderer use only.
|
|
134
|
-
* @internal
|
|
135
|
-
*/
|
|
136
|
-
_markDirty(): void;
|
|
137
|
-
/**
|
|
138
|
-
* Clear every cell in this chunk. Does not re-allocate storage.
|
|
139
|
-
* Increments revision if any cell was non-zero.
|
|
140
|
-
*
|
|
141
|
-
* Package-internal: only {@link TileLayer} may call this.
|
|
142
|
-
* @internal
|
|
143
|
-
*/
|
|
144
|
-
_clear(): void;
|
|
145
|
-
/**
|
|
146
|
-
* Register a callback invoked synchronously whenever this chunk's revision
|
|
147
|
-
* advances. Multiple listeners are supported (a chunk may back more than one
|
|
148
|
-
* `TileChunkNode` - e.g. two `TileLayerNode`s over the same `TileLayer`).
|
|
149
|
-
* Package-internal: called by `TileChunkNode` to push mutations onto the
|
|
150
|
-
* scene-node content-revision chain (see the `_dirtyListeners` field).
|
|
151
|
-
* @internal
|
|
152
|
-
*/
|
|
153
|
-
_addDirtyListener(listener: () => void): void;
|
|
154
|
-
/**
|
|
155
|
-
* Unregister a listener added via {@link _addDirtyListener} (node destroy).
|
|
156
|
-
* @internal
|
|
157
|
-
*/
|
|
158
|
-
_removeDirtyListener(listener: () => void): void;
|
|
159
101
|
private _notifyDirty;
|
|
160
102
|
}
|
|
161
103
|
//# sourceMappingURL=TileChunk.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileChunk.d.ts","sourceRoot":"","sources":["../../src/TileChunk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC,iCAAiC;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,oCAAoC;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,qCAAqC;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,8CAA8C;IAC9C,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,UAAU,CAAC;IAE7C;;;OAGG;IACH,UAAU,IAAI,WAAW,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,SAAU,YAAW,iBAAiB;IACjD,iCAAiC;IACjC,SAAgB,EAAE,EAAE,MAAM,CAAC;IAC3B,iCAAiC;IACjC,SAAgB,EAAE,EAAE,MAAM,CAAC;IAE3B,oCAAoC;IACpC,SAAgB,KAAK,EAAE,MAAM,CAAC;IAC9B,qCAAqC;IACrC,SAAgB,MAAM,EAAE,MAAM,CAAC;IAE/B,yEAAyE;IACzE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IAErC,oEAAoE;IACpE,OAAO,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AAW,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,SAAU,YAAW,iBAAiB;IACjD,iCAAiC;IACjC,SAAgB,EAAE,EAAE,MAAM,CAAC;IAC3B,iCAAiC;IACjC,SAAgB,EAAE,EAAE,MAAM,CAAC;IAE3B,oCAAoC;IACpC,SAAgB,KAAK,EAAE,MAAM,CAAC;IAC9B,qCAAqC;IACrC,SAAgB,MAAM,EAAE,MAAM,CAAC;IAE/B,yEAAyE;IACzE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IAErC,oEAAoE;IACpE,OAAO,CAAC,MAAM,CAAwB;IAEtC,kEAAkE;IAClE,OAAO,CAAC,SAAS,CAAK;IAEtB;;;;;;;OAOG;IACH,OAAO,CAAC,eAAe,CAAgC;IAEvD;;;;;;OAMG;gBACgB,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW;IA0C9F,2DAA2D;IAC3D,OAAO,CAAC,MAAM;IAId;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAa3B,kBAAkB;IACX,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,UAAU;IAKnD,kBAAkB;IAClB,IAAW,KAAK,IAAI,OAAO,CAK1B;IAED,kBAAkB;IAClB,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED,kBAAkB;IACX,UAAU,IAAI,WAAW;IAuGhC,OAAO,CAAC,YAAY;CAMrB"}
|
|
@@ -1,74 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { Drawable } from '@codexo/exojs/renderer-sdk';
|
|
3
|
-
import type { ChunkPage } from './chunkGeometry';
|
|
4
|
-
import type { ReadonlyTileChunk } from './TileChunk';
|
|
5
|
-
import type { TileSet } from './TileSet';
|
|
6
|
-
/**
|
|
7
|
-
* A single renderable tile chunk. One `TileChunkNode` is a {@link Drawable}
|
|
8
|
-
* that owns the batched quad geometry for exactly one {@link ReadonlyTileChunk}
|
|
9
|
-
* of one {@link import('./TileLayer').TileLayer}, positioned at the chunk's
|
|
10
|
-
* pixel origin within the owning {@link TileLayerNode}.
|
|
11
|
-
*
|
|
12
|
-
* Geometry is built lazily and cached against the source chunk's `revision`:
|
|
13
|
-
* the renderer reads {@link TileChunkNode.pages} on each visible frame, but a
|
|
14
|
-
* rebuild only happens when the underlying chunk actually changed. Off-screen
|
|
15
|
-
* chunks are culled by their accurate {@link getLocalBounds} before `render`
|
|
16
|
-
* is ever called, so a camera pan rebuilds nothing.
|
|
17
|
-
*
|
|
18
|
-
* The node references - but never owns - the runtime chunk, tilesets, and
|
|
19
|
-
* tileset textures. Destroying it releases only its cached CPU geometry; the
|
|
20
|
-
* `TileMap`/`TileLayer` data and Loader-owned textures are untouched.
|
|
21
|
-
*
|
|
22
|
-
* @internal Package-internal render node; the renderer is registered for this
|
|
23
|
-
* class. Applications use {@link TileMapNode} / {@link TileLayerNode}.
|
|
24
|
-
*/
|
|
25
|
-
export declare class TileChunkNode extends Drawable {
|
|
26
|
-
private readonly _chunk;
|
|
27
|
-
private readonly _tilesets;
|
|
28
|
-
private readonly _tileWidth;
|
|
29
|
-
private readonly _tileHeight;
|
|
30
|
-
private readonly _pixelWidth;
|
|
31
|
-
private readonly _pixelHeight;
|
|
32
|
-
private _pages;
|
|
33
|
-
private _builtRevision;
|
|
34
|
-
/**
|
|
35
|
-
* Bound once so `TileChunk._addDirtyListener`/`_removeDirtyListener` add and
|
|
36
|
-
* remove the SAME function reference. Pushes the chunk's revision bump onto
|
|
37
|
-
* this node's own content revision (see `TileChunk._dirtyListeners`) so a
|
|
38
|
-
* `RetainedContainer` ancestor - which skips walking a content-clean
|
|
39
|
-
* subtree entirely - observes the mutation and re-collects instead of
|
|
40
|
-
* replaying stale cached geometry.
|
|
41
|
-
*/
|
|
42
|
-
private readonly _onChunkDirty;
|
|
43
|
-
/**
|
|
44
|
-
* @param chunk The readonly chunk this node renders.
|
|
45
|
-
* @param tilesets The owning layer's tileset array.
|
|
46
|
-
* @param tileWidth Map/layer tile cell width in pixels.
|
|
47
|
-
* @param tileHeight Map/layer tile cell height in pixels.
|
|
48
|
-
* @param chunkWidthTiles The layer's (unclamped) chunk width in tiles, used
|
|
49
|
-
* to compute the chunk's pixel origin. Edge chunks
|
|
50
|
-
* report a smaller `chunk.width`, but always start at
|
|
51
|
-
* `cx * chunkWidthTiles`.
|
|
52
|
-
* @param chunkHeightTiles The layer's (unclamped) chunk height in tiles.
|
|
53
|
-
*/
|
|
54
|
-
constructor(chunk: ReadonlyTileChunk, tilesets: readonly TileSet[], tileWidth: number, tileHeight: number, chunkWidthTiles: number, chunkHeightTiles: number);
|
|
55
|
-
/** The signed chunk coordinates this node renders. */
|
|
56
|
-
get chunkX(): number;
|
|
57
|
-
get chunkY(): number;
|
|
58
|
-
/**
|
|
59
|
-
* The revision-cached per-tileset page geometry. Rebuilt only when the source
|
|
60
|
-
* chunk's `revision` advances; otherwise the same arrays are returned.
|
|
61
|
-
* @internal Read by the per-backend tile chunk renderer.
|
|
62
|
-
*/
|
|
63
|
-
get pages(): readonly ChunkPage[];
|
|
64
|
-
/** `true` when the chunk has no drawable tiles (no geometry, no draw calls). */
|
|
65
|
-
get isEmpty(): boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Recomputed lazily on read, so it writes `_localBounds` directly rather than
|
|
68
|
-
* going through `_setLocalBounds`: an invalidating write inside a getter
|
|
69
|
-
* would re-dirty the node on every read.
|
|
70
|
-
*/
|
|
71
|
-
getLocalBounds(): ReadonlyRectangle;
|
|
72
|
-
destroy(): void;
|
|
73
|
-
}
|
|
1
|
+
export {};
|
|
74
2
|
//# sourceMappingURL=TileChunkNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileChunkNode.d.ts","sourceRoot":"","sources":["../../src/TileChunkNode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TileChunkNode.d.ts","sourceRoot":"","sources":["../../src/TileChunkNode.ts"],"names":[],"mappings":""}
|
|
@@ -89,7 +89,7 @@ var TileChunkNode = class extends Drawable {
|
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
91
|
* Recomputed lazily on read, so it writes `_localBounds` directly rather than
|
|
92
|
-
* going through `
|
|
92
|
+
* going through `setLocalBounds`: an invalidating write inside a getter
|
|
93
93
|
* would re-dirty the node on every read.
|
|
94
94
|
*/
|
|
95
95
|
getLocalBounds() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileChunkNode.js","names":[],"sources":["../../src/TileChunkNode.ts"],"sourcesContent":["import type { ReadonlyRectangle } from '@codexo/exojs';\nimport { Drawable } from '@codexo/exojs/renderer-sdk';\n\nimport type { ChunkPage } from './chunkGeometry';\nimport { buildChunkPages } from './chunkGeometry';\nimport type { ReadonlyTileChunk } from './TileChunk';\nimport { TileChunk } from './TileChunk';\nimport type { TileSet } from './TileSet';\n\n/**\n * A single renderable tile chunk. One `TileChunkNode` is a {@link Drawable}\n * that owns the batched quad geometry for exactly one {@link ReadonlyTileChunk}\n * of one {@link import('./TileLayer').TileLayer}, positioned at the chunk's\n * pixel origin within the owning {@link TileLayerNode}.\n *\n * Geometry is built lazily and cached against the source chunk's `revision`:\n * the renderer reads {@link TileChunkNode.pages} on each visible frame, but a\n * rebuild only happens when the underlying chunk actually changed. Off-screen\n * chunks are culled by their accurate {@link getLocalBounds} before `render`\n * is ever called, so a camera pan rebuilds nothing.\n *\n * The node references - but never owns - the runtime chunk, tilesets, and\n * tileset textures. Destroying it releases only its cached CPU geometry; the\n * `TileMap`/`TileLayer` data and Loader-owned textures are untouched.\n *\n * @internal Package-internal render node; the renderer is registered for this\n * class. Applications use {@link TileMapNode} / {@link TileLayerNode}.\n */\nexport class TileChunkNode extends Drawable {\n private readonly _chunk: ReadonlyTileChunk;\n private readonly _tilesets: readonly TileSet[];\n private readonly _tileWidth: number;\n private readonly _tileHeight: number;\n private readonly _pixelWidth: number;\n private readonly _pixelHeight: number;\n\n private _pages: ChunkPage[] = [];\n private _builtRevision = -1;\n\n /**\n * Bound once so `TileChunk._addDirtyListener`/`_removeDirtyListener` add and\n * remove the SAME function reference. Pushes the chunk's revision bump onto\n * this node's own content revision (see `TileChunk._dirtyListeners`) so a\n * `RetainedContainer` ancestor - which skips walking a content-clean\n * subtree entirely - observes the mutation and re-collects instead of\n * replaying stale cached geometry.\n */\n private readonly _onChunkDirty = (): void => {\n this.invalidateContent();\n };\n\n /**\n * @param chunk The readonly chunk this node renders.\n * @param tilesets The owning layer's tileset array.\n * @param tileWidth Map/layer tile cell width in pixels.\n * @param tileHeight Map/layer tile cell height in pixels.\n * @param chunkWidthTiles The layer's (unclamped) chunk width in tiles, used\n * to compute the chunk's pixel origin. Edge chunks\n * report a smaller `chunk.width`, but always start at\n * `cx * chunkWidthTiles`.\n * @param chunkHeightTiles The layer's (unclamped) chunk height in tiles.\n */\n public constructor(\n chunk: ReadonlyTileChunk,\n tilesets: readonly TileSet[],\n tileWidth: number,\n tileHeight: number,\n chunkWidthTiles: number,\n chunkHeightTiles: number,\n ) {\n super();\n\n this._chunk = chunk;\n this._tilesets = tilesets;\n this._tileWidth = tileWidth;\n this._tileHeight = tileHeight;\n this._pixelWidth = chunk.width * tileWidth;\n this._pixelHeight = chunk.height * tileHeight;\n\n this.setPosition(chunk.cx * chunkWidthTiles * tileWidth, chunk.cy * chunkHeightTiles * tileHeight);\n\n // `loadedChunks()` always yields the concrete `TileChunk` behind the\n // readonly view (see TileLayer); the guard is defensive only.\n if (chunk instanceof TileChunk) {\n chunk._addDirtyListener(this._onChunkDirty);\n }\n }\n\n /** The signed chunk coordinates this node renders. */\n public get chunkX(): number {\n return this._chunk.cx;\n }\n\n public get chunkY(): number {\n return this._chunk.cy;\n }\n\n /**\n * The revision-cached per-tileset page geometry. Rebuilt only when the source\n * chunk's `revision` advances; otherwise the same arrays are returned.\n * @internal Read by the per-backend tile chunk renderer.\n */\n public get pages(): readonly ChunkPage[] {\n if (this._builtRevision !== this._chunk.revision) {\n this._pages = buildChunkPages(this._chunk, this._tilesets, this._tileWidth, this._tileHeight);\n this._builtRevision = this._chunk.revision;\n }\n\n return this._pages;\n }\n\n /** `true` when the chunk has no drawable tiles (no geometry, no draw calls). */\n public get isEmpty(): boolean {\n return this.pages.length === 0;\n }\n\n /**\n * Recomputed lazily on read, so it writes `_localBounds` directly rather than\n * going through `
|
|
1
|
+
{"version":3,"file":"TileChunkNode.js","names":[],"sources":["../../src/TileChunkNode.ts"],"sourcesContent":["import type { ReadonlyRectangle } from '@codexo/exojs';\nimport { Drawable } from '@codexo/exojs/renderer-sdk';\n\nimport type { ChunkPage } from './chunkGeometry';\nimport { buildChunkPages } from './chunkGeometry';\nimport type { ReadonlyTileChunk } from './TileChunk';\nimport { TileChunk } from './TileChunk';\nimport type { TileSet } from './TileSet';\n\n/**\n * A single renderable tile chunk. One `TileChunkNode` is a {@link Drawable}\n * that owns the batched quad geometry for exactly one {@link ReadonlyTileChunk}\n * of one {@link import('./TileLayer').TileLayer}, positioned at the chunk's\n * pixel origin within the owning {@link TileLayerNode}.\n *\n * Geometry is built lazily and cached against the source chunk's `revision`:\n * the renderer reads {@link TileChunkNode.pages} on each visible frame, but a\n * rebuild only happens when the underlying chunk actually changed. Off-screen\n * chunks are culled by their accurate {@link getLocalBounds} before `render`\n * is ever called, so a camera pan rebuilds nothing.\n *\n * The node references - but never owns - the runtime chunk, tilesets, and\n * tileset textures. Destroying it releases only its cached CPU geometry; the\n * `TileMap`/`TileLayer` data and Loader-owned textures are untouched.\n *\n * @internal Package-internal render node; the renderer is registered for this\n * class. Applications use {@link TileMapNode} / {@link TileLayerNode}.\n */\nexport class TileChunkNode extends Drawable {\n private readonly _chunk: ReadonlyTileChunk;\n private readonly _tilesets: readonly TileSet[];\n private readonly _tileWidth: number;\n private readonly _tileHeight: number;\n private readonly _pixelWidth: number;\n private readonly _pixelHeight: number;\n\n private _pages: ChunkPage[] = [];\n private _builtRevision = -1;\n\n /**\n * Bound once so `TileChunk._addDirtyListener`/`_removeDirtyListener` add and\n * remove the SAME function reference. Pushes the chunk's revision bump onto\n * this node's own content revision (see `TileChunk._dirtyListeners`) so a\n * `RetainedContainer` ancestor - which skips walking a content-clean\n * subtree entirely - observes the mutation and re-collects instead of\n * replaying stale cached geometry.\n */\n private readonly _onChunkDirty = (): void => {\n this.invalidateContent();\n };\n\n /**\n * @param chunk The readonly chunk this node renders.\n * @param tilesets The owning layer's tileset array.\n * @param tileWidth Map/layer tile cell width in pixels.\n * @param tileHeight Map/layer tile cell height in pixels.\n * @param chunkWidthTiles The layer's (unclamped) chunk width in tiles, used\n * to compute the chunk's pixel origin. Edge chunks\n * report a smaller `chunk.width`, but always start at\n * `cx * chunkWidthTiles`.\n * @param chunkHeightTiles The layer's (unclamped) chunk height in tiles.\n */\n public constructor(\n chunk: ReadonlyTileChunk,\n tilesets: readonly TileSet[],\n tileWidth: number,\n tileHeight: number,\n chunkWidthTiles: number,\n chunkHeightTiles: number,\n ) {\n super();\n\n this._chunk = chunk;\n this._tilesets = tilesets;\n this._tileWidth = tileWidth;\n this._tileHeight = tileHeight;\n this._pixelWidth = chunk.width * tileWidth;\n this._pixelHeight = chunk.height * tileHeight;\n\n this.setPosition(chunk.cx * chunkWidthTiles * tileWidth, chunk.cy * chunkHeightTiles * tileHeight);\n\n // `loadedChunks()` always yields the concrete `TileChunk` behind the\n // readonly view (see TileLayer); the guard is defensive only.\n if (chunk instanceof TileChunk) {\n chunk._addDirtyListener(this._onChunkDirty);\n }\n }\n\n /** The signed chunk coordinates this node renders. */\n public get chunkX(): number {\n return this._chunk.cx;\n }\n\n public get chunkY(): number {\n return this._chunk.cy;\n }\n\n /**\n * The revision-cached per-tileset page geometry. Rebuilt only when the source\n * chunk's `revision` advances; otherwise the same arrays are returned.\n * @internal Read by the per-backend tile chunk renderer.\n */\n public get pages(): readonly ChunkPage[] {\n if (this._builtRevision !== this._chunk.revision) {\n this._pages = buildChunkPages(this._chunk, this._tilesets, this._tileWidth, this._tileHeight);\n this._builtRevision = this._chunk.revision;\n }\n\n return this._pages;\n }\n\n /** `true` when the chunk has no drawable tiles (no geometry, no draw calls). */\n public get isEmpty(): boolean {\n return this.pages.length === 0;\n }\n\n /**\n * Recomputed lazily on read, so it writes `_localBounds` directly rather than\n * going through `setLocalBounds`: an invalidating write inside a getter\n * would re-dirty the node on every read.\n */\n public override getLocalBounds(): ReadonlyRectangle {\n return this._localBounds.set(0, 0, this._pixelWidth, this._pixelHeight);\n }\n\n public override destroy(): void {\n if (this._chunk instanceof TileChunk) {\n this._chunk._removeDirtyListener(this._onChunkDirty);\n }\n\n this._pages = [];\n this._builtRevision = -1;\n\n super.destroy();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA4BA,IAAa,gBAAb,cAAmC,SAAS;CAC1C,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CACjB,AAAiB;CAEjB,AAAQ,SAAsB,CAAC;CAC/B,AAAQ,iBAAiB;;;;;;;;;CAUzB,AAAiB,sBAA4B;EAC3C,KAAK,kBAAkB;CACzB;;;;;;;;;;;;CAaA,AAAO,YACL,OACA,UACA,WACA,YACA,iBACA,kBACA;EACA,MAAM;EAEN,KAAK,SAAS;EACd,KAAK,YAAY;EACjB,KAAK,aAAa;EAClB,KAAK,cAAc;EACnB,KAAK,cAAc,MAAM,QAAQ;EACjC,KAAK,eAAe,MAAM,SAAS;EAEnC,KAAK,YAAY,MAAM,KAAK,kBAAkB,WAAW,MAAM,KAAK,mBAAmB,UAAU;EAIjG,IAAI,iBAAiB,WACnB,MAAM,kBAAkB,KAAK,aAAa;CAE9C;;CAGA,IAAW,SAAiB;EAC1B,OAAO,KAAK,OAAO;CACrB;CAEA,IAAW,SAAiB;EAC1B,OAAO,KAAK,OAAO;CACrB;;;;;;CAOA,IAAW,QAA8B;EACvC,IAAI,KAAK,mBAAmB,KAAK,OAAO,UAAU;GAChD,KAAK,SAAS,gBAAgB,KAAK,QAAQ,KAAK,WAAW,KAAK,YAAY,KAAK,WAAW;GAC5F,KAAK,iBAAiB,KAAK,OAAO;EACpC;EAEA,OAAO,KAAK;CACd;;CAGA,IAAW,UAAmB;EAC5B,OAAO,KAAK,MAAM,WAAW;CAC/B;;;;;;CAOA,AAAgB,iBAAoC;EAClD,OAAO,KAAK,aAAa,IAAI,GAAG,GAAG,KAAK,aAAa,KAAK,YAAY;CACxE;CAEA,AAAgB,UAAgB;EAC9B,IAAI,KAAK,kBAAkB,WACzB,KAAK,OAAO,qBAAqB,KAAK,aAAa;EAGrD,KAAK,SAAS,CAAC;EACf,KAAK,iBAAiB;EAEtB,MAAM,QAAQ;CAChB;AACF"}
|
package/dist/esm/TileLayer.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type { ChunkPayload } from './ChunkSource';
|
|
2
1
|
import type { ReadonlyTileChunk } from './TileChunk';
|
|
3
|
-
import { TileChunk } from './TileChunk';
|
|
4
2
|
import type { TileSet } from './TileSet';
|
|
5
3
|
import type { TileProperties } from './types';
|
|
6
4
|
import type { PackedTile, ResolvedTile } from './types';
|
|
@@ -75,19 +73,6 @@ export interface ChunkRange {
|
|
|
75
73
|
readonly maxCx: number;
|
|
76
74
|
readonly maxCy: number;
|
|
77
75
|
}
|
|
78
|
-
/**
|
|
79
|
-
* Fired via {@link TileLayer._addStructuralListener} whenever a chunk is
|
|
80
|
-
* installed ({@link TileLayer._adoptChunk}) or evicted
|
|
81
|
-
* ({@link TileLayer._evictChunk}) - structural changes only, not per-tile
|
|
82
|
-
* edits (see {@link import('./TileChunk').TileChunk._addDirtyListener} for
|
|
83
|
-
* those). `chunk` is `null` on eviction.
|
|
84
|
-
* @internal
|
|
85
|
-
*/
|
|
86
|
-
export interface ChunkStructuralEvent {
|
|
87
|
-
readonly cx: number;
|
|
88
|
-
readonly cy: number;
|
|
89
|
-
readonly chunk: ReadonlyTileChunk | null;
|
|
90
|
-
}
|
|
91
76
|
/**
|
|
92
77
|
* A generic, format-independent tile layer with chunk-first storage.
|
|
93
78
|
*
|
|
@@ -191,54 +176,6 @@ export declare class TileLayer {
|
|
|
191
176
|
* @advanced
|
|
192
177
|
*/
|
|
193
178
|
getChunk(cx: number, cy: number): ReadonlyTileChunk | undefined;
|
|
194
|
-
/**
|
|
195
|
-
* Get or create a chunk at the given coordinates.
|
|
196
|
-
* For a bounded layer, creation is only allowed within the valid chunk
|
|
197
|
-
* range and edge chunks are clamped to the layer's remaining size. For an
|
|
198
|
-
* unbounded layer, any signed chunk coordinate is accepted and every
|
|
199
|
-
* chunk is full-size ({@link chunkWidth} × {@link chunkHeight}).
|
|
200
|
-
*
|
|
201
|
-
* @internal Package-private: used by {@link setTileAt}, {@link fillRect},
|
|
202
|
-
* and future adapter ingest. External users should not allocate
|
|
203
|
-
* chunks - use {@link setTileAt} to populate tiles.
|
|
204
|
-
*/
|
|
205
|
-
_ensureChunk(cx: number, cy: number): TileChunk;
|
|
206
|
-
/**
|
|
207
|
-
* Install a chunk-provider-supplied payload directly, bypassing per-tile
|
|
208
|
-
* `setTileAt` cost. Overwrites any existing chunk at `(cx, cy)`. Always
|
|
209
|
-
* bumps the layer revision (installing a chunk is always a structural
|
|
210
|
-
* change, even if the payload happens to be all-zero).
|
|
211
|
-
*
|
|
212
|
-
* Does not validate `(cx, cy)` against {@link chunkRange} - callers
|
|
213
|
-
* (chunk-streaming controllers) are trusted to request coordinates within
|
|
214
|
-
* whatever range they intend to manage.
|
|
215
|
-
*
|
|
216
|
-
* @internal Package-private: for future chunk-provider/streaming use.
|
|
217
|
-
*/
|
|
218
|
-
_adoptChunk(cx: number, cy: number, payload: ChunkPayload): void;
|
|
219
|
-
/**
|
|
220
|
-
* Evict a chunk from storage, freeing it for garbage collection. No-op if
|
|
221
|
-
* no chunk is loaded at `(cx, cy)`.
|
|
222
|
-
*
|
|
223
|
-
* @returns `true` if a chunk was found and removed, `false` otherwise.
|
|
224
|
-
* @internal Package-private: for future chunk-streaming eviction use.
|
|
225
|
-
*/
|
|
226
|
-
_evictChunk(cx: number, cy: number): boolean;
|
|
227
|
-
/**
|
|
228
|
-
* Register a callback invoked synchronously whenever a chunk is installed
|
|
229
|
-
* ({@link _adoptChunk}) or evicted ({@link _evictChunk}). Package-internal:
|
|
230
|
-
* {@link import('./TileLayerNode').TileLayerNode} subscribes to keep its
|
|
231
|
-
* chunk-node children in sync with chunk-provider-driven adopt/evict calls
|
|
232
|
-
* (e.g. from {@link import('./ChunkStreamer').ChunkStreamer}) without
|
|
233
|
-
* needing a full {@link import('./TileLayerNode').TileLayerNode.refresh}.
|
|
234
|
-
* @internal
|
|
235
|
-
*/
|
|
236
|
-
_addStructuralListener(listener: (event: ChunkStructuralEvent) => void): void;
|
|
237
|
-
/**
|
|
238
|
-
* Unregister a listener added via {@link _addStructuralListener} (node destroy).
|
|
239
|
-
* @internal
|
|
240
|
-
*/
|
|
241
|
-
_removeStructuralListener(listener: (event: ChunkStructuralEvent) => void): void;
|
|
242
179
|
private _notifyStructural;
|
|
243
180
|
/**
|
|
244
181
|
* Iterate over all loaded chunks in deterministic (cy, cx) ascending order.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileLayer.d.ts","sourceRoot":"","sources":["../../src/TileLayer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TileLayer.d.ts","sourceRoot":"","sources":["../../src/TileLayer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAIxD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,+CAA+C;IAC/C,QAA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ode';
|
|
3
|
+
import { PixelSnapMode } from '@codexo/exojs/renderer-sdk';
|
|
5
4
|
import type { TileLayer } from './TileLayer';
|
|
6
5
|
/**
|
|
7
6
|
* Options for a {@link TileLayerNode}. All optional; reserved for forward
|
|
@@ -23,8 +22,8 @@ export interface TileLayerNodeOptions {
|
|
|
23
22
|
* Each non-empty loaded chunk becomes one child positioned at its pixel
|
|
24
23
|
* origin, so the engine's existing per-node culling drops individual chunks and
|
|
25
24
|
* the render-plan optimiser batches them by tileset texture. The layer's pixel
|
|
26
|
-
* `offset
|
|
27
|
-
*
|
|
25
|
+
* `offset`, `visible` and `opacity` are all read live from the runtime layer on
|
|
26
|
+
* every frame (no rebuild required).
|
|
28
27
|
*
|
|
29
28
|
* A `parallax` factor other than `1` makes this node's rendered position
|
|
30
29
|
* camera-dependent, resolved per frame in {@link _collectContent} by patching
|
|
@@ -54,8 +53,6 @@ export declare class TileLayerNode extends Container {
|
|
|
54
53
|
private _syncedOpacity;
|
|
55
54
|
private _syncedTint;
|
|
56
55
|
private _pixelSnapMode;
|
|
57
|
-
private readonly _baseOffsetX;
|
|
58
|
-
private readonly _baseOffsetY;
|
|
59
56
|
/**
|
|
60
57
|
* Bound once so `TileLayer._addStructuralListener`/`_removeStructuralListener`
|
|
61
58
|
* add and remove the SAME function reference. Incrementally adds/removes
|
|
@@ -91,16 +88,12 @@ export declare class TileLayerNode extends Container {
|
|
|
91
88
|
* tile edits to existing chunks do not need a refresh.
|
|
92
89
|
*/
|
|
93
90
|
refresh(): this;
|
|
94
|
-
/** The chunk render nodes owned by this layer node, in build order. @internal */
|
|
95
|
-
get chunkNodes(): readonly TileChunkNode[];
|
|
96
91
|
/**
|
|
97
92
|
* Recomputed lazily on read, so it writes `_localBounds` directly rather than
|
|
98
|
-
* going through `
|
|
93
|
+
* going through `setLocalBounds`: an invalidating write inside a getter
|
|
99
94
|
* would re-dirty the node on every read.
|
|
100
95
|
*/
|
|
101
96
|
getLocalBounds(): ReadonlyRectangle;
|
|
102
|
-
/** @internal */
|
|
103
|
-
protected _collectContent(builder: RenderPlanBuilder): void;
|
|
104
97
|
destroy(): void;
|
|
105
98
|
private _buildChunkNodes;
|
|
106
99
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileLayerNode.d.ts","sourceRoot":"","sources":["../../src/TileLayerNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"TileLayerNode.d.ts","sourceRoot":"","sources":["../../src/TileLayerNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,aAAa,EAA0B,MAAM,4BAA4B,CAAC;AAMnF,OAAO,KAAK,EAAwB,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnE;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,qBAAa,aAAc,SAAQ,SAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;IACnC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAU;IACtC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAuB;IACnD,OAAO,CAAC,cAAc,CAAM;IAC5B,OAAO,CAAC,WAAW,CAAwC;IAC3D,OAAO,CAAC,cAAc,CAAqC;IAE3D;;;;;;OAMG;IACH,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAoBlC;gBAEiB,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,oBAAoB;IAgBnE,2CAA2C;IAC3C,IAAW,KAAK,IAAI,SAAS,CAE5B;IAED;;;;;;;;;;;;;;;OAeG;IACH,IAAW,aAAa,IAAI,aAAa,CAExC;IAED,IAAW,aAAa,CAAC,IAAI,EAAE,aAAa,EAW3C;IAED;;;;OAIG;IACI,OAAO,IAAI,IAAI;IAsBtB;;;;OAIG;IACa,cAAc,IAAI,iBAAiB;IAkEnC,OAAO,IAAI,IAAI;IAc/B,OAAO,CAAC,gBAAgB;IAiBxB;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAaxB;;;;;;;OAOG;IACH,OAAO,CAAC,UAAU;IAQlB;;;;OAIG;IACH,OAAO,CAAC,SAAS;CAelB"}
|
|
@@ -12,8 +12,8 @@ import { Container } from "@codexo/exojs";
|
|
|
12
12
|
* Each non-empty loaded chunk becomes one child positioned at its pixel
|
|
13
13
|
* origin, so the engine's existing per-node culling drops individual chunks and
|
|
14
14
|
* the render-plan optimiser batches them by tileset texture. The layer's pixel
|
|
15
|
-
* `offset
|
|
16
|
-
*
|
|
15
|
+
* `offset`, `visible` and `opacity` are all read live from the runtime layer on
|
|
16
|
+
* every frame (no rebuild required).
|
|
17
17
|
*
|
|
18
18
|
* A `parallax` factor other than `1` makes this node's rendered position
|
|
19
19
|
* camera-dependent, resolved per frame in {@link _collectContent} by patching
|
|
@@ -43,8 +43,6 @@ var TileLayerNode = class extends Container {
|
|
|
43
43
|
_syncedOpacity = -1;
|
|
44
44
|
_syncedTint = void 0;
|
|
45
45
|
_pixelSnapMode = PixelSnapMode.None;
|
|
46
|
-
_baseOffsetX;
|
|
47
|
-
_baseOffsetY;
|
|
48
46
|
/**
|
|
49
47
|
* Bound once so `TileLayer._addStructuralListener`/`_removeStructuralListener`
|
|
50
48
|
* add and remove the SAME function reference. Incrementally adds/removes
|
|
@@ -70,8 +68,6 @@ var TileLayerNode = class extends Container {
|
|
|
70
68
|
super();
|
|
71
69
|
this._layer = layer;
|
|
72
70
|
this._cullChunks = options?.cullable ?? true;
|
|
73
|
-
this._baseOffsetX = layer.offsetX;
|
|
74
|
-
this._baseOffsetY = layer.offsetY;
|
|
75
71
|
this.setPosition(layer.offsetX, layer.offsetY);
|
|
76
72
|
this._buildChunkNodes();
|
|
77
73
|
if (!this._layer.bounded || layer.parallaxX !== 1 || layer.parallaxY !== 1 || layer.parallaxScale !== 1) this.cullable = false;
|
|
@@ -127,7 +123,7 @@ var TileLayerNode = class extends Container {
|
|
|
127
123
|
}
|
|
128
124
|
/**
|
|
129
125
|
* Recomputed lazily on read, so it writes `_localBounds` directly rather than
|
|
130
|
-
* going through `
|
|
126
|
+
* going through `setLocalBounds`: an invalidating write inside a getter
|
|
131
127
|
* would re-dirty the node on every read.
|
|
132
128
|
*/
|
|
133
129
|
getLocalBounds() {
|
|
@@ -146,22 +142,23 @@ var TileLayerNode = class extends Container {
|
|
|
146
142
|
const patchesScale = layer.parallaxScale !== 1;
|
|
147
143
|
if (patchesPosition || patchesScale) {
|
|
148
144
|
const camCenter = builder.view.center;
|
|
149
|
-
const prevX = this.x;
|
|
150
|
-
const prevY = this.y;
|
|
151
145
|
const prevScaleX = this.scale.x;
|
|
152
146
|
const prevScaleY = this.scale.y;
|
|
153
147
|
if (patchesPosition) {
|
|
154
|
-
this.x =
|
|
155
|
-
this.y =
|
|
156
|
-
}
|
|
148
|
+
this.x = layer.offsetX + camCenter.x * (1 - layer.parallaxX);
|
|
149
|
+
this.y = layer.offsetY + camCenter.y * (1 - layer.parallaxY);
|
|
150
|
+
} else this.setPosition(layer.offsetX, layer.offsetY);
|
|
157
151
|
if (patchesScale) this.setScale(prevScaleX * layer.parallaxScale, prevScaleY * layer.parallaxScale);
|
|
158
152
|
try {
|
|
159
153
|
super._collectContent(builder);
|
|
160
154
|
} finally {
|
|
161
|
-
if (patchesPosition) this.setPosition(
|
|
155
|
+
if (patchesPosition) this.setPosition(layer.offsetX, layer.offsetY);
|
|
162
156
|
if (patchesScale) this.setScale(prevScaleX, prevScaleY);
|
|
163
157
|
}
|
|
164
|
-
} else
|
|
158
|
+
} else {
|
|
159
|
+
this.setPosition(layer.offsetX, layer.offsetY);
|
|
160
|
+
super._collectContent(builder);
|
|
161
|
+
}
|
|
165
162
|
}
|
|
166
163
|
destroy() {
|
|
167
164
|
this._layer._removeStructuralListener(this._onStructuralChange);
|